mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: BAREBOX <barebox@lists.infradead.org>
Cc: Sascha Hauer <sascha@saschahauer.de>,
	"Claude Opus 4.6" <noreply@anthropic.com>
Subject: [PATCH 7/9] firmware: Add fwobj_uncompress() for decompressing firmware in PBL
Date: Mon, 16 Mar 2026 18:21:20 +0100	[thread overview]
Message-ID: <20260316-compressed-firmware-v1-7-d9712142881e@pengutronix.de> (raw)
In-Reply-To: <20260316-compressed-firmware-v1-0-d9712142881e@pengutronix.de>

From: Sascha Hauer <sascha@saschahauer.de>

Add fwobj_uncompress() which decompresses a firmware object into a
destination buffer. This pairs with get_builtin_firmware_compressed()
to provide a simple API for loading compressed firmware in PBL context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/firmware.h | 2 ++
 pbl/decomp.c       | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/include/firmware.h b/include/firmware.h
index 2f75ded82b..07651f1a93 100644
--- a/include/firmware.h
+++ b/include/firmware.h
@@ -121,6 +121,8 @@ struct fwobj {
 #define get_builtin_firmware_ext(name, base, fwobj)			\
 	__get_builtin_firmware(name, (long)base - (long)_text, fwobj)
 
+int fwobj_uncompress(struct fwobj *fwobj, void *dest);
+
 #define get_builtin_firmware_compressed(name, fwobj)			\
 	do {								\
 		extern char _fw_z_##name##_start[];			\
diff --git a/pbl/decomp.c b/pbl/decomp.c
index 532e9d460f..1539a6b67e 100644
--- a/pbl/decomp.c
+++ b/pbl/decomp.c
@@ -9,6 +9,7 @@
 #include <crypto/sha.h>
 #include <crypto/pbl-sha.h>
 #include <digest.h>
+#include <firmware.h>
 #include <asm/sections.h>
 #include <pbl.h>
 #include <debug_ll.h>
@@ -116,3 +117,9 @@ int pbl_dtbz_uncompress(void *dest, void *compressed_start, unsigned long len)
 	return decompress(compressed_start, len, NULL, NULL, dest, NULL,
 			  errorfn);
 }
+
+int fwobj_uncompress(struct fwobj *fwobj, void *dest)
+{
+	return decompress(fwobj->data, fwobj->size, NULL, NULL, dest, NULL,
+			  errorfn);
+}

-- 
2.47.3




  parent reply	other threads:[~2026-03-16 17:22 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 ` Sascha Hauer [this message]
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 ` [PATCH 9/9] ARM: Rockchip: Use compressed TF-A binary Sascha Hauer
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-7-d9712142881e@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=noreply@anthropic.com \
    --cc=sascha@saschahauer.de \
    /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