public inbox for u-boot-amlogic@groups.io
 help / color / mirror / Atom feed
From: Julien Masson <massonju.eseo@gmail.com>
To: Guillaume La Roque <glaroque@baylibre.com>,
	Mattijs Korpershoek <mkorpershoek@baylibre.com>,
	Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	Neil Armstrong <neil.armstrong@linaro.org>
Cc: <u-boot@lists.denx.de>, <u-boot-amlogic@groups.io>,
	Guillaume La Roque <glaroque@baylibre.com>,
	<20241017-android_ab_master-v5-0-43bfcc096d95@salutedevices.com>,
	<20241017-topic-fastboot-fixes-mkbootimg-v2-0-c3927102d931@linaro.org>
Subject: Re: [PATCH 1/6] bootstd: android: add support of bootimage v2
Date: Fri, 08 Nov 2024 11:08:52 +0100	[thread overview]
Message-ID: <8734k2javf.fsf@gmail.com> (raw)
In-Reply-To: <20241017-adnroidv2-v1-1-781c939902c9@baylibre.com>


On Fri 08 Nov 2024 at 11:07, Guillaume La Roque <glaroque@baylibre.com> wrote:

> Android bootmeth only support boot image v3/4.
> 
> Add support of Android Boot Image version 2 [1].
> Vendor boot image is only supported in version 3 and 4 so don't try to
> read it when header version if version is less than 3.
> 
> 1: https://source.android.com/docs/core/architecture/bootloader/boot-image-header#header-v2
> 
> Signed-off-by: Guillaume La Roque <glaroque@baylibre.com>
> ---
>  boot/bootmeth_android.c | 27 ++++++++++++---------------
>  1 file changed, 12 insertions(+), 15 deletions(-)
> 
> diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
> index 19b1f2c377b9..2e7f85e4a708 100644
> --- a/boot/bootmeth_android.c
> +++ b/boot/bootmeth_android.c
> @@ -259,16 +259,12 @@ static int android_read_bootflow(struct udevice *dev, struct bootflow *bflow)
>  		goto free_priv;
>  	}
>  
> -	if (priv->header_version != 4) {
> -		log_debug("only boot.img v4 is supported %u\n", priv->header_version);
> -		ret = -EINVAL;
> -		goto free_priv;
> -	}
> -
> -	ret = scan_vendor_boot_part(bflow->blk, priv);
> -	if (ret < 0) {
> -		log_debug("scan vendor_boot failed: err=%d\n", ret);
> -		goto free_priv;
> +	if (priv->header_version >= 3) {
> +		ret = scan_vendor_boot_part(bflow->blk, priv);
> +		if (ret < 0) {
> +			log_debug("scan vendor_boot failed: err=%d\n", ret);
> +			goto free_priv;
> +		}
>  	}
>  
>  	/*
> @@ -476,12 +472,13 @@ static int boot_android_normal(struct bootflow *bflow)
>  	if (ret < 0)
>  		return log_msg_ret("read boot", ret);
>  
> -	ret = read_slotted_partition(desc, "vendor_boot", priv->slot, vloadaddr);
> -	if (ret < 0)
> -		return log_msg_ret("read vendor_boot", ret);
> -
> +	if (priv->header_version >= 3) {
> +		ret = read_slotted_partition(desc, "vendor_boot", priv->slot, vloadaddr);
> +		if (ret < 0)
> +			return log_msg_ret("read vendor_boot", ret);
> +		set_avendor_bootimg_addr(vloadaddr);
> +	}
>  	set_abootimg_addr(loadaddr);
> -	set_avendor_bootimg_addr(vloadaddr);
>  
>  	ret = bootm_boot_start(loadaddr, bflow->cmdline);
>  
> 
> -- 
> 2.34.1
> 
> 
>

Tested on mediatek MT8365 EVK board with boot image V2.

Tested-by: Julien Masson <jmasson@baylibre.com>
-- 
Julien Masson


  parent reply	other threads:[~2024-11-12 15:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 16:10 [PATCH 0/6] Add support of Android Boot Image version 2 and non-AB image Guillaume La Roque
2024-10-17 16:10 ` [PATCH 1/6] bootstd: android: add support of bootimage v2 Guillaume La Roque
2024-10-22 13:24   ` Mattijs Korpershoek
2024-11-08 10:08   ` Julien Masson [this message]
2024-10-17 16:10 ` [PATCH 2/6] bootstd: android: add non-A/B image support Guillaume La Roque
2024-10-22 13:42   ` Mattijs Korpershoek
2024-10-17 16:10 ` [PATCH 3/6] configs: khadas-vim3{l}: fix userdata size Guillaume La Roque
2024-10-22 12:25   ` Mattijs Korpershoek
2024-11-08 10:05   ` Mattijs Korpershoek
2024-11-08 10:10     ` Neil Armstrong
2024-10-17 16:10 ` [PATCH 4/6] configs: khadas-vim3l_android{_ab}: move on bootmeth android Guillaume La Roque
2024-10-22 12:43   ` Mattijs Korpershoek
2024-10-17 16:10 ` [PATCH 5/6] configs: khadas-vim3_android{_ab}: " Guillaume La Roque
2024-10-22 12:46   ` Mattijs Korpershoek
2024-10-17 16:10 ` [PATCH 6/6] bootstd: Add test for Android boot image v2 Guillaume La Roque
2024-10-22 12:56   ` Mattijs Korpershoek
2024-11-08 10:11 ` (subset) [PATCH 0/6] Add support of Android Boot Image version 2 and non-AB image Neil Armstrong
2024-11-08 10:38   ` 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=8734k2javf.fsf@gmail.com \
    --to=massonju.eseo@gmail.com \
    --cc=20241017-android_ab_master-v5-0-43bfcc096d95@salutedevices.com \
    --cc=20241017-topic-fastboot-fixes-mkbootimg-v2-0-c3927102d931@linaro.org \
    --cc=glaroque@baylibre.com \
    --cc=mkorpershoek@baylibre.com \
    --cc=neil.armstrong@linaro.org \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot-amlogic@groups.io \
    --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