summaryrefslogtreecommitdiff
path: root/common/fdt_support.c
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2009-10-21 23:29:51 -0500
committerWolfgang Denk <wd@denx.de>2009-10-24 22:39:51 +0200
commitd535a493004fb701f131b132402a7704f9c9342d (patch)
tree72e423232c5b97807e32a97f614f1e25389f53e9 /common/fdt_support.c
parent0ac59d0c0718ccdc7f8184668ec5c4f48c1987a2 (diff)
downloadu-boot-imx-d535a493004fb701f131b132402a7704f9c9342d.zip
u-boot-imx-d535a493004fb701f131b132402a7704f9c9342d.tar.gz
u-boot-imx-d535a493004fb701f131b132402a7704f9c9342d.tar.bz2
fdt: Fix fdt padding issue for initrd mem_rsv
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>
Diffstat (limited to 'common/fdt_support.c')
-rw-r--r--common/fdt_support.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 40ff00a..9adaeb3 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -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);