Skip to content

Commit d398e9f

Browse files
committed
fill boot when not enough
1 parent 79ffdef commit d398e9f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

tools/bootimg.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ int repack_bootimg(const char *orig_boot_path,
705705
fread(&avb, sizeof(avb), 1, f_orig);
706706

707707
uint32_t header_ver = hdr.unused[0];
708-
if (header_ver == 0){tools_loge_exit("we don't support this device any more\n");}
708+
//if (header_ver == 0){tools_loge_exit("we don't support this device any more\n");}
709709
uint32_t page_size = (header_ver >= 3) ? 4096 : hdr.page_size;
710710
uint32_t fmt_size = (header_ver >= 3) ? hdr.kernel_addr : hdr.ramdisk_size;
711711

@@ -918,6 +918,7 @@ int repack_bootimg(const char *orig_boot_path,
918918
avb.data_size2 = XXH_swap32(avb_size);
919919
}
920920
if (rest_data_size > total_size - page_size - new_k_total_aligned){
921+
total_size = ALIGN(page_size + new_k_total_aligned + rest_data_size, page_size); // when rest data is larger than original, we need to expand the total size to fit it
921922
fwrite(rest_buf, 1, total_size - page_size - new_k_total_aligned -64, f_out);
922923
fwrite(&avb, sizeof(avb), 1, f_out);
923924
}else{

0 commit comments

Comments
 (0)