From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Subject: [PATCH 9/9] ARM: Rockchip: Use compressed TF-A binary
Date: Mon, 16 Mar 2026 18:21:22 +0100 [thread overview]
Message-ID: <20260316-compressed-firmware-v1-9-d9712142881e@pengutronix.de> (raw)
In-Reply-To: <20260316-compressed-firmware-v1-0-d9712142881e@pengutronix.de>
Rockchip images are often size constraint due to the ROM limiting the
maximum image size to 2MiB, at least when redundant copies on SD/eMMC
are desired. For this reason use the compressed variant of the TF-A
image.
FIXME: Uncompress address currently hardcoded.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-rockchip/atf.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-rockchip/atf.c b/arch/arm/mach-rockchip/atf.c
index 2ba7f074ce..3e0a14292b 100644
--- a/arch/arm/mach-rockchip/atf.c
+++ b/arch/arm/mach-rockchip/atf.c
@@ -39,15 +39,20 @@ static unsigned long load_elf64_image_phdr(struct fwobj *bl31)
{
const Elf64_Ehdr *ehdr; /* Elf header structure pointer */
const Elf64_Phdr *phdr; /* Program header structure pointer */
- int i;
+ int i, ret;
+ void *bl31_image = free_mem();
- ehdr = elf;
- phdr = elf + ehdr->e_phoff;
+ ret = fwobj_uncompress(bl31, bl31_image);
+ if (ret)
+ panic("Failed to uncompress TF-A\n");
+
+ ehdr = bl31_image;
+ phdr = bl31_image + ehdr->e_phoff;
/* Load each program header */
for (i = 0; i < ehdr->e_phnum; ++i) {
void *dst = (void *)(ulong)phdr->p_paddr;
- const void *src = elf + phdr->p_offset;
+ const void *src = bl31_image + phdr->p_offset;
pr_debug("Loading phdr %i to 0x%p (%lu bytes)\n",
i, dst, (ulong)phdr->p_filesz);
@@ -131,7 +136,7 @@ static struct fwobj bl32; /* OP-TEE in barebox image */
do { \
barebox_load_address = SOC##_BAREBOX_LOAD_ADDRESS; \
optee_load_address = SOC##_OPTEE_LOAD_ADDRESS; \
- get_builtin_firmware(atf_bin, &bl31); \
+ get_builtin_firmware_compressed(atf_bin, &bl31); \
if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP_OPTEE)) \
get_builtin_firmware_compressed(tee_bin, &bl32); \
} while (0)
@@ -141,7 +146,7 @@ static void rockchip_atf_load_bl31(void *fdt)
{
unsigned long bl31_ep;
- bl31_ep = load_elf64_image_phdr(bl31.data);
+ bl31_ep = load_elf64_image_phdr(&bl31);
if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP_OPTEE))
optee_load_address = rk_load_optee(optee_load_address, &bl32);
--
2.47.3
next prev parent reply other threads:[~2026-03-16 17:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-16 17:21 [PATCH 0/9] Firmware: support compressing firmware files Sascha Hauer
2026-03-16 17:21 ` [PATCH 1/9] ARM: socfpga: Drop unnecessary select USE_COMPRESSED_DTB Sascha Hauer
2026-03-16 17:21 ` [PATCH 2/9] ARM: radxa-rock5: Use compressed DTB Sascha Hauer
2026-03-16 17:21 ` [PATCH 3/9] ARM: Rockchip: Simplify retrieval of SoC specific addresses Sascha Hauer
2026-03-16 17:21 ` [PATCH 4/9] firmware: Move firmware assembly generation to scripts/gen-fw-s Sascha Hauer
2026-03-16 17:21 ` [PATCH 5/9] firmware: Use struct fwobj for get_builtin_firmware APIs Sascha Hauer
2026-03-16 17:21 ` [PATCH 6/9] firmware: Add compressed firmware symbols for PBL Sascha Hauer
2026-03-19 14:19 ` [PATCH] fixup! " Sascha Hauer
2026-03-20 8:54 ` Sascha Hauer
2026-03-16 17:21 ` [PATCH 7/9] firmware: Add fwobj_uncompress() for decompressing firmware in PBL Sascha Hauer
2026-03-16 17:21 ` [PATCH 8/9] ARM: Rockchip: Use compressed OP-TEE binary Sascha Hauer
2026-03-18 8:10 ` Sascha Hauer
2026-03-16 17:21 ` Sascha Hauer [this message]
2026-03-19 6:53 ` [PATCH 0/9] Firmware: support compressing firmware files Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260316-compressed-firmware-v1-9-d9712142881e@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox