From b1ee0307cc5dcd88f19b4ee0baf29172c0dddffa Mon Sep 17 00:00:00 2001 From: Gonzalo Ruiz Date: Wed, 9 Nov 2022 16:57:47 +0100 Subject: [PATCH] u-boot-dey: ccmp1: update install scripts for CCMP1 platform Signed-off-by: Gonzalo Ruiz --- .../u-boot-dey/ccmp1/install_linux_fw_sd.txt | 98 +++++++-------- .../u-boot-dey/ccmp1/install_linux_fw_usb.txt | 96 +++++++------- .../u-boot-dey/ccmp1/install_linux_fw_uuu.sh | 118 +++++++----------- 3 files changed, 131 insertions(+), 181 deletions(-) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_sd.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_sd.txt index 75615a981..cda1d1379 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_sd.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_sd.txt @@ -7,41 +7,9 @@ install_abort=0 BASEFILENAME=0 -# Determine U-Boot file to program basing on module variant -if test -n "${module_variant}"; then - if test "${module_variant}" = "0x02" || test "${module_variant}" = "0x03" || test "${module_variant}" = "0x06" || test "${module_variant}" = "0x0a"; then - setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##.imx; - elif test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x07"; then - setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx; - elif test "${module_variant}" = "0x08" || test "${module_variant}" = "0x09"; then - setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##512MB.imx - fi -fi - -# Use 'test -n ...' because 'test -z ...' does not work well on old versions of -# u-boot when the checked value is empty. -if test -n "${INSTALL_UBOOT_FILENAME}"; then - true; -else - echo ""; - echo "[ERROR] Cannot determine U-Boot file for this module!"; - echo ""; - echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6UL variant:"; - echo " - For a SOM with 1GB DDR3, run:"; - echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx"; - echo " - For a SOM with 512MB DDR3, run:"; - echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##512MB.imx"; - echo " - For a SOM with 256MB DDR3, run:"; - echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##.imx"; - echo ""; - echo "2. Run the install script again."; - echo ""; - echo "Aborted"; - echo ""; - exit; -fi; - -setenv INSTALL_MMCDEV 0 +setenv INSTALL_ATF_FILENAME tf-a-##MACHINE##-nand.stm32 +setenv INSTALL_FIP_FILENAME fip-##MACHINE##-optee.bin +setenv INSTALL_MMCDEV 1 if test -z "${image-name}"; then setenv image-name ##DEFAULT_IMAGE_NAME## @@ -60,7 +28,7 @@ setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.ubifs setenv INSTALL_ROOTFS_FILENAME ${BASEFILENAME}-##MACHINE##.ubifs # Check for presence of firmware files on the SD card -for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do +for install_f in ${INSTALL_ATF_FILENAME} ${INSTALL_FIP_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do if test ! -e mmc ${INSTALL_MMCDEV} ${install_f}; then echo "ERROR: Could not find file ${install_f}"; install_abort=1; @@ -80,7 +48,10 @@ echo " on the partitions of the NAND." echo "" echo " PARTITION FILENAME" echo " --------- --------" -echo " bootloader ${INSTALL_UBOOT_FILENAME}" +echo " fsbl1 ${INSTALL_ATF_FILENAME}" +echo " fsbl2 ${INSTALL_ATF_FILENAME}" +echo " fip-a ${INSTALL_FIP_FILENAME}" +echo " fip-b ${INSTALL_FIP_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" echo " linux_b ${INSTALL_LINUX_FILENAME}" @@ -108,41 +79,60 @@ setenv forced_update 1 # the first reset. setenv bootdelay 0 -# Update U-Boot +# Update ATF and FIP images echo "" echo "" -echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)" +echo ">> Installing ATF boot loader image ${INSTALL_ATF_FILENAME}" echo "" echo "" -update uboot mmc ${INSTALL_MMCDEV} ${INSTALL_UBOOT_FILENAME} +update fsbl1 mmc ${INSTALL_MMCDEV} ${INSTALL_ATF_FILENAME} if test $? -eq 1; then - # Use old-style update with source file system argument - update uboot mmc ${INSTALL_MMCDEV} fat ${INSTALL_UBOOT_FILENAME} - if test $? -eq 1; then - echo "[ERROR] Failed to update U-Boot boot loader!"; - echo ""; - echo "Aborted."; - exit; - fi + echo "[ERROR] Failed to update fsbl1!"; + echo ""; + echo "Aborted."; + exit; +fi +update fsbl2 mmc ${INSTALL_MMCDEV} ${INSTALL_ATF_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update fsbl2!"; + echo ""; + echo "Aborted."; + exit; +fi +echo "" +echo "" +echo ">> Installing FIP boot loader image ${INSTALL_FIP_FILENAME} (target will reset)" +echo "" +echo "" +update fip-a mmc ${INSTALL_MMCDEV} ${INSTALL_FIP_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update fip-a!"; + echo ""; + echo "Aborted."; + exit; +fi +update fip-b mmc ${INSTALL_MMCDEV} ${INSTALL_FIP_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update fip-b!"; + echo ""; + echo "Aborted."; + exit; fi # Set 'bootcmd' to the second part of the script that will # - Reset environment to defaults # - Restore 'dualboot' if previously set -# - Run 'partition_nand_linux' script to re-partition the NAND if needed -# - Save the environment +# - Run 'ubivolscript' script to re-partition the UBI partition and save the +# environment # - If Dual Boot # - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b # - If Normal Boot: # - Update the system partitions: linux, recovery, rootfs -# - Erase the 'update' partition # - Configure recovery to wipe 'update' partition # - Run 'recovery' and let the system boot after setenv bootcmd " env default -a; setenv dualboot ${dualboot}; - run partition_nand_linux; - saveenv; run ubivolscript; if test \"\$\{dualboot\}\" = yes; then echo \"\"; @@ -233,8 +223,8 @@ setenv bootcmd " echo \"\"; setenv boot_recovery yes; setenv recovery_command wipe_update; + saveenv; fi; - saveenv; echo \"\"; echo \"\"; echo \">> Firmware installation complete.\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_usb.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_usb.txt index 813fa0381..fc1b2a7f4 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_usb.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_usb.txt @@ -7,40 +7,8 @@ install_abort=0 BASEFILENAME=0 -# Determine U-Boot file to program basing on module variant -if test -n "${module_variant}"; then - if test "${module_variant}" = "0x02" || test "${module_variant}" = "0x03" || test "${module_variant}" = "0x06" || test "${module_variant}" = "0x0a"; then - setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##.imx; - elif test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x07"; then - setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx; - elif test "${module_variant}" = "0x08" || test "${module_variant}" = "0x09"; then - setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##512MB.imx - fi -fi - -# Use 'test -n ...' because 'test -z ...' does not work well on old versions of -# u-boot when the checked value is empty. -if test -n "${INSTALL_UBOOT_FILENAME}"; then - true; -else - echo ""; - echo "[ERROR] Cannot determine U-Boot file for this module!"; - echo ""; - echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6UL variant:"; - echo " - For a SOM with 1GB DDR3, run:"; - echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##1GB.imx"; - echo " - For a SOM with 512MB DDR3, run:"; - echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##512MB.imx"; - echo " - For a SOM with 256MB DDR3, run:"; - echo " => setenv INSTALL_UBOOT_FILENAME u-boot-##MACHINE##.imx"; - echo ""; - echo "2. Run the install script again."; - echo ""; - echo "Aborted"; - echo ""; - exit; -fi; - +setenv INSTALL_ATF_FILENAME tf-a-##MACHINE##-nand.stm32 +setenv INSTALL_FIP_FILENAME fip-##MACHINE##-optee.bin setenv INSTALL_USBDEV 0 if test -z "${image-name}"; then @@ -60,7 +28,7 @@ setenv INSTALL_RECOVERY_FILENAME ${BASEFILENAME}-##MACHINE##.recovery.ubifs setenv INSTALL_ROOTFS_FILENAME ${BASEFILENAME}-##MACHINE##.ubifs # Check for presence of firmware files on the USB -for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do +for install_f in ${INSTALL_ATF_FILENAME} ${INSTALL_FIP_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do if test ! -e usb ${INSTALL_USBDEV} ${install_f}; then echo "ERROR: Could not find file ${install_f}"; install_abort=1; @@ -80,7 +48,10 @@ echo " on the partitions of the NAND." echo "" echo " PARTITION FILENAME" echo " --------- --------" -echo " bootloader ${INSTALL_UBOOT_FILENAME}" +echo " fsbl1 ${INSTALL_ATF_FILENAME}" +echo " fsbl2 ${INSTALL_ATF_FILENAME}" +echo " fip-a ${INSTALL_FIP_FILENAME}" +echo " fip-b ${INSTALL_FIP_FILENAME}" if test "${dualboot}" = "yes"; then echo " linux_a ${INSTALL_LINUX_FILENAME}" echo " linux_b ${INSTALL_LINUX_FILENAME}" @@ -108,41 +79,60 @@ setenv forced_update 1 # the first reset. setenv bootdelay 0 -# Update U-Boot +# Update ATF and FIP images echo "" echo "" -echo ">> Installing U-Boot boot loader image ${INSTALL_UBOOT_FILENAME} (target will reset)" +echo ">> Installing ATF boot loader image ${INSTALL_ATF_FILENAME}" echo "" echo "" -update uboot usb ${INSTALL_USBDEV} ${INSTALL_UBOOT_FILENAME} +update fsbl1 usb ${INSTALL_USBDEV} ${INSTALL_ATF_FILENAME} if test $? -eq 1; then - # Use old-style update with source file system argument - update uboot usb ${INSTALL_USBDEV} fat ${INSTALL_UBOOT_FILENAME} - if test $? -eq 1; then - echo "[ERROR] Failed to update U-Boot boot loader!"; - echo ""; - echo "Aborted."; - exit; - fi + echo "[ERROR] Failed to update fsbl1!"; + echo ""; + echo "Aborted."; + exit; +fi +update fsbl2 usb ${INSTALL_USBDEV} ${INSTALL_ATF_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update fsbl2!"; + echo ""; + echo "Aborted."; + exit; +fi +echo "" +echo "" +echo ">> Installing FIP boot loader image ${INSTALL_FIP_FILENAME} (target will reset)" +echo "" +echo "" +update fip-a usb ${INSTALL_USBDEV} ${INSTALL_FIP_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update fip-a!"; + echo ""; + echo "Aborted."; + exit; +fi +update fip-b usb ${INSTALL_USBDEV} ${INSTALL_FIP_FILENAME} +if test $? -eq 1; then + echo "[ERROR] Failed to update fip-b!"; + echo ""; + echo "Aborted."; + exit; fi # Set 'bootcmd' to the second part of the script that will # - Reset environment to defaults # - Restore 'dualboot' if previously set -# - Run 'partition_nand_linux' script to re-partition the NAND if needed -# - Save the environment +# - Run 'ubivolscript' script to re-partition the UBI partition and save the +# environment # - If Dual Boot # - Update the system partitions: linux_a, linux_b, rootfs_a, rootfs_b # - If Normal Boot: # - Update the system partitions: linux, recovery, rootfs -# - Erase the 'update' partition # - Configure recovery to wipe 'update' partition # - Run 'recovery' and let the system boot after setenv bootcmd " env default -a; setenv dualboot ${dualboot}; - run partition_nand_linux; - saveenv; run ubivolscript; usb start; if test \"\$\{dualboot\}\" = yes; then @@ -234,8 +224,8 @@ setenv bootcmd " echo \"\"; setenv boot_recovery yes; setenv recovery_command wipe_update; + saveenv; fi; - saveenv; echo \"\"; echo \"\"; echo \">> Firmware installation complete.\"; diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_uuu.sh b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_uuu.sh index b32229a85..ddecd9152 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_uuu.sh +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp1/install_linux_fw_uuu.sh @@ -1,7 +1,7 @@ #!/bin/sh #=============================================================================== # -# Copyright (C) 2020-2021 by Digi International Inc. +# Copyright (C) 2022 by Digi International Inc. # All rights reserved. # # This program is free software; you can redistribute it and/or modify it @@ -32,13 +32,15 @@ show_usage() echo "Usage: $0 [options]" echo "" echo " Options:" + echo " -a Arm-trusted-firmware filename." + echo " Auto-determined by variant if not provided." + echo " -f FIP filename." + echo " Auto-determined by variant if not provided." echo " -h Show this help." echo " -i Image name that prefixes the image filenames, such as 'dey-image-qt', " echo " 'dey-image-webkit', 'core-image-base'..." echo " Defaults to '##DEFAULT_IMAGE_NAME##' if not provided." echo " -n No wait. Skips 10 seconds delay to stop script." - echo " -u U-Boot filename." - echo " Auto-determined by variant if not provided." exit 2 } @@ -59,7 +61,7 @@ part_update() echo "\033[0m" uuu fb: download -f "${2}" - uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${fastboot_bytes} ${ERASE} + uuu "fb[-t ${3}]:" ucmd update "${1}" ram \${fastboot_buffer} \${filesize} ${ERASE} } clear @@ -68,15 +70,17 @@ echo "# Linux firmware install through USB OTG #" echo "############################################################" # Command line admits the following parameters: -# -u +# -a +# -f # -i -while getopts 'hi:nu:' c +while getopts 'a:f:hi:n' c do case $c in + a) INSTALL_ATF_FILENAME=${OPTARG} ;; + f) INSTALL_FIP_FILENAME=${OPTARG} ;; h) show_usage ;; i) IMAGE_NAME=${OPTARG} ;; n) NOWAIT=true ;; - u) INSTALL_UBOOT_FILENAME=${OPTARG} ;; esac done @@ -89,54 +93,21 @@ if [ "${dualboot}" = "yes" ]; then DUALBOOT=true; fi +# remove redirect +uuu fb: ucmd setenv stdout serial + echo "" echo "Determining image files to use..." -# Determine U-Boot filename if not provided -if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then - module_variant=$(getenv "module_variant") - # Determine U-Boot file to program basing on SOM's variant - if [ -n "$module_variant" ] || [ "$module_variant" = "0x00" ]; then - if [ "$module_variant" = "0x08" ] || \ - [ "$module_variant" = "0x09" ]; then - INSTALL_UBOOT_FILENAME="u-boot-##MACHINE##512MB.imx" - elif [ "$module_variant" = "0x04" ] || \ - [ "$module_variant" = "0x05" ] || \ - [ "$module_variant" = "0x07" ]; then - INSTALL_UBOOT_FILENAME="u-boot-##MACHINE##1GB.imx" - else - INSTALL_UBOOT_FILENAME="u-boot-##MACHINE##.imx" - fi - fi - - # U-Boot when the checked value is empty. - if [ -n "${INSTALL_UBOOT_FILENAME}" ]; then - true - else - # remove redirect - uuu fb: ucmd setenv stdout serial - - echo "" - echo "[ERROR] Cannot determine U-Boot file for this module!" - echo "" - echo "1. Add U-boot file name, depending on your ConnectCore 6UL variant, to script command line:" - echo " - For a SOM with 1GB DDR3, run:" - echo " => ./install_linux_fw_uuu.sh -u u-boot-##MACHINE##1GB.imx" - echo " - For a SOM with 512MB DDR3, run:" - echo " => ./install_linux_fw_uuu.sh -u u-boot-##MACHINE##512MB.imx" - echo " - For a SOM with 256MB DDR3, run:" - echo " => ./install_linux_fw_uuu.sh -u u-boot-##MACHINE##.imx" - echo "" - echo "2. Run the install script again." - echo "" - echo "Aborted" - echo "" - exit - fi +# Determine ATF file to program +if [ -z "${INSTALL_ATF_FILENAME}" ]; then + INSTALL_ATF_FILENAME="tf-a-##MACHINE##-nand.stm32" fi -# remove redirect -uuu fb: ucmd setenv stdout serial +# Determine FIP file to program +if [ -z "${INSTALL_FIP_FILENAME}" ]; then + INSTALL_FIP_FILENAME="fip-##MACHINE##-optee.bin" +fi # Determine linux, recovery, and rootfs image filenames to update if [ -z "${IMAGE_NAME}" ]; then @@ -156,7 +127,7 @@ INSTALL_RECOVERY_FILENAME="${BASEFILENAME}-##MACHINE##.recovery.ubifs" INSTALL_ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ubifs" # Verify existance of files before starting the update -FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}" +FILES="${INSTALL_ATF_FILENAME} ${INSTALL_FIP_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}" for f in ${FILES}; do if [ ! -f ${f} ]; then echo "\033[31m[ERROR] Could not find file '${f}'\033[0m" @@ -182,7 +153,10 @@ if [ "${NOWAIT}" != true ]; then printf "\n" printf " PARTITION\tFILENAME\n" printf " ---------\t--------\n" - printf " bootloader\t${INSTALL_UBOOT_FILENAME}\n" + printf " fsbl1\t${INSTALL_ATF_FILENAME}\n" + printf " fsbl2\t${INSTALL_ATF_FILENAME}\n" + printf " fip-a\t${INSTALL_FIP_FILENAME}\n" + printf " fip-b\t${INSTALL_FIP_FILENAME}\n" if [ "${DUALBOOT}" = true ]; then printf " ${LINUX_NAME}_a\t${INSTALL_LINUX_FILENAME}\n" printf " ${LINUX_NAME}_b\t${INSTALL_LINUX_FILENAME}\n" @@ -211,20 +185,26 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr} # Skip user confirmation for U-Boot update uuu fb: ucmd setenv forced_update 1 -# Update U-Boot -part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000 +# Update ATF +part_update "fsbl1" "${INSTALL_ATF_FILENAME}" 5000 +part_update "fsbl2" "${INSTALL_ATF_FILENAME}" 5000 + +# Update FIP +part_update "fip-a" "${INSTALL_FIP_FILENAME}" 5000 +part_update "fip-b" "${INSTALL_FIP_FILENAME}" 5000 + # Set 'bootcmd' for the second part of the script that will # - Reset environment to defaults +# - Keep the 'dualboot' status # - Save the environment -# - Update the 'linux' partition -# - Update the 'recovery' partition -# - Update the 'rootfs' partition -# - Erase the 'update' partition +# - Update the 'linux' partition(s) +# - Update the 'rootfs' partition(s) uuu fb: ucmd setenv bootcmd " env default -a; setenv dualboot \${dualboot}; saveenv; + saveenv; echo \"\"; echo \"\"; echo \">> Installing Linux firmware\"; @@ -237,16 +217,13 @@ uuu fb: ucmd saveenv uuu fb: acmd reset # Wait for the target to reset -sleep 3 +sleep 8 # Set fastboot buffer address to $loadaddr uuu fb: ucmd setenv fastboot_buffer \${loadaddr} -# Create partition table -uuu "fb[-t 10000]:" ucmd run partition_nand_linux - -uuu "fb[-t 30000]:" ucmd nand erase.part system -uuu "fb[-t 10000]:" ucmd run ubivolscript +# Create UBI volumes +uuu "fb[-t 20000]:" ucmd run ubivolscript if [ "${DUALBOOT}" = true ]; then # Update Linux A @@ -264,19 +241,12 @@ else part_update "${RECOVERY_NAME}" "${INSTALL_RECOVERY_FILENAME}" 15000 # Update Rootfs part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}" 90000 -fi - -if [ "${DUALBOOT}" != true ]; then - # Erase the 'Update' partition - uuu "fb[-t 20000]:" ucmd nand erase.part update -fi - -if [ "${DUALBOOT}" != true ]; then - # Configure u-boot to boot into recovery mode + # Configure u-boot to boot into recovery mode and format the + # 'update' partition uuu fb: ucmd setenv boot_recovery yes uuu fb: ucmd setenv recovery_command wipe_update + uuu fb: ucmd saveenv fi -uuu fb: ucmd saveenv # Reset the target uuu fb: acmd reset