Added outline of shell command, added generator support.
[libguestfs.git] / Makefile.am
1 # libguestfs
2 # Copyright (C) 2009 Red Hat Inc.
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 ACLOCAL_AMFLAGS = -I m4
19
20 SUBDIRS = src daemon fish examples
21
22 EXTRA_DIST = make-initramfs.sh
23
24 # Build the root filesystem.
25 # Currently this is arch-dependent, so it seems like putting it in
26 # $(libdir) is best.  When we build cross-architecture filesystems we
27 # should probably move them to $(datadir).
28
29 fsdir = $(libdir)/guestfs
30
31 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
32 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
33
34 fs_DATA =  $(INITRAMFSIMG) $(VMLINUZ)
35
36 $(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
37
38 initramfs/fakeroot.log: make-initramfs.sh.in
39         -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
40         -mv $(VMLINUZ) $(VMLINUZ).bak
41         if ! bash $(builddir)/make-initramfs.sh; then rm -f $@; exit 1; fi
42
43 $(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
44         rm -f $@
45         bash $(builddir)/update-initramfs.sh
46         touch $@
47
48 # Make clean.
49
50 CLEANFILES = $(fs_DATA) emptydisk
51
52 clean-local:
53         rm -rf initramfs
54
55 # Test-boot the image.
56
57 test-boot: emptydisk
58         qemu-system-$(host_cpu) \
59           -m 384 \
60           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
61           -hda emptydisk
62
63 emptydisk:
64         rm -f emptydisk
65         dd if=/dev/zero of=emptydisk bs=1024 count=1440
66         echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
67
68 # This is a more realistic test boot command line which better
69 # reflects what the library does.
70
71 test-boot-realistic: emptydisk
72         qemu-system-$(host_cpu) \
73           -m 384 \
74           -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
75           -hda emptydisk \
76           -append "console=ttyS0 guestfs=10.0.2.4:6666" \
77           -nographic \
78           -serial stdio \
79           -net channel,6666:unix:/tmp/sock,server,nowait \
80           -net user,vlan=0 \
81           -net nic,vlan=0