diff options
Diffstat (limited to 'meta-fsl-extras/recipes/u-boot/u-boot-script-toradex/mx6/flash_blk.scr')
-rw-r--r-- | meta-fsl-extras/recipes/u-boot/u-boot-script-toradex/mx6/flash_blk.scr | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/meta-fsl-extras/recipes/u-boot/u-boot-script-toradex/mx6/flash_blk.scr b/meta-fsl-extras/recipes/u-boot/u-boot-script-toradex/mx6/flash_blk.scr new file mode 100644 index 0000000..ec3e00b --- /dev/null +++ b/meta-fsl-extras/recipes/u-boot/u-boot-script-toradex/mx6/flash_blk.scr | |||
@@ -0,0 +1,50 @@ | |||
1 | test -n ${interface} || setenv interface mmc | ||
2 | test -n ${drive} || setenv drive 1 | ||
3 | setenv uboot_hwpart 1 | ||
4 | |||
5 | setenv set_blkcnt 'setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200' | ||
6 | #workaround U-Boot counting in hex and split did in decimal | ||
7 | setenv incr_decimal 'setexpr filenum ${filenum} + 1; setexpr filenrlow1 ${filenum} % 0x100; setexpr filenrlow2 ${filenrlow1} % 0x10; test ${filenrlow1} -eq "9a" && test ${filenrlow2} -ne "9" && setexpr filenum ${filenum} + 0x66; test ${filenrlow1} -ne "9a" && test ${filenrlow2} -eq "a" && setexpr filenum ${filenum} + 0x6; true' | ||
8 | setenv set_nextnum 'run incr_decimal; setexpr blkstart ${blkstart} + ${blkcnt}' | ||
9 | |||
10 | setenv check_1 'setenv conf_blk_offset 0x1fff; mmc read ${loadaddr} ${conf_blk_offset} 1' | ||
11 | setenv check_2 'setenv conf_blk_offset 0xfff; mmc read ${loadaddr} ${conf_blk_offset} 1' | ||
12 | setenv check_3 'setenv conf_blk_offset 0x7ff; mmc read ${loadaddr} ${conf_blk_offset} 1' | ||
13 | setenv check_configblock 'setexpr toradex_oui_addr ${loadaddr} + 8; mw.l ${kernel_addr_r} 0x002d1400; mmc dev 0 1; run check_1 || run check_2 || run check_3; cmp.b ${kernel_addr_r} ${toradex_oui_addr} 3' | ||
14 | |||
15 | setenv migrate_configblock 'run check_configblock; mmc dev 0 0 && mmc read ${loadaddr} 0x500 1 && cmp.b ${kernel_addr_r} ${toradex_oui_addr} 3 && mmc dev 0 1 && mmc write ${loadaddr} ${conf_blk_offset} 1' | ||
16 | |||
17 | setenv migrate_uboot_old 'setenv uboot_hwpart 0; run update_spl && run update_uboot_bin; setenv uboot_hwpart 1' | ||
18 | setenv migrate_uboot 'run update_spl && run update_uboot_bin && mmc bootbus 0 2 1 2 && mmc partconf 0 1 1 0' | ||
19 | |||
20 | setenv cp_file_chunk 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/root.ext3-${filenum} ${filesize} ${filepos}; run set_blkcnt; mmc dev 0 0 && mmc write ${loadaddr} ${blkstart} ${blkcnt}' | ||
21 | |||
22 | setenv update_spl 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/SPL && run set_blkcnt && mmc dev 0 ${uboot_hwpart} && mmc write ${loadaddr} 2 ${blkcnt}' | ||
23 | setenv update_uboot_bin 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/u-boot.imx-spl && run set_blkcnt && mmc dev 0 ${uboot_hwpart} && mmc write ${loadaddr} 8a ${blkcnt}' | ||
24 | setenv update_uboot 'run update_uboot_bin && updt_fuse && mmc bootbus 0 2 0 1 && mmc partconf 0 1 1 0 && mmc rst-function 0 1' | ||
25 | |||
26 | setenv update_kernel 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/uImage && fatwrite mmc 0:1 ${loadaddr} uImage ${filesize}' | ||
27 | |||
28 | setenv update_fdt 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/${fdt_file} && fatwrite mmc 0:1 ${loadaddr} ${fdt_file} ${filesize}' | ||
29 | |||
30 | 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' | ||
31 | |||
32 | setenv update_1 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/mbr.bin && mmc dev 0 0 && mmc write ${loadaddr} 0x0 0x1' | ||
33 | setenv update_2 'load ${interface} ${drive}:1 ${loadaddr} ${board_name}/boot.vfat && run set_blkcnt && mmc dev 0 0 && mmc write ${loadaddr} 0x2000 ${blkcnt}' | ||
34 | #do it in chunks of 64M to fit into DDR RAM of the smallest module | ||
35 | setenv update_3 'setenv filesize 4000000; setenv filenum 100; setenv blkstart a000; while test ${filesize} -eq "4000000"; do run cp_file_chunk; run set_nextnum; done; true' | ||
36 | |||
37 | setenv echo_migrate echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate\" to complete update" | ||
38 | setenv migrate 'run migrate_configblock; run update_latest; reset' | ||
39 | setenv update_v2.4b1 'run check_configblock || run migrate_configblock; run migrate_uboot_old && run echo_migrate' | ||
40 | setenv update_v2.5b3 'run check_configblock || run migrate_configblock; run migrate_uboot && run echo_migrate' | ||
41 | |||
42 | # Not migrated to SPL if no U-Boot Image Magic Number at 69k into the eMMC | ||
43 | setenv update_to_spl 'mmc dev 0 1; mmc read $loadaddr 8a 1; itest.l *12000000 -ne 56190527 && run update_spl' | ||
44 | setenv update_latest 'run update_to_spl; run update_uboot; run update_1; run update_2; run update_kernel; run update_fdt; run update_3' | ||
45 | # 'updt_fuse' not available in V2.5 Beta 3 and earlier, migration needed | ||
46 | setenv update_new 'updt_fuse -n && run update_latest && reset; run update_v2.5b3' | ||
47 | # 'mmc bootbus' not available in in V2.4 Beta 1 and earlier, migration needed | ||
48 | setenv update 'mmc bootbus 0 2 0 1 && run update_new && exit; run update_v2.4b1' | ||
49 | |||
50 | echo 'enter "run update" to update the entire module' | ||