summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/bootm.c2
-rw-r--r--common/cmd_fdt.c9
-rw-r--r--common/fdt_support.c3
-rw-r--r--common/image-fdt.c2
4 files changed, 11 insertions, 5 deletions
diff --git a/common/bootm.c b/common/bootm.c
index 7ce9420fe0..ade859df1d 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -368,7 +368,7 @@ static int bootm_add_ignore_mpt_to_fdt(void *fdth)
ret = fdt_setprop(fdth, nodeoffset, "ignore_mpt", NULL, 0);
if (ret == -FDT_ERR_NOSPACE) {
- fdt_shrink_to_minimum(fdth);
+ fdt_shrink_to_minimum(fdth, 0);
ret = fdt_setprop(fdth, nodeoffset, "ignore_mpt", NULL, 0);
}
diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c
index 7a9dfb8137..441d3fd272 100644
--- a/common/cmd_fdt.c
+++ b/common/cmd_fdt.c
@@ -661,7 +661,12 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
#endif
/* resize the fdt */
else if (strncmp(argv[1], "re", 2) == 0) {
- fdt_shrink_to_minimum(working_fdt);
+ uint extrasize;
+ if (argc > 2)
+ extrasize = simple_strtoul(argv[2], NULL, 16);
+ else
+ extrasize = 0;
+ fdt_shrink_to_minimum(working_fdt, extrasize);
}
else {
/* Unrecognized command */
@@ -1055,7 +1060,7 @@ static char fdt_help_text[] =
"fdt systemsetup - Do system-specific set up\n"
#endif
"fdt move <fdt> <newaddr> <length> - Copy the fdt to <addr> and make it active\n"
- "fdt resize - Resize fdt to size + padding to 4k addr\n"
+ "fdt resize [<extrasize>] - Resize fdt to size + padding to 4k addr + some optinal <extrasize> if needed\n"
"fdt print <path> [<prop>] - Recursive print starting at <path>\n"
"fdt list <path> [<prop>] - Print one level starting at <path>\n"
"fdt get value <var> <path> <prop> - Get <property> and store in <var>\n"
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 5f28d9738a..f3e4a972af 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -567,7 +567,7 @@ void fdt_fixup_ethernet(void *fdt)
}
/* Resize the fdt to its actual size + a bit of padding */
-int fdt_shrink_to_minimum(void *blob)
+int fdt_shrink_to_minimum(void *blob, uint extrasize)
{
int i;
uint64_t addr, size;
@@ -595,6 +595,7 @@ int fdt_shrink_to_minimum(void *blob)
actualsize = fdt_off_dt_strings(blob) +
fdt_size_dt_strings(blob) + 5 * sizeof(struct fdt_reserve_entry);
+ actualsize += extrasize;
/* Make it so the fdt ends on a page boundary */
actualsize = ALIGN(actualsize + ((uintptr_t)blob & 0xfff), 0x1000);
actualsize = actualsize - ((uintptr_t)blob & 0xfff);
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 14ec22509a..0f126dc969 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -525,7 +525,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob,
lmb_free(lmb, (phys_addr_t)(u32)(uintptr_t)blob,
(phys_size_t)fdt_totalsize(blob));
- ret = fdt_shrink_to_minimum(blob);
+ ret = fdt_shrink_to_minimum(blob, 0);
if (ret < 0)
goto err;
of_size = ret;