diff options
author | Tim Wang <timwang@asrmicro.com> | 2016-07-18 15:56:53 +0800 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2016-09-22 14:25:50 +1000 |
commit | 874f40588d3eb7e406521117c6e24d5a3376a77e (patch) | |
tree | 07dde61a1be800cff7da07d8eada795936e11f42 /flattree.c | |
parent | 1ed45d40a137299671b8d0c924e87f9c080899d7 (diff) | |
download | dtc-874f40588d3eb7e406521117c6e24d5a3376a77e.tar.gz |
Implement the -a option to pad dtb aligned
There is one condition that need cat the dtb files
into one dtb.img which can support several boards
use same SoC platform.
And the original dtb file size is not aligned to any base.
This may cause "Synchronous Abort" when load from a unligned
address on some SoC machine, such as ARM.
So this patch implement the -a <aligned number> option to
pad zero at the end of dtb files and make the dtb size aligned
to <aligned number>.
Then, the aligned dtbs can cat together and load without "Synchronous
Abort".
Signed-off-by: Tim Wang <timwang@asrmicro.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'flattree.c')
-rw-r--r-- | flattree.c | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -398,15 +398,22 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version) */ if (minsize > 0) { padlen = minsize - fdt32_to_cpu(fdt.totalsize); - if ((padlen < 0) && (quiet < 1)) - fprintf(stderr, - "Warning: blob size %d >= minimum size %d\n", - fdt32_to_cpu(fdt.totalsize), minsize); + if (padlen < 0) { + padlen = 0; + if (quiet < 1) + fprintf(stderr, + "Warning: blob size %d >= minimum size %d\n", + fdt32_to_cpu(fdt.totalsize), minsize); + } } if (padsize > 0) padlen = padsize; + if (alignsize > 0) + padlen = ALIGN(fdt32_to_cpu(fdt.totalsize) + padlen, alignsize) + - fdt32_to_cpu(fdt.totalsize); + if (padlen > 0) { int tsize = fdt32_to_cpu(fdt.totalsize); tsize += padlen; @@ -572,6 +579,8 @@ void dt_to_asm(FILE *f, struct boot_info *bi, int version) if (padsize > 0) { fprintf(f, "\t.space\t%d, 0\n", padsize); } + if (alignsize > 0) + asm_emit_align(f, alignsize); emit_label(f, symprefix, "blob_abs_end"); data_free(strbuf); |