mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-06-02 09:46:37 +03:00
android: boot: fix wrong end of header in v3/v4 parsing
The android boot header is page aligned but the current code made the
assumption that the header was always smaller than the current header
format.
When the page_size is defined as 2048, as this is the case with the
cuttlefish target, the current code sets the end of the header in the
middle of it as the v3 and v4 headers are respectively 2112 and 2128
bytes long.
Fix that by aligning to page_size
Fixes: 1115027d2f ("android: boot: update android_image_get_data to support v3, v4")
Signed-off-by: Guillaume Ranquet <ranquet.guillaume@gmail.com>
This commit is contained in:
committed by
Tom Rini
parent
1e8592e0ec
commit
5289b6e554
@@ -107,7 +107,12 @@ static void android_vendor_boot_image_v3_v4_parse_hdr(const struct andr_vnd_boot
|
|||||||
data->dtb_load_addr = hdr->dtb_addr;
|
data->dtb_load_addr = hdr->dtb_addr;
|
||||||
data->bootconfig_size = hdr->bootconfig_size;
|
data->bootconfig_size = hdr->bootconfig_size;
|
||||||
end = (ulong)hdr;
|
end = (ulong)hdr;
|
||||||
end += hdr->page_size;
|
|
||||||
|
if (hdr->header_version > 3)
|
||||||
|
end += ALIGN(ANDR_VENDOR_BOOT_V4_SIZE, hdr->page_size);
|
||||||
|
else
|
||||||
|
end += ALIGN(ANDR_VENDOR_BOOT_V3_SIZE, hdr->page_size);
|
||||||
|
|
||||||
if (hdr->vendor_ramdisk_size) {
|
if (hdr->vendor_ramdisk_size) {
|
||||||
data->vendor_ramdisk_ptr = end;
|
data->vendor_ramdisk_ptr = end;
|
||||||
data->vendor_ramdisk_size = hdr->vendor_ramdisk_size;
|
data->vendor_ramdisk_size = hdr->vendor_ramdisk_size;
|
||||||
|
|||||||
@@ -21,6 +21,8 @@
|
|||||||
#define ANDR_BOOT_ARGS_SIZE 512
|
#define ANDR_BOOT_ARGS_SIZE 512
|
||||||
#define ANDR_BOOT_EXTRA_ARGS_SIZE 1024
|
#define ANDR_BOOT_EXTRA_ARGS_SIZE 1024
|
||||||
#define VENDOR_BOOT_MAGIC "VNDRBOOT"
|
#define VENDOR_BOOT_MAGIC "VNDRBOOT"
|
||||||
|
#define ANDR_VENDOR_BOOT_V3_SIZE 2112 /* sz(andr_vnd_boot_img_hdr) - sz(vendor_ramdisk_table*) */
|
||||||
|
#define ANDR_VENDOR_BOOT_V4_SIZE 2128 /* sz(andr_vnd_boot_img_hdr) */
|
||||||
#define ANDR_VENDOR_BOOT_MAGIC_SIZE 8
|
#define ANDR_VENDOR_BOOT_MAGIC_SIZE 8
|
||||||
#define ANDR_VENDOR_BOOT_ARGS_SIZE 2048
|
#define ANDR_VENDOR_BOOT_ARGS_SIZE 2048
|
||||||
#define ANDR_VENDOR_BOOT_NAME_SIZE 16
|
#define ANDR_VENDOR_BOOT_NAME_SIZE 16
|
||||||
|
|||||||
Reference in New Issue
Block a user