diff options
author | Safae Ouajih <souajih@baylibre.com> | 2023-02-06 00:50:13 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-04-04 14:50:47 -0400 |
commit | c79a2e6823d5a3a2813f66d03023c0a192c27e7e (patch) | |
tree | 679e97bca8656fb6d76d55690df017f54725419e /boot | |
parent | 1115027d2f75ade805f0d4d44a6a2c21e74ea6b2 (diff) | |
download | u-boot-c79a2e6823d5a3a2813f66d03023c0a192c27e7e.tar.gz u-boot-c79a2e6823d5a3a2813f66d03023c0a192c27e7e.tar.bz2 u-boot-c79a2e6823d5a3a2813f66d03023c0a192c27e7e.zip |
android: boot: ramdisk: support vendor ramdisk
Version 3 and 4 of boot image header introduced
vendor boot ramdisk: Please check include/android_image.h
for details.
The ramdisk is now split into a generic ramdisk in boot image
and a vendor ramdisk in vendor boot image.
Support the new vendor ramdisk.
Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Diffstat (limited to 'boot')
-rw-r--r-- | boot/image-android.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/boot/image-android.c b/boot/image-android.c index 712d437766..35243fd5b1 100644 --- a/boot/image-android.c +++ b/boot/image-android.c @@ -25,6 +25,7 @@ static void android_boot_image_v3_v4_parse_hdr(const struct andr_boot_img_hdr_v3 data->kcmdline = hdr->cmdline; data->header_version = hdr->header_version; + data->ramdisk_ptr = env_get_ulong("ramdisk_addr_r", 16, 0); /* * The header takes a full page, the remaining components are aligned @@ -322,10 +323,11 @@ ulong android_image_get_kcomp(const struct andr_boot_img_hdr_v0 *hdr, return image_decomp_type(p, sizeof(u32)); } -int android_image_get_ramdisk(const struct andr_boot_img_hdr_v0 *hdr, - const void *vendor_boot_img, ulong *rd_data, ulong *rd_len) +int android_image_get_ramdisk(const void *hdr, const void *vendor_boot_img, + ulong *rd_data, ulong *rd_len) { struct andr_image_data img_data = {0}; + ulong ramdisk_ptr; if (!android_image_get_data(hdr, vendor_boot_img, &img_data)) return -EINVAL; @@ -334,6 +336,13 @@ int android_image_get_ramdisk(const struct andr_boot_img_hdr_v0 *hdr, *rd_data = *rd_len = 0; return -1; } + if (img_data.header_version > 2) { + ramdisk_ptr = img_data.ramdisk_ptr; + memcpy((void *)(ramdisk_ptr), (void *)img_data.vendor_ramdisk_ptr, + img_data.vendor_ramdisk_size); + memcpy((void *)(ramdisk_ptr + img_data.vendor_ramdisk_size), + (void *)img_data.ramdisk_ptr, img_data.boot_ramdisk_size); + } printf("RAM disk load addr 0x%08lx size %u KiB\n", img_data.ramdisk_ptr, DIV_ROUND_UP(img_data.ramdisk_size, 1024)); |