mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-14 00:37:41 -04:00
Fix padding options
"Add an option to pad the blob that is generated" broke the padding support. We were updating the fdt header after writing it. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
This commit is contained in:
parent
c048102f5b
commit
80c72a81cf
1 changed files with 7 additions and 5 deletions
12
flattree.c
12
flattree.c
|
@ -399,6 +399,12 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
|
||||||
if (padsize > 0)
|
if (padsize > 0)
|
||||||
padlen = padsize;
|
padlen = padsize;
|
||||||
|
|
||||||
|
if (padlen > 0) {
|
||||||
|
int tsize = be32_to_cpu(fdt.totalsize);
|
||||||
|
tsize += padlen;
|
||||||
|
fdt.totalsize = cpu_to_be32(tsize);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Assemble the blob: start with the header, add with alignment
|
* Assemble the blob: start with the header, add with alignment
|
||||||
* the reserve buffer, add the reserve map terminating zeroes,
|
* the reserve buffer, add the reserve map terminating zeroes,
|
||||||
|
@ -414,12 +420,8 @@ void dt_to_blob(FILE *f, struct boot_info *bi, int version,
|
||||||
/*
|
/*
|
||||||
* If the user asked for more space than is used, pad out the blob.
|
* If the user asked for more space than is used, pad out the blob.
|
||||||
*/
|
*/
|
||||||
if (padlen > 0) {
|
if (padlen > 0)
|
||||||
int tsize = be32_to_cpu(fdt.totalsize);
|
|
||||||
tsize += padlen;
|
|
||||||
blob = data_append_zeroes(blob, padlen);
|
blob = data_append_zeroes(blob, padlen);
|
||||||
fdt.totalsize = cpu_to_be32(tsize);
|
|
||||||
}
|
|
||||||
|
|
||||||
fwrite(blob.val, blob.len, 1, f);
|
fwrite(blob.val, blob.len, 1, f);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue