openwrt-pf/package/boot/uboot-rockchip/patches/108-03-rockchip-mkimage-Print-boot0-and-boot1-parameters.patch
Ryan Leung 54e47e56c2 uboot-rockchip: fix boot from SD card for rk3576
Apply pending U-Boot patches so that Rockchip RK3576 devices can boot from SD card. The problem:
"The BootROM on RK3576 has an issue loading boot images from an SD-card. This issue can be worked
around by injecting an initial boot image before TPL…and return to BootROM to load next image, TPL"

Compilation of the initial boot image has been added to the U-Boot build recipe.

Tested on FriendlyELEC NanoPi M5

Signed-off-by: Ryan Leung <untilscour@protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/23008
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-05-14 17:52:56 +02:00

68 lines
2 KiB
Diff

From 83326e18d15be1ac9b7daf7b472d0bcb8074da2b Mon Sep 17 00:00:00 2001
From: Jonas Karlman <jonas@kwiboo.se>
Date: Wed, 29 Jan 2025 22:36:29 +0000
Subject: [PATCH 3/7] rockchip: mkimage: Print boot0 and boot1 parameters
The v2 image format embeds boot0 and boot1 parameters, the vendor tool
boot_merger may write these parameters based on the rkboot miniall.ini
files.
E.g. a RK3576 boot image may contain a boot1 parameter that signals
BootROM or vendor blobs to use 1 GHz instead of the regular 24 MHz rate
for the high precision timer.
Add support for printing boot0 and boot1 parameters, e.g.:
> tools/mkimage -l rk3576_idblock_v1.09.107.img
Rockchip Boot Image (v2)
Boot1 2: 0x100
Image 1: 4096 @ 0x1000
- Load address: 0x3ffc0000
Image 2: 77824 @ 0x2000
- Load address: 0x3ff81000
Image 3: 262144 @ 0x15000
Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
---
--- a/tools/rkcommon.c
+++ b/tools/rkcommon.c
@@ -62,6 +62,8 @@ struct image_entry {
* @boot_flag: [3:0] hash type (0:none, 1:sha256, 2:sha512)
* @images: images
* @hash: hash or signature for header info
+ *
+ * Other fields are not used by U-Boot
*/
struct header0_info_v2 {
uint32_t magic;
@@ -69,7 +71,9 @@ struct header0_info_v2 {
uint16_t size;
uint16_t num_images;
uint32_t boot_flag;
- uint8_t reserved1[104];
+ uint8_t reserved1[32];
+ uint32_t boot0_param[10];
+ uint32_t boot1_param[8];
struct image_entry images[4];
uint8_t reserved2[1064];
uint8_t hash[512];
@@ -509,6 +513,18 @@ static void rkcommon_print_header_v2(con
printf("Rockchip Boot Image (v2)\n");
+ for (i = 0; i < ARRAY_SIZE(hdr->boot0_param); i++) {
+ val = le32_to_cpu(hdr->boot0_param[i]);
+ if (val)
+ printf("Boot0 %d: 0x%x\n", i, val);
+ }
+
+ for (i = 0; i < ARRAY_SIZE(hdr->boot1_param); i++) {
+ val = le32_to_cpu(hdr->boot1_param[i]);
+ if (val)
+ printf("Boot1 %d: 0x%x\n", i, val);
+ }
+
for (i = 0; i < le16_to_cpu(hdr->num_images); i++) {
printf("Image %u: %u @ 0x%x\n",
le32_to_cpu(hdr->images[i].counter),