aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
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 4d6cf0f..2653b55 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;
}