aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-11-23 03:18:35 +0100
committerficus <ficus@robocracy.org>2012-11-23 03:18:35 +0100
commitd50de354390413424cd53e997665ddb16c13c25e (patch)
tree07eade340ea67c496e919e3e44918d07094a8852
parentecd26e16b2ce4ac6b64768f69987fc18d8d1391b (diff)
downloadtorouter-live-d50de354390413424cd53e997665ddb16c13c25e.tar.gz
torouter-live-d50de354390413424cd53e997665ddb16c13c25e.zip
clean up kernel image scripts
-rwxr-xr-xconfig/hooks/kernel-image.sh.binary6
-rwxr-xr-xconfig/hooks/kernel-image.sh.chroot13
2 files changed, 14 insertions, 5 deletions
diff --git a/config/hooks/kernel-image.sh.binary b/config/hooks/kernel-image.sh.binary
new file mode 100755
index 0000000..2b4d094
--- /dev/null
+++ b/config/hooks/kernel-image.sh.binary
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+
+echo "(re)Copying in kernel images..."
+cp -a chroot/live/uInitrd chroot/live/uImage chroot/live/dtb binary/live/
diff --git a/config/hooks/kernel-image.sh.chroot b/config/hooks/kernel-image.sh.chroot
index 89e5cf5..05d287c 100755
--- a/config/hooks/kernel-image.sh.chroot
+++ b/config/hooks/kernel-image.sh.chroot
@@ -6,13 +6,15 @@ 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.
+KERNELVERSION=`ls /boot/vmlinuz-* | sed -e "s/\/boot\/vmlinuz-//"`
+
echo "Mangling kernel..."
# TBD: is it necessary to do this first stage of mangling which removes the
# conf/param.conf file, which may or may not be clobbering kernel boot
# arguments?
mkdir -p /tmp/initrd-repack
(cd /tmp/initrd-repack ; \
- zcat /boot/initrd.img-* | cpio -i ; \
+ zcat /boot/initrd.img-$KERNELVERSION | cpio -i ; \
rm -f conf/param.conf ; \
find . | cpio --quiet -o -H newc | \
gzip -9 > /boot/initrd.img)
@@ -20,14 +22,15 @@ rm -rf /tmp/initrd-repack
(cd /boot ; \
cp /usr/lib/linux-image-*/kirkwood-dreamplug.dtb dtb ; \
- cat vmlinuz-* dtb >> temp-kernel ; \
- mkimage -A arm -O linux -T kernel -n "Debian kernel (unknown version)" \
+ cat vmlinuz-$KERNELVERSION dtb >> temp-kernel ; \
+ mkimage -A arm -O linux -T kernel -n "Debian kernel ($KERNELVERSION)" \
-C none -a 0x8000 -e 0x8000 -d temp-kernel uImage ; \
rm -f temp-kernel ; \
mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 \
- -n "Debian ramdisk (unknown version)" \
+ -n "Debian ramdisk ($KERNELVERSION)" \
-d initrd.img uInitrd )
+rm /boot/initrd.img
echo "Creating /live and copying in boot images..."
mkdir -p /live
-cp /boot/uInitrd /boot/uImage /boot/dtb /live
+mv /boot/uInitrd /boot/uImage /boot/dtb /live