android: boot: rename andr_img_hdr -> andr_boot_img_hdr_v0
Android introduced boot header version 3 or 4. The header structure change with version 3 and 4 to support the new updates such as: - Introducing Vendor boot image: with a vendor ramdisk - Bootconfig feature (v4) Change andr_img_hdr struct name to maintain support for version v0, v1 and v2 while introducing version 3 and 4. 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>
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
|
||||
static char andr_tmp_str[ANDR_BOOT_ARGS_SIZE + 1];
|
||||
|
||||
static ulong android_image_get_kernel_addr(const struct andr_img_hdr *hdr)
|
||||
static ulong android_image_get_kernel_addr(const struct andr_boot_img_hdr_v0 *hdr)
|
||||
{
|
||||
/*
|
||||
* All the Android tools that generate a boot.img use this
|
||||
@@ -59,7 +59,7 @@ static ulong android_image_get_kernel_addr(const struct andr_img_hdr *hdr)
|
||||
* Return: Zero, os start address and length on success,
|
||||
* otherwise on failure.
|
||||
*/
|
||||
int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
|
||||
int android_image_get_kernel(const struct andr_boot_img_hdr_v0 *hdr, int verify,
|
||||
ulong *os_data, ulong *os_len)
|
||||
{
|
||||
u32 kernel_addr = android_image_get_kernel_addr(hdr);
|
||||
@@ -122,12 +122,21 @@ int android_image_get_kernel(const struct andr_img_hdr *hdr, int verify,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int android_image_check_header(const struct andr_img_hdr *hdr)
|
||||
/**
|
||||
* android_image_check_header() - Check the magic of boot image
|
||||
*
|
||||
* This checks the header of Android boot image and verifies the
|
||||
* magic is "ANDROID!"
|
||||
*
|
||||
* @hdr: Pointer to boot image
|
||||
* Return: 0 if the magic is correct, non-zero if there is a magic mismatch
|
||||
*/
|
||||
int android_image_check_header(const struct andr_boot_img_hdr_v0 *hdr)
|
||||
{
|
||||
return memcmp(ANDR_BOOT_MAGIC, hdr->magic, ANDR_BOOT_MAGIC_SIZE);
|
||||
}
|
||||
|
||||
ulong android_image_get_end(const struct andr_img_hdr *hdr)
|
||||
ulong android_image_get_end(const struct andr_boot_img_hdr_v0 *hdr)
|
||||
{
|
||||
ulong end;
|
||||
|
||||
@@ -150,12 +159,12 @@ ulong android_image_get_end(const struct andr_img_hdr *hdr)
|
||||
return end;
|
||||
}
|
||||
|
||||
ulong android_image_get_kload(const struct andr_img_hdr *hdr)
|
||||
ulong android_image_get_kload(const struct andr_boot_img_hdr_v0 *hdr)
|
||||
{
|
||||
return android_image_get_kernel_addr(hdr);
|
||||
}
|
||||
|
||||
ulong android_image_get_kcomp(const struct andr_img_hdr *hdr)
|
||||
ulong android_image_get_kcomp(const struct andr_boot_img_hdr_v0 *hdr)
|
||||
{
|
||||
const void *p = (void *)((uintptr_t)hdr + hdr->page_size);
|
||||
|
||||
@@ -167,7 +176,7 @@ ulong android_image_get_kcomp(const struct andr_img_hdr *hdr)
|
||||
return image_decomp_type(p, sizeof(u32));
|
||||
}
|
||||
|
||||
int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
|
||||
int android_image_get_ramdisk(const struct andr_boot_img_hdr_v0 *hdr,
|
||||
ulong *rd_data, ulong *rd_len)
|
||||
{
|
||||
if (!hdr->ramdisk_size) {
|
||||
@@ -186,8 +195,8 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int android_image_get_second(const struct andr_img_hdr *hdr,
|
||||
ulong *second_data, ulong *second_len)
|
||||
int android_image_get_second(const struct andr_boot_img_hdr_v0 *hdr,
|
||||
ulong *second_data, ulong *second_len)
|
||||
{
|
||||
if (!hdr->second_size) {
|
||||
*second_data = *second_len = 0;
|
||||
@@ -226,7 +235,7 @@ int android_image_get_second(const struct andr_img_hdr *hdr,
|
||||
*/
|
||||
bool android_image_get_dtbo(ulong hdr_addr, ulong *addr, u32 *size)
|
||||
{
|
||||
const struct andr_img_hdr *hdr;
|
||||
const struct andr_boot_img_hdr_v0 *hdr;
|
||||
ulong dtbo_img_addr;
|
||||
bool ret = true;
|
||||
|
||||
@@ -275,7 +284,7 @@ exit:
|
||||
*/
|
||||
static bool android_image_get_dtb_img_addr(ulong hdr_addr, ulong *addr)
|
||||
{
|
||||
const struct andr_img_hdr *hdr;
|
||||
const struct andr_boot_img_hdr_v0 *hdr;
|
||||
ulong dtb_img_addr;
|
||||
bool ret = true;
|
||||
|
||||
@@ -328,7 +337,7 @@ exit:
|
||||
bool android_image_get_dtb_by_index(ulong hdr_addr, u32 index, ulong *addr,
|
||||
u32 *size)
|
||||
{
|
||||
const struct andr_img_hdr *hdr;
|
||||
const struct andr_boot_img_hdr_v0 *hdr;
|
||||
bool res;
|
||||
ulong dtb_img_addr; /* address of DTB part in boot image */
|
||||
u32 dtb_img_size; /* size of DTB payload in boot image */
|
||||
@@ -393,7 +402,7 @@ bool android_image_get_dtb_by_index(ulong hdr_addr, u32 index, ulong *addr,
|
||||
* returns:
|
||||
* no returned results
|
||||
*/
|
||||
void android_print_contents(const struct andr_img_hdr *hdr)
|
||||
void android_print_contents(const struct andr_boot_img_hdr_v0 *hdr)
|
||||
{
|
||||
const char * const p = IMAGE_INDENT_STRING;
|
||||
/* os_version = ver << 11 | lvl */
|
||||
@@ -485,7 +494,7 @@ static bool android_image_print_dtb_info(const struct fdt_header *fdt,
|
||||
*/
|
||||
bool android_image_print_dtb_contents(ulong hdr_addr)
|
||||
{
|
||||
const struct andr_img_hdr *hdr;
|
||||
const struct andr_boot_img_hdr_v0 *hdr;
|
||||
bool res;
|
||||
ulong dtb_img_addr; /* address of DTB part in boot image */
|
||||
u32 dtb_img_size; /* size of DTB payload in boot image */
|
||||
|
||||
Reference in New Issue
Block a user