[PATCH 08/17] android: boot: content print is not supported for v3, v4 header version

Safae Ouajih souajih at baylibre.com
Sat Nov 26 17:59:22 CET 2022


Content print is not supported for version 3 and 4 of boot image header.
Thus, only print that content when v2 is used.

Update android_print_contents() to print an error message
when trying to print boot image header version 3 or 4 content.

Signed-off-by: Safae Ouajih <souajih at baylibre.com>
---
 boot/image-android.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/boot/image-android.c b/boot/image-android.c
index d0cb8615c28c..d6476904f35e 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -475,6 +475,10 @@ bool android_image_get_dtb_by_index(ulong hdr_addr, u32 index, ulong *addr,
  */
 void android_print_contents(const struct andr_boot_img_hdr_v0_v1_v2 *hdr)
 {
+	if (hdr->header_version >= 3) {
+		printf("Content print is not supported for boot image header version > 2");
+		return;
+	}
 	const char * const p = IMAGE_INDENT_STRING;
 	/* os_version = ver << 11 | lvl */
 	u32 os_ver = hdr->os_version >> 11;
@@ -507,7 +511,7 @@ void android_print_contents(const struct andr_boot_img_hdr_v0_v1_v2 *hdr)
 		       hdr->header_size);
 	}
 
-	if (hdr->header_version >= 2) {
+	if (hdr->header_version == 2) {
 		printf("%sdtb size:             %x\n", p, hdr->dtb_size);
 		printf("%sdtb addr:             %llx\n", p, hdr->dtb_addr);
 	}
-- 
2.25.1



More information about the U-Boot mailing list