From: Dirk Brandewie <[email protected]> This patch forces the size of the DTB to be modulo 32 bytes. This is needed to support linking multiple DTB's into a single section in the image. GCC wants structures to be 32 byte aligned without this change DTB's after the first in the section may not be properly aligned so the flat tree parsing code will fall over.
Signed-off-by: Dirk Brandewie <[email protected]> --- scripts/dtc/flattree.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/scripts/dtc/flattree.c b/scripts/dtc/flattree.c index 76acd28..ccca797 100644 --- a/scripts/dtc/flattree.c +++ b/scripts/dtc/flattree.c @@ -358,6 +358,7 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version) struct data strbuf = empty_data; struct fdt_header fdt; int padlen = 0; + int align_size; for (i = 0; i < ARRAY_SIZE(version_table); i++) { if (version_table[i].version == version) @@ -395,6 +396,9 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version) fdt.totalsize = cpu_to_fdt32(tsize); } + align_size = ALIGN(fdt32_to_cpu(fdt.totalsize), 32); + fdt.totalsize = cpu_to_fdt32(align_size); + /* * Assemble the blob: start with the header, add with alignment * the reserve buffer, add the reserve map terminating zeroes, @@ -412,7 +416,7 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version) */ if (padlen > 0) blob = data_append_zeroes(blob, padlen); - + blob = data_append_align(blob, 32); fwrite(blob.val, blob.len, 1, f); if (ferror(f)) -- 1.7.2.3 _______________________________________________ devicetree-discuss mailing list [email protected] https://lists.ozlabs.org/listinfo/devicetree-discuss
