diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2015-04-17 18:03:12 +0200 |
---|---|---|
committer | Max Krummenacher <max.krummenacher@toradex.com> | 2015-05-12 10:04:36 +0200 |
commit | d8f07f260236fdb74e3dd9b33ec16fae99b5b608 (patch) | |
tree | f11c86ccc638e1a8fd0aef4f7a2c0392dfca5135 /recipes | |
parent | 3239b796312d02ea683d0a24a85cc2a0f7222d8d (diff) |
trdx-image-fstype: implement migration to V2.4
The migration to BSP V2.4 is somewhat more complex due to ECC level
change. The scripts detect whether we are on a new or old module by
checking the NAND driver type (which probably reflects best which
ECC level has been used). In case the NAND driver has the old name
(fsl_nfc), then the script assumes that migration is required:
The migration script runs in two stages:
- The first part updates U-Boot, erases the root file system and
loads the config block into memory (upgrade_part1).
- After reboot, the second stage runs with the new U-Boot version.
The script update the boot configuration block (BCB), restores the
config block from memory and U-Boot is written again using the
new ECC level. Then, the script erases the UBI partition (which
contains the root filesystem) and recreates it using the new ECC
level too (upgrade_part2).
Since we keep the config block temporarly in RAM, the whole update
process should not be interrupted! In case it did, the new U-Boot
version is able to restore the configuration block from command
line.
In contrast to older update scripts, the standard upgrade procedure
does not erase the whole UBI partition anymore. This makes sure that
wear-leveling information can be preserved.
Diffstat (limited to 'recipes')
-rw-r--r-- | recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.img | bin | 1257 -> 1531 bytes | |||
-rw-r--r-- | recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.scr | 19 | ||||
-rw-r--r-- | recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img | bin | 1282 -> 1483 bytes | |||
-rw-r--r-- | recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr | 21 | ||||
-rw-r--r-- | recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img | bin | 163 -> 163 bytes |
5 files changed, 25 insertions, 15 deletions
diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.img b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.img Binary files differindex 488a844..8141bad 100644 --- a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.img +++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.img diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.scr b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.scr index 58d1282..b2a3bf6 100644 --- a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.scr +++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_blk.scr @@ -1,16 +1,21 @@ setenv create_bcb 'nand erase.part vf-bcb && writebcb 0x20000 0x20000' setenv update_configblock 'fatload ${interface} 0:1 ${loadaddr} configblock.bin && nand write ${loadaddr} 0x800 ${filesize}' +setenv prepare_rootfs 'ubi part ubi && ubi check rootfs || ubi create rootfs' setenv update_uboot 'fatload ${interface} 0:1 ${loadaddr} u-boot-nand.imx && nand erase.part u-boot && nand erase.part u-boot-env && nand write ${loadaddr} u-boot' -setenv update_rootfs 'fatload ${interface} 0:1 ${loadaddr} ubifs.img && nand erase.part ubi && ubi part ubi && ubi createvol rootfs && ubi write ${loadaddr} rootfs ${filesize}' +setenv update_rootfs 'fatload ${interface} 0:1 ${loadaddr} ubifs.img && run prepare_rootfs && ubi write ${loadaddr} rootfs ${filesize}' -setenv echo_v2.1b3 echo "successfully updated U-Boot, power-cycle and enter \"run setupdate\; run migrate_v2.1b3\" to complete update" -setenv migrate_v2.1b3 'nand read ${loadaddr} 0x40000 0x800 && nand erase.chip && writebcb 0x20000 0x20000 && nand write ${loadaddr} 0x800 0x800 && run update_new' -setenv update_v2.1b3 'run update_uboot; run echo_v2.1b3' +setenv update_new 'run update_uboot; run update_rootfs; reset' -setenv mtdparts 'mtdparts=fsl_nfc:128k(vf-bcb)ro,1408k(u-boot)ro,512k(u-boot-env),-(ubi)' +# Upgrade part 1, write new U-Boot, but with old ECC format still... +# Store config block temporarly in memory at kernel_addr_r. +setenv upgrade_part1 'run update_uboot && nand read ${kernel_addr_r} 0x800 0x20 && echo "successfully updated U-Boot, enter \"reset\", interrupt boot process and enter \"run setupdate\; run upgrade_part2\" to complete upgrade"' -setenv update_new 'run update_uboot; run update_rootfs; reset' -setenv update 'if test -v $ver; then run update_new; else run update_v2.1b3; fi' +# Upgrade part 2, use new ECC format for the whole device... +setenv upgrade_part2 'run create_bcb && nand write ${kernel_addr_r} 0x800 0x20 && \ +run update_uboot && nand erase.part ubi && run update_rootfs' + +# fsl_nfc indicates old NAND format (24-bit ECC), start migration process +setenv update 'mtdparts default && if test "${mtdids}" = "nand0=fsl_nfc"; then; run upgrade_part1; else run update_new; fi' echo 'enter "run update" to update the entire module' diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img Binary files differindex 0f72b14..c5c141c 100644 --- a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img +++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.img diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr index bef0405..36da10b 100644 --- a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr +++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_eth.scr @@ -1,16 +1,21 @@ setenv create_bcb 'nand erase.part vf-bcb && writebcb 0x20000 0x20000' -setenv update_configblock 'mw.l ${loadaddr} 0xffffffff 0x200 && tftpboot ${loadaddr} configblock.bin && nand write ${loadaddr} 0x800 0x800' +setenv update_configblock 'tftpboot ${loadaddr} configblock.bin && nand write ${loadaddr} 0x800 ${filesize}' +setenv prepare_rootfs 'ubi part ubi && ubi check rootfs || ubi create rootfs' setenv update_uboot 'tftpboot ${loadaddr} u-boot-nand.imx && nand erase.part u-boot && nand erase.part u-boot-env && nand write ${loadaddr} u-boot' -setenv update_rootfs 'tftpboot ${loadaddr} ubifs.img && nand erase.part ubi && ubi part ubi && ubi createvol rootfs && ubi write ${loadaddr} rootfs ${filesize}' +setenv update_rootfs 'tftpboot ${loadaddr} ubifs.img && run prepare_rootfs && ubi write ${loadaddr} rootfs ${filesize}' -setenv echo_v2.1b3 echo "successfully updated U-Boot, power-cycle and enter \"tftpboot flash_eth.img ${loadaddr}\; source ${loadaddr}\; run migrate_v2.1b3\" to complete update" -setenv migrate_v2.1b3 'nand read ${loadaddr} 0x40000 0x800 && nand erase.chip && writebcb 0x20000 0x20000 && nand write ${loadaddr} 0x800 0x800 && run update_new' -setenv update_v2.1b3 'run update_uboot; run echo_v2.1b3' +setenv update_new 'run update_uboot; run update_rootfs; reset' -setenv mtdparts 'mtdparts=fsl_nfc:128k(vf-bcb)ro,1408k(u-boot)ro,512k(u-boot-env),-(ubi)' +# Upgrade part 1, write new U-Boot, but with old ECC format still... +# Store config block temporarly in memory at kernel_addr_r. +setenv upgrade_part1 'run update_uboot && nand read ${kernel_addr_r} 0x800 0x20 && echo "successfully updated U-Boot, enter \"reset\", interrupt boot process and enter \"run setupdate\; run upgrade_part2\" to complete upgrade"' -setenv update_new 'run update_uboot; run update_rootfs; reset' -setenv update 'if test -v $ver; then run update_new; else run update_v2.1b3; fi' +# Upgrade part 2, use new ECC format for the whole device... +setenv upgrade_part2 'run create_bcb && nand write ${kernel_addr_r} 0x800 0x20 && \ +run update_uboot && nand erase.part ubi && run update_rootfs' + +# fsl_nfc indicates old NAND format (24-bit ECC), start migration process +setenv update 'mtdparts default && if test "${mtdids}" = "nand0=fsl_nfc"; then; run upgrade_part1; else run update_new; fi' echo 'enter "run update" to update the entire module' diff --git a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img Binary files differindex 9c7ab9f..64a813b 100644 --- a/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img +++ b/recipes/images/files/colibri-vf/colibri-vf_bin/flash_mmc.img |