Add update-initramfs.sh.in so we don't need to rebuild initramfs for

small changes in the daemon.
This commit is contained in:
Richard Jones
2009-04-03 01:13:42 +01:00
parent 11d20e2b9f
commit 207056e823
5 changed files with 56 additions and 11 deletions

1
.gitignore vendored
View File

@@ -36,4 +36,5 @@ m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
stamp-h1
update-initramfs.sh
vmlinuz.*

View File

@@ -33,17 +33,21 @@ VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
$(VMLINUZ) $(INITRAMFSIMG): initramfs.timestamp
$(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
#initramfs.timestamp: make-initramfs.sh.in daemon/guestfsd
initramfs.timestamp: make-initramfs.sh.in
initramfs/fakeroot.log: make-initramfs.sh.in
-mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
-mv $(VMLINUZ) $(VMLINUZ).bak
bash $(builddir)/make-initramfs.sh || rm -f $@
$(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
rm -f $@
bash $(builddir)/make-initramfs.sh
bash $(builddir)/update-initramfs.sh
touch $@
# Make clean.
CLEANFILES = $(fs_DATA) initramfs.timestamp emptydisk
CLEANFILES = $(fs_DATA) emptydisk
clean-local:
rm -rf initramfs

View File

@@ -91,7 +91,8 @@ AC_CONFIG_SUBDIRS([daemon])
dnl Produce output files.
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile make-initramfs.sh])
AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile
make-initramfs.sh update-initramfs.sh])
AC_OUTPUT
dnl WTF?

View File

@@ -34,7 +34,8 @@ fi
# Decide on names for the final output. These have to match Makefile.am.
output=initramfs.@REPO@.@host_cpu@.img
koutput=vmlinuz.@REPO@.@host_cpu@
rm -f $output $koutput
rm -f $output
rm -f $koutput
# Create the basic initramfs.
@FEBOOTSTRAP@ $modules @REPO@ initramfs @MIRROR@
@@ -47,7 +48,7 @@ find initramfs -name '*python*' -print0 | xargs -0 rm -rf
# Modules take up nearly half of the image. It's a rough guess that
# we don't need any drivers (which take up most of the space).
# (We need to keep kernel/net/sunrpc for NFS)
rm -rf initramfs/lib/modules/*/kernel/{drivers,sound}
#rm -rf initramfs/lib/modules/*/kernel/{drivers,sound}
rm -rf initramfs/lib/modules/*/kernel/arch/x86/kvm
# Pull the kernel out into the current directory. We don't want it in
@@ -73,9 +74,6 @@ if [ ! -f initramfs/etc/fstab ]; then
@FEBOOTSTRAP_RUN@ initramfs -- touch /etc/fstab
fi
# Copy the daemon into the filesystem.
#cp daemon/guestfsd initramfs/sbin
# Create the init script.
cat > initramfs/init.new <<'__EOF__'
#!/bin/sh
@@ -105,6 +103,12 @@ fi
@FEBOOTSTRAP_RUN@ initramfs -- install -m 0755 -o root -g root /init.new /init
rm initramfs/init.new
# Copy the daemon into the filesystem.
cp @abs_builddir@/daemon/guestfsd initramfs/sbin/guestfsd.new
@FEBOOTSTRAP_RUN@ initramfs -- \
install -m 0755 -o root -g root /sbin/guestfsd.new /sbin/guestfsd
rm initramfs/sbin/guestfsd.new
# Generate final image.
@FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
mv $output-t $output

35
update-initramfs.sh.in Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/bash -
# @configure_input@
# Copyright (C) 2009 Red Hat Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# Update the daemon inside an existing initramfs. Avoids the
# timeconsuming rebuild.
set -e
output=initramfs.@REPO@.@host_cpu@.img
# Copy the daemon into the filesystem.
cp @abs_builddir@/daemon/guestfsd initramfs/sbin/guestfsd.new
@FEBOOTSTRAP_RUN@ initramfs -- \
install -m 0755 -o root -g root /sbin/guestfsd.new /sbin/guestfsd
rm initramfs/sbin/guestfsd.new
# Generate final image.
@FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
mv $output-t $output
ls -lh $output