Comment 12 for bug 345534

Revision history for this message
Oliver Grawert (ogra) wrote :

here is a patch that does the necessary bits, though loic just fixed the need for $initramfs_size which means it will need to be reworked a bit ...

--- flash-kernel-2.13ubuntu2/debian/flash-kernel-installer.postinst 2009-03-31 11:22:17.000000000 +0200
+++ flash-kernel-installer.postinst 2009-03-31 16:48:28.000000000 +0200
@@ -76,6 +76,29 @@
  ;;
  "Freescale MX51 Babbage Board")
   in-target update-initramfs -u || true
+ if ! apt-install redboot-tools; then
+ error "apt-install redboot-tools failed"
+ fi
+ # hardcoded defaults
+ dev="/dev/mmcblk0"
+ fis_ofst="0x40000"
+ ofst=$(LC_ALL=C fis -d $dev -o $fis_ofst list | sed -n '/config:/s/^.*addr = \(.*\), size.*$/\1/p')
+ if [ -z $ofst ]; then
+ error "could not find fis configuration on $dev"
+ fi
+ # find the size of the initramfs we created above
+ initrd_size=$(wc -c /target/initrd.img|cut -d ' ' -f1)
+ # required to assemble redboot script
+ load_initrd="fis load initramfs"
+ load_kernel="fis load kernel"
+ console="console=ttymxc0,115200 console=tty1"
+ # find target UUID
+ rootfs=$(findfs /)
+ vol_id=$(PATH="/lib/udev:$PATH" vol_id -u $rootfs)
+ # assemble cmdline
+ cmdline="\"$console root=UUID=$vol_id quiet\""
+ script="$load_initrd\\$load_kernel\\exec -r 0x1000000 -s $initrd_size -c $cmdline"
+ fconfig -w -d $dev -o $ofst -n boot_script_data -x "${script}"
  ;;
  "GLAN Tank")
   in-target update-initramfs -u || true