Commit 104816142f9c6a4c8c164e7541a3424bcf5e8e91
Committed by
Tom Rini
1 parent
e24bd1e79e
Exists in
smarc_8mq_lf_v2020.04
and in
17 other branches
parse the second area of android image
The second area of android image was intended to put a 2nd stage bootloader but in practice were rarely used (in my knowledge). An proposal was made to the AOSP to (re)use the second area as the dtb[1], This patch itself doesn't depend on that proposal being accepted but it won't be that helpful as well if that proposal won't be accepted. But don't do any harm as well. [1] https://android-review.googlesource.com/#/c/417447/ Signed-off-by: Bin Chen <bin.chen@linaro.org> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Showing 2 changed files with 21 additions and 0 deletions Side-by-side Diff
common/image-android.c
... | ... | @@ -146,6 +146,25 @@ |
146 | 146 | return 0; |
147 | 147 | } |
148 | 148 | |
149 | +int android_image_get_second(const struct andr_img_hdr *hdr, | |
150 | + ulong *second_data, ulong *second_len) | |
151 | +{ | |
152 | + if (!hdr->second_size) { | |
153 | + *second_data = *second_len = 0; | |
154 | + return -1; | |
155 | + } | |
156 | + | |
157 | + *second_data = (unsigned long)hdr; | |
158 | + *second_data += hdr->page_size; | |
159 | + *second_data += ALIGN(hdr->kernel_size, hdr->page_size); | |
160 | + *second_data += ALIGN(hdr->ramdisk_size, hdr->page_size); | |
161 | + | |
162 | + printf("second address is 0x%lx\n",*second_data); | |
163 | + | |
164 | + *second_len = hdr->second_size; | |
165 | + return 0; | |
166 | +} | |
167 | + | |
149 | 168 | #if !defined(CONFIG_SPL_BUILD) |
150 | 169 | /** |
151 | 170 | * android_print_contents - prints out the contents of the Android format image |
include/image.h
... | ... | @@ -1263,6 +1263,8 @@ |
1263 | 1263 | ulong *os_data, ulong *os_len); |
1264 | 1264 | int android_image_get_ramdisk(const struct andr_img_hdr *hdr, |
1265 | 1265 | ulong *rd_data, ulong *rd_len); |
1266 | +int android_image_get_second(const struct andr_img_hdr *hdr, | |
1267 | + ulong *second_data, ulong *second_len); | |
1266 | 1268 | ulong android_image_get_end(const struct andr_img_hdr *hdr); |
1267 | 1269 | ulong android_image_get_kload(const struct andr_img_hdr *hdr); |
1268 | 1270 | void android_print_contents(const struct andr_img_hdr *hdr); |