diff --git a/iopsys-brcm63xx-arm/image/bundled-migrator-script/script.sh b/iopsys-brcm63xx-arm/image/bundled-migrator-script/script.sh index 65cf4694ce2f94d6d38b49613f24da7f3e2a497e..38d30afbe7de91eccc761e732201cecec1aa2443 100755 --- a/iopsys-brcm63xx-arm/image/bundled-migrator-script/script.sh +++ b/iopsys-brcm63xx-arm/image/bundled-migrator-script/script.sh @@ -19,8 +19,6 @@ extract_section() { echo $section_sz } -# Erase all iop5 volumes except for the current -# rootfs volume and the data volume erase_iop5_volumes() { local next=$(get_flashbank_next) @@ -37,26 +35,23 @@ erase_iop5_volumes() { upgrade_ubi_volume() { local volume="$1" local size="$2" - local count="$3" - local ubivol - - for i in `seq $count`; do - # Create a fresh UBI volume - echo "Creating ${volume}$i" - ubimkvol "/dev/ubi0" -N "${volume}$i" -t static -s $size - ubivol=$(nand_find_volume ubi0 ${volume}$i) - - # Write volume data to flash. - ubiupdatevol "/dev/$ubivol" --size=$size /tmp/$volume - fsync "/dev/$ubivol" - done + local name="$3" + local id="$4" + + # Create a fresh UBI volume + echo "Creating $name" + ubimkvol /dev/ubi0 -N $name -n $id -t static -s $size + + # Write volume data to flash. + ubiupdatevol /dev/ubi0_$id --size=$size /tmp/$volume + fsync /dev/ubi0_$id } local img="$1" size echo "Running iop5 to iop6 migration script" -# Write loader to nvram mtd partition +# Write loader to nvram mtd partition. # 0x000000000000-0x000000400000 : "nvram" echo "Writing loader to flash" size=$(extract_section $img loader) @@ -66,28 +61,35 @@ else return 1 fi +# Erase all iop5 volumes except for the current +# rootfs volume and the data volume. erase_iop5_volumes +# Volume id:s are important for metadata and +# boofs as they need to be loaded from the TPL. +# Hence, create all volumes now so that they are +# not occupied later. echo "Extracting metadata" size=$(extract_section $img metadata) -upgrade_ubi_volume metadata $size 2 +upgrade_ubi_volume metadata $size metatada1 1 +upgrade_ubi_volume metadata $size metadata2 2 echo "Extracting bootfs" size=$(extract_section $img bootfs) -upgrade_ubi_volume bootfs $size 1 +upgrade_ubi_volume bootfs $size bootfs1 3 +upgrade_ubi_volume bootfs $size bootfs2 5 echo "Extracting rootfs" size=$(extract_section $img rootfs) -upgrade_ubi_volume rootfs $size 1 +upgrade_ubi_volume rootfs $size rootfs1 4 -# We need to save volume id 5 for bootfs2 -# Hence, create the overlay with a higher id -# or it will be created automatically with id 5 +# Create the overlay. Save id 6 for rootfs2. echo "Creating overlay partition" ubimkvol "/dev/ubi0" -n 10 -N overlay1 -t dynamic -s 38092800 echo "Upgrade completed; rebooting." #reboot -return 1 || exit 1 # Halt execution of sysupgrade, both when sourced and execuded as a task. +# Halt execution of sysupgrade, both when sourced and execuded as a task. +return 1 || exit 1