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
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;
*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));
* @rd_len: Pointer to a ulong variable, will hold ramdisk length
* Return: 0 if succeeded, -1 if ramdisk size is 0
*/
-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);
/**
* android_image_get_second() - Extracts the secondary bootloader address