aboutsummaryrefslogtreecommitdiffstats
path: root/config/hooks
diff options
context:
space:
mode:
authorficus <ficus@robocracy.org>2012-11-13 22:56:37 +0100
committerficus <ficus@robocracy.org>2012-11-13 22:56:37 +0100
commiteddf79ba816ed061c6e2e70558f9a62c9191467c (patch)
tree57fb8baf793ba1560b4e5abb1aa4a4554478ec1a /config/hooks
parent554b72536dc9fbd145868518d122695b3f7b56b5 (diff)
downloadtorouter-live-eddf79ba816ed061c6e2e70558f9a62c9191467c.tar.gz
torouter-live-eddf79ba816ed061c6e2e70558f9a62c9191467c.zip
WIP: more torouter-ish image, boots with care
Diffstat (limited to 'config/hooks')
-rwxr-xr-xconfig/hooks/kernel-image.sh.binary27
-rwxr-xr-xconfig/hooks/kernel-image.sh.chroot26
2 files changed, 53 insertions, 0 deletions
diff --git a/config/hooks/kernel-image.sh.binary b/config/hooks/kernel-image.sh.binary
new file mode 100755
index 0000000..69a3b77
--- /dev/null
+++ b/config/hooks/kernel-image.sh.binary
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -e
+
+echo "Mangling kernel..."
+cd ./binary
+mkdir initrd-repack
+cp live/initrd.img-* initrd-repack
+(cd initrd-repack ; \
+ zcat initrd.img-* | cpio -i ; \
+ rm -f conf/param.conf ; \
+ find . | cpio --quiet -o -H newc | \
+ gzip -9 > initrd.img ; \
+ cd ..)
+
+cp initrd-repack/initrd.img live/initrd.img
+rm -rf initrd-repack
+
+(cd live; \
+ 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)" \
+ -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)" \
+ -d initrd.img uInitrd )
diff --git a/config/hooks/kernel-image.sh.chroot b/config/hooks/kernel-image.sh.chroot
new file mode 100755
index 0000000..28b7f44
--- /dev/null
+++ b/config/hooks/kernel-image.sh.chroot
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -e
+
+# TODO: this seems to be a null-op... flash-kernel is symlinked to `true`?
+echo "Trying to flashing kernel..."
+/usr/sbin/flash-kernel || echo "Failed to flash kernel! Don't worry, will mangle"
+
+echo "Mangling kernel..."
+mkdir /tmp/initrd-repack
+(cd /tmp/initrd-repack ; \
+ zcat /boot/initrd.img-* | cpio -i ; \
+ rm -f conf/param.conf ; \
+ find . | cpio --quiet -o -H newc | \
+ gzip -9 > /boot/initrd.img)
+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)" \
+ -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)" \
+ -d initrd.img uInitrd )