--- flash-kernel 2011-02-17 15:01:32.000000000 +0000 +++ ../../flash-kernel-2.28ubuntu14/flash-kernel 2011-02-23 18:05:50.000000000 +0000 @@ -586,79 +586,41 @@ ;; "Freescale MX51 Babbage Board") check_subarch "imx51" - - for c in fis_dev fis_offset_hex fis_size_hex; do - if [ -z "`eval echo \$$c`" ]; then - error "$c not set in $config" - fi - done - check_dev_mtdblock "$fis_dev" - check_fis "$fis_dev" "$fis_offset_hex" "$fis_size_hex" - - # check for an "initrd" entry - initrd="initrd" - ifisinfo=$(fis_info "$fis_dev" "$fis_offset_hex" "$fis_size_hex" "initrd") - # fallback on "initramfs" - if [ -z "$ifisinfo" ]; then - initrd="initramfs" - ifisinfo=$(fis_info "$fis_dev" "$fis_offset_hex" "$fis_size_hex" "$initrd") - if [ -z "$ifisinfo" ]; then - error "Cannot find FIS partition '$initrd'" - fi - fi - ifissize=$(fis_size $ifisinfo) - check_size "$initrd" $ifilesize $ifissize - - kfisinfo=$(fis_info "$fis_dev" "$fis_offset_hex" "$fis_size_hex" "kernel") - if [ -z "$kfisinfo" ]; then - error "Cannot find FIS partition 'kernel'" - fi - kfissize=$(fis_size $kfisinfo) - check_size "kernel" $kfilesize $kfissize - - kfisoffset=$(fis_offset $kfisinfo) - kfisentry=$(fis_entry $kfisinfo) - # the kernel is started at its load address so kfisram == - # kfisentry - kfisram="$kfisentry" - - ifisoffset=$(fis_offset $ifisinfo) - # not used - ifisentry=$(printf %d 0xffffffff) - # XXX hardcoded, should be read from RedBoot; but fis command - # currently doesn't return that info - ifisram=$(printf %d 0x1000000) - - printf "Flashing kernel... " >&2 - fis -d "$fis_dev" -o "$fis_offset_hex" -s "$fis_size_hex" create "kernel" -f $kfisoffset -l $kfissize -e $kfisentry -r $kfisram -c "$kfile" || error "FIS create failed." - dd if="$kfile" of="$fis_dev" bs=$kfisoffset seek=1 2>/dev/null || error "update failed." - echo "done." >&2 - - printf "Generating padded initramfs... " >&2 - # padded initramfs; we need to use a temp file because of the - # fis command which needs to see a padded datalength - ipadded="" - # cleanup handler which removes the generated temp file when - # this script finished - cleanup_ipadded() { - if [ -n "$ipadded" ]; then - rm -f "$ipadded" - fi - } - cleanup_funcs="cleanup_ipadded $cleanup_funcs" - ipadded=$(mktemp -t flash-kernel.XXXXXXXXXX) - pad=$(expr $ifissize - $ifilesize) - ( - cat $ifile - # pad with zeroes; this uses $pad mem, not very elegant - dd if=/dev/zero bs=$pad count=1 2>/dev/null - ) | dd of="$ipadded" bs=4k 2>/dev/null || error "failed." + echo "Using u-boot partition: ${UBOOT_PART}" >&2 + TMPMOUNT=$(mktemp -d) + mount $UBOOT_PART $TMPMOUNT + 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.uboot >&2 1>/dev/null + echo "done." >&2 + + if [ -e $TMPMOUNT/uImage ]; then + mv $TMPMOUNT/uImage $TMPMOUNT/uImage.bak + fi + cp $tmp.uboot $TMPMOUNT/uImage + rm -f $tmp.uboot + + printf "Generating initrd u-boot image... " >&2 + mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 \ + -e 0x0 -n "$idesc" -d "$ifile" "$tmp.uboot" >&2 1>/dev/null echo "done." >&2 + if [ -e $TMPMOUNT/uInitrd ]; then + mv $TMPMOUNT/uInitrd $TMPMOUNT/uInitrd.bak + fi + cp "$tmp.uboot" $TMPMOUNT/uInitrd + rm -f "$tmp.uboot" + + if [ -e /boot/boot.script ];then + mv $TMPMOUNT/boot.scr $TMPMOUNT/boot.scr.bak + printf "Generating u-boot configuration from /boot/boot.script... " >&2 + mkimage -A arm -T script -C none -n "Ubuntu boot script" -d /boot/boot.script \ + /boot/boot.scr >&2 1>/dev/null + echo "done." >&2 + fi - printf "Flashing initramfs... " >&2 - fis -d "$fis_dev" -o "$fis_offset_hex" -s "$fis_size_hex" create "$initrd" -f $ifisoffset -l $ifissize -e $ifisentry -r $ifisram -c "$ipadded" || error "FIS create failed." - dd if="$ipadded" of="$fis_dev" bs=$ifisoffset seek=1 2>/dev/null || error "failed." - echo "done." >&2 + umount $TMPMOUNT + rm -rf $TMPMOUNT ;; "GLAN Tank") rm -f /boot/initrd /boot/zImage