diff --git a/board/boundary/bootscripts/README.md b/board/boundary/bootscripts/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6bd72e254883d1944c7cc076f673d263ef634346 --- /dev/null +++ b/board/boundary/bootscripts/README.md @@ -0,0 +1,19 @@ +Boot scripts +============ + +This folder contains all the boot scripts for booting / upgrading any OS: +* `bootscript-mainline.txt`: boot script for any OS using mainline-based kernel +* `bootscript-ubuntu.txt`: boot script for Ubuntu OS using NXP-based kernel +* `bootscript-yocto.txt`: boot script for Yocto OS using NXP-based kernel +* `net_upgrade_fs.txt`: downloads `${upgrade_file}` over TFTP and flashes it into `${upgrade_device}` +* `net_upgradeu_fs.txt`: downloads `${net_upgrade_fs}` over TFTP and executes it +* `net_upgradeu.txt`: downloads `u-boot.${uboot_defconfig}` over TFTP and flashes it into NOR flash +* `prog_fuses.txt`: program the fuses for both MAC address and boot selection +* `upgrade.txt`: downloads `u-boot.${uboot_defconfig}` from local media and flashes it into NOR flash + +Those `.txt` files need to be transformed into U-Boot scripts (`.scr`) using `mkimage`. + +Here is an example for generating a `boot.scr` for Yocto OS: +``` +mkimage -A arm -O linux -T script -C none -a 0 -e 0 -n "bootscript" -d bootscript-yocto.txt boot.scr +``` diff --git a/board/boundary/bootscripts/bootscript-mainline.txt b/board/boundary/bootscripts/bootscript-mainline.txt new file mode 100644 index 0000000000000000000000000000000000000000..13805a88bf8119044999018bb12cbfab12dccd49 --- /dev/null +++ b/board/boundary/bootscripts/bootscript-mainline.txt @@ -0,0 +1,150 @@ +setenv bootargs '' + +setenv initrd_high 0xffffffff +a_base=0x10000000 +if itest.s x51 == "x${imx_cpu}" ; then + a_base=0x90000000 +elif itest.s x53 == "x${imx_cpu}"; then + a_base=0x70000000 +elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_base=0x80000000 +fi + +setexpr a_script ${a_base} + 0x00800000 +setexpr a_zImage ${a_base} + 0x00800000 +setexpr a_fdt ${a_base} + 0x03000000 +setexpr a_ramdisk ${a_base} + 0x03800000 +setexpr a_initrd ${a_base} + 0x03a00000 +setexpr a_reset_cause_marker ${a_base} + 0x80 +setexpr a_reset_cause ${a_base} + 0x84 + +if itest.s "x" == "x${board}" ; then + echo "!!!! Error: Your u-boot is outdated. Please upgrade."; + exit; +fi + +if itest.s "x" == "x${fdt_file}" ; then + if itest.s x6SOLO == "x${imx_cpu}" ; then + fdt_file=imx6dl-${board}.dtb; + elif itest.s x6DL == "x${imx_cpu}" ; then + fdt_file=imx6dl-${board}.dtb; + elif itest.s x6QP == "x${imx_cpu}" ; then + fdt_file=imx6qp-${board}.dtb; + elif itest.s x6SX == "x${imx_cpu}" ; then + fdt_file=imx6sx-${board}.dtb; + elif itest.s x7D == "x${imx_cpu}" ; then + fdt_file=imx7d-${board}.dtb; + elif itest.s x51 == "x${imx_cpu}" ; then + fdt_file=imx51-${board}${m4}.dtb; + elif itest.s x53 == "x${imx_cpu}" ; then + fdt_file=imx53-${board}${m4}.dtb; + else + fdt_file=imx6q-${board}.dtb; + fi +fi + +if load ${devtype} ${devnum}:1 ${a_script} uEnv.txt ; then + env import -t ${a_script} ${filesize} +fi + +if itest.s x${distro_bootpart} == x ; then + distro_bootpart=1 +fi + +if load ${devtype} ${devnum}:${distro_bootpart} ${a_fdt} ${prefix}${fdt_file} ; then + fdt addr ${a_fdt} + setenv fdt_high 0xffffffff +else + echo "!!!! Error loading ${prefix}${fdt_file}"; + exit; +fi + +fdt resize +if itest.s "x" != "x${cmd_custom}" ; then + run cmd_custom +fi + +## HDMI ## +if itest.s "xoff" == "x$fb_hdmi" ; then + setenv bootargs $bootargs video=HDMI-A-1:d +else + if itest.s "x" != "x$force_edid" ; then + echo "------ forcing EDID to /lib/firmware/$force_edid" + setenv bootargs $bootargs drm_kms_helper.edid_firmware=$force_edid + fi +fi + +## LVDS ## +if itest.s "xoff" == "x$fb_lvds" ; then + setenv bootargs $bootargs video=LVDS-1:d +elif itest.s "xhannstar7" == "x$fb_lvds" ; then + fdt set /panel-lvds0 compatible "hannstar,hsd070pww1" +elif itest.s "xtm070jdhg30" == "x$fb_lvds" ; then + fdt set /panel-lvds0 compatible "tianma,tm070jdhg30" +elif itest.s "xdt070btft" == "x$fb_lvds" ; then + fdt set /panel-lvds0 compatible "innolux,zj070na-01p" +fi + +if itest.s "xoff" == "x$fb_lvds2" ; then + setenv bootargs $bootargs video=LVDS-2:d +elif itest.s "xhannstar7" == "x$fb_lvds2" ; then + fdt set /panel-lvds1 compatible "hannstar,hsd070pww1" +elif itest.s "xtm070jdhg30" == "x$fb_lvds2" ; then + fdt set /panel-lvds1 compatible "tianma,tm070jdhg30" +elif itest.s "xdt070btft" == "x$fb_lvds2" ; then + fdt set /panel-lvds1 compatible "innolux,zj070na-01p" +fi + +## LCD ## +if itest.s "xoff" == "x$fb_lcd" ; then + setenv bootargs $bootargs video=VGA-1:d +fi + +if itest.s x${rfspart} == x ; then + rfspart=2 +fi + +if itest.s "x" == "x${root}"; then + part uuid ${devtype} ${devnum}:${rfspart} uuid + if itest.s "x" != "x${uuid}"; then + root=PARTUUID=${uuid} + elif test "sata" = "${devtype}" || test "usb" = "${devtype}" ; then + root=/dev/sda${rfspart} + else + root=/dev/mmcblk${devnum}p${rfspart} + fi +fi + +if itest.s "x" == "x$cma" ; then + cma=256M +fi + +if itest.s "x" == "x$vmalloc" ; then + vmalloc=400M +fi + +if itest.s "x" != "x$show_fdt" ; then + fdt print / +fi + +if itest.s "x" != "x$show_env" ; then + printenv +fi + +setenv bootargs "$bootargs console=${console},115200 vmalloc=${vmalloc}" +setenv bootargs "$bootargs cma=${cma} consoleblank=0 root=${root} rootwait" + +if itest.s "x" != "x${loglevel}" ; then + setenv bootargs ${bootargs} loglevel=${loglevel} +fi + +if itest *${a_reset_cause_marker} == 12345678 ; then + setexpr.l reset_cause *${a_reset_cause} + setenv bootargs $bootargs reset_cause=0x${reset_cause} +fi +setenv bootargs ${bootargs} snd.slots=,snd-soc-imx-hdmi + +if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} ${prefix}zImage ; then + bootz ${a_zImage} - ${a_fdt} +fi +echo "Error loading kernel image" diff --git a/board/boundary/bootscripts/bootscript-ubuntu.txt b/board/boundary/bootscripts/bootscript-ubuntu.txt new file mode 100644 index 0000000000000000000000000000000000000000..433fffa04b763e4d544319db1b44014739956310 --- /dev/null +++ b/board/boundary/bootscripts/bootscript-ubuntu.txt @@ -0,0 +1,213 @@ +setenv bootargs '' + +setenv initrd_high 0xffffffff +m4='' +a_base=0x10000000 +if itest.s x51 == "x${imx_cpu}" ; then + a_base=0x90000000 +elif itest.s x53 == "x${imx_cpu}"; then + a_base=0x70000000 +elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_base=0x80000000 + if itest.s "x1" == "x$m4enabled" ; then + run m4boot; + m4='-m4'; + fi +fi + +setexpr a_script ${a_base} + 0x00800000 +setexpr a_zImage ${a_base} + 0x00800000 +setexpr a_fdt ${a_base} + 0x03000000 +setexpr a_ramdisk ${a_base} + 0x03800000 +setexpr a_initrd ${a_base} + 0x03a00000 +setexpr a_reset_cause_marker ${a_base} + 0x80 +setexpr a_reset_cause ${a_base} + 0x84 + +if itest.s "x" == "x${board}" ; then + echo "!!!! Error: Your u-boot is outdated. Please upgrade."; + exit; +fi + +if itest.s "x" == "x${fdt_file}" ; then + if itest.s x6SOLO == "x${imx_cpu}" ; then + fdt_file=imx6dl-${board}.dtb; + elif itest.s x6DL == "x${imx_cpu}" ; then + fdt_file=imx6dl-${board}.dtb; + elif itest.s x6QP == "x${imx_cpu}" ; then + fdt_file=imx6qp-${board}.dtb; + elif itest.s x6SX == "x${imx_cpu}" ; then + fdt_file=imx6sx-${board}${m4}.dtb; + elif itest.s x7D == "x${imx_cpu}" ; then + fdt_file=imx7d-${board}${m4}.dtb; + elif itest.s x51 == "x${imx_cpu}" ; then + fdt_file=imx51-${board}${m4}.dtb; + elif itest.s x53 == "x${imx_cpu}" ; then + fdt_file=imx53-${board}${m4}.dtb; + else + fdt_file=imx6q-${board}.dtb; + fi +fi + +if itest.s x${distro_bootpart} == x ; then + distro_bootpart=1 +fi + +if load ${devtype} ${devnum}:${distro_bootpart} ${a_script} uEnv.txt ; then + env import -t ${a_script} ${filesize} +fi + +if itest.s x${console} != x ; then + setenv bootargs ${bootargs} console=${console},115200 +fi +setenv bootargs ${bootargs} vmalloc=400M consoleblank=0 rootwait fixrtc cpu=${imx_cpu} board=${board} + +if load ${devtype} ${devnum}:${distro_bootpart} ${a_fdt} ${prefix}${fdt_file} ; then + fdt addr ${a_fdt} + setenv fdt_high 0xffffffff +else + echo "!!!! Error loading ${prefix}${fdt_file}"; + exit; +fi + +cmd_xxx_present= +fdt resize +if itest.s "x" != "x${cmd_custom}" ; then + run cmd_custom + cmd_xxx_present=1; +fi + +if itest.s "x" != "x${cmd_hdmi}" ; then + run cmd_hdmi + cmd_xxx_present=1; + if itest.s x == x${allow_noncea} ; then + setenv bootargs ${bootargs} mxc_hdmi.only_cea=1; + echo "only CEA modes allowed on HDMI port"; + else + setenv bootargs ${bootargs} mxc_hdmi.only_cea=0; + echo "non-CEA modes allowed on HDMI, audio may be affected"; + fi +fi + +if itest.s "x" != "x${cmd_lcd}" ; then + run cmd_lcd + cmd_xxx_present=1; +fi +if itest.s "x" != "x${cmd_lcd2}" ; then + run cmd_lcd2 + cmd_xxx_present=1; +fi +if itest.s "x" != "x${cmd_lvds}" ; then + run cmd_lvds + cmd_xxx_present=1; +fi +if itest.s "x" != "x${cmd_lvds2}" ; then + run cmd_lvds2 + cmd_xxx_present=1; +fi + +if itest.s "x" == "x${cmd_xxx_present}" ; then + echo "!!!!!!!!!!!!!!!!" + echo "warning: your u-boot may be outdated, please upgrade" + echo "!!!!!!!!!!!!!!!!" +fi + +setexpr b0 ${distro_bootpart} % 0x0a; +setexpr b1 ${distro_bootpart} / 0x0a; +#this is to show a decimal number when really hex is output +setexpr bpart ${b1} * 0x10 +setexpr bpart ${bpart} + ${b0}; + +if test "sata" = "${devtype}" ; then + setenv bootargs "${bootargs} root=/dev/sda${bpart}" ; +elif test "usb" = "${devtype}" ; then + setenv bootargs "${bootargs} root=/dev/sda${bpart}" ; +else + setenv bootargs "${bootargs} root=/dev/mmcblk${devnum}p${bpart}" +fi + +if itest.s "x" != "x${disable_msi}" ; then + setenv bootargs ${bootargs} pci=nomsi +fi; + +if itest.s "x" != "x${disable_giga}" ; then + setenv bootargs ${bootargs} fec.disable_giga=1 +fi + +if itest.s "x" != "x${wlmac}" ; then + setenv bootargs ${bootargs} wlan.mac=${wlmac} wlcore.mac=${wlmac} +fi + +if itest.s "x" != "x${bd_addr}" ; then + setenv bootargs ${bootargs} bd_addr=${bd_addr} +fi + +if itest.s "x" != "x${gpumem}" ; then + setenv bootargs ${bootargs} galcore.contiguousSize=${gpumem} +fi + + +if itest.s "no" != "${dosplash}" ; then + if itest.s "x" == "x${loglevel}" ; then + loglevel=4 + fi + setenv bootargs ${bootargs} splash plymouth.ignore-serial-consoles +fi + +if itest.s "x" != "x${loglevel}" ; then + setenv bootargs ${bootargs} loglevel=${loglevel} +fi + +if itest *${a_reset_cause_marker} == 12345678 ; then + setexpr.l reset_cause *${a_reset_cause} + setenv bootargs $bootargs reset_cause=0x${reset_cause} +fi + +if itest.s "x" != "x${overlayfs}" ; then + setenv bootargs ${bootargs} overlayfs=${overlayfs} + if itest.s "x" != "x${ofs-size}" ; then + setenv bootargs ${bootargs} ofs-size=${ofs-size} + fi +fi + +if itest.s "x" != "x${cma}" ; then + setenv bootargs ${bootargs} cma=${cma} +fi +setenv bootargs ${bootargs} snd.slots=,snd-soc-imx-hdmi + +if itest.s "x" != "x${show_fdt}" ; then + fdt print / +fi + +if itest.s "x" != "x${show_env}" ; then + printenv +fi + +if kbd ; then + if itest.s "xv" == "x${keybd}" ; then + load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} ${prefix}uImage-recovery && + load ${devtype} ${devnum}:${distro_bootpart} ${a_ramdisk} ${prefix}uramdisk-recovery.img && + bootm ${a_zImage} ${a_ramdisk}; + echo "--- error launching recovery!" + exit; + fi +fi + +echo "----------- trying to load /initrd.img"; +if load ${devtype} ${devnum}:${distro_bootpart} ${a_initrd} /initrd.img ; then + haverd=1; + setenv initrd_size ${filesize} +else + haverd= +fi + +if itest.s x${haverd} == x ; then + if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} /vmlinuz ; then + setenv bootargs ${bootargs} rw + bootz ${a_zImage} - ${a_fdt} + fi +else + if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} /vmlinuz ; then + bootz ${a_zImage} ${a_initrd}:${initrd_size} ${a_fdt} ; + fi +fi +echo "Error loading kernel image" diff --git a/board/boundary/bootscripts/bootscript-yocto.txt b/board/boundary/bootscripts/bootscript-yocto.txt new file mode 100644 index 0000000000000000000000000000000000000000..c7009d840a4d7ecef7c4470e357e1cb74876b055 --- /dev/null +++ b/board/boundary/bootscripts/bootscript-yocto.txt @@ -0,0 +1,165 @@ +setenv bootargs '' + +setenv initrd_high 0xffffffff +m4='' +a_base=0x10000000 +if itest.s x51 == "x${imx_cpu}" ; then + a_base=0x90000000 +elif itest.s x53 == "x${imx_cpu}"; then + a_base=0x70000000 +elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_base=0x80000000 + if itest.s "x1" == "x$m4enabled" ; then + run m4boot; + m4='-m4'; + fi +fi + +setexpr a_script ${a_base} + 0x00800000 +setexpr a_zImage ${a_base} + 0x00800000 +setexpr a_fdt ${a_base} + 0x03000000 +setexpr a_ramdisk ${a_base} + 0x03800000 +setexpr a_initrd ${a_base} + 0x03a00000 +setexpr a_reset_cause_marker ${a_base} + 0x80 +setexpr a_reset_cause ${a_base} + 0x84 + +if itest.s "x" == "x${board}" ; then + echo "!!!! Error: Your u-boot is outdated. Please upgrade."; + exit; +fi + +if itest.s "x" == "x${fdt_file}" ; then + if itest.s x6SOLO == "x${imx_cpu}" ; then + fdt_file=imx6dl-${board}.dtb; + elif itest.s x6DL == "x${imx_cpu}" ; then + fdt_file=imx6dl-${board}.dtb; + elif itest.s x6QP == "x${imx_cpu}" ; then + fdt_file=imx6qp-${board}.dtb; + elif itest.s x6SX == "x${imx_cpu}" ; then + fdt_file=imx6sx-${board}${m4}.dtb; + elif itest.s x7D == "x${imx_cpu}" ; then + fdt_file=imx7d-${board}${m4}.dtb; + elif itest.s x51 == "x${imx_cpu}" ; then + fdt_file=imx51-${board}${m4}.dtb; + elif itest.s x53 == "x${imx_cpu}" ; then + fdt_file=imx53-${board}${m4}.dtb; + else + fdt_file=imx6q-${board}.dtb; + fi +fi + +if itest.s x${distro_bootpart} == x ; then + distro_bootpart=1 +fi + +if load ${devtype} ${devnum}:${distro_bootpart} ${a_script} uEnv.txt ; then + env import -t ${a_script} ${filesize} +fi +setenv bootargs ${bootargs} console=${console},115200 vmalloc=400M consoleblank=0 rootwait fixrtc cpu=${imx_cpu} board=${board} + +if load ${devtype} ${devnum}:${distro_bootpart} ${a_fdt} ${prefix}${fdt_file} ; then + fdt addr ${a_fdt} + setenv fdt_high 0xffffffff +else + echo "!!!! Error loading ${prefix}${fdt_file}"; + exit; +fi + +cmd_xxx_present= +fdt resize +if itest.s "x" != "x${cmd_custom}" ; then + run cmd_custom + cmd_xxx_present=1; +fi + +if itest.s "x" != "x${cmd_hdmi}" ; then + run cmd_hdmi + cmd_xxx_present=1; + if itest.s x == x${allow_noncea} ; then + setenv bootargs ${bootargs} mxc_hdmi.only_cea=1; + echo "only CEA modes allowed on HDMI port"; + else + setenv bootargs ${bootargs} mxc_hdmi.only_cea=0; + echo "non-CEA modes allowed on HDMI, audio may be affected"; + fi +fi + +if itest.s "x" != "x${cmd_lcd}" ; then + run cmd_lcd + cmd_xxx_present=1; +fi +if itest.s "x" != "x${cmd_lcd2}" ; then + run cmd_lcd2 + cmd_xxx_present=1; +fi +if itest.s "x" != "x${cmd_lvds}" ; then + run cmd_lvds + cmd_xxx_present=1; +fi +if itest.s "x" != "x${cmd_lvds2}" ; then + run cmd_lvds2 + cmd_xxx_present=1; +fi + +if itest.s "x" == "x${cmd_xxx_present}" ; then + echo "!!!!!!!!!!!!!!!!" + echo "warning: your u-boot may be outdated, please upgrade" + echo "!!!!!!!!!!!!!!!!" +fi + +bpart=2 + +if test "sata" = "${devtype}" ; then + setenv bootargs "${bootargs} root=/dev/sda${bpart}" ; +elif test "usb" = "${devtype}" ; then + setenv bootargs "${bootargs} root=/dev/sda${bpart}" ; +else + setenv bootargs "${bootargs} root=/dev/mmcblk${devnum}p${bpart}" +fi + +if itest.s "x" != "x${disable_msi}" ; then + setenv bootargs ${bootargs} pci=nomsi +fi; + +if itest.s "x" != "x${disable_giga}" ; then + setenv bootargs ${bootargs} fec.disable_giga=1 +fi + +if itest.s "x" != "x${wlmac}" ; then + setenv bootargs ${bootargs} wlan.mac=${wlmac} wlcore.mac=${wlmac} +fi + +if itest.s "x" != "x${bd_addr}" ; then + setenv bootargs ${bootargs} bd_addr=${bd_addr} +fi + +if itest.s "x" != "x${gpumem}" ; then + setenv bootargs ${bootargs} galcore.contiguousSize=${gpumem} +fi + +if itest.s "x" != "x${cma}" ; then + setenv bootargs ${bootargs} cma=${cma} +fi + +if itest.s "x" != "x${loglevel}" ; then + setenv bootargs ${bootargs} loglevel=${loglevel} +fi + +if itest *${a_reset_cause_marker} == 12345678 ; then + setexpr.l reset_cause *${a_reset_cause} + setenv bootargs $bootargs reset_cause=0x${reset_cause} +fi +setenv bootargs ${bootargs} snd.slots=,snd-soc-imx-hdmi + +if itest.s "x" != "x${show_fdt}" ; then + fdt print / +fi + +if itest.s "x" != "x${show_env}" ; then + printenv +fi + +if load ${devtype} ${devnum}:${distro_bootpart} ${a_zImage} ${prefix}zImage ; then + bootz ${a_zImage} - ${a_fdt} +fi +echo "Error loading kernel image" diff --git a/board/boundary/bootscripts/net_upgrade_fs.txt b/board/boundary/bootscripts/net_upgrade_fs.txt new file mode 100644 index 0000000000000000000000000000000000000000..59a74b99f6b00b5519a8fe38727f501863810534 --- /dev/null +++ b/board/boundary/bootscripts/net_upgrade_fs.txt @@ -0,0 +1,73 @@ +# remove from environment so they won't override local values +setenv upgraded_fs +setenv a_base +setenv imagefile + +upgraded_fs=0 +a_base=0x10200000 + +if itest.s x51 == "x${imx_cpu}"; then + a_base=0x90200000 +elif itest.s x53 == "x${imx_cpu}"; then + a_base=0x70200000 +elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_base=0x80200000 +fi + +if itest.s x != "x${upgrade_file}" ; then + imagefile=${upgrade_file} +else + imagefile=trusty.img.gz +fi + +echo "Trying to load ${imagefile} (about 5...10 minutes)" +if itest.s x == "x${upgrade_device}" ; then + upgrade_device="mmc 1" +fi + +setexpr i 0; +setexpr offset 0; +while test ${i} -le 99 +do + if tftp ${a_base} ${imagefile}.${i} ; then + echo "Extracting file ${imagefile}.${i} to ${upgrade_device}" + setexpr end ${a_base} + ${filesize} + setexpr end ${end} - 1 + setexpr.b sz3 *${end} * 0x1000000 + setexpr end ${end} - 1 + setexpr.b sz2 *${end} * 0x10000 + setexpr end ${end} - 1 + setexpr.b sz1 *${end} * 0x100 + setexpr end ${end} - 1 + setexpr.b sz0 *${end} + setexpr sz ${sz3} + ${sz2} + setexpr sz ${sz} + ${sz1} + setexpr sz ${sz} + ${sz0} + if gzwrite ${upgrade_device} ${a_base} 0x${filesize} 0x100000 0x${offset} 0x${sz}; then + echo "Successfully wrote segment ${i} of ${sz} bytes" + setexpr i ${i} + 1; + setexpr rem ${i} % 0x10; + if test ${rem} -eq 0x0a ; then + #this is to show a decimal number when really hex is output + setexpr i ${i} + 6; + fi; + setexpr offset ${offset} + ${sz} + else + echo "Error writing segment ${i} of ${sz} bytes" + setexpr i ${i} + 1000; + fi + else + if test ${i} -eq 0 ; then + echo "image file not found or its too big to fit in the memory"; + echo "expected file name : ${imagefile}.${i}"; + echo "exiting..." + setexpr i ${i} + 1000; + else + upgraded_fs=1 + echo "---- ${upgrade_device} upgraded" + echo ; echo + sleep 2 + setexpr i ${i} + 1000; + fi + fi +done diff --git a/board/boundary/bootscripts/net_upgradeu.txt b/board/boundary/bootscripts/net_upgradeu.txt new file mode 100644 index 0000000000000000000000000000000000000000..9d81a6324ab6220aab6137d3bd8260f3c1ba1b07 --- /dev/null +++ b/board/boundary/bootscripts/net_upgradeu.txt @@ -0,0 +1,168 @@ +if itest.s a${uboot_defconfig} == a; then + echo "Please set uboot_defconfig to the appropriate value" + exit +fi + +# remove from environment so they won't override local values +setenv offset +setenv erase_size +setenv qspi_offset +setenv a_base +setenv qspi_match +setenv n + +offset=0x400 +erase_size=0xC0000 +qspi_offset=0x0 +a_base=0x10100000 + +if itest.s x51 == "x${imx_cpu}"; then + a_base=0x90100000 +elif itest.s x53 == "x${imx_cpu}"; then + a_base=0x70100000 +elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_base=0x80100000 +fi + +qspi_match=1 +setexpr a_qspi1 ${a_base} +setexpr a_qspi2 ${a_qspi1} + 0x400000 +setexpr a_uImage1 ${a_qspi1} + 0x400 +setexpr a_uImage2 ${a_qspi2} + 0x400 +setexpr a_script ${a_base} + +setenv stdout serial,vga + +if sf probe || sf probe || sf probe 1 27000000 || sf probe 1 27000000 ; then + echo "probed SPI ROM" ; +else + echo "Error initializing EEPROM" + exit +fi + +if itest.s "x${sfname}" == "xat45db041d" ; then + erase_size=0x7e000 +fi + +if itest.s x7D == "x${imx_cpu}"; then + echo "check qspi parameter block" ; + if tftp ${a_qspi1} qspi-${sfname}.${uboot_defconfig} ; then + else + echo "parameter file qspi-${sfname}.${uboot_defconfig} not found on TFTP server" + exit + fi + if itest ${filesize} != 0x200 ; then + echo "------- qspi-${sfname}.${uboot_defconfig} 0x${filesize} != 0x200 bytes" ; + exit + fi + setexpr a_marker ${a_qspi1} + 0x1fc + if itest *${a_marker} != c0ffee01 ; then + echo "------- qspi-${sfname}.${uboot_defconfig} c0ffee01 marker missing" ; + exit + fi + if sf read ${a_qspi2} ${qspi_offset} 0x200 ; then + else + echo "Error reading qspi parameter from EEPROM" + exit + fi + if cmp.b ${a_qspi1} ${a_qspi2} 0x200 ; then + echo "------- qspi parameters match" + else + echo "------- qspi parameters mismatch" + qspi_match=0 + fi +fi + +echo "check U-Boot" ; + +if tftp ${a_uImage1} u-boot.${uboot_defconfig} ; then +else + echo "File u-boot.${uboot_defconfig} not found on TFTP server" ; + exit +fi +echo "read ${filesize} bytes" ; +if sf read ${a_uImage2} ${offset} ${filesize} ; then +else + echo "Error reading boot loader from EEPROM" ; + exit +fi + +if cmp.b ${a_uImage1} ${a_uImage2} ${filesize} ; then + echo "------- U-Boot versions match" ; + if itest.s "${qspi_match}" == "1" ; then + echo "------- u-boot upgrade not needed" ; + if itest.s x != "x${net_upgrade_fs}" ; then + if tftp ${a_base} ${net_upgrade_fs} ; then + echo "------- running ${net_upgrade_fs}" ; + source ${a_base} + else + echo "------- ${net_upgrade_fs} not found on TFTP server" ; + fi + fi + exit + fi + erase_size=0x1000 + if itest.s xMX25L6405D == "x${sfname}"; then + erase_size=0x10000 + fi + setexpr filesize ${erase_size} - ${offset} +fi + +echo "Need U-Boot upgrade" ; +echo "Program in 5 seconds" ; +for n in 5 4 3 2 1 ; do + echo ${n} ; + sleep 1 ; +done +echo "erasing" ; +sf erase 0 ${erase_size} ; + +# two steps to prevent bricking +echo "programming" ; +setexpr a1 ${a_uImage1} + 0x400 +setexpr o1 ${offset} + 0x400 +setexpr s1 ${filesize} - 0x400 +sf write ${a1} ${o1} ${s1} ; +sf write ${a_uImage1} ${offset} 0x400 ; + +if itest.s x7D == "x${imx_cpu}"; then + sf write ${a_qspi1} ${qspi_offset} 0x200 +fi + +echo "verifying" ; +if sf read ${a_uImage2} ${offset} ${filesize} ; then +else + echo "Error re-reading EEPROM" ; + exit +fi +if cmp.b ${a_uImage1} ${a_uImage2} ${filesize} ; then +else + echo "Read verification error" ; + exit +fi + +if itest.s x7D == "x${imx_cpu}"; then + if sf read ${a_qspi2} ${qspi_offset} 0x200 ; then + else + echo "Error re-reading qspi" ; + exit + fi + if cmp.b ${a_qspi1} ${a_qspi2} 0x200 ; then + else + echo "qspi parameter block verification error" ; + exit + fi +fi + +if itest.s "x" != "x${next}" ; then + if tftp ${a_script} ${next} ; then + source ${a_script} + else + echo "${next} not found" + fi +fi + +echo "---- U-Boot upgraded. resetting" +sleep 2 +reset + diff --git a/board/boundary/bootscripts/net_upgradeu_fs.txt b/board/boundary/bootscripts/net_upgradeu_fs.txt new file mode 100644 index 0000000000000000000000000000000000000000..57bbc4297d7cc7569728975d6adf23379e154fc9 --- /dev/null +++ b/board/boundary/bootscripts/net_upgradeu_fs.txt @@ -0,0 +1,35 @@ +# if upgrade_device is set in environment, it will override the value here +# if net_upgrade_fs is set in environment, it will override the value here +# +# remove from environment so they won't override local values +setenv a_script + +a_script=0x1000c000 +if itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_script=0x8000c000 +fi +# uncomment below to force upgrade to eMMC, +# regardless of where script was sourced. +# devtype=mmc +# devnum=1 +if itest.s "x${devtype}" == "x" ; then + # loading from network, default to eMMC + # may have to start script twice if loading from network + devtype=mmc + devnum=1 +fi +run clearenv + +upgrade_device="${devtype} ${devnum}" +net_upgrade_fs=net_upgrade_fs.scr; +dhcp ${a_script} ${net_upgrade_fs} && source ${a_script} +if itest.s "x${upgraded_fs}" == "x1" ; then + # file system has changed, load new bootscript + # and execute + ${devtype} dev ${devnum} + load ${devtype} ${devnum}:${distro_bootpart} ${a_script} /boot.scr && + source ${a_script} +fi +while echo "---- FS upgrade FAILED!!!" ; do + sleep 120 +done diff --git a/board/boundary/bootscripts/prog_fuses.txt b/board/boundary/bootscripts/prog_fuses.txt new file mode 100644 index 0000000000000000000000000000000000000000..9f9981f0e9bf60005e733e3467a8a78f4f15060c --- /dev/null +++ b/board/boundary/bootscripts/prog_fuses.txt @@ -0,0 +1,27 @@ +for f in fuse1 fuse2 fuse_mac1b fuse_mac1a ; do + setenv t "fuse=0x\${${f}}; fuse_val=0x\${${f}_val}" + run t + + if itest.s "0x" != "${fuse}" ; then + if itest.s "0x" == "${fuse_val}" ; then + echo ${f}_val is not set + exit + fi + fuse read ${fuse} + if itest.s "0x" == "0x${fuse_read_val0}" ; then + echo "uboot version too old" + exit + fi + if itest.s "0x${fuse_read_val0}" == "${fuse_val}" ; then + echo "fuse ${fuse} verified" + else + if itest.s "${fuse_read_val0}" == "00000000" ; then + fuse prog -y ${fuse} ${fuse_val} + echo fuse prog ${fuse} ${fuse_val} + else + echo "fuse ${fuse} already set to 0x${fuse_read_val0}, aborting write of ${fuse_val}" + exit + fi + fi + fi +done diff --git a/board/boundary/bootscripts/upgrade.txt b/board/boundary/bootscripts/upgrade.txt new file mode 100644 index 0000000000000000000000000000000000000000..766ad467db1137820495d671eae9e3e501a2070b --- /dev/null +++ b/board/boundary/bootscripts/upgrade.txt @@ -0,0 +1,158 @@ +if itest.s a$uboot_defconfig == a; then + echo "Please set uboot_defconfig to the appropriate value" + exit +fi + +offset=0x400 +erase_size=0xC0000 +qspi_offset=0x0 +a_base=0x12000000 + +if itest.s x51 == "x${imx_cpu}"; then + a_base=0x92000000 +elif itest.s x53 == "x${imx_cpu}"; then + a_base=0x72000000 +elif itest.s x6SX == "x${imx_cpu}" || itest.s x7D == "x${imx_cpu}"; then + a_base=0x82000000 +fi + +qspi_match=1 +setexpr a_qspi1 ${a_base} +setexpr a_qspi2 ${a_qspi1} + 0x400000 +setexpr a_uImage1 ${a_qspi1} + 0x400 +setexpr a_uImage2 ${a_qspi2} + 0x400 +setexpr a_script ${a_base} + +setenv stdout serial,vga + +if sf probe || sf probe || sf probe 1 27000000 || sf probe 1 27000000 ; then + echo "probed SPI ROM" ; +else + echo "Error initializing EEPROM" + exit +fi + +if itest.s "x${sfname}" == "xat45db041d" ; then + erase_size=0x7e000 +fi + +if itest.s x7D == "x${imx_cpu}"; then + echo "check qspi parameter block" ; + if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_qspi1} qspi-${sfname}.${uboot_defconfig} ; then + else + echo "parameter file qspi-${sfname}.${uboot_defconfig} not found on SD card" + exit + fi + if itest ${filesize} != 0x200 ; then + echo "------- qspi-${sfname}.${uboot_defconfig} 0x${filesize} != 0x200 bytes" ; + exit + fi + setexpr a_marker ${a_qspi1} + 0x1fc + if itest *${a_marker} != c0ffee01 ; then + echo "------- qspi-${sfname}.${uboot_defconfig} c0ffee01 marker missing" ; + exit + fi + if sf read ${a_qspi2} ${qspi_offset} 0x200 ; then + else + echo "Error reading qspi parameter from EEPROM" + exit + fi + if cmp.b ${a_qspi1} ${a_qspi2} 0x200 ; then + echo "------- qspi parameters match" + else + echo "------- qspi parameters mismatch" + qspi_match=0 + fi +fi + +echo "check U-Boot" ; + +if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_uImage1} u-boot.$uboot_defconfig ; then +else + echo "File u-boot.$uboot_defconfig not found on SD card" ; + exit +fi +echo "read $filesize bytes from SD card" ; +if sf read ${a_uImage2} $offset $filesize ; then +else + echo "Error reading boot loader from EEPROM" ; + exit +fi + +if cmp.b ${a_uImage1} ${a_uImage2} $filesize ; then + echo "------- U-Boot versions match" ; + if itest.s "${qspi_match}" == "1" ; then + echo "------- upgrade not needed" ; + if itest.s "x" != "x${next}" ; then + if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_script} ${next} ; then + source ${a_script} + else + echo "${next} not found on SD card" + fi + fi + exit + fi + erase_size=0x1000 + if itest.s xMX25L6405D == "x${sfname}"; then + erase_size=0x10000 + fi + setexpr filesize ${erase_size} - ${offset} +fi + +echo "Need U-Boot upgrade" ; +echo "Program in 5 seconds" ; +for n in 5 4 3 2 1 ; do + echo $n ; + sleep 1 ; +done +echo "erasing" ; +sf erase 0 ${erase_size} ; + +# two steps to prevent bricking +echo "programming" ; +setexpr a1 ${a_uImage1} + 0x400 +setexpr o1 ${offset} + 0x400 +setexpr s1 ${filesize} - 0x400 +sf write ${a1} ${o1} ${s1} ; +sf write ${a_uImage1} $offset 0x400 ; + +if itest.s x7D == "x${imx_cpu}"; then + sf write ${a_qspi1} ${qspi_offset} 0x200 +fi + +echo "verifying" ; +if sf read ${a_uImage2} $offset $filesize ; then +else + echo "Error re-reading EEPROM" ; + exit +fi +if cmp.b ${a_uImage1} ${a_uImage2} $filesize ; then +else + echo "Read verification error" ; + exit +fi + +if itest.s x7D == "x${imx_cpu}"; then + if sf read ${a_qspi2} ${qspi_offset} 0x200 ; then + else + echo "Error re-reading qspi" ; + exit + fi + if cmp.b ${a_qspi1} ${a_qspi2} 0x200 ; then + else + echo "qspi parameter block verification error" ; + exit + fi +fi + +if itest.s "x" != "x${next}" ; then + if ${fs}load ${devtype} ${devnum}:${distro_bootpart} ${a_script} ${next} ; then + source ${a_script} + else + echo "${next} not found on ${devtype} ${devnum}:${distro_bootpart}" + fi +fi + +while echo "---- U-Boot upgraded. reset" ; do + sleep 120 +done