From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Simon Glass <sjg@chromium.org>, Safae Ouajih <souajih@baylibre.com>
Cc: u-boot@lists.denx.de, sean.anderson@seco.com,
r.stratiienko@gmail.com, glaroque@baylibre.com,
khilman@baylibre.com
Subject: Re: [PATCH v2 13/17] android: boot: update android_image_get_dtb_img_addr to support v3,v4
Date: Wed, 01 Feb 2023 09:42:41 +0100 [thread overview]
Message-ID: <87k011ixoe.fsf@baylibre.com> (raw)
In-Reply-To: <CAPnjgZ39XTwO6Gn2A7wPxMJCx3YyKcjg_BfeK0w0PMpvT+-a1A@mail.gmail.com>
On Thu, Jan 26, 2023 at 17:55, Simon Glass <sjg@chromium.org> wrote:
> Hi Safae,
>
> On Thu, 26 Jan 2023 at 09:05, Safae Ouajih <souajih@baylibre.com> wrote:
>>
>> This adds support for boot image version 3 and 4
>> in android_image_get_dtb_img_addr(). Since the dtb
>> is now included in vendor_boot image instead of
>> boot image, the dtb address should be extracted from
>> vendor_boot image when a v3 or v4 is used.
>>
>> Signed-off-by: Safae Ouajih <souajih@baylibre.com>
>> ---
>> boot/image-android.c | 47 +++++++++++++++++++++++++++++++-------------
>> 1 file changed, 33 insertions(+), 14 deletions(-)
>>
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
>
> nits below
>
>> diff --git a/boot/image-android.c b/boot/image-android.c
>> index cb4fc22b00..edeeaaaee0 100644
>> --- a/boot/image-android.c
>> +++ b/boot/image-android.c
>> @@ -459,6 +459,7 @@ exit:
>> static bool android_image_get_dtb_img_addr(ulong hdr_addr, ulong vhdr_addr, ulong *addr)
>> {
>> const struct andr_boot_img_hdr_v0 *hdr;
>> + const struct andr_vendor_img_hdr *v_hdr;
>> ulong dtb_img_addr;
>> bool ret = true;
>>
>> @@ -475,22 +476,40 @@ static bool android_image_get_dtb_img_addr(ulong hdr_addr, ulong vhdr_addr, ulon
>> goto exit;
>> }
>>
>> - if (hdr->dtb_size == 0) {
>> - printf("Error: dtb_size is 0\n");
>> - ret = false;
>> - goto exit;
>> + if (hdr->header_version == 2) {
>> + if (hdr->dtb_size == 0) {
>
> if (!hdr->dtb_size)
>
>> + printf("Error: dtb_size is 0\n");
>> + ret = false;
>> + goto exit;
>> + }
>> + /* Calculate the address of DTB area in boot image */
>> + dtb_img_addr = hdr_addr;
>> + dtb_img_addr += hdr->page_size;
>> + dtb_img_addr += ALIGN(hdr->kernel_size, hdr->page_size);
>> + dtb_img_addr += ALIGN(hdr->ramdisk_size, hdr->page_size);
>> + dtb_img_addr += ALIGN(hdr->second_size, hdr->page_size);
>> + dtb_img_addr += ALIGN(hdr->recovery_dtbo_size, hdr->page_size);
>> +
>> + *addr = dtb_img_addr;
>> }
>>
>> - /* Calculate the address of DTB area in boot image */
>> - dtb_img_addr = hdr_addr;
>> - dtb_img_addr += hdr->page_size;
>> - dtb_img_addr += ALIGN(hdr->kernel_size, hdr->page_size);
>> - dtb_img_addr += ALIGN(hdr->ramdisk_size, hdr->page_size);
>> - dtb_img_addr += ALIGN(hdr->second_size, hdr->page_size);
>> - dtb_img_addr += ALIGN(hdr->recovery_dtbo_size, hdr->page_size);
>> -
>> - *addr = dtb_img_addr;
>> -
>> + if (hdr->header_version > 2) {
>> + v_hdr = map_sysmem(vhdr_addr, sizeof(*v_hdr));
>> + if (v_hdr->dtb_size == 0) {
>
> same here
>
>> + printf("Error: dtb_size is 0\n");
>> + ret = false;
>> + unmap_sysmem(v_hdr);
>> + goto exit;
>> + }
>> + /* Calculate the address of DTB area in boot image */
>> + dtb_img_addr = vhdr_addr;
>> + dtb_img_addr += v_hdr->page_size;
>> + if (v_hdr->vendor_ramdisk_size)
>> + dtb_img_addr += ALIGN(v_hdr->vendor_ramdisk_size, v_hdr->page_size);
>> + *addr = dtb_img_addr;
>> + unmap_sysmem(v_hdr);
>> + goto exit;
>> + }
>> exit:
>> unmap_sysmem(hdr);
>> return ret;
>> --
>> 2.34.1
>>
>
> Regards,
> Simon
next prev parent reply other threads:[~2023-02-01 8:42 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-26 16:04 [PATCH v2 00/17] Support android boot image v3/v4 Safae Ouajih
2023-01-26 16:04 ` [PATCH v2 01/17] android: boot: rename andr_img_hdr -> andr_boot_img_hdr_v0 Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-02-01 8:27 ` Mattijs Korpershoek
2023-01-26 16:04 ` [PATCH v2 02/17] android: boot: support vendor boot image in abootimg Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-02-01 8:32 ` Mattijs Korpershoek
2023-01-26 16:04 ` [PATCH v2 03/17] android: boot: replace android_image_check_header Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-02-01 8:33 ` Mattijs Korpershoek
2023-01-26 16:04 ` [PATCH v2 04/17] android: boot: add boot image header v3 and v4 structures Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-02-01 8:34 ` Mattijs Korpershoek
2023-01-26 16:04 ` [PATCH v2 05/17] android: boot: kcomp: support andr_image_data Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-02-01 8:35 ` Mattijs Korpershoek
2023-01-26 16:04 ` [PATCH v2 06/17] android: boot: move to andr_image_data structure Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-01-27 15:50 ` Safae Ouajih
2023-01-27 17:15 ` Simon Glass
2023-01-26 16:04 ` [PATCH v2 07/17] android: boot: content print is not supported for v3, v4 header version Safae Ouajih
2023-01-27 0:54 ` [PATCH v2 07/17] android: boot: content print is not supported for v3,v4 " Simon Glass
2023-01-27 15:50 ` Safae Ouajih
2023-01-27 17:15 ` Simon Glass
2023-02-01 8:36 ` Mattijs Korpershoek
2023-01-26 16:04 ` [PATCH v2 08/17] android: boot: boot image header v3, v4 do not support recovery DTBO Safae Ouajih
2023-01-27 0:54 ` [PATCH v2 08/17] android: boot: boot image header v3,v4 " Simon Glass
2023-02-01 8:37 ` Mattijs Korpershoek
2023-01-26 16:04 ` [PATCH v2 09/17] android: boot: add vendor boot image to prepare for v3, v4 support Safae Ouajih
2023-01-27 0:54 ` [PATCH v2 09/17] android: boot: add vendor boot image to prepare for v3,v4 support Simon Glass
2023-01-26 16:04 ` [PATCH v2 10/17] android: boot: update android_image_get_data to support v3, v4 Safae Ouajih
2023-01-27 0:54 ` [PATCH v2 10/17] android: boot: update android_image_get_data to support v3,v4 Simon Glass
2023-01-26 16:05 ` [PATCH v2 11/17] android: boot: ramdisk: support vendor ramdisk Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-01-26 16:05 ` [PATCH v2 12/17] android: boot: support extra command line Safae Ouajih
2023-01-27 0:54 ` Simon Glass
2023-01-27 15:51 ` Safae Ouajih
2023-01-27 17:15 ` Simon Glass
2023-02-01 8:39 ` Mattijs Korpershoek
2023-01-26 16:05 ` [PATCH v2 13/17] android: boot: update android_image_get_dtb_img_addr to support v3, v4 Safae Ouajih
2023-01-27 0:55 ` [PATCH v2 13/17] android: boot: update android_image_get_dtb_img_addr to support v3,v4 Simon Glass
2023-02-01 8:42 ` Mattijs Korpershoek [this message]
2023-01-26 16:05 ` [PATCH v2 14/17] drivers: fastboot: zImage flashing is not supported for v3, v4 Safae Ouajih
2023-01-27 0:55 ` [PATCH v2 14/17] drivers: fastboot: zImage flashing is not supported for v3,v4 Simon Glass
2023-01-26 16:05 ` [PATCH v2 15/17] android: boot: support boot image header version 3 and 4 Safae Ouajih
2023-01-27 0:55 ` Simon Glass
2023-02-01 8:44 ` Mattijs Korpershoek
2023-02-02 9:54 ` Safae Ouajih
2023-01-26 16:05 ` [PATCH v2 16/17] android: boot: support bootconfig Safae Ouajih
2023-01-27 0:55 ` Simon Glass
2023-02-01 8:45 ` Mattijs Korpershoek
2023-01-26 16:05 ` [PATCH v2 17/17] test/py: android: extend abootimg test Safae Ouajih
2023-01-27 0:55 ` Simon Glass
2023-01-27 15:51 ` Safae Ouajih
2023-01-27 20:37 ` Tom Rini
2023-01-31 12:34 ` Safae Ouajih
2023-01-26 18:17 ` [PATCH v2 00/17] Support android boot image v3/v4 Roman Stratiienko
2023-01-27 9:19 ` Safae Ouajih
2023-02-01 8:26 ` Mattijs Korpershoek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k011ixoe.fsf@baylibre.com \
--to=mkorpershoek@baylibre.com \
--cc=glaroque@baylibre.com \
--cc=khilman@baylibre.com \
--cc=r.stratiienko@gmail.com \
--cc=sean.anderson@seco.com \
--cc=sjg@chromium.org \
--cc=souajih@baylibre.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox