9
0
Fork 0

bootm: Do not cross 1MiB sections for the devicetree

ARM Linux only maps a single 1MiB section for the devicetree. This has
a 1Mib alignment, so we are not allowed to cross such a boundary. Align
the devicetree to the next power of two so that this never happens.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2012-11-01 12:42:40 +01:00
parent da7d19b9d8
commit b8d7c3a95c
1 changed files with 9 additions and 1 deletions

View File

@ -141,6 +141,7 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
struct fdt_header *fdt, *fixfdt;
int ret;
size_t size;
unsigned int align;
if (bootm_verbose(data))
printf("Loading oftree from '%s'\n", oftree);
@ -189,7 +190,14 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
file_type_to_string(ft));
}
fixfdt = xmemalign(4096, size + OFTREE_SIZE_INCREASE);
/*
* ARM Linux uses a single 1MiB section (with 1MiB alignment)
* for mapping the devicetree, so we are not allowed to cross
* 1MiB boundaries.
*/
align = 1 << fls(size + OFTREE_SIZE_INCREASE - 1);
fixfdt = xmemalign(align, size + OFTREE_SIZE_INCREASE);
memcpy(fixfdt, fdt, size);