From d50de354390413424cd53e997665ddb16c13c25e Mon Sep 17 00:00:00 2001 From: ficus Date: Fri, 23 Nov 2012 03:18:35 +0100 Subject: clean up kernel image scripts --- config/hooks/kernel-image.sh.binary | 6 ++++++ config/hooks/kernel-image.sh.chroot | 13 ++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) create mode 100755 config/hooks/kernel-image.sh.binary 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 -- cgit v1.2.3