android: update android image header to support new version

mainly to support android P.

Change-Id: I34a49e4eedcde06a9e40792c7c908737dc10b426
Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
This commit is contained in:
Joseph Chen 2018-07-25 16:22:38 +08:00 committed by Kever Yang
parent 9322063530
commit 09f4e561ac
2 changed files with 17 additions and 1 deletions

View File

@ -141,6 +141,9 @@ ulong android_image_get_end(const struct andr_img_hdr *hdr)
end += ALIGN(hdr->ramdisk_size, hdr->page_size);
end += ALIGN(hdr->second_size, hdr->page_size);
if (hdr->header_version >= 1)
end += ALIGN(hdr->recovery_dtbo_size, hdr->page_size);
return end;
}
@ -300,6 +303,7 @@ void android_print_contents(const struct andr_img_hdr *hdr)
/* os_version = ver << 11 | lvl */
u32 os_ver = hdr->os_version >> 11;
u32 os_lvl = hdr->os_version & ((1U << 11) - 1);
u32 header_version = hdr->header_version;
printf("%skernel size: %x\n", p, hdr->kernel_size);
printf("%skernel address: %x\n", p, hdr->kernel_addr);
@ -309,6 +313,7 @@ void android_print_contents(const struct andr_img_hdr *hdr)
printf("%ssecond address: %x\n", p, hdr->second_addr);
printf("%stags address: %x\n", p, hdr->tags_addr);
printf("%spage size: %x\n", p, hdr->page_size);
printf("%sheader_version: %x\n", p, header_version);
/* ver = A << 14 | B << 7 | C (7 bits for each of A, B, C)
* lvl = ((Y - 2000) & 127) << 4 | M (7 bits for Y, 4 bits for M) */
printf("%sos_version: %x (ver: %u.%u.%u, level: %u.%u)\n",
@ -317,5 +322,11 @@ void android_print_contents(const struct andr_img_hdr *hdr)
(os_lvl >> 4) + 2000, os_lvl & 0x0F);
printf("%sname: %s\n", p, hdr->name);
printf("%scmdline: %s\n", p, hdr->cmdline);
if (header_version >= 1) {
printf("%srecovery dtbo size: %x\n", p, hdr->recovery_dtbo_size);
printf("%srecovery dtbo offset: %llx\n", p, hdr->recovery_dtbo_offset);
printf("%sheader size: %x\n", p, hdr->header_size);
}
}
#endif

View File

@ -34,7 +34,8 @@ struct andr_img_hdr {
u32 tags_addr; /* physical addr for kernel tags */
u32 page_size; /* flash page size we assume */
u32 unused; /* reserved for future expansion: MUST be 0 */
u32 header_version;
/* operating system version and security patch level; for
* version "A.B.C" and patch level "Y-M-D":
@ -52,6 +53,10 @@ struct andr_img_hdr {
/* Supplemental command line data; kept here to maintain
* binary compatibility with older versions of mkbootimg */
char extra_cmdline[ANDR_BOOT_EXTRA_ARGS_SIZE];
uint32_t recovery_dtbo_size; /* size of recovery dtbo image */
uint64_t recovery_dtbo_offset; /* offset in boot image */
uint32_t header_size; /* size of boot image header in bytes */
} __attribute__((packed));
/*