[U-Boot] [PATCH] image-fdt: reserve lmb for fdt

Andy Yan andy.yan at rock-chips.com
Tue Aug 7 11:44:06 UTC 2018


Memory region for fdt should be reserved, or they
may be allocated by other module via lmb_alloc.
Then the fdt data will be destroy.

We found a case on a board with 64MB DRAM like bellow:

No ethernet found.
Hit any key to stop autoboot:  0
ANDROID: reboot reason: "recovery"
FDT load addr 0x10f00000 size 41 KiB
Booting kernel at 0x2008000 with fdt at 2c8ac00...

lmb_add base:0x58000 size:0x3fa8000
lmb_add base:0x0 size:0x0
lmb_reserve base:0x34ca2a0 size:0xb35d60
  Booting Android Image at 0x02008000 ...
Kernel load addr 0x02008800 size 3808 KiB
RAM disk load addr 0x11000000 size 9000 KiB
*  fdt: cmdline image address = 0x02c8ac00
  Checking for 'FDT'/'FDT Image' at 02c8ac00
*  fdt: raw FDT blob
   Flattened Device Tree blob at 02c8ac00
   Booting using the fdt blob at 0x2c8ac00
   of_flat_tree at 0x02c8ac00 size 0x00009d6d
   XIP Kernel Image ... OK
do_bootm_states reserve: 0x2008800 -- 0x3b7c30
lmb_reserve base:0x2008800 size:0x3b7c30
no initrd_high
env_get_bootm_size size:66748416(0x3fa8000) tmp:360448(0x58000)
start:360448(0x58000)
   initrd_high = 0x03fa8000, copy_to_ram = 1
   Loading Ramdisk to 02c00000, end 034c9d09 ... OK
ERROR: image is not a fdt - must RESET the board to recover.
FDT creation failed! hanging...### ERROR ### Please RESET the board ###

Signed-off-by: Andy Yan <andy.yan at rock-chips.com>
---

 common/image-fdt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/image-fdt.c b/common/image-fdt.c
index 9b41f16248..56f6d7e26b 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -422,6 +422,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
 
 	*of_flat_tree = fdt_blob;
 	*of_size = fdt_totalsize(fdt_blob);
+	lmb_reserve(&images->lmb, (ulong)*of_flat_tree, *of_size);
 	debug("   of_flat_tree at 0x%08lx size 0x%08lx\n",
 	      (ulong)*of_flat_tree, *of_size);
 
-- 
2.17.1




More information about the U-Boot mailing list