summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorSafae Ouajih <souajih@baylibre.com>2023-02-06 00:50:17 +0100
committerPraneeth Bajjuri <praneeth@ti.com>2023-04-05 11:41:11 -0500
commit5456cac6eacdd55c5f7379f406b08d24a7285112 (patch)
treef666110694d39e8f2217f61865116c2ae644bac2 /cmd
parent0349ecf2f5d4ec227b51a70f95c4e8aff6588c37 (diff)
android: boot: support boot image header version 3 and 4
commit 636da2039aea4ea3a638b14da0a9ec258897a10c upstream. 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> Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/abootimg.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/cmd/abootimg.c b/cmd/abootimg.c
index 4d6cf0fa3e..2653b555b1 100644
--- a/cmd/abootimg.c
+++ b/cmd/abootimg.c
@@ -17,6 +17,16 @@
static ulong _abootimg_addr = -1;
static ulong _avendor_bootimg_addr = -1;
+ulong get_abootimg_addr(void)
+{
+ return (_abootimg_addr == -1 ? image_load_addr : _abootimg_addr);
+}
+
+ulong get_avendor_bootimg_addr(void)
+{
+ return _avendor_bootimg_addr;
+}
+
static int abootimg_get_ver(int argc, char *const argv[])
{
const struct andr_boot_img_hdr_v0 *hdr;
@@ -70,12 +80,21 @@ static int abootimg_get_dtb_load_addr(int argc, char *const argv[])
return CMD_RET_USAGE;
struct andr_image_data img_data = {0};
const struct andr_boot_img_hdr_v0 *hdr;
+ const struct andr_vnd_boot_img_hdr *vhdr;
hdr = map_sysmem(abootimg_addr(), sizeof(*hdr));
- if (!android_image_get_data(hdr, NULL, &img_data)) {
+ if (get_avendor_bootimg_addr() != -1)
+ vhdr = map_sysmem(get_avendor_bootimg_addr(), sizeof(*vhdr));
+
+ if (!android_image_get_data(hdr, vhdr, &img_data)) {
+ if (get_avendor_bootimg_addr() != -1)
+ unmap_sysmem(vhdr);
unmap_sysmem(hdr);
return CMD_RET_FAILURE;
}
+
+ if (get_avendor_bootimg_addr() != -1)
+ unmap_sysmem(vhdr);
unmap_sysmem(hdr);
if (img_data.header_version < 2) {
@@ -119,7 +138,8 @@ static int abootimg_get_dtb_by_index(int argc, char *const argv[])
return CMD_RET_FAILURE;
}
- if (!android_image_get_dtb_by_index(abootimg_addr(), 0, num,
+ if (!android_image_get_dtb_by_index(abootimg_addr(),
+ get_avendor_bootimg_addr(), num,
&addr, &size)) {
return CMD_RET_FAILURE;
}