From 13df57c1fc5c30e3f3776269cf90a8db7a856bf5 Mon Sep 17 00:00:00 2001 From: Hector Palacios Date: Thu, 26 Aug 2021 14:16:53 +0200 Subject: [PATCH] ccimx6ul: add support for ubisysvols on SD/USB install scripts The script preserves the current value of env variable 'ubisysvols' so that the new partition script generates the appropriate partition table before proceeding with the update operations. If using a UBI volumes layout, the script will not erase the partitions. Signed-off-by: Hector Palacios https://onedigi.atlassian.net/browse/DEL-7614 --- .../ccimx6ul/install_linux_fw_sd.txt | 23 +++++++++++++++---- .../ccimx6ul/install_linux_fw_usb.txt | 23 +++++++++++++++---- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt index 68c043aa7..ac0398c4c 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_sd.txt @@ -121,6 +121,8 @@ fi # Set 'bootcmd' to the second part of the script that will # - Reset environment to defaults +# - Restore 'ubisysvols' if previously set +# - Run 'partition_nand_linux' script to re-partition the NAND if needed # - Save the environment # - Update the 'linux' partition # - Update the 'recovery' partition @@ -130,13 +132,20 @@ fi # - Run 'recovery' and let the system boot after setenv bootcmd " env default -a; + setenv ubisysvols ${ubisysvols}; + run partition_nand_linux; saveenv; + if test -n \$\{ubisysvols\} && test \$\{ubisysvols\} = yes; then + run ubivolscript; + fi; echo \"\"; echo \"\"; echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\"; echo \"\"; echo \"\"; - nand erase.part linux; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part linux; + fi; update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update linux partition!\"; @@ -149,7 +158,9 @@ setenv bootcmd " echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\"; echo \"\"; echo \"\"; - nand erase.part recovery; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part recovery; + fi; update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update recovery partition!\"; @@ -162,7 +173,9 @@ setenv bootcmd " echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\"; echo \"\"; echo \"\"; - nand erase.part rootfs; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part rootfs; + fi; update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update rootfs partition!\"; @@ -171,7 +184,9 @@ setenv bootcmd " exit; fi; echo \"\"; - nand erase.part update; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part update; + fi; setenv boot_recovery yes; setenv recovery_command wipe_update; saveenv; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt index b3b30ea60..da5cda0b8 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ul/install_linux_fw_usb.txt @@ -121,6 +121,8 @@ fi # Set 'bootcmd' to the second part of the script that will # - Reset environment to defaults +# - Restore 'ubisysvols' if previously set +# - Run 'partition_nand_linux' script to re-partition the NAND if needed # - Save the environment # - Update the 'linux' partition # - Update the 'recovery' partition @@ -130,14 +132,21 @@ fi # - Run 'recovery' and let the system boot after setenv bootcmd " env default -a; + setenv ubisysvols ${ubisysvols}; + run partition_nand_linux; saveenv; + if test -n \$\{ubisysvols\} && test \$\{ubisysvols\} = yes; then + run ubivolscript; + fi; usb start; echo \"\"; echo \"\"; echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\"; echo \"\"; echo \"\"; - nand erase.part linux; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part linux; + fi; update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update linux partition!\"; @@ -150,7 +159,9 @@ setenv bootcmd " echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\"; echo \"\"; echo \"\"; - nand erase.part recovery; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part recovery; + fi; update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update recovery partition!\"; @@ -163,7 +174,9 @@ setenv bootcmd " echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\"; echo \"\"; echo \"\"; - nand erase.part rootfs; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part rootfs; + fi; update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME}; if test \$? -eq 1; then echo \"[ERROR] Failed to update rootfs partition!\"; @@ -172,7 +185,9 @@ setenv bootcmd " exit; fi; echo \"\"; - nand erase.part update; + if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then + nand erase.part update; + fi; setenv boot_recovery yes; setenv recovery_command wipe_update; saveenv;