* [PATCH 0/4] ARM: rockchip: add support for signed images
@ 2025-08-20 10:16 Michael Tretter
2025-08-20 10:16 ` [PATCH 1/4] filetype: detect Rockchip " Michael Tretter
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Michael Tretter @ 2025-08-20 10:16 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter
The Rockchip signed image has the same header format as the unsigned
image, but uses a different magic.
In order to be able do boot and update signed images, barebox has to
accept the magic of the signed images.
Extend the bootm and bbu handlers to accept signed images.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
Michael Tretter (4):
filetype: detect Rockchip signed images
ARM: rockchip: bbu: accept signed images
ARM: rockchip: bootm: don't propagate error from register_image_handler
ARM: rockchip: bootm: accept signed images
arch/arm/mach-rockchip/bbu.c | 8 ++++----
arch/arm/mach-rockchip/bootm.c | 11 ++++++++++-
common/filetype.c | 4 ++++
include/filetype.h | 1 +
4 files changed, 19 insertions(+), 5 deletions(-)
---
base-commit: c23f4202a0abd964a5d0a2ac7b1e7bcf28a1d687
change-id: 20250820-rkimage-signed-c5278283d49b
Best regards,
--
Michael Tretter <m.tretter@pengutronix.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] filetype: detect Rockchip signed images
2025-08-20 10:16 [PATCH 0/4] ARM: rockchip: add support for signed images Michael Tretter
@ 2025-08-20 10:16 ` Michael Tretter
2025-08-20 10:16 ` [PATCH 2/4] ARM: rockchip: bbu: accept " Michael Tretter
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michael Tretter @ 2025-08-20 10:16 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter
Rockchip signed images use the RKSS magic instead of the RKNS magic.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
common/filetype.c | 4 ++++
include/filetype.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index 019f34811103ac66dae05e8c09b15fc061602eb8..eb397a175cb63df06e4426d2b99e4fde360c5b11 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -85,6 +85,8 @@ static const struct filetype_str filetype_str[] = {
[filetype_rockchip_rkns_image] = { "Rockchip boot image", "rk-image" },
[filetype_fip] = { "TF-A Firmware Image Package", "fip" },
[filetype_zstd_compressed] = { "ZSTD compressed", "zstd" },
+ [filetype_rockchip_rkss_image] = { "Rockchip signed boot image",
+ "rk-image" },
};
static const char *file_type_to_nr_string(enum filetype f)
@@ -385,6 +387,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (strncmp(buf8, "RKNS", 4) == 0)
return filetype_rockchip_rkns_image;
+ if (strncmp(buf8, "RKSS", 4) == 0)
+ return filetype_rockchip_rkss_image;
if (le32_to_cpu(buf[0]) == le32_to_cpu(0xaa640001))
return filetype_fip;
diff --git a/include/filetype.h b/include/filetype.h
index e66237878615ecf039e12ac68055000b60fc13a9..6f4a103df3040ef259660d06ca878f72e2245c12 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -66,6 +66,7 @@ enum filetype {
filetype_qemu_fw_cfg,
filetype_nxp_fspi_image,
filetype_zstd_compressed,
+ filetype_rockchip_rkss_image,
filetype_max,
};
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] ARM: rockchip: bbu: accept signed images
2025-08-20 10:16 [PATCH 0/4] ARM: rockchip: add support for signed images Michael Tretter
2025-08-20 10:16 ` [PATCH 1/4] filetype: detect Rockchip " Michael Tretter
@ 2025-08-20 10:16 ` Michael Tretter
2025-08-20 10:16 ` [PATCH 3/4] ARM: rockchip: bootm: don't propagate error from register_image_handler Michael Tretter
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Michael Tretter @ 2025-08-20 10:16 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter
Accept Rockchip signed images in the update handler.
This is necessary to be able to use the update handler to flash a signed
image to an SD card or eMMC.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
arch/arm/mach-rockchip/bbu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-rockchip/bbu.c b/arch/arm/mach-rockchip/bbu.c
index b4d2a5280fab9f8bf6357948f2188afcb8cc89a5..2067af7b1d231e00ec436d50686cb252e9c96dbd 100644
--- a/arch/arm/mach-rockchip/bbu.c
+++ b/arch/arm/mach-rockchip/bbu.c
@@ -46,10 +46,10 @@ static int rockchip_bbu_mmc_handler(struct bbu_handler *handler,
struct cdev *cdev;
filetype = file_detect_type(data->image, data->len);
- if (filetype != filetype_rockchip_rkns_image) {
- if (!bbu_force(data, "incorrect image type. Expected: %s, got %s",
- file_type_to_string(filetype_rockchip_rkns_image),
- file_type_to_string(filetype)))
+ if (filetype != filetype_rockchip_rkns_image &&
+ filetype != filetype_rockchip_rkss_image) {
+ if (!bbu_force(data, "incorrect image type. Got %s",
+ file_type_to_string(filetype)))
return -EINVAL;
}
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/4] ARM: rockchip: bootm: don't propagate error from register_image_handler
2025-08-20 10:16 [PATCH 0/4] ARM: rockchip: add support for signed images Michael Tretter
2025-08-20 10:16 ` [PATCH 1/4] filetype: detect Rockchip " Michael Tretter
2025-08-20 10:16 ` [PATCH 2/4] ARM: rockchip: bbu: accept " Michael Tretter
@ 2025-08-20 10:16 ` Michael Tretter
2025-08-20 10:17 ` [PATCH 4/4] ARM: rockchip: bootm: accept signed images Michael Tretter
2025-08-20 12:30 ` [PATCH 0/4] ARM: rockchip: add support for " Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Michael Tretter @ 2025-08-20 10:16 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter
register_image_handler() always returns 0 and never fails.
Make this obvious by not propagating the return code from
register_image_handler() but always returning 0 in
rockchip_register_barebox_image_handler().
This is a preparation for adding more image handlers for Rockchip.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
arch/arm/mach-rockchip/bootm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/bootm.c b/arch/arm/mach-rockchip/bootm.c
index 6f4aa278087639cf2088c4e0f83929f7c2b59db9..097b0af7d8ba29a37e50dcb0f7d823c0456d1020 100644
--- a/arch/arm/mach-rockchip/bootm.c
+++ b/arch/arm/mach-rockchip/bootm.c
@@ -118,6 +118,8 @@ static int rockchip_register_barebox_image_handler(void)
if (rockchip_soc() < 0)
return 0;
- return register_image_handler(&image_handler_rkns_barebox_image);
+ register_image_handler(&image_handler_rkns_barebox_image);
+
+ return 0;
}
late_initcall(rockchip_register_barebox_image_handler);
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 4/4] ARM: rockchip: bootm: accept signed images
2025-08-20 10:16 [PATCH 0/4] ARM: rockchip: add support for signed images Michael Tretter
` (2 preceding siblings ...)
2025-08-20 10:16 ` [PATCH 3/4] ARM: rockchip: bootm: don't propagate error from register_image_handler Michael Tretter
@ 2025-08-20 10:17 ` Michael Tretter
2025-08-20 12:30 ` [PATCH 0/4] ARM: rockchip: add support for " Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Michael Tretter @ 2025-08-20 10:17 UTC (permalink / raw)
To: Sascha Hauer, BAREBOX; +Cc: Michael Tretter
Add an image handler for signed Rockchip images.
Signed image can be handled like unsigned images. Eventually barebox may
perform additional checks on the signed image, e.g. that the image is
actually signed and the signature is valid. For now, simply accept and
boot signed images.
Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
arch/arm/mach-rockchip/bootm.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/mach-rockchip/bootm.c b/arch/arm/mach-rockchip/bootm.c
index 097b0af7d8ba29a37e50dcb0f7d823c0456d1020..ff3d9a2db3a0462365f3ccd4e09f178b74903244 100644
--- a/arch/arm/mach-rockchip/bootm.c
+++ b/arch/arm/mach-rockchip/bootm.c
@@ -113,12 +113,19 @@ static struct image_handler image_handler_rkns_barebox_image = {
.filetype = filetype_rockchip_rkns_image,
};
+static struct image_handler image_handler_rkss_barebox_image = {
+ .name = "Rockchip RKSS barebox image",
+ .bootm = do_bootm_rkns_barebox_image,
+ .filetype = filetype_rockchip_rkss_image,
+};
+
static int rockchip_register_barebox_image_handler(void)
{
if (rockchip_soc() < 0)
return 0;
register_image_handler(&image_handler_rkns_barebox_image);
+ register_image_handler(&image_handler_rkss_barebox_image);
return 0;
}
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] ARM: rockchip: add support for signed images
2025-08-20 10:16 [PATCH 0/4] ARM: rockchip: add support for signed images Michael Tretter
` (3 preceding siblings ...)
2025-08-20 10:17 ` [PATCH 4/4] ARM: rockchip: bootm: accept signed images Michael Tretter
@ 2025-08-20 12:30 ` Sascha Hauer
4 siblings, 0 replies; 6+ messages in thread
From: Sascha Hauer @ 2025-08-20 12:30 UTC (permalink / raw)
To: BAREBOX, Michael Tretter
On Wed, 20 Aug 2025 12:16:56 +0200, Michael Tretter wrote:
> The Rockchip signed image has the same header format as the unsigned
> image, but uses a different magic.
>
> In order to be able do boot and update signed images, barebox has to
> accept the magic of the signed images.
>
> Extend the bootm and bbu handlers to accept signed images.
>
> [...]
Applied, thanks!
[1/4] filetype: detect Rockchip signed images
https://git.pengutronix.de/cgit/barebox/commit/?id=82d6bc770840 (link may not be stable)
[2/4] ARM: rockchip: bbu: accept signed images
https://git.pengutronix.de/cgit/barebox/commit/?id=7837c6b1a9cd (link may not be stable)
[3/4] ARM: rockchip: bootm: don't propagate error from register_image_handler
https://git.pengutronix.de/cgit/barebox/commit/?id=5ba734b8fb15 (link may not be stable)
[4/4] ARM: rockchip: bootm: accept signed images
https://git.pengutronix.de/cgit/barebox/commit/?id=87b9c0e8ff8a (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-08-20 12:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-08-20 10:16 [PATCH 0/4] ARM: rockchip: add support for signed images Michael Tretter
2025-08-20 10:16 ` [PATCH 1/4] filetype: detect Rockchip " Michael Tretter
2025-08-20 10:16 ` [PATCH 2/4] ARM: rockchip: bbu: accept " Michael Tretter
2025-08-20 10:16 ` [PATCH 3/4] ARM: rockchip: bootm: don't propagate error from register_image_handler Michael Tretter
2025-08-20 10:17 ` [PATCH 4/4] ARM: rockchip: bootm: accept signed images Michael Tretter
2025-08-20 12:30 ` [PATCH 0/4] ARM: rockchip: add support for " Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox