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 libguestfs-supermin-helper \
23 debian/modules/install_kernel \
24 debian/modules/y0_install-guestfsd \
25 debian/modules/z99_final-cleanups \
26 debian/debirf.conf.in \
29 # Build the root filesystem (appliance).
30 # Currently this is arch-dependent, so it seems like putting it in
31 # $(libdir) is best. When we build cross-architecture filesystems we
32 # should probably move them to $(datadir).
33 fsdir = $(libdir)/guestfs
34 fs_DATA = $(APPLIANCE_FILES)
36 # These are the resulting output files from the whole process:
37 # VMLINUZ kernel for the full appliance
38 # INITRAMFSIMG initramfs (ie. root fs) for the full appliance
39 # For details of the supermin appliance, read the README file:
40 # SUPERMINIMG initramfs (ie. partial root fs) for the supermin appliance
41 # SUPERMINFILES list of missing files (the ones we will pull out of the
42 # host filesystem at runtime) in the supermin appliance
43 APPLIANCE_FILES = $(INITRAMFSIMG) $(VMLINUZ)
45 APPLIANCE_FILES += $(SUPERMINIMG) $(SUPERMINFILES) kmod.whitelist
46 bin_SCRIPTS = libguestfs-supermin-helper
49 # Don't change these names - they must be the same as in '*.sh' scripts.
50 INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
51 VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
53 SUPERMINIMG = initramfs.$(REPO).$(host_cpu).supermin.img
54 SUPERMINFILES = initramfs.$(REPO).$(host_cpu).supermin.hostfiles
57 # This is for building the normal appliance:
58 $(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
60 $(top_builddir)/initramfs/fakeroot.log: make.sh kmod.whitelist packagelist
61 mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak 2>/dev/null; :
62 mv $(VMLINUZ) $(VMLINUZ).bak 2>/dev/null; :
63 if ! bash make.sh; then rm -f $@; exit 1; fi
65 # This used to be a configure-generated file (as is update.sh still).
66 # However config.status always touches the destination file, which
67 # means the appliance got rebuilt too often.
69 cd $(top_builddir) && \
70 ./config.status --file=appliance/$@-t:appliance/$<
74 $(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd init update.sh
79 kmod.whitelist: kmod.whitelist.in
80 grep -v '^[[:space:]]*$$' < $< | grep -v '^#' > $@
82 packagelist: packagelist.in
83 cpp -undef -D$(DIST)=1 < $< | \
84 grep -v '^[[:space:]]*$$' | grep -v '^#' > $@
86 # This is for building the supermin appliance. It has to be enabled
87 # specifically with './configure --enable-supermin'. You really need
88 # to read the README file.
92 # First we need to decide which files go in and out of the supermin
93 # appliance. This decision is made by 'supermin-split.sh'.
94 $(SUPERMINFILES): supermin.incfiles
95 supermin.incfiles: $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd supermin-split.sh
96 rm -f supermin.incfiles $(SUPERMINFILES)
97 bash supermin-split.sh
99 # Second we need to create a supermin appliance with just the included
100 # files (leaving out the host files, which we'll add back at runtime).
101 $(SUPERMINIMG): supermin.incfiles supermin-make.sh
103 bash supermin-make.sh
107 # Extra symlinks needed by the Debian appliance.
113 noinst_DATA = $(debirf_symlinks:%=debian/modules/%)
114 $(debirf_symlinks:%=debian/modules/%): stamp-debirf-modules
115 stamp-debirf-modules:
116 mkdir -p debian/modules
117 for f in $(debirf_symlinks); do \
118 ln -sf /usr/share/debirf/modules/$$f debian/modules/$$f; \
122 #----------------------------------------------------------------------
123 # Extra rules for testing the appliance.
125 # Test-boot the appliance.
128 qemu-system-$(host_cpu) \
130 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
135 dd if=/dev/zero of=emptydisk bs=1024 count=1440
136 echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
138 # This is a more realistic test boot command line which better
139 # reflects what the library does.
141 test-boot-realistic: emptydisk
142 qemu-system-$(host_cpu) \
144 -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
146 -append "console=ttyS0 guestfs=10.0.2.4:6666 guestfs_rescue=1" \
149 -net channel,6666:unix:/tmp/sock,server,nowait \
151 -net nic,model=virtio,vlan=0
155 CLEANFILES = $(APPLIANCE_FILES) packagelist kmod.whitelist supermin.incfiles
158 rm -rf $(top_builddir)/initramfs