cbfstool: Don't patch cbfs_file->len, it's already set correctly
->len used to be set to the file data length plus the size of the padding used for the cbfs_file header. This isn't the case anymore, so no patching of this field is necessary anymore. ->offset still needs to be patched in that case because its final value can only be determined when the file's actual location is known. Change-Id: I1037885f81b4ed3b68898dd7d0e515cf7a9c90a8 Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Reviewed-on: http://review.coreboot.org/11322 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
bc39690900
commit
7a33b53dc0
|
@ -487,15 +487,18 @@ static int cbfs_add_entry_at(struct cbfs_image *image,
|
||||||
addr = cbfs_get_entry_addr(image, entry);
|
addr = cbfs_get_entry_addr(image, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
len = size + (content_offset - addr - header_size);
|
len = content_offset - addr - header_size;
|
||||||
memcpy(entry, header_data, header_size);
|
memcpy(entry, header_data, header_size);
|
||||||
if (len != size) {
|
if (len != 0) {
|
||||||
|
/* the header moved backwards a bit to accomodate cbfs_file
|
||||||
|
* alignment requirements, so patch up ->offset to still point
|
||||||
|
* to file data.
|
||||||
|
*/
|
||||||
DEBUG("|..|header|content|... <use offset to create entry>\n");
|
DEBUG("|..|header|content|... <use offset to create entry>\n");
|
||||||
DEBUG("before: offset=0x%x, len=0x%x\n",
|
DEBUG("before: offset=0x%x, len=0x%x\n",
|
||||||
ntohl(entry->offset), ntohl(entry->len));
|
ntohl(entry->offset), ntohl(entry->len));
|
||||||
// TODO reset expanded name buffer to 0xFF.
|
// TODO reset expanded name buffer to 0xFF.
|
||||||
entry->offset = htonl(ntohl(entry->offset) + (len - size));
|
entry->offset = htonl(ntohl(entry->offset) + len);
|
||||||
entry->len = htonl(size);
|
|
||||||
DEBUG("after: offset=0x%x, len=0x%x\n",
|
DEBUG("after: offset=0x%x, len=0x%x\n",
|
||||||
ntohl(entry->offset), ntohl(entry->len));
|
ntohl(entry->offset), ntohl(entry->len));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue