diff mbox series

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

Message ID 20230126160506.1026643-8-souajih@baylibre.com
State Changes Requested
Delegated to: Simon Glass
Headers show
Series Support android boot image v3/v4 | expand

Commit Message

Safae Ouajih Jan. 26, 2023, 4:04 p.m. UTC
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@baylibre.com>
---
 boot/image-android.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Simon Glass Jan. 27, 2023, 12:54 a.m. UTC | #1
Hi Safae,

On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
>
> 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@baylibre.com>
> ---
>  boot/image-android.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>

Why is that?

Regards,
Simon
Safae Ouajih Jan. 27, 2023, 3:50 p.m. UTC | #2
On 27/01/2023 01:54, Simon Glass wrote:
> Hi Safae,
>
> On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
>> 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@baylibre.com>
>> ---
>>   boot/image-android.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
> Why is that?
>
> Regards,
> Simon

Hi Simon,

Thank you for the review.

Content print for boot image header v4 can be supported

and only requires updating the existing functions.

This is something I intend to support later on.

Best regards,

--safae
Simon Glass Jan. 27, 2023, 5:15 p.m. UTC | #3
On Fri, 27 Jan 2023 at 08:50, Safae Ouajih <souajih@baylibre.com> wrote:
>
>
> On 27/01/2023 01:54, Simon Glass wrote:
> > Hi Safae,
> >
> > On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
> >> 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@baylibre.com>
> >> ---
> >>   boot/image-android.c | 6 +++++-
> >>   1 file changed, 5 insertions(+), 1 deletion(-)
> >>
> > Why is that?
> >
> > Regards,
> > Simon
>
> Hi Simon,
>
> Thank you for the review.
>
> Content print for boot image header v4 can be supported
>
> and only requires updating the existing functions.
>
> This is something I intend to support later on.

OK thanks

Reviewed-by: Simon Glass <sjg@chromium.org>
Mattijs Korpershoek Feb. 1, 2023, 8:36 a.m. UTC | #4
On Fri, Jan 27, 2023 at 10:15, Simon Glass <sjg@chromium.org> wrote:

> On Fri, 27 Jan 2023 at 08:50, Safae Ouajih <souajih@baylibre.com> wrote:
>>
>>
>> On 27/01/2023 01:54, Simon Glass wrote:
>> > Hi Safae,
>> >
>> > On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
>> >> 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@baylibre.com>
>> >> ---
>> >>   boot/image-android.c | 6 +++++-
>> >>   1 file changed, 5 insertions(+), 1 deletion(-)
>> >>
>> > Why is that?
>> >
>> > Regards,
>> > Simon
>>
>> Hi Simon,
>>
>> Thank you for the review.
>>
>> Content print for boot image header v4 can be supported
>>
>> and only requires updating the existing functions.
>>
>> This is something I intend to support later on.
>
> OK thanks
>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
diff mbox series

Patch

diff --git a/boot/image-android.c b/boot/image-android.c
index 9dab09a69a..a6e7a7abb0 100644
--- a/boot/image-android.c
+++ b/boot/image-android.c
@@ -481,6 +481,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 *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;
@@ -513,7 +517,7 @@  void android_print_contents(const struct andr_boot_img_hdr_v0 *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);
 	}