diff options
author | Steffen Trumtrar <s.trumtrar@pengutronix.de> | 2012-04-18 11:09:20 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-04-18 20:38:24 +0200 |
commit | 030b5a1ba5bfb5cbbf8ff88f8880184b5fc76354 (patch) | |
tree | f2ae6412e877bbb979b4b3d3d9213b342c66adb2 /commands | |
parent | 89c2c5cff827b7ad65af9560e907395a7829fa68 (diff) | |
download | barebox-030b5a1ba5bfb5cbbf8ff88f8880184b5fc76354.tar.gz barebox-030b5a1ba5bfb5cbbf8ff88f8880184b5fc76354.tar.xz |
bootm: Align oftree
Arm needs 64-Bit alignment of the oftree as mentioned in the documentation
Documentation/arm/Booting.
Other architectures may need a bigger alignment so align to 4K.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r-- | commands/bootm.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/commands/bootm.c b/commands/bootm.c index 4f4cbb3ea9..c89a3cc7f0 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -150,7 +150,7 @@ static int bootm_open_initrd_uimage(struct image_data *data) static int bootm_open_oftree(struct image_data *data, char *oftree, int num) { enum filetype ft; - struct fdt_header *fdt; + struct fdt_header *fdt, *fixfdt; int ret; size_t size; @@ -201,21 +201,25 @@ static int bootm_open_oftree(struct image_data *data, char *oftree, int num) file_type_to_string(ft)); } - fdt = xrealloc(fdt, size + 0x8000); - ret = fdt_open_into(fdt, fdt, size + 0x8000); + fixfdt = xmemalign(4096, size + 0x8000); + memcpy(fixfdt, fdt, size); + + free(fdt); + + ret = fdt_open_into(fixfdt, fixfdt, size + 0x8000); if (ret) { printf("unable to parse %s\n", oftree); return -ENODEV; } - ret = of_fix_tree(fdt); + ret = of_fix_tree(fixfdt); if (ret) return ret; if (bootm_verbose(data) > 1) - fdt_print(fdt, "/"); + fdt_print(fixfdt, "/"); - data->oftree = fdt; + data->oftree = fixfdt; return ret; } |