Comment 26 for bug 671027

Revision history for this message
Matt Sealey (mwsealey) wrote :

For reference this is my untested hook for the Efika..

efikamx_flash_kernel() {
 tmp=$(tempfile)
 printf "Generating kernel u-boot image... " >&2
 mkimage -A arm -O linux -T kernel -C none -a 0x90008000 \
  -e 0x90008000 -d $kfile "$tmp.uImage" >&2 1>/dev/null
 echo "done." >&2

 if [ -e /boot/uImage-${kvers} ]; then
  mv /boot/uImage-${kvers} /boot/uImage-${kvers}.bak
 fi
 mv $tmp.uImage /boot/uImage-${kvers}
 rm -f "$tmp.uImage"

 if [ -e ${ifile} ]; then
  printf "Generating initrd u-boot image... " >&2
  mkimage -A arm -O linux -T ramdisk -C none -a 0x0 \
   -e 0x0 -n "$idesc" -d "$ifile" "$tmp.uInitrd" >&2 1>/dev/null
  echo "done." >&2

  if [ -e /boot/uInitrd-${kvers} ]; then
   mv /boot/uInitrd-${kvers} /boot/uInitrd-${kvers}.bak
  fi
  mv "$tmp.uInitrd" /boot/uInitrd-${kvers}
  rm -f "$tmp.uInitrd"
 fi

 if [ -e /boot/boot.script ];then
  cp /boot/boot.scr /boot/boot.scr.bak

  printf "Generating u-boot configuration from /boot/boot.script... " >&2
  cp /boot/boot.script "$tmp.boot.script"
  # not sure if sed or bash is going to freak at the dollar or curlybraces.. TEST TEST!! - NEKO
  sed -i 'backup' -e's/KVERSION/${kvers}/' "$tmp.boot.script"
  mkimage -A arm -T script -C none -n "Ubuntu boot script" \
   -d "$tmp.boot.script" /boot/boot.scr >&2 1>/dev/null
  echo "done." >&2
  rm -f "$tmp.boot.script"
 fi

 rm -f "$tmp"
}