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 <hector.palacios@digi.com>

https://onedigi.atlassian.net/browse/DEL-7614
This commit is contained in:
Hector Palacios 2021-08-26 14:16:53 +02:00
parent e380377310
commit 13df57c1fc
2 changed files with 38 additions and 8 deletions

View File

@ -121,6 +121,8 @@ fi
# Set 'bootcmd' to the second part of the script that will # Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults # - Reset environment to defaults
# - Restore 'ubisysvols' if previously set
# - Run 'partition_nand_linux' script to re-partition the NAND if needed
# - Save the environment # - Save the environment
# - Update the 'linux' partition # - Update the 'linux' partition
# - Update the 'recovery' partition # - Update the 'recovery' partition
@ -130,13 +132,20 @@ fi
# - Run 'recovery' and let the system boot after # - Run 'recovery' and let the system boot after
setenv bootcmd " setenv bootcmd "
env default -a; env default -a;
setenv ubisysvols ${ubisysvols};
run partition_nand_linux;
saveenv; saveenv;
if test -n \$\{ubisysvols\} && test \$\{ubisysvols\} = yes; then
run ubivolscript;
fi;
echo \"\"; echo \"\";
echo \"\"; echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\"; echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\"; echo \"\";
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}; update linux mmc ${INSTALL_MMCDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\"; echo \"[ERROR] Failed to update linux partition!\";
@ -149,7 +158,9 @@ setenv bootcmd "
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\"; echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\"; echo \"\";
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}; update recovery mmc ${INSTALL_MMCDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\"; echo \"[ERROR] Failed to update recovery partition!\";
@ -162,7 +173,9 @@ setenv bootcmd "
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\"; echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\"; echo \"\";
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}; update rootfs mmc ${INSTALL_MMCDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\"; echo \"[ERROR] Failed to update rootfs partition!\";
@ -171,7 +184,9 @@ setenv bootcmd "
exit; exit;
fi; fi;
echo \"\"; echo \"\";
nand erase.part update; if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then
nand erase.part update;
fi;
setenv boot_recovery yes; setenv boot_recovery yes;
setenv recovery_command wipe_update; setenv recovery_command wipe_update;
saveenv; saveenv;

View File

@ -121,6 +121,8 @@ fi
# Set 'bootcmd' to the second part of the script that will # Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults # - Reset environment to defaults
# - Restore 'ubisysvols' if previously set
# - Run 'partition_nand_linux' script to re-partition the NAND if needed
# - Save the environment # - Save the environment
# - Update the 'linux' partition # - Update the 'linux' partition
# - Update the 'recovery' partition # - Update the 'recovery' partition
@ -130,14 +132,21 @@ fi
# - Run 'recovery' and let the system boot after # - Run 'recovery' and let the system boot after
setenv bootcmd " setenv bootcmd "
env default -a; env default -a;
setenv ubisysvols ${ubisysvols};
run partition_nand_linux;
saveenv; saveenv;
if test -n \$\{ubisysvols\} && test \$\{ubisysvols\} = yes; then
run ubivolscript;
fi;
usb start; usb start;
echo \"\"; echo \"\";
echo \"\"; echo \"\";
echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\"; echo \">> Installing linux image file ${INSTALL_LINUX_FILENAME}\";
echo \"\"; echo \"\";
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}; update linux usb ${INSTALL_USBDEV} ${INSTALL_LINUX_FILENAME};
if test \$? -eq 1; then if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\"; echo \"[ERROR] Failed to update linux partition!\";
@ -150,7 +159,9 @@ setenv bootcmd "
echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\"; echo \">> Installing recovery file ${INSTALL_RECOVERY_FILENAME}\";
echo \"\"; echo \"\";
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}; update recovery usb ${INSTALL_USBDEV} ${INSTALL_RECOVERY_FILENAME};
if test \$? -eq 1; then if test \$? -eq 1; then
echo \"[ERROR] Failed to update recovery partition!\"; echo \"[ERROR] Failed to update recovery partition!\";
@ -163,7 +174,9 @@ setenv bootcmd "
echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\"; echo \">> Installing root file system file ${INSTALL_ROOTFS_FILENAME}\";
echo \"\"; echo \"\";
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}; update rootfs usb ${INSTALL_USBDEV} ${INSTALL_ROOTFS_FILENAME};
if test \$? -eq 1; then if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\"; echo \"[ERROR] Failed to update rootfs partition!\";
@ -172,7 +185,9 @@ setenv bootcmd "
exit; exit;
fi; fi;
echo \"\"; echo \"\";
nand erase.part update; if test ! -n \$\{ubisysvols\} || test \$\{ubisysvols\} = no; then
nand erase.part update;
fi;
setenv boot_recovery yes; setenv boot_recovery yes;
setenv recovery_command wipe_update; setenv recovery_command wipe_update;
saveenv; saveenv;