]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
fdt: Fix fdt padding issue for initrd mem_rsv
authorKumar Gala <galak@kernel.crashing.org>
Thu, 22 Oct 2009 04:29:51 +0000 (23:29 -0500)
committerWolfgang Denk <wd@denx.de>
Sat, 24 Oct 2009 20:39:51 +0000 (22:39 +0200)
Its possible that we end up with a device tree that happens to be a
particular size that after we call fdt_resize() we don't have any
space left for the initrd mem_rsv.

Fix this be adding a second mem_rsv into the size calculation.  We
had one to cover the fdt itself and we have the potential of adding
a second for the initrd.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Gerald Van Baren <vanbaren@cideas.com>
common/fdt_support.c

index 40ff00a154454ca9a57a09311589fd72c45a34e5..9adaeb3db78cd55b3238682c795dbcbfc70a27e8 100644 (file)
@@ -604,10 +604,11 @@ int fdt_resize(void *blob)
 
        /*
         * Calculate the actual size of the fdt
-        * plus the size needed for fdt_add_mem_rsv
+        * plus the size needed for two fdt_add_mem_rsv, one
+        * for the fdt itself and one for a possible initrd
         */
        actualsize = fdt_off_dt_strings(blob) +
-               fdt_size_dt_strings(blob) + sizeof(struct fdt_reserve_entry);
+               fdt_size_dt_strings(blob) + 2*sizeof(struct fdt_reserve_entry);
 
        /* Make it so the fdt ends on a page boundary */
        actualsize = ALIGN(actualsize + ((uint)blob & 0xfff), 0x1000);