android: boot: support boot image header version 3 and 4

Enable the support for boot image header version 3 and 4
using abootimg command.

In order to use version 3 or 4:

1- Vendor boot image address should be given to abootimg cmd.

	abootimg addr $1 $vendor_boot_load_addr

2- "ramdisk_addr_r" env variable (ramdisk address) should be set to host
the ramdisk : generic ramdisk + vendor ramdisk

Replace "struct andr_boot_img_hdr_v0*" by "void *" in
some functions since v3 and v4 are now supported as well.

Signed-off-by: Safae Ouajih <souajih@baylibre.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Tested-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
diff --git a/include/image.h b/include/image.h
index c4d9b1c..456197d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -1767,7 +1767,7 @@
  * Return: Zero, os start address and length on success,
  *		otherwise on failure.
  */
-int android_image_get_kernel(const struct andr_boot_img_hdr_v0 *hdr,
+int android_image_get_kernel(const void *hdr,
 			     const void *vendor_boot_img, int verify,
 			     ulong *os_data, ulong *os_len);
 
@@ -1796,8 +1796,7 @@
  * @second_len : Pointer to a ulong variable, will hold secondary bootloader length
  * Return: 0 if succeeded, -1 if secondary bootloader size is 0
  */
-int android_image_get_second(const struct andr_boot_img_hdr_v0 *hdr,
-			     ulong *second_data, ulong *second_len);
+int android_image_get_second(const void *hdr, ulong *second_data, ulong *second_len);
 bool android_image_get_dtbo(ulong hdr_addr, ulong *addr, u32 *size);
 
 /**
@@ -1838,7 +1837,7 @@
  * @vendor_boot_img : Pointer to vendor boot image header
  * Return: The kernel load address
  */
-ulong android_image_get_kload(const struct andr_boot_img_hdr_v0 *hdr,
+ulong android_image_get_kload(const void *hdr,
 			      const void *vendor_boot_img);
 
 /**
@@ -1850,7 +1849,7 @@
  * @vendor_boot_img : Pointer to vendor boot image header
  * Return: Kernel compression type
  */
-ulong android_image_get_kcomp(const struct andr_boot_img_hdr_v0 *hdr,
+ulong android_image_get_kcomp(const void *hdr,
 			      const void *vendor_boot_img);
 
 /**
@@ -1874,7 +1873,7 @@
  * @hdr: Pointer to boot image
  * Return: non-zero if the magic is correct, zero otherwise
  */
-bool is_android_boot_image_header(const struct andr_boot_img_hdr_v0 *hdr);
+bool is_android_boot_image_header(const void *hdr);
 
 /**
  * is_android_vendor_boot_image_header() - Check the magic of vendor boot image
@@ -1888,6 +1887,20 @@
 bool is_android_vendor_boot_image_header(const void *vendor_boot_img);
 
 /**
+ * get_abootimg_addr() - Get Android boot image address
+ *
+ * Return: Android boot image address
+ */
+ulong get_abootimg_addr(void);
+
+/**
+ * get_avendor_bootimg_addr() - Get Android vendor boot image address
+ *
+ * Return: Android vendor boot image address
+ */
+ulong get_avendor_bootimg_addr(void);
+
+/**
  * board_fit_config_name_match() - Check for a matching board name
  *
  * This is used when SPL loads a FIT containing multiple device tree files