public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mattijs Korpershoek <mkorpershoek@baylibre.com>
To: Neil Armstrong <neil.armstrong@linaro.org>,
	Tom Rini <trini@konsulko.com>
Cc: Guillaume La Roque <glaroque@baylibre.com>,
	Caleb Connolly <caleb.connolly@linaro.org>,
	u-boot-qcom@groups.io, u-boot@lists.denx.de,
	Neil Armstrong <neil.armstrong@linaro.org>
Subject: Re: [PATCH v2 2/3] image: android: do not boot XIP when kernel is compressed
Date: Tue, 22 Oct 2024 11:18:58 +0200	[thread overview]
Message-ID: <87bjzcwl4t.fsf@baylibre.com> (raw)
In-Reply-To: <20241017-topic-fastboot-fixes-mkbootimg-v2-2-c3927102d931@linaro.org>

Hi Neil,

Thank you for the patch.

On jeu., oct. 17, 2024 at 16:44, Neil Armstrong <neil.armstrong@linaro.org> wrote:

> When trying to boot an android boot image with a compressed
> kernel, if the kernel is used in-place because it was created
> with mkbootimg, the space will be too small to properly
> uncompress.
>
> Take in account the compressed state, and if compressed
> use the kernel_addr_r which should be big enough.
>
> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>

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

> ---
>  boot/image-android.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/boot/image-android.c b/boot/image-android.c
> index bb5f4f84487d40e0cf24dc3b57042993967e66d5..3adcc69a392f74ae64f3fbcf1b85204f60ac9aff 100644
> --- a/boot/image-android.c
> +++ b/boot/image-android.c
> @@ -208,7 +208,8 @@ bool android_image_get_data(const void *boot_hdr, const void *vendor_boot_hdr,
>  	return true;
>  }
>  
> -static ulong android_image_get_kernel_addr(struct andr_image_data *img_data)
> +static ulong android_image_get_kernel_addr(struct andr_image_data *img_data,
> +					   ulong comp)
>  {
>  	/*
>  	 * All the Android tools that generate a boot.img use this
> @@ -221,8 +222,11 @@ static ulong android_image_get_kernel_addr(struct andr_image_data *img_data)
>  	 *
>  	 * Otherwise, we will return the actual value set by the user.
>  	 */
> -	if (img_data->kernel_addr  == ANDROID_IMAGE_DEFAULT_KERNEL_ADDR)
> -		return img_data->kernel_ptr;
> +	if (img_data->kernel_addr  == ANDROID_IMAGE_DEFAULT_KERNEL_ADDR) {
> +		if (comp == IH_COMP_NONE)
> +			return img_data->kernel_ptr;
> +		return env_get_ulong("kernel_addr_r", 16, 0);
> +	}
>  
>  	/*
>  	 * abootimg creates images where all load addresses are 0
> @@ -258,11 +262,14 @@ int android_image_get_kernel(const void *hdr,
>  	struct andr_image_data img_data = {0};
>  	ulong kernel_addr;
>  	const struct legacy_img_hdr *ihdr;
> +	ulong comp;
>  
>  	if (!android_image_get_data(hdr, vendor_boot_img, &img_data))
>  		return -EINVAL;
>  
> -	kernel_addr = android_image_get_kernel_addr(&img_data);
> +	comp = android_image_get_kcomp(hdr, vendor_boot_img);
> +
> +	kernel_addr = android_image_get_kernel_addr(&img_data, comp);
>  	ihdr = (const struct legacy_img_hdr *)img_data.kernel_ptr;
>  
>  	/*
> @@ -359,11 +366,14 @@ ulong android_image_get_kload(const void *hdr,
>  			      const void *vendor_boot_img)
>  {
>  	struct andr_image_data img_data;
> +	ulong comp;
>  
>  	if (!android_image_get_data(hdr, vendor_boot_img, &img_data))
>  		return -EINVAL;
>  
> -	return android_image_get_kernel_addr(&img_data);
> +	comp = android_image_get_kcomp(hdr, vendor_boot_img);
> +
> +	return android_image_get_kernel_addr(&img_data, comp);
>  }
>  
>  ulong android_image_get_kcomp(const void *hdr,
>
> -- 
> 2.34.1

  reply	other threads:[~2024-10-22  9:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-17 14:44 [PATCH v2 0/3] image: android: misc fixes when using on Qualcomm platforms Neil Armstrong
2024-10-17 14:44 ` [PATCH v2 1/3] image: android: use ulong for kernel address Neil Armstrong
2024-10-22  9:15   ` Mattijs Korpershoek
2024-10-17 14:44 ` [PATCH v2 2/3] image: android: do not boot XIP when kernel is compressed Neil Armstrong
2024-10-22  9:18   ` Mattijs Korpershoek [this message]
2024-10-17 14:44 ` [PATCH v2 3/3] image: android: handle ramdisk default address Neil Armstrong
2024-10-22  9:20   ` Mattijs Korpershoek
2024-10-18  5:49 ` [PATCH v2 0/3] image: android: misc fixes when using on Qualcomm platforms Guillaume LA ROQUE
2024-10-24  7:48 ` 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=87bjzcwl4t.fsf@baylibre.com \
    --to=mkorpershoek@baylibre.com \
    --cc=caleb.connolly@linaro.org \
    --cc=glaroque@baylibre.com \
    --cc=neil.armstrong@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot-qcom@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