Skip to contentSkip to conversation

Fix handling of mem reserves for ramdisk

PATCH New Kumar Gala 2 participants 2 messages Sep 5, 2008 – Sep 6, 2008

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 Fix handling of mem reserves for ramdisk

When we call fdt_chosen in bootm we get a dummy mem reserve added for the ramdisk location before its relocated. We need to delete that mem reserve before we call fdt_initrd() for the final fixup.

---
 lib_ppc/bootm.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
lib_ppc/bootm.c +15 -1
index 348421f..c801021 100644
@@ -180,8 +180,22 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 
 #if defined(CONFIG_OF_LIBFDT)
 	/* fixup the initrd now that we know where it should be */
-	if ((of_flat_tree) && (initrd_start && initrd_end))
+	if ((of_flat_tree) && (initrd_start && initrd_end)) {
+                uint64_t addr, size;
+                int  total = fdt_num_mem_rsv(of_flat_tree);
+                int  j;
+
+                /* The call to fdt_chosen created a dummy mem rsv, delete it */
+                for (j = 0; j < total; j++) {
+                        fdt_get_mem_rsv(of_flat_tree, j, &addr, &size);
+                        if (addr == images->rd_start) {
+                                fdt_del_mem_rsv(of_flat_tree, j);
+                                break;
+                        }
+                }
+
 		fdt_initrd(of_flat_tree, initrd_start, initrd_end, 1);
+	}
 #endif
 	debug ("## Transferring control to Linux (at address %08lx) ...\n",
 		(ulong)kernel);
Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 1/1 Fix handling of mem reserves for ramdisk

Dear Kumar Gala,

Quoted 3 lines · In message <[email protected]> you…

When we call fdt_chosen in bootm we get a dummy mem reserve added for the ramdisk location before its relocated. We need to delete that mem reserve before we call fdt_initrd() for the final fixup.

There will be no such thing as a release 1.3.5; it will be callsed 2008-10 or so.

And I would like to see a reply to Heiko's (IMHO perfectly valid)
question: why do we add a memory reservation just so we have to bother later to remove it again?

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Substitute "damn" every time you're inclined to write "very"; your
editor will delete it and the writing will be just as it should be.
                - Mark Twain