aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorHannes Schmelzer <hannes.schmelzer@br-automation.com>2016-09-20 18:10:43 +0200
committerSimon Glass <sjg@chromium.org>2016-10-13 13:54:10 -0600
commitef47683646516002694729986d19713e49b903e3 (patch)
treebcc15aaf0aba47b52029e4b9595dabfb5e5ed4b1 /common
parentc69f6d04ec66433f2360490a5cd0263c83aab18f (diff)
downloadu-boot-ef47683646516002694729986d19713e49b903e3.zip
u-boot-ef47683646516002694729986d19713e49b903e3.tar.gz
u-boot-ef47683646516002694729986d19713e49b903e3.tar.bz2
cmd/fdt: add possibilty to have 'extrasize' on fdt resize
Sometimes devicetree nodes and or properties are added out of the u-boot console, maybe through some script or manual interaction. The devicetree as loaded or embedded is quite small, so the devicetree has to be resized to take up those new nodes/properties. In original the devicetree was only extended by effective 4 * add_mem_rsv. With this commit we can add an argument to the "fdt resize" command, which takes the extrasize to be added. Signed-off-by: Hannes Schmelzer <hannes.schmelzer@br-automation.com> Signed-off-by: Hannes Schmelzer <oe5hpm@oevsv.at> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c3
-rw-r--r--common/image-fdt.c2
2 files changed, 3 insertions, 2 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 2020586..0609470 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -523,7 +523,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;
@@ -551,6 +551,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 3d23608..5454227 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -503,7 +503,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;