From: Kumar Gala Date: Fri, 5 Sep 2008 11:13:54 -0500 Subject: [U-Boot] [PATCH][for 1.3.5] Fix handling of mem reserves for ramdisk Message-ID: <1220631234-1051-1-git-send-email-galak@kernel.crashing.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 --- 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