summaryrefslogtreecommitdiff
path: root/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_blk.scr
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_blk.scr')
-rw-r--r--recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_blk.scr42
1 files changed, 32 insertions, 10 deletions
diff --git a/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_blk.scr b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_blk.scr
index 529321d..2f1f346 100644
--- a/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_blk.scr
+++ b/recipes/images/files/apalis-imx6/apalis-imx6_bin/flash_blk.scr
@@ -4,16 +4,38 @@ test -n ${drive} || setenv drive 1
setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200'
setenv set_nextpos 'setexpr filepos ${filepos} + ${filesize}; setexpr blkstart ${blkstart} + ${blkcnt}'
-setenv cp_file_chunk 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/root.ext3 ${filesize} ${filepos}; run set_blkcnt; mmc dev 0 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
-setenv update_uboot 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/u-boot.imx && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 2 ${blkcnt}'
-setenv update_uboot_it 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/u-boot-it.imx && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 2 ${blkcnt}'
-setenv update_kernel 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
-setenv update_fdt 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
-setenv update_configblock 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/configblock.bin && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 0x500 ${blkcnt}'
-setenv update 'run update_1; run update_uboot; run update_2; run update_3; reset'
-setenv update_it 'run update_1; run update_uboot_it; run update_2; run update_3; reset'
-setenv update_1 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
-setenv update_2 'fatload ${interface} ${drive}:1 ${loadaddr} ${board_name}/boot.vfat && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
+setenv check_1 'setenv conf_blk_offset 0x1fff; mmc read ${loadaddr} ${conf_blk_offset} 1'
+setenv check_2 'setenv conf_blk_offset 0xfff; mmc read ${loadaddr} ${conf_blk_offset} 1'
+setenv check_3 'setenv conf_blk_offset 0x7ff; mmc read ${loadaddr} ${conf_blk_offset} 1'
+setenv check_configblock 'setexpr toradex_oui_addr ${loadaddr} + 8; mmc dev 0 1; run check_1 || run check_2 || run check_3; crc32 -v ${toradex_oui_addr} 3 94305232'
+
+setenv migrate_configblock 'setexpr toradex_oui_addr ${loadaddr} + 8; mmc dev 0 1; run check_1 || run check_2 || run check_3; mmc dev 0 0 && mmc read ${loadaddr} 0x500 1 && crc32 -v ${toradex_oui_addr} 3 94305232 && mmc dev 0 1 && mmc write ${loadaddr} ${conf_blk_offset} 1'
+
+setenv migrate_uboot 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/u-boot${module_type}.imx && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 2 ${blkcnt}'
+
+setenv cp_file_chunk 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/root.ext3 ${filesize} ${filepos}; run set_blkcnt; mmc dev 0 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}'
+
+setenv update_uboot 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/u-boot${module_type}.imx && run set_blkcnt && mmc dev 0 1 && mmc write ${loadaddr} 2 ${blkcnt} && mmc bootbus 0 2 1 2 && mmc partconf 0 1 1 0'
+
+setenv update_kernel 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}'
+
+setenv update_fdt 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}'
+
+setenv update_configblock 'run check_configblock; load ${interface} ${drive}:1 ${loadaddr} ${board_name}/configblock.bin && mmc dev 0 1 && mmc write ${loadaddr} ${conf_blk_offset} 1'
+
+setenv update_1 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1'
+setenv update_2 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/boot.vfat && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}'
#do it in chunks of 64M to fit into DDR RAM of the smallest module
setenv update_3 'setenv filesize 4000000; setenv filepos 0; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextpos; done'
+
+setenv echo_v2.4b1 echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.4b1\" to complete update"
+setenv echo_v2.4b1-it echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.4b1_it\" to complete update"
+setenv migrate_v2.4b1 'run migrate_configblock; run update_new'
+setenv migrate_v2.4b1_it 'setenv module_type -it; run migrate_v2.4b1'
+setenv update_v2.4b1 'run migrate_uboot && run echo_v2.4b1${module_type}'
+
+setenv update_new 'run check_configblock || run migrate_configblock; run update_uboot; run update_1; run update_2; run update_kernel; run update_fdt; run update_3; reset'
+setenv update 'mmc bootbus 0 2 1 2 && run update_new; run update_v2.4b1'
+setenv update_it 'setenv module_type -it; run update'
+
echo 'enter "run update" or "run update_it" to update the entire module'