arm-bsp/trusted-firmware-a: N1SDP trusted boot
cover arm-bsp/trusted-firmware-a: N1SDP trusted boot
From: Adam Johnston <[email protected]>
This patch re-configures the N1SDP for trusted boot, using the changes published by the Silicon Solutions team in N1SDP-2022.02.04 and up-streamed to trusted-firmware-a and scp-firmware.
arm-bsp/trusted-firmware-a: For N1SDP only, upgraded to 2.7.0 and configured for trusted boot
arm-bsp/scp-firmware: For N1SDP only, source is updated to master at 3e4c34ceccc1c960eb3a4adaa922f2a0c6b36be3
arm-bsp/scp-firmware: BL1 replaces BL31 in scp_fw.bin for N1SDP
arm-bsp/sdcard-image-n1sdp: fip.bin replaces uefi.bin. Now depends on trusted-firmware-a rather than edk2-firmware
arm-bsp/edk2-firmware: Add support for NT_FW_CONFIG DTB to N1SDP. Note: This patch contains CRLF line endings which must be preserved.
arm-bsp/scp-firmware should be updated to next SCP firmware release (2.11.0?) when available
Adam Johnston (5):
arm-bsp/trusted-firmware-a: N1SDP trusted boot arm-bsp/scp-firmware: N1SDP trusted boot arm-bsp/sdcard-image-n1sdp: N1SDP trusted boot arm-bsp/edk2-firmware: Add NT_FW_CONFIG to N1SDP to fix aborts when
accessing virtual memory
arm-bsp/sdcard-image-n1sdp: Fix N1SDP dependencies
meta-arm-bsp/conf/machine/n1sdp.conf | 2 + .../images/sdcard-image-n1sdp_0.1.bb | 11 +- .../scp-firmware/scp-firmware-n1sdp.inc | 6 +- .../scp-firmware/scp-firmware_2.10.%.bbappend | 7 + .../scp-firmware/scp-firmware_2.9.%.bbappend | 1 - .../files/n1sdp/bl_size.patch | 40 ++ .../trusted-firmware-a-n1sdp.inc | 27 +- .../trusted-firmware-a_2.6.bbappend | 1 - .../trusted-firmware-a_2.7.bbappend | 6 + .../recipes-bsp/uefi/edk2-firmware-n1sdp.inc | 6 + .../edk2-platforms/add-nt-fw-config.patch | 474 ++++++++++++++++++ .../trusted-firmware-a_2.7.bb | 15 + 12 files changed, 587 insertions(+), 9 deletions(-) create mode 100644 meta-arm-bsp/recipes-bsp/scp-firmware/scp-firmware_2.10.%.bbappend create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/n1sdp/bl_size.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bbappend create mode 100644 meta-arm-bsp/recipes-bsp/uefi/files/edk2-platforms/add-nt-fw-config.patch create mode 100644 meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bb
Signature · 1 line
2.17.1
PATCH 1/5 arm-bsp/trusted-firmware-a: N1SDP trusted boot
From: Adam Johnston <[email protected]>
This commit configures trusted-firmware-a for TBBR bootflow on N1SDP as follows:
* Trusted Firmware is upgraded to 2.7.0 for the N1SDP only
* Trusted boot is enabled.
* Generation of root-of-trust is enabled
* All TB images (BLx, DTBs) are built
* uefi.bin is specified as the BL33 image
* BL2, BL31, BL33 are signed and stored in the FIP
* N1SDP platform sources are patched to increase max size BL2 and reduce max size of BL1
--- meta-arm-bsp/conf/machine/n1sdp.conf | 2 + .../files/n1sdp/bl_size.patch | 40 +++++++++++++++++++ .../trusted-firmware-a-n1sdp.inc | 27 +++++++++++-- .../trusted-firmware-a_2.6.bbappend | 1 - .../trusted-firmware-a_2.7.bbappend | 6 +++ .../trusted-firmware-a_2.7.bb | 15 +++++++ 6 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/n1sdp/bl_size.patch create mode 100644 meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bbappend create mode 100644 meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bb
meta-arm-bsp/conf/machine/n1sdp.conf +2 -0
@@ -25,6 +25,8 @@ PREFERRED_VERSION_linux-yocto ?= "5.15%" MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "linux-firmware-rtl8168" EXTRA_IMAGEDEPENDS += "trusted-firmware-a" +PREFERRED_VERSION_trusted-firmware-a ?= "2.7%" + EXTRA_IMAGEDEPENDS += "virtual/control-processor-firmware" #UEFI EDK2 firmware
meta-arm-bsp/recipes-bsp/trusted-firmware-a/files/n1sdp/bl_size.patch new file +40 -0
@@ -0,0 +1,40 @@ +From 80b1efa92486a87f9e82dbf665ef612291148de8 Mon Sep 17 00:00:00 2001 +From: Adam Johnston <[email protected]> +Date: Tue, 14 Jun 2022 11:19:30 +0000 +Subject: [PATCH] arm-bsp/trusted-firmware-a: N1SDP trusted boot + +Increase max size of BL2 on N1SDP by 4KB to enable trusted boot +Decrease max size of BL1 on N1SDP by 8KB so BL1/BL2 fits above BL31 progbits + +Signed-off-by: Adam Johnston <[email protected]> +Upstream-Status: Pending [Flagged to upstream] + +--- + plat/arm/board/n1sdp/include/platform_def.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/plat/arm/board/n1sdp/include/platform_def.h b/plat/arm/board/n1sdp/include/platform_def.h +index c9b81bafa..7468a31ed 100644 +--- a/plat/arm/board/n1sdp/include/platform_def.h ++++ b/plat/arm/board/n1sdp/include/platform_def.h +@@ -91,7 +91,7 @@ + * PLAT_ARM_MAX_BL1_RW_SIZE is calculated using the current BL1 RW debug size + * plus a little space for growth. + */ +-#define PLAT_ARM_MAX_BL1_RW_SIZE 0xE000 ++#define PLAT_ARM_MAX_BL1_RW_SIZE 0xC000 + + /* + * PLAT_ARM_MAX_ROMLIB_RW_SIZE is define to use a full page +@@ -110,7 +110,7 @@ + * little space for growth. + */ + #if TRUSTED_BOARD_BOOT +-# define PLAT_ARM_MAX_BL2_SIZE 0x20000 ++# define PLAT_ARM_MAX_BL2_SIZE 0x21000 + #else + # define PLAT_ARM_MAX_BL2_SIZE 0x14000 + #endif +-- +2.35.1 +
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a-n1sdp.inc +24 -3
@@ -2,8 +2,29 @@ COMPATIBLE_MACHINE = "n1sdp" TFA_PLATFORM = "n1sdp" -TFA_BUILD_TARGET = "bl31 dtbs" -TFA_INSTALL_TARGET = "bl31 n1sdp-multi-chip n1sdp-single-chip" +TFA_BUILD_TARGET = "all fip" +TFA_INSTALL_TARGET = "bl1 bl2 bl31 n1sdp-multi-chip n1sdp-single-chip n1sdp_fw_config n1sdp_tb_fw_config fip" TFA_DEBUG = "1" -TFA_MBEDTLS = "0" +TFA_MBEDTLS = "1" TFA_UBOOT = "0" +TFA_UEFI = "1" + +SRC_URI:remove = " \ + file://ssl.patch \ + " + +SRC_URI:append = " \ + file://bl_size.patch \ + " + +TFA_ROT_KEY= "plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem" + +EXTRA_OEMAKE:append = "\ + TRUSTED_BOARD_BOOT=1 \ + GENERATE_COT=1 \ + CREATE_KEYS=1 \ + ENABLE_PIE=0 \ + ARM_ROTPK_LOCATION="devel_rsa" \ + ROT_KEY="${TFA_ROT_KEY}" \ + BL33=${RECIPE_SYSROOT}/firmware/uefi.bin \ + "
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.6.bbappend +0 -1
@@ -6,7 +6,6 @@ MACHINE_TFA_REQUIRE:corstone1000 = "trusted-firmware-a-corstone1000.inc" MACHINE_TFA_REQUIRE:fvp-base = "trusted-firmware-a-fvp.inc" MACHINE_TFA_REQUIRE:fvp-base-arm32 = "trusted-firmware-a-fvp-arm32.inc" MACHINE_TFA_REQUIRE:juno = "trusted-firmware-a-juno.inc" -MACHINE_TFA_REQUIRE:n1sdp = "trusted-firmware-a-n1sdp.inc" MACHINE_TFA_REQUIRE:sgi575 = "trusted-firmware-a-sgi575.inc" MACHINE_TFA_REQUIRE:tc = "trusted-firmware-a-tc.inc"
meta-arm-bsp/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bbappend new file +6 -0
@@ -0,0 +1,6 @@ +# Machine specific TFAs + +MACHINE_TFA_REQUIRE ?= "" +MACHINE_TFA_REQUIRE:n1sdp = "trusted-firmware-a-n1sdp.inc" + +require ${MACHINE_TFA_REQUIRE}
meta-arm/recipes-bsp/trusted-firmware-a/trusted-firmware-a_2.7.bb new file +15 -0
@@ -0,0 +1,15 @@ +require trusted-firmware-a.inc + +# TF-A v2.7 +SRCREV_tfa = "35f4c7295bafeb32c8bcbdfb6a3f2e74a57e732b" + +LIC_FILES_CHKSUM += "file://docs/license.rst;md5=b2c740efedc159745b9b31f88ff03dde" + +# mbed TLS v2.28.0 +SRC_URI_MBEDTLS = "git://github.com/ARMmbed/mbedtls.git;name=mbedtls;protocol=https;destsuffix=git/mbedtls;branch=mbedtls-2.28" +SRCREV_mbedtls = "8b3f26a5ac38d4fdccbc5c5366229f3e01dafcc0" + +LIC_FILES_CHKSUM_MBEDTLS = "file://mbedtls/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +# Disable by default +DEFAULT_PREFERENCE = "-1"
Signature · 1 line
2.17.1
PATCH 2/5 arm-bsp/scp-firmware: N1SDP trusted boot
In reply to [email protected]From: Adam Johnston <[email protected]>
This commit configures scp-firmware for TBBR bootflow as follows:
* SCP FW upgraded to 2.10 for the N1SDP only
* Updates SCP FW src to master
* BL31 replaced in the SCP firmware image with BL1
--- .../recipes-bsp/scp-firmware/scp-firmware-n1sdp.inc | 6 +++++- .../recipes-bsp/scp-firmware/scp-firmware_2.10.%.bbappend | 7 +++++++ .../recipes-bsp/scp-firmware/scp-firmware_2.9.%.bbappend | 1 - 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 meta-arm-bsp/recipes-bsp/scp-firmware/scp-firmware_2.10.%.bbappend
meta-arm-bsp/recipes-bsp/scp-firmware/scp-firmware-n1sdp.inc +5 -1
@@ -3,6 +3,10 @@ SCP_PLATFORM = "n1sdp" SCP_LOG_LEVEL = "INFO" +# master branch at n1sdp: Introduce trusted board boot +SRCREV = "3e4c34ceccc1c960eb3a4adaa922f2a0c6b36be3" +PV .= "+git${SRCPV}" + COMPATIBLE_MACHINE:n1sdp = "n1sdp" DEPENDS += "fiptool-native"
@@ -12,7 +16,7 @@ do_install:append() { fiptool \ create \ --scp-fw "${D}/firmware/scp_ramfw.bin" \ - --soc-fw "${RECIPE_SYSROOT}/firmware/bl31.bin" \ + --blob uuid=cfacc2c4-15e8-4668-82be-430a38fad705,file="${RECIPE_SYSROOT}/firmware/bl1.bin" \ "scp_fw.bin" # This UUID is FIP_UUID_MCP_BL2 in SCP-Firmware.
meta-arm-bsp/recipes-bsp/scp-firmware/scp-firmware_2.10.%.bbappend new file +7 -0
@@ -0,0 +1,7 @@ +# Include machine specific SCP configurations + +MACHINE_SCP_REQUIRE ?= "" + +MACHINE_SCP_REQUIRE:n1sdp = "scp-firmware-n1sdp.inc" + +require ${MACHINE_SCP_REQUIRE}
meta-arm-bsp/recipes-bsp/scp-firmware/scp-firmware_2.9.%.bbappend +0 -1
@@ -3,7 +3,6 @@ MACHINE_SCP_REQUIRE ?= "" MACHINE_SCP_REQUIRE:juno = "scp-firmware-juno.inc" -MACHINE_SCP_REQUIRE:n1sdp = "scp-firmware-n1sdp.inc" MACHINE_SCP_REQUIRE:sgi575 = "scp-firmware-sgi575.inc" MACHINE_SCP_REQUIRE:tc = "scp-firmware-tc.inc"
Signature · 1 line
2.17.1
PATCH 3/5 arm-bsp/sdcard-image-n1sdp: N1SDP trusted boot
In reply to [email protected]From: Adam Johnston <[email protected]>
This commit configures N1SDP firmware for TBBR bootflow as follows:
* uefi.bin replaced with with fip.bin
* load address adjusted for FIP image
--- .../recipes-bsp/images/sdcard-image-n1sdp_0.1.bb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
meta-arm-bsp/recipes-bsp/images/sdcard-image-n1sdp_0.1.bb +7 -2
@@ -27,8 +27,8 @@ prepare_package() { cp -av ${RECIPE_SYSROOT}/${FIRMWARE_DIR}/* ${PRIMARY_DIR} mkdir -p ${PRIMARY_DIR}/SOFTWARE/ - # Copy uefi binary - cp -v ${RECIPE_SYSROOT}/firmware/uefi.bin ${PRIMARY_DIR}/SOFTWARE/ + # Copy FIP binary + cp -v ${RECIPE_SYSROOT}/firmware/fip.bin ${PRIMARY_DIR}/SOFTWARE/ # Copy SOC binaries for f in ${SOC_BINARIES}; do
@@ -42,6 +42,11 @@ prepare_package() { sed -i -e 's|.*SOCCON: 0x1170.*PLATFORM_CTRL.*|SOCCON: 0x1170 0x00000100 ;SoC SCC PLATFORM_CTRL|' \ ${PRIMARY_DIR}/MB/HBI0316A/io_v123f.txt + # Update load address for trusted boot + sed -i -e '/^IMAGE4ADDRESS:/ s|0x60200000|0x64200000|' ${PRIMARY_DIR}/MB/HBI0316A/images.txt + sed -i -e '/^IMAGE4UPDATE:/ s|FORCE |SCP_AUTO|' ${PRIMARY_DIR}/MB/HBI0316A/images.txt + sed -i -e '/^IMAGE4FILE: \\SOFTWARE\\/s|uefi.bin|fip.bin |' ${PRIMARY_DIR}/MB/HBI0316A/images.txt + # Slave/Secondary cp -av ${RECIPE_SYSROOT}/${FIRMWARE_DIR}/* ${SECONDARY_DIR} mkdir -p ${SECONDARY_DIR}/SOFTWARE/
Signature · 1 line
2.17.1
PATCH 4/5 arm-bsp/edk2-firmware: Add NT_FW_CONFIG to N1SDP to fix aborts when accessing virtual memory
In reply to [email protected]From: Adam Johnston <[email protected]>
NT_FW_CONFIG DTB contains platform information passed by TF-A boot stage. This information is used for Virtual memory map generation during PEI phase and passed on to DXE phase as a HOB, where it is used in ConfigurationManagerDxe.
--- .../recipes-bsp/uefi/edk2-firmware-n1sdp.inc | 6 + .../edk2-platforms/add-nt-fw-config.patch | 474 ++++++++++++++++++ 2 files changed, 480 insertions(+) create mode 100644 meta-arm-bsp/recipes-bsp/uefi/files/edk2-platforms/add-nt-fw-config.patch
meta-arm-bsp/recipes-bsp/uefi/edk2-firmware-n1sdp.inc +6 -0
@@ -11,6 +11,12 @@ COMPATIBLE_MACHINE = "n1sdp" EFIDIR = "/EFI/BOOT" EFI_BOOT_IMAGE = "bootaa64.efi" +FILESEXTRAPATHS:prepend := "${THISDIR}/files/edk2-platforms:" + +SRC_URI:append = "\ + file://add-nt-fw-config.patch;patchdir=edk2-platforms \ +" + do_deploy:append() { EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g') printf 'FS2:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" > ${DEPLOYDIR}/startup.nsh
meta-arm-bsp/recipes-bsp/uefi/files/edk2-platforms/add-nt-fw-config.patch new file +474 -0
474 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 5/5 arm-bsp/sdcard-image-n1sdp: Fix N1SDP dependencies
In reply to [email protected]From: Adam Johnston <[email protected]>
When enabling trusted boot, the UEFI binary was replaced with a FIP image (which contains the UEFI binary), therefore the SD card image should depend on trusted-firmware-a rather than edk2-firmware.
--- meta-arm-bsp/recipes-bsp/images/sdcard-image-n1sdp_0.1.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta-arm-bsp/recipes-bsp/images/sdcard-image-n1sdp_0.1.bb +1 -1
@@ -2,7 +2,7 @@ SUMMARY = "Firmware image recipe for generating SD-Card artifacts." inherit deploy nopackages -DEPENDS = "edk2-firmware \ +DEPENDS = "trusted-firmware-a \ virtual/control-processor-firmware \ n1sdp-board-firmware"
Signature · 1 line
2.17.1
Jon Mason
AppliedQuoted 8 lines · On Wed, 27 Jul 2022 16:56:38 +0100, [email protected] wrote:
This patch re-configures the N1SDP for trusted boot, using the changes published by the Silicon Solutions team in N1SDP-2022.02.04 and up-streamed to trusted-firmware-a and scp-firmware.
arm-bsp/trusted-firmware-a: For N1SDP only, upgraded to 2.7.0 and configured for trusted boot
[...]
Applied, thanks!
[1/5] arm-bsp/trusted-firmware-a: N1SDP trusted boot
commit: d9c6ff98c316da14d225290471c586da824797a2
[2/5] arm-bsp/scp-firmware: N1SDP trusted boot
commit: 1e13b8b419d119a133882aa6db9d5ab17e4cb96c
[3/5] arm-bsp/sdcard-image-n1sdp: N1SDP trusted boot
commit: 01aa5431d66c1dbcd5d8f87de16f49af5ccbb9ca
[4/5] arm-bsp/edk2-firmware: Add NT_FW_CONFIG to N1SDP to fix aborts when accessing virtual memory
commit: 2b392ebd3cf92cf1f62b53a13774649ca6be11dd
[5/5] arm-bsp/sdcard-image-n1sdp: Fix N1SDP dependencies
commit: 6301b32aec4ff3b1c1545df6a0a5247a15491d14Best regards,
Signature · 1 line
Jon Mason <[email protected]>
Jon Mason
AppliedQuoted 8 lines · On Wed, 27 Jul 2022 16:56:38 +0100, [email protected] wrote:
This patch re-configures the N1SDP for trusted boot, using the changes published by the Silicon Solutions team in N1SDP-2022.02.04 and up-streamed to trusted-firmware-a and scp-firmware.
arm-bsp/trusted-firmware-a: For N1SDP only, upgraded to 2.7.0 and configured for trusted boot
[...]
Applied, thanks!
[1/5] arm-bsp/trusted-firmware-a: N1SDP trusted boot
commit: d9c6ff98c316da14d225290471c586da824797a2
[2/5] arm-bsp/scp-firmware: N1SDP trusted boot
commit: 1e13b8b419d119a133882aa6db9d5ab17e4cb96c
[3/5] arm-bsp/sdcard-image-n1sdp: N1SDP trusted boot
commit: 01aa5431d66c1dbcd5d8f87de16f49af5ccbb9ca
[4/5] arm-bsp/edk2-firmware: Add NT_FW_CONFIG to N1SDP to fix aborts when accessing virtual memory
commit: 2b392ebd3cf92cf1f62b53a13774649ca6be11dd
[5/5] arm-bsp/sdcard-image-n1sdp: Fix N1SDP dependencies
commit: 6301b32aec4ff3b1c1545df6a0a5247a15491d14Best regards,
Signature · 1 line
Jon Mason <[email protected]>
Jon Mason
AppliedQuoted 8 lines · On Wed, 27 Jul 2022 16:56:38 +0100, [email protected] wrote:
This patch re-configures the N1SDP for trusted boot, using the changes published by the Silicon Solutions team in N1SDP-2022.02.04 and up-streamed to trusted-firmware-a and scp-firmware.
arm-bsp/trusted-firmware-a: For N1SDP only, upgraded to 2.7.0 and configured for trusted boot
[...]
Applied, thanks!
[1/5] arm-bsp/trusted-firmware-a: N1SDP trusted boot
commit: d9c6ff98c316da14d225290471c586da824797a2
[2/5] arm-bsp/scp-firmware: N1SDP trusted boot
commit: 1e13b8b419d119a133882aa6db9d5ab17e4cb96c
[3/5] arm-bsp/sdcard-image-n1sdp: N1SDP trusted boot
commit: 01aa5431d66c1dbcd5d8f87de16f49af5ccbb9ca
[4/5] arm-bsp/edk2-firmware: Add NT_FW_CONFIG to N1SDP to fix aborts when accessing virtual memory
commit: 2b392ebd3cf92cf1f62b53a13774649ca6be11dd
[5/5] arm-bsp/sdcard-image-n1sdp: Fix N1SDP dependencies
commit: 6301b32aec4ff3b1c1545df6a0a5247a15491d14Best regards,
Signature · 1 line
Jon Mason <[email protected]>