aboutsummaryrefslogtreecommitdiffstats
path: root/meta-agl-refhw-gen3/recipes-bsp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2021-06-30 14:10:57 -0400
committerScott Murray <scott.murray@konsulko.com>2021-07-15 16:38:49 +0000
commitb3c6d00aa6f2c534bc117f5a63054432b3e62fcc (patch)
tree7bdb4095074c7bdf529383d646cb747adcb9450e /meta-agl-refhw-gen3/recipes-bsp
parentb7ccd481b6e38d92a51e364c23c0d1363df36700 (diff)
arm-trusted-firmware: Enable building in AGL build
Leverage the reworked extra_opl_ipt hook in the rcar3 BSP's arm-trusted-firmware recipe as of BSP v4.7.0 to enable building the reference hardware flavor of the firmware as an extra firmware version when building with MACHINE=h3ulcb. This will then enable working inside the AGL build which combines the reference hardware support into its h3ulcb build to avoid needing an extra platform build. Support for building standalone with MACHINE=agl-refhw-h3 has been retained for potential use outside of the full AGL build. The firmware documentation has been reworked to document the build and flashing procedure for both types of build. Based on initial prototype by Vasyl Vavrychuk at: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl-refhw/+/26352 Bug-AGL: SPEC-3916 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I5f74450851aeb4cb015a21e234709eca2014f378 (cherry picked from commit e7f137f15d25b1a33b9ec9f5cd3ac79bac21fd41)
Diffstat (limited to 'meta-agl-refhw-gen3/recipes-bsp')
-rw-r--r--meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend65
1 files changed, 48 insertions, 17 deletions
diff --git a/meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend b/meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend
index bf2874f..962f84e 100644
--- a/meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend
+++ b/meta-agl-refhw-gen3/recipes-bsp/arm-trusted-firmware/arm-trusted-firmware_%.bbappend
@@ -1,33 +1,64 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
-SRC_URI += "file://0001-Boot-Normal-World-in-EL2.patch"
+# Apply the patch AGL applies for all rcar3 in meta-agl-bsp when
+# building the standalone agl-refhw-h3 machine.
+SRC_URI_append_agl-refhw-h3 = " file://0001-Boot-Normal-World-in-EL2.patch"
# It is believed the eMMC configuration below makes the result AGL
-# reference hardware specific, mark it as such to try to prevent
-# unintended usage on other boards.
-COMPATIBLE_MACHINE = "agl-refhw-h3"
+# reference hardware specific, mark it as such when building with
+# MACHINE=agl-refhw-h3 to potentially flag this in an incorrectly
+# configured build.
+COMPATIBLE_MACHINE_agl-refhw-h3 = "agl-refhw-h3"
# There are hardware issues in using hyperflash. arm-trusted-firmware, optee and
# u-boot have to be stored into eMMC by using serial donwload.
EMMC_BOOT_OPTION = "RCAR_SA6_TYPE=1"
-DDR_8G_OPTION= "RCAR_DRAM_LPDDR4_MEMCONF=1"
+# RCAR_DRAM_MEMRANK must be set, since in case of RCAR_DRAM_LPDDR4_MEMCONF=1
+# ddr_rank_judge is called. But for RCAR_DRAM_MEMRANK=0 it can determine values
+# only for Salvator XS and Starter Kit Pre.
+#
+# RCAR_DRAM_MEMRANK=2 is set because for ATF from BSP v4.7.0:
+#
+# https://github.com/renesas-rcar/arm-trusted-firmware/tree/af9f429a48b438e314289f17947ad5d8036f398e
+#
+# _board_judge returns hardcoded 'brd = 8; /* 8Gbit/2rank */' by default.
+#
+DDR_8G_OPTION = "RCAR_DRAM_LPDDR4_MEMCONF=1 RCAR_DRAM_MEMRANK=2"
-ATFW_OPT_append_agl-refhw-h3 = " ${EMMC_BOOT_OPTION}"
+ATFW_OPT_agl-refhw-h3 = "LSI=H3 RCAR_DRAM_SPLIT=1 ${EMMC_BOOT_OPTION} ${DDR_8G_OPTION}"
-# In arm-trusted-firmware-control.inc, a "extra_ipl_opt" task is appended to
-# create firmware for 4x2g or 2x2g variation. it is supposed to use
-# EXTRA_ATFW_OPT to customize the compiler opton.
#
-#EXTRA_ATFW_OPT_append_agl-refhw-h3 = " ${EMMC_BOOT_OPTION} ${DDR_8G_OPTION}"
+# Handle building as extra firmware with MACHINE=h3ulcb
+#
+
+# Build options for building as extra firmware when MACHINE=h3ulcb, based on H3[4x2g]
+H3ULCB[agl-refhw-4x2g] = "LSI=H3 RCAR_DRAM_SPLIT=1 ${EMMC_BOOT_OPTION} ${DDR_8G_OPTION}"
+
#
-# Unfortunately in do_extra_ipl_opt() it use d.setVar() instead of d.appendVar()
-# to setup EXTRA_ATFW_OPT variable which makes it impossible to customize it properly
-# by others... Override it.
-#
+# Need to prepend the compile tasks with a distclean that actually cleans
+# out all the platform specific files like the new rcar_layout_tool output,
+# otherwise they do not get rebuilt and board builds can get the wrong
+# version of e.g. cert_headers_sa6. This needs to be addressed with
+# upstream.
#
-do_ipl_opt_compile_agl-refhw-h3 () {
- oe_runmake distclean
- oe_runmake bl2 bl31 dummytool PLAT=${PLATFORM} ${EXTRA_ATFW_OPT} ${ATFW_OPT_LOSSY} ${EMMC_BOOT_OPTION} ${DDR_8G_OPTION}
+
+do_compile_prepend() {
+ oe_runmake distclean PLAT=${PLATFORM} MBEDTLS_COMMON_MK=1 ${ATFW_OPT}
+}
+
+do_ipl_opt_compile_prepend() {
+ oe_runmake distclean PLAT=${PLATFORM} MBEDTLS_COMMON_MK=1 ${ATFW_OPT}
+}
+
+do_extra_ipl_opt_refhw_fixup() {
+ # Rename agl-refhw-h3 firmware files to drop h3ulcb-
+ for f in ${DEPLOYDIR}/*-h3ulcb-agl-refhw-4x2g*; do
+ n=`basename $f | sed 's/h3ulcb-//'`
+ mv -f $f ${DEPLOYDIR}/$n
+ done
}
+EXTRA_IPL_OPT_POSTFUNCS = ""
+EXTRA_IPL_OPT_POSTFUNCS_h3ulcb = "do_extra_ipl_opt_refhw_fixup"
+do_extra_ipl_opt[postfuncs] += "${EXTRA_IPL_OPT_POSTFUNCS}"