From 19ec627e904d07e22669020d3e84daa1dda22334 Mon Sep 17 00:00:00 2001 From: Martin Schmiedel Date: Thu, 25 Jul 2024 11:05:42 +0200 Subject: [PATCH] MBa8MPxL: fix boot problem after updating uboot.sh - since 792d9d9d Variables add to environment in post_config_uboot_target function are ignored. - So setting the variable ATF_LOAD_ADDR doesn't work anymore - ATF_LOAD_ADDR changed in the uboot patch instead Signed-off-by: Martin Schmiedel --- config/sources/families/imx8m.conf | 3 - ..._atf_imx8mp.sh-add-script-for-imx8mp.patch | 176 ++++++++++++++++++ 2 files changed, 176 insertions(+), 3 deletions(-) create mode 100644 patch/u-boot/u-boot-tqma/0003-imx-mkimage_fit_atf_imx8mp.sh-add-script-for-imx8mp.patch diff --git a/config/sources/families/imx8m.conf b/config/sources/families/imx8m.conf index 4b2a9fd783..82711d1172 100644 --- a/config/sources/families/imx8m.conf +++ b/config/sources/families/imx8m.conf @@ -22,7 +22,6 @@ case $BOARD in mba8mpxl*) ATFSOURCE='https://github.com/tq-systems/atf' # required for ram ATFBRANCH="branch:TQMa8-imx_5.4.70_2.3.0" - ATF_ADDR="0x00970000" BOOTSOURCE='https://github.com/tq-systems/u-boot-tqmaxx.git' # u-boot mainlining is hard and has low-priority BOOTBRANCH='branch:TQMa8-v2020.04_imx_5.4.70_2.3.0' BOOTPATCHDIR="u-boot-tqma" # could be removed when distro boot patches are integrated @@ -41,8 +40,6 @@ pre_config_uboot_target() { cp ${IMX_FIRMWARE}/firmware/hdmi/cadence/signed_hdmi_imx8m.bin . cp ${IMX_FIRMWARE}/firmware/hdmi/cadence/signed_dp_imx8m.bin . cp ${IMX_FIRMWARE}/firmware/ddr/synopsys/lpddr4*.bin . - - export ATF_LOAD_ADDR=${ATF_ADDR} } write_uboot_platform() { diff --git a/patch/u-boot/u-boot-tqma/0003-imx-mkimage_fit_atf_imx8mp.sh-add-script-for-imx8mp.patch b/patch/u-boot/u-boot-tqma/0003-imx-mkimage_fit_atf_imx8mp.sh-add-script-for-imx8mp.patch new file mode 100644 index 0000000000..4f496eba34 --- /dev/null +++ b/patch/u-boot/u-boot-tqma/0003-imx-mkimage_fit_atf_imx8mp.sh-add-script-for-imx8mp.patch @@ -0,0 +1,176 @@ +From 37855f81b2eed3cf4b426d99823f43009755a416 Mon Sep 17 00:00:00 2001 +From: Martin Schmiedel +Date: Mon, 22 Jul 2024 07:48:26 +0200 +Subject: [PATCH] imx: mkimage_fit_atf_imx8mp.sh: add script for imx8mp + +If Varibles can not be exported this script set default value for ATF_LOAD_ADDR + +Signed-off-by: Martin Schmiedel +--- + arch/arm/mach-imx/mkimage_fit_atf_imx8mp.sh | 139 ++++++++++++++++++++ + board/tqc/tqma8mpxl/Kconfig | 3 + + 2 files changed, 142 insertions(+) + create mode 100755 arch/arm/mach-imx/mkimage_fit_atf_imx8mp.sh + +diff --git a/arch/arm/mach-imx/mkimage_fit_atf_imx8mp.sh b/arch/arm/mach-imx/mkimage_fit_atf_imx8mp.sh +new file mode 100755 +index 0000000000..25031ce710 +--- /dev/null ++++ b/arch/arm/mach-imx/mkimage_fit_atf_imx8mp.sh +@@ -0,0 +1,139 @@ ++#!/bin/sh ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# script to generate FIT image source for i.MX8MQ boards with ++# ARM Trusted Firmware and multiple device trees (given on the command line) ++# ++# usage: $0 [ [&2 ++ exit 0 ++else ++ echo "$BL31 size: " >&2 ++ ls -lct $BL31 | awk '{print $5}' >&2 ++fi ++ ++BL32="tee.bin" ++ ++if [ ! -f $BL32 ]; then ++ BL32=/dev/null ++else ++ echo "Building with TEE support, make sure your $BL31 is compiled with spd. If you do not want tee, please delete $BL31" >&2 ++ echo "$BL32 size: " >&2 ++ ls -lct $BL32 | awk '{print $5}' >&2 ++fi ++ ++BL33="u-boot-nodtb.bin" ++ ++if [ ! -f $BL33 ]; then ++ echo "ERROR: $BL33 file NOT found" >&2 ++ exit 0 ++else ++ echo "u-boot-nodtb.bin size: " >&2 ++ ls -lct u-boot-nodtb.bin | awk '{print $5}' >&2 ++fi ++ ++for dtname in $* ++do ++ echo "$dtname size: " >&2 ++ ls -lct $dtname | awk '{print $5}' >&2 ++done ++ ++ ++cat << __HEADER_EOF ++/dts-v1/; ++ ++/ { ++ description = "Configuration to load ATF before U-Boot"; ++ ++ images { ++ uboot@1 { ++ description = "U-Boot (64-bit)"; ++ os = "u-boot"; ++ data = /incbin/("$BL33"); ++ type = "standalone"; ++ arch = "arm64"; ++ compression = "none"; ++ load = <$BL33_LOAD_ADDR>; ++ }; ++ atf@1 { ++ description = "ARM Trusted Firmware"; ++ os = "arm-trusted-firmware"; ++ data = /incbin/("$BL31"); ++ type = "firmware"; ++ arch = "arm64"; ++ compression = "none"; ++ load = <$ATF_LOAD_ADDR>; ++ entry = <$ATF_LOAD_ADDR>; ++ }; ++__HEADER_EOF ++ ++if [ -f $BL32 ]; then ++cat << __HEADER_EOF ++ tee@1 { ++ description = "TEE firmware"; ++ data = /incbin/("$BL32"); ++ type = "firmware"; ++ arch = "arm64"; ++ compression = "none"; ++ load = <$TEE_LOAD_ADDR>; ++ entry = <$TEE_LOAD_ADDR>; ++ }; ++__HEADER_EOF ++fi ++ ++cnt=1 ++for dtname in $* ++do ++ cat << __FDT_IMAGE_EOF ++ fdt@$cnt { ++ description = "$(basename $dtname .dtb)"; ++ data = /incbin/("$dtname"); ++ type = "flat_dt"; ++ compression = "none"; ++ }; ++__FDT_IMAGE_EOF ++cnt=$((cnt+1)) ++done ++ ++cat << __CONF_HEADER_EOF ++ }; ++ configurations { ++ default = "config@1"; ++ ++__CONF_HEADER_EOF ++ ++cnt=1 ++for dtname in $* ++do ++if [ -f $BL32 ]; then ++cat << __CONF_SECTION_EOF ++ config@$cnt { ++ description = "$(basename $dtname .dtb)"; ++ firmware = "uboot@1"; ++ loadables = "atf@1", "tee@1"; ++ fdt = "fdt@$cnt"; ++ }; ++__CONF_SECTION_EOF ++else ++cat << __CONF_SECTION1_EOF ++ config@$cnt { ++ description = "$(basename $dtname .dtb)"; ++ firmware = "uboot@1"; ++ loadables = "atf@1"; ++ fdt = "fdt@$cnt"; ++ }; ++__CONF_SECTION1_EOF ++fi ++cnt=$((cnt+1)) ++done ++ ++cat << __ITS_EOF ++ }; ++}; ++__ITS_EOF +diff --git a/board/tqc/tqma8mpxl/Kconfig b/board/tqc/tqma8mpxl/Kconfig +index 19e5d5030f..a8bd61246f 100644 +--- a/board/tqc/tqma8mpxl/Kconfig ++++ b/board/tqc/tqma8mpxl/Kconfig +@@ -15,6 +15,9 @@ config SPL_TEXT_BASE + config CSF_SIZE + default 0x2000 + ++config SPL_FIT_GENERATOR ++ default "arch/arm/mach-imx/mkimage_fit_atf_imx8mp.sh" ++ + config TQMA8MPXL_DEFAULTS + bool + default y +-- +2.34.1 +