[U-Boot] [PATCH] fdt_resize(): Expand to next page boundary independent of offset

Peter Korsgaard jacmet at sunsite.dk
Wed Oct 22 14:30:31 CEST 2008


fdt_resize() adjusted the fdt totalsize so the fdt would end on a
page boundary in memory - E.G. the amount of padding depended on
the location of the fdt (offset within page).

This doesn't work very good with multi file images where the fdt
is located after the kernel and hence on a more-or-less random
offset within a page.

Instead, simply pad fdt to the next page boundary.

For the common case of fdt at offset 0 within a page, the same amount
of padding as before is added.

Signed-off-by: Peter Korsgaard <jacmet at sunsite.dk>
---
 common/fdt_support.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 8ceeb0f..12aebac 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -579,9 +579,8 @@ int fdt_resize(void *blob)
 	actualsize = fdt_off_dt_strings(blob) +
 		fdt_size_dt_strings(blob);
 
-	/* Make it so the fdt ends on a page boundary */
+	/* Expand to next page boundary */
 	actualsize = ALIGN(actualsize, 0x1000);
-	actualsize = actualsize - ((uint)blob & 0xfff);
 
 	/* Change the fdt header to reflect the correct size */
 	fdt_set_totalsize(blob, actualsize);
-- 
1.5.6.5



More information about the U-Boot mailing list