From 4b4d4b5a6b63985714dfcd2e9ce90d3d0ef8b461 Mon Sep 17 00:00:00 2001 From: Mike Engel Date: Thu, 1 Feb 2024 16:27:39 +0100 Subject: [PATCH] u-boot-dey: add install uboot on redundant partition This commit adds instructions to update the redundant u-boot partition. https://onedigi.atlassian.net/browse/DEL-8848 Signed-off-by: Mike Engel --- .../ccimx93/install_linux_fw_sd.txt | 20 ++++++++++++++++++- .../ccimx93/install_linux_fw_usb.txt | 20 ++++++++++++++++++- .../ccimx93/install_linux_fw_uuu.sh | 13 ++++++++++-- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt index 31f7bd298..b973c36b6 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_sd.txt @@ -76,7 +76,10 @@ echo " on the partitions of the eMMC." echo "" echo " PARTITION FILENAME" echo " --------- --------" -echo " bootloader ${INSTALL_UBOOT_FILENAME}" +echo " bootloader1 ${INSTALL_UBOOT_FILENAME}" +if test "${install_redundant_bootloader}" = "yes"; then + echo " bootloader2 ${INSTALL_UBOOT_FILENAME}" +fi if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" if test "${install_dualboot}" = "yes"; then @@ -129,6 +132,21 @@ if test $? -eq 1; then fi fi +if test "${install_redundant_bootloader}" = yes; then + echo ""; + echo ""; + echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} on redundant partition"; + echo ""; + echo ""; + update uboot-redundant mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME}; + if test $? -eq 1; then + echo "[ERROR] Failed to update redundant U-Boot boot loader!"; + echo ""; + echo "Aborted."; + exit; + fi; +fi; + # Set 'bootcmd' to the second part of the script that will # - Reset environment to defaults # - Restore 'dualboot' if previously set diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt index d1a80f0d7..e20b94544 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_usb.txt @@ -76,7 +76,10 @@ echo " on the partitions of the eMMC." echo "" echo " PARTITION FILENAME" echo " --------- --------" -echo " bootloader ${INSTALL_UBOOT_FILENAME}" +echo " bootloader1 ${INSTALL_UBOOT_FILENAME}" +if test "${install_redundant_bootloader}" = "yes"; then + echo " bootloader2 ${INSTALL_UBOOT_FILENAME}" +fi if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" if test "${install_dualboot}" = "yes"; then @@ -129,6 +132,21 @@ if test $? -eq 1; then fi fi +if test "${install_redundant_bootloader}" = yes; then + echo ""; + echo ""; + echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} on redundant partition"; + echo ""; + echo ""; + update uboot-redundant usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME}; + if test $? -eq 1; then + echo "[ERROR] Failed to update redundant U-Boot boot loader!"; + echo ""; + echo "Aborted."; + exit; + fi; +fi; + # Set 'bootcmd' to the second part of the script that will # - Reset environment to defaults # - Restore 'dualboot' if previously set diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh index fd1336cbd..c6213dff3 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93/install_linux_fw_uuu.sh @@ -42,6 +42,8 @@ show_usage() echo " -n No wait. Skips 10 seconds delay to stop script." echo " -u U-Boot filename." echo " Auto-determined by variant if not provided." + echo " -U Update redundant bootloader partition." + exit 2 } @@ -57,7 +59,7 @@ part_update() echo "=====================================================================================" echo "\033[0m" - if [ "${1}" = "bootloader" ]; then + if [ "${1}" = "bootloader" ] || [ "${1}" = "bootloader_redundant" ]; then uuu fb: flash "${1}" "${2}" else uuu fb: flash -raw2sparse "${1}" "${2}" @@ -73,7 +75,7 @@ echo "############################################################" # -b, -d, -n (booleans) # -i # -u -while getopts 'bdhi:nu:' c +while getopts 'bdhi:nu:U' c do case $c in b) BOOTCOUNT=true ;; @@ -82,6 +84,7 @@ do i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; + U) INSTALL_REDUNDANT_UBOOT=true ;; esac done @@ -191,6 +194,9 @@ if [ "${NOWAIT}" != true ]; then printf " PARTITION\tFILENAME\n" printf " ---------\t--------\n" printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" + if [ "${INSTALL_REDUNDANT_UBOOT}" = true ]; then + printf " bootloader_redundant\t${INSTALL_UBOOT_FILENAME}\n" + fi if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" if [ "${INSTALL_DUALBOOT}" = true ]; then @@ -225,6 +231,9 @@ uuu fb: ucmd setenv forced_update 1 # Update U-Boot part_update "bootloader" "${INSTALL_UBOOT_FILENAME}" +if [ "${INSTALL_REDUNDANT_UBOOT}" = true ]; then + part_update bootloader_redundant "${INSTALL_UBOOT_FILENAME}" +fi # Set MMC to boot from BOOT1 partition uuu fb: ucmd mmc partconf 0 1 1 1