From ad68d15e39017245ade131c1fd21bcc48f33ac97 Mon Sep 17 00:00:00 2001 From: Kees Jongenburger Date: Wed, 22 May 2013 09:12:13 +0200 Subject: [PATCH] arm:build generate uEnv.txt Generate uEnv.txt to allow to generate an uEnv containing commands to boot over the network. Change-Id: I8bcd831ee474d837411568bf1c1e2c2d96ec931b --- releasetools/arm_sdimage.sh | 5 ++- releasetools/gen_uEnv.txt.sh | 74 ++++++++++++++++++++++++++++++++++++ releasetools/uEnv.txt | 17 --------- 3 files changed, 77 insertions(+), 19 deletions(-) create mode 100755 releasetools/gen_uEnv.txt.sh delete mode 100644 releasetools/uEnv.txt diff --git a/releasetools/arm_sdimage.sh b/releasetools/arm_sdimage.sh index 4c1cfd8f4..58ca46e0e 100755 --- a/releasetools/arm_sdimage.sh +++ b/releasetools/arm_sdimage.sh @@ -142,16 +142,17 @@ END_SFDISK # mkfs.vfat ${IMG_DIR}/fat.img +./releasetools/gen_uEnv.txt.sh > ${IMG_DIR}/uEnv.txt echo "Copying configuration kernel and boot modules" mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$MLO ::MLO mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/$UBOOT ::u-boot.img -mcopy -bsp -i ${IMG_DIR}/fat.img releasetools/uEnv.txt ::uEnv.txt +mcopy -bsp -i ${IMG_DIR}/fat.img ${IMG_DIR}/uEnv.txt ::uEnv.txt mcopy -bsp -i ${IMG_DIR}/fat.img releasetools/cmdline.txt ::cmdline.txt # # For tftp booting # -cp releasetools/uEnv.txt ${OBJ}/ +cp ${IMG_DIR}/uEnv.txt ${OBJ}/ cp releasetools/cmdline.txt ${OBJ}/ # diff --git a/releasetools/gen_uEnv.txt.sh b/releasetools/gen_uEnv.txt.sh new file mode 100755 index 000000000..e1060ad40 --- /dev/null +++ b/releasetools/gen_uEnv.txt.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +#generate a u-boot u-env. +list="0x80200000 kernel.bin +0x90000000 ds.elf +0x90800000 rs.elf +0x91000000 pm.elf +0x91800000 sched.elf +0x92000000 vfs.elf +0x92800000 memory.elf +0x93000000 log.elf +0x93800000 tty.elf +0x94000000 mfs.elf +0x94800000 vm.elf +0x95000000 pfs.elf +0x95800000 init.elf +0x96000000 cmdline.txt" + +# +# PREFIX for loading file over tftp to allow hosting multiple +# version/devices. +NETBOOT_PREFIX="" +NETBOOT="no" +BOOT="mmcbootcmd" + +while getopts "p:n?" c +do + case "$c" in + \?) + echo "Usage: $0 [-p netboot_prefix] -n" >&2 + exit 1 + ;; + n) + # genrate netbooting uEnv.txt + BOOT="netbootcmd" + NETBOOT="yes" + ;; + p) + NETBOOT_PREFIX=$OPTARG + ;; + esac +done + +function fill_cmd(){ + #load == load method like fatload mmc 0:1 + #prefix is an optional directory containing the ending / + load=$1 + prefix=$2 + export IFS=" " + echo $list | while true + do + if ! read -r mem addr + then + break + fi + #e.g. ; fatloat mmc 0:1 0x82000000 mydir/ds.elf + echo -n "; $load $mem $prefix$addr" + done +} + + +echo "# Set the command to be executed" +echo "uenvcmd=run $BOOT" +echo +echo "# With cmdline/bootargs in cmdline.txt" +echo "mmcbootcmd=echo starting from MMC ; mmc part 0; mw.b 0x96000000 0 16384 $(fill_cmd "fatload mmc 0:1" "") ; dcache off ; icache off ; go 0x80200000" +echo +echo "# Netbooting." +echo "serverip=192.168.12.10" +echo "ipaddr=192.168.12.62" +echo "usbnet_devaddr=e8:03:9a:24:f9:10" +echo "usbethaddr=e8:03:9a:24:f9:11" +echo "netbootcmd=echo starting from TFTP; usb start; mw.b 0x96000000 0 16384 $(fill_cmd "tftp" "$NETBOOT_PREFIX") ; dcache off ; icache off ; go 0x80200000" +exit 0 diff --git a/releasetools/uEnv.txt b/releasetools/uEnv.txt deleted file mode 100644 index 30dabd1a6..000000000 --- a/releasetools/uEnv.txt +++ /dev/null @@ -1,17 +0,0 @@ -#uEnv.txt - -# Set the command to be executed -uenvcmd=run mmcbootcmd - -# With cmdline/bootargs in cmdline.txt -mmcbootcmd=echo starting from MMC ; mmc part 0; fatload mmc 0:1 0x80200000 kernel.bin; fatload mmc 0:1 0x90000000 ds.elf; fatload mmc 0:1 0x90800000 rs.elf; fatload mmc 0:1 0x91000000 pm.elf; fatload mmc 0:1 0x91800000 sched.elf; fatload mmc 0:1 0x92000000 vfs.elf; fatload mmc 0:1 0x92800000 memory.elf; fatload mmc 0:1 0x93000000 log.elf; fatload mmc 0:1 0x93800000 tty.elf; fatload mmc 0:1 0x94000000 mfs.elf; fatload mmc 0:1 0x94800000 vm.elf; fatload mmc 0:1 0x95000000 pfs.elf; fatload mmc 0:1 0x95800000 init.elf; mw.b 0x96000000 0 16384; fatload mmc 0:1 0x96000000 cmdline.txt; dcache off ; icache off ; go 0x80200000 - -# Netbooting. -#echo == Configure the server IP == -#serverip=192.168.12.10 -#ipaddr=192.168.12.62 -#usbnet_devaddr=e8:03:9a:24:f9:10 -#usbethaddr=e8:03:9a:24:f9:11 -#mmcbootcmd=echo starting from TFTP; usb start ; tftp 0x80200000 kernel.bin; tftp 0x90000000 ds.elf; tftp 0x90800000 rs.elf; tftp 0x91000000 pm.elf; tftp 0x91800000 sched.elf; tftp 0x92000000 vfs.elf; tftp 0x92800000 memory.elf; tftp 0x93000000 log.elf; tftp 0x93800000 tty.elf; tftp 0x94000000 mfs.elf; tftp 0x94800000 vm.elf; tftp 0x95000000 pfs.elf; tftp 0x95800000 init.elf; mw.b 0x96000000 0 16384; tftp 0x96000000 cmdline.txt; dcache off ; icache off ; go 0x80200000 - - -- 2.44.0