From e9aeb051cfc5c7fbeabc188723aec0cb2b2eff00 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Thu, 2 Nov 2023 18:59:37 +0100 Subject: [PATCH] ccimx93: enable the build of A0 SOC revision bootloader Implement support to program the correct bootloader on the different installation scripts. Signed-off-by: Javier Viguera --- meta-digi-arm/conf/machine/ccimx93-dvk.conf | 5 ++++- .../conf/machine/include/ccimx93.inc | 6 +++++- .../ccimx93/install_linux_fw_sd.txt | 15 +++++++++++++- .../ccimx93/install_linux_fw_usb.txt | 15 +++++++++++++- .../ccimx93/install_linux_fw_uuu.sh | 20 ++++++++++++++----- 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/meta-digi-arm/conf/machine/ccimx93-dvk.conf b/meta-digi-arm/conf/machine/ccimx93-dvk.conf index ea0007aa8..858dc075e 100644 --- a/meta-digi-arm/conf/machine/ccimx93-dvk.conf +++ b/meta-digi-arm/conf/machine/ccimx93-dvk.conf @@ -56,7 +56,10 @@ IMAGE_FSTYPES ?= '${@bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", \ "boot.vfat recovery.vfat ext4.gz tar.bz2 sdcard.gz", d)}' # Boot artifacts to be copied from the deploy dir to the installer ZIP -BOOTABLE_ARTIFACTS = "imx-boot-ccimx93-dvk.bin" +BOOTABLE_ARTIFACTS = " \ + imx-boot-ccimx93-dvk.bin \ + imx-boot-ccimx93-dvk-A0.bin \ +" # Default overlayfs_etc mount point and type OVERLAYFS_ETC_MOUNT_POINT ?= "/mnt/data" diff --git a/meta-digi-arm/conf/machine/include/ccimx93.inc b/meta-digi-arm/conf/machine/include/ccimx93.inc index 743645367..ca450fff6 100644 --- a/meta-digi-arm/conf/machine/include/ccimx93.inc +++ b/meta-digi-arm/conf/machine/include/ccimx93.inc @@ -17,6 +17,10 @@ BOOTLOADER_IMAGE_RECIPE = "imx-boot" BOOTABLE_FILENAME = "${UBOOT_PREFIX}-${MACHINE}.bin" SDIMG_BOOTLOADER = "${DEPLOY_DIR_IMAGE}/${BOOTABLE_FILENAME}" +# Generate images for all SOC revisions (keep the override as otherwise the +# one in "use-imx-security-controller-firmware.bbclass" takes precedence) +SECO_FIRMWARE_NAME:ccimx93 = "mx93??-ahab-container.img" + DDR_FIRMWARE_NAME = " \ lpddr4_dmem_1d_v202201.bin \ lpddr4_dmem_2d_v202201.bin \ @@ -48,7 +52,7 @@ MACHINE_EXTRA_RDEPENDS += " \ # TrustFence TRUSTFENCE_SIGN_MODE = "AHAB" -IMXBOOT_TARGETS = "flash_singleboot" +IMXBOOT_TARGETS = "flash_singleboot flash_singleboot_a0" IMX_BOOT_SOC_TARGET = "iMX9" IMX_BOOT_SEEK = "32" 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 eaba3add2..baa7d2a84 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 @@ -7,7 +7,20 @@ install_abort=0 BASEFILENAME=0 -setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##.bin; +# Determine U-Boot file to program basing on SOM's SOC revision +if test -z "${soc_rev}"; then + # Fallback to hardware version if soc_rev is empty + setexpr som_hv ${hwid_2} \& 78 + setexpr som_hv ${som_hv} / 8 + if test "${som_hv}" -lt "2"; then + SOCREV="-A0" + fi +else + if test "${soc_rev}" = "0x10"; then + SOCREV="-A0" + fi +fi +setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##${SOCREV}.bin setenv INSTALL_MMCDEV 1 if test -z "${image-name}"; then 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 a31bd122e..e438d274e 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 @@ -7,7 +7,20 @@ install_abort=0 BASEFILENAME=0 -setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##.bin; +# Determine U-Boot file to program basing on SOM's SOC revision +if test -z "${soc_rev}"; then + # Fallback to hardware version if soc_rev is empty + setexpr som_hv ${hwid_2} \& 78 + setexpr som_hv ${som_hv} / 8 + if test "${som_hv}" -lt "2"; then + SOCREV="-A0" + fi +else + if test "${soc_rev}" = "0x10"; then + SOCREV="-A0" + fi +fi +setenv INSTALL_UBOOT_FILENAME imx-boot-##MACHINE##${SOCREV}.bin setenv INSTALL_USBDEV 0 if test -z "${image-name}"; then 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 1ee6c2f79..fcf342151 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 @@ -93,17 +93,27 @@ 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 file to program basing on SOM's SOC type (linked to bus width) +# Determine U-Boot file to program basing on SOM's SOC revision if [ -z "${INSTALL_UBOOT_FILENAME}" ]; then - INSTALL_UBOOT_FILENAME="imx-boot-##MACHINE##.bin" + soc_rev="$(getenv soc_rev)" + if [ -n "${soc_rev}" ]; then + [ "${soc_rev}" = "0x10" ] && SOCREV="-A0" + else + # Fallback to hardware version if soc_rev is empty + hwid_2="$(getenv hwid_2)" + hwid_2="0x${hwid_2#0x}" + som_hv="$(((hwid_2 & 0x78) >> 3))" + [ "${som_hv}" -lt "2" ] && SOCREV="-A0" + fi + INSTALL_UBOOT_FILENAME="imx-boot-##MACHINE##${SOCREV}.bin" fi +# remove redirect +uuu fb: ucmd setenv stdout serial + # Determine linux, recovery, and rootfs image filenames to update if [ -z "${IMAGE_NAME}" ]; then IMAGE_NAME="##DEFAULT_IMAGE_NAME##"