Try to repair boot_hdr v1 entries

This commit is contained in:
topjohnwu 2018-12-04 03:30:43 -05:00
parent 5d3a8a5b1a
commit 08cd5b81d1
2 changed files with 6 additions and 0 deletions

View File

@ -440,6 +440,10 @@ void repack(const char* orig_image, const char* out_image) {
// Print new image info
boot.print_hdr();
// Try to fix the header
if (boot.header_version() && boot.header_size() == 0)
boot.header_size(sizeof(boot_img_hdr));
// Main header
memcpy(boot.map_addr + header_off, boot.hdr, boot.hdr_size());

View File

@ -207,6 +207,8 @@ static_cast<boot_img_hdr_v1 *>(hdr)->x)
hdr_set(recovery_dtbo_size, uint32_t);
hdr_get(recovery_dtbo_offset, uint32_t);
hdr_set(recovery_dtbo_offset, uint32_t);
hdr_get(header_size, uint32_t);
hdr_set(header_size, uint32_t);
uint32_t header_version() {
if (IS_PXA)