aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-11-23 19:48:20 +0100
committerficus <ficus@robocracy.org>2012-11-23 19:48:20 +0100
commit63ec73ed1a4fd5c1a6b6b3cdeb805dc4e6dcfdfe (patch)
treec33785ed2336683513020547dc48574318a3ba9f
parentd576ae7f1fa525dc1dd1fc167f166e0b98958a75 (diff)
downloadtorouter-live-63ec73ed1a4fd5c1a6b6b3cdeb805dc4e6dcfdfe.tar.gz
torouter-live-63ec73ed1a4fd5c1a6b6b3cdeb805dc4e6dcfdfe.zip
document kernel copy scripts
-rwxr-xr-xconfig/hooks/kernel-image.sh.binary15
-rwxr-xr-xconfig/hooks/kernel-image.sh.chroot5
2 files changed, 20 insertions, 0 deletions
diff --git a/config/hooks/kernel-image.sh.binary b/config/hooks/kernel-image.sh.binary
index 2b4d094..65ed75a 100755
--- a/config/hooks/kernel-image.sh.binary
+++ b/config/hooks/kernel-image.sh.binary
@@ -2,5 +2,20 @@
set -e
+# This script is necessary for squashfs (or any not-plainroot) builds, where
+# the usual /live images end up inside the filesystem.
+
+# In these cases the kernel ships in three places, which is inefficient:
+# enclosing binary /live (mangled)
+# rootfs /live (mangled)
+# rootfs /boot (original)
+
echo "(re)Copying in kernel images..."
cp -a chroot/live/uInitrd chroot/live/uImage chroot/live/dtb binary/live/
+
+# This reduces final image size significantly; original raw kernel files are
+# still duplicated in /boot.
+# Don't stop on errors, because this script may have already been run.
+echo "Removing redundant kernel images..."
+rm binary/live/vmlinuz-* || true
+rm binary/live/initrd.img-* || true
diff --git a/config/hooks/kernel-image.sh.chroot b/config/hooks/kernel-image.sh.chroot
index 05d287c..84de114 100755
--- a/config/hooks/kernel-image.sh.chroot
+++ b/config/hooks/kernel-image.sh.chroot
@@ -6,6 +6,9 @@ set -e
# generates uImage and uInitrd style files (for use with u-boot, as opposed to
# syslinux-style images), and moves those files to /live.
+# See also kernel-image.sh.binary, which recopies files at the final binary
+# assembly stage.
+
KERNELVERSION=`ls /boot/vmlinuz-* | sed -e "s/\/boot\/vmlinuz-//"`
echo "Mangling kernel..."
@@ -31,6 +34,8 @@ rm -rf /tmp/initrd-repack
-d initrd.img uInitrd )
rm /boot/initrd.img
+# Useful to to this here because sometimes /live doesn't get created
+# otherwise...
echo "Creating /live and copying in boot images..."
mkdir -p /live
mv /boot/uInitrd /boot/uImage /boot/dtb /live