[PATCH 08/10] Use the correct ramdisk address

Matthew Garrett mjg59 at srcf.ucam.org
Sat Nov 23 20:55:07 CET 2024


From: Matthew Garrett <mgarrett at aurora.tech>

CONFIG_SYS_BOOT_RAMDISK_HIGH copies the initrd out of the FIT and into
correctly aligned RAM, but the addresses used for this are then discarded
by the x86 bootm code. Fix that.

Signed-off-by: Matthew Garrett <mgarrett at aurora.tech>
---

 arch/x86/lib/bootm.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index c4446b1f9c6..cabf18fccb7 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -72,6 +72,7 @@ int arch_fixup_memory_node(void *blob)
 /* Subcommand: PREP */
 static int boot_prep_linux(struct bootm_headers *images)
 {
+	ulong initrd_start, initrd_size;
 	char *cmd_line_dest = NULL;
 	struct legacy_img_hdr *hdr;
 	int is_zimage = 0;
@@ -134,10 +135,16 @@ static int boot_prep_linux(struct bootm_headers *images)
 		goto error;
 	}
 
+	if (IS_ENABLED(CONFIG_SYS_BOOT_RAMDISK_HIGH)) {
+		initrd_start = images->initrd_start;
+		initrd_size = images->initrd_end - images->initrd_start;
+	} else {
+		initrd_start = images->rd_start;
+		initrd_size = images->rd_end - images->rd_start;
+	}
 	printf("Setup at %#08lx\n", images->ep);
 	ret = setup_zimage((void *)images->ep, cmd_line_dest,
-			0, images->rd_start,
-			images->rd_end - images->rd_start, 0);
+			   0, initrd_start, initrd_size, 0);
 
 	if (ret) {
 		printf("## Setting up boot parameters failed ...\n");
-- 
2.47.0



More information about the U-Boot mailing list