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 \
20 guestfs-supermin-helper \
24 # Build the root filesystem (appliance).
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 fsdir = $(libdir)/guestfs
29 fs_DATA = $(APPLIANCE_FILES)
31 # These are the resulting output files from the whole process:
32 # VMLINUZ kernel for the full appliance
33 # INITRAMFSIMG initramfs (ie. root fs) for the full appliance
34 # For details of the supermin appliance, read the README file:
35 # SUPERMINIMG initramfs (ie. partial root fs) for the supermin appliance
36 # SUPERMINFILES list of missing files (the ones we will pull out of the
37 # host filesystem at runtime) in the supermin appliance
38 APPLIANCE_FILES = $(INITRAMFSIMG) $(VMLINUZ)
40 APPLIANCE_FILES += $(SUPERMINIMG) $(SUPERMINFILES) kmod.whitelist
41 bin_SCRIPTS = guestfs-supermin-helper
44 # Don't change these names - they must be the same as in '*.sh' scripts.
45 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
46 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
48 SUPERMINIMG = initramfs.$(REPO).$(host_cpu).supermin.img
49 SUPERMINFILES = initramfs.$(REPO).$(host_cpu).supermin.hostfiles
52 # This is for building the normal appliance:
53 $(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
55 $(top_builddir)/initramfs/fakeroot.log: make.sh kmod.whitelist
56 -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
57 -mv $(VMLINUZ) $(VMLINUZ).bak
58 if ! bash make.sh; then rm -f $@; exit 1; fi
60 $(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd update.sh
65 kmod.whitelist: kmod.whitelist.in
66 grep -v '^[[:space:]]*$$' < $< | grep -v '^#' > $@
68 # This is for building the supermin appliance. It has to be enabled
69 # specifically with './configure --enable-supermin'. You really need
70 # to read the README file.
74 # First we need to decide which files go in and out of the supermin
75 # appliance. This decision is made by 'supermin-split.sh'.
76 $(SUPERMINFILES): supermin.incfiles
77 supermin.incfiles: $(top_builddir)/initramfs/fakeroot.log supermin-split.sh
78 rm -f supermin.incfiles $(SUPERMINFILES)
79 bash supermin-split.sh
81 # Second we need to create a supermin appliance with just the included
82 # files (leaving out the host files, which we'll add back at runtime).
83 $(SUPERMINIMG): supermin.incfiles supermin-make.sh
89 # This should rebuild the scripts if the input files change, although
90 # it doesn't always seem to work.
92 cd .. && ./config.status appliance/$@
95 guestfs-supermin-helper: guestfs-supermin-helper.in
96 cd .. && ./config.status appliance/$@
99 #----------------------------------------------------------------------
100 # Extra rules for testing the appliance.
102 # Test-boot the appliance.
105 qemu-system-$(host_cpu) \
107 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
112 dd if=/dev/zero of=emptydisk bs=1024 count=1440
113 echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
115 # This is a more realistic test boot command line which better
116 # reflects what the library does.
118 test-boot-realistic: emptydisk
119 qemu-system-$(host_cpu) \
121 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
123 -append "console=ttyS0 guestfs=10.0.2.4:6666" \
126 -net channel,6666:unix:/tmp/sock,server,nowait \
128 -net nic,model=virtio,vlan=0
132 CLEANFILES = $(APPLIANCE_FILES)
135 rm -rf $(top_builddir)/initramfs