[U-Boot] [PATCH][for 1.3.5] Fix handling of mem reserves for ramdisk

Kumar Gala galak at kernel.crashing.org
Fri Sep 5 18:13:54 CEST 2008


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.

Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
 lib_ppc/bootm.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 348421f..c801021 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -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);
-- 
1.5.5.1



More information about the U-Boot mailing list