diff options
author | Tom Rini <trini@konsulko.com> | 2019-07-24 14:15:51 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-07-24 14:15:51 -0400 |
commit | a9aa4c5700c68c070d63a391b51ea8d341b6e8a6 (patch) | |
tree | 974a824402b489cfec95f2ca8ec5bd9fef71a8bc /common/image-android.c | |
parent | ef783259d6a558d31385039fa0def211fa7ad032 (diff) | |
parent | e21e3ffdd18b88a12d98f6ae985fd5d334b9cec9 (diff) |
Merge branch '2019-07-24-master-imports'
- Various Android related changes including A/B update and BCB updates
- Assorted minor fixes
Diffstat (limited to 'common/image-android.c')
-rw-r--r-- | common/image-android.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/common/image-android.c b/common/image-android.c index 8b0f6b3b8b..6c9568a655 100644 --- a/common/image-android.c +++ b/common/image-android.c @@ -52,6 +52,8 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, ulong *os_data, ulong *os_len) { u32 kernel_addr = android_image_get_kernel_addr(hdr); + const struct image_header *ihdr = (const struct image_header *) + ((uintptr_t)hdr + hdr->page_size); /* * Not all Android tools use the id field for signing the image with @@ -93,11 +95,19 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify, env_set("bootargs", newbootargs); if (os_data) { - *os_data = (ulong)hdr; - *os_data += hdr->page_size; + if (image_get_magic(ihdr) == IH_MAGIC) { + *os_data = image_get_data(ihdr); + } else { + *os_data = (ulong)hdr; + *os_data += hdr->page_size; + } + } + if (os_len) { + if (image_get_magic(ihdr) == IH_MAGIC) + *os_len = image_get_data_size(ihdr); + else + *os_len = hdr->kernel_size; } - if (os_len) - *os_len = hdr->kernel_size; return 0; } @@ -131,7 +141,9 @@ ulong android_image_get_kcomp(const struct andr_img_hdr *hdr) { const void *p = (void *)((uintptr_t)hdr + hdr->page_size); - if (get_unaligned_le32(p) == LZ4F_MAGIC) + if (image_get_magic((image_header_t *)p) == IH_MAGIC) + return image_get_comp((image_header_t *)p); + else if (get_unaligned_le32(p) == LZ4F_MAGIC) return IH_COMP_LZ4; else return IH_COMP_NONE; |