summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-08-18 07:04:46 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-08-22 10:52:19 +0200
commit867681db2efe997d3f5c3b1ba1bebb366a336110 (patch)
tree6fb10dc8025c623952746d02142a75042ac92d44 /arch
parent4794b2ccced53efaf2dc8d0fc1c70e71431d4daa (diff)
downloadbarebox-867681db2efe997d3f5c3b1ba1bebb366a336110.tar.gz
barebox-867681db2efe997d3f5c3b1ba1bebb366a336110.tar.xz
firmware: add external firmware PBL support
Normally, barebox embds firmware into the binary referencing it, which means that device tree blobs, RAM training code and e.g. TF-A for i.MX8M end up in the prebootloader, while, e.g. Freescale FMan microcode ends up in barebox proper. The only exception so far was barebox proper: When only the PBL fits in on-chip SRAM, barebox proper is chainloaded from the boot medium. To avoid TOCTOU attack, it's read fully into DRAM after setup and then a SHA256 is calculated and compared against the hash embedded in barebox PBL, which in a secure boot system would be trusted by virtue of the PBL as a whole being verified beforehand by the BootROM. Reuse this mechanism to support arbitrary firmware, which is now termed external firmware. Such firmware is placed beyond the piggydata (barebox proper) and only offset and hash are included in the prebootloader image. The new get_builtin_firmware_ext() is used to retrieve this external firmware after integrity verification with SHA256. This enables referencing firmware blobs from PBL that would bloat the size of the PBL beyond what can fit into on-chip SRAM, e.g. very big OP-TEE binaries. As users of get_builtin_firmware() didn't have to worry about TOCTOU so far, we panic when a firmware verification fails to ensure that we never load an OP-TEE that has been modified in-transit We can't include the OP-TEE binary in barebox proper, because we need to install it in EL3, but barebox proper on the i.MX8M runs as BL33 in a lower exception level. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220818050447.2072932-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/lib/pbl.lds.S7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/arm/lib/pbl.lds.S b/arch/arm/lib/pbl.lds.S
index e77b3220fc..44ad5b3353 100644
--- a/arch/arm/lib/pbl.lds.S
+++ b/arch/arm/lib/pbl.lds.S
@@ -101,6 +101,13 @@ SECTIONS
}
__piggydata_end = .;
+ . = ALIGN(4);
+ __pblext_start = .;
+ .pblext : {
+ *(.pblext.*)
+ }
+ __pblext_end = .;
+
.image_end : { KEEP(*(.__image_end)) }
pbl_image_size = . - BASE;