2 # Copyright (C) 2009 Red Hat Inc.
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.
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.
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.
19 make.sh update.sh supermin-split.sh supermin-make.sh
21 # Build the root filesystem (appliance).
22 # Currently this is arch-dependent, so it seems like putting it in
23 # $(libdir) is best. When we build cross-architecture filesystems we
24 # should probably move them to $(datadir).
25 fsdir = $(libdir)/guestfs
26 fs_DATA = $(APPLIANCE_FILES)
28 # These are the resulting output files from the whole process:
29 # VMLINUZ kernel for the full appliance
30 # INITRAMFSIMG initramfs (ie. root fs) for the full appliance
31 # For details of the supermin appliance, read the README file:
32 # SUPERMINIMG initramfs (ie. partial root fs) for the supermin appliance
33 # SUPERMINFILES list of missing files (the ones we will pull out of the
34 # host filesystem at runtime) in the supermin appliance
35 APPLIANCE_FILES = $(INITRAMFSIMG) $(VMLINUZ)
37 APPLIANCE_FILES += $(SUPERMINIMG) $(SUPERMINFILES) kmod.whitelist
38 bin_SCRIPTS = guestfs-supermin-helper
41 # Don't change these names - they must be the same as in '*.sh' scripts.
42 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
43 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
45 SUPERMINIMG = initramfs.$(REPO).$(host_cpu).supermin.img
46 SUPERMINFILES = initramfs.$(REPO).$(host_cpu).supermin.hostfiles
49 # This is for building the normal appliance:
50 $(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
52 $(top_builddir)/initramfs/fakeroot.log: make.sh kmod.whitelist
53 -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
54 -mv $(VMLINUZ) $(VMLINUZ).bak
55 if ! bash make.sh; then rm -f $@; exit 1; fi
57 $(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd update.sh
62 kmod.whitelist: kmod.whitelist.in
63 grep -v '^[[:space:]]*$$' < $< | grep -v '^#' > $@
65 # This is for building the supermin appliance. It has to be enabled
66 # specifically with './configure --enable-supermin'. You really need
67 # to read the README file.
71 # First we need to decide which files go in and out of the supermin
72 # appliance. This decision is made by 'supermin-split.sh'.
73 $(SUPERMINFILES): supermin.incfiles
74 supermin.incfiles: $(top_builddir)/initramfs/fakeroot.log supermin-split.sh
75 rm -f supermin.incfiles $(SUPERMINFILES)
76 bash supermin-split.sh
78 # Second we need to create a supermin appliance with just the included
79 # files (leaving out the host files, which we'll add back at runtime).
80 $(SUPERMINIMG): supermin.incfiles supermin-make.sh
86 # This should rebuild the scripts if the input files change, although
87 # it doesn't always seem to work.
89 cd .. && ./config.status appliance/$@
92 guestfs-supermin-helper: guestfs-supermin-helper.in
93 cd .. && ./config.status appliance/$@
96 #----------------------------------------------------------------------
97 # Extra rules for testing the appliance.
99 # Test-boot the appliance.
102 qemu-system-$(host_cpu) \
104 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
109 dd if=/dev/zero of=emptydisk bs=1024 count=1440
110 echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
112 # This is a more realistic test boot command line which better
113 # reflects what the library does.
115 test-boot-realistic: emptydisk
116 qemu-system-$(host_cpu) \
118 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
120 -append "console=ttyS0 guestfs=10.0.2.4:6666" \
123 -net channel,6666:unix:/tmp/sock,server,nowait \
125 -net nic,model=virtio,vlan=0
129 CLEANFILES = $(APPLIANCE_FILES)
132 rm -rf $(top_builddir)/initramfs