mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@pengutronix.de>
Cc: barebox@lists.infradead.org, Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH] FIT: support kernel images with type = "kernel_noload"
Date: Tue, 5 Dec 2023 08:56:50 +0100	[thread overview]
Message-ID: <20231205075650.GN1057032@pengutronix.de> (raw)
In-Reply-To: <20231129203106.2417486-1-a.fatoum@pengutronix.de>

On Wed, Nov 29, 2023 at 09:31:06PM +0100, Ahmad Fatoum wrote:
> U-Boot interprets "kernel_noload" to mean that the load and entry
> addresses shall be ignored[1] and that the kernel image should be executed
> in-place, unless compressed[2]. The entry and load addresses are still
> mandatory and need to be initialized to some dummy value according to
> spec[3].
> 
> barebox, which is unaware of any special semantics for the kernel_noload
> type, would thus try to place a kernel_noload image at the dummy load
> address specified and fail if that's not possible. Fix this by treating
> type = "kernel_noload" as if load and entry properties were omitted,
> in which case barebox falls back to find a suitable memory region at
> runtime.
> 
> This change is motivated by the Linux kernel series adding FIT as
> additional Kbuild target for ARM64[4]. With the change here, it's possible
> to consume these FIT images in barebox as well.
> 
> [1]: U-Boot commit b9b50e89d317 ("image: Implement IH_TYPE_KERNEL_NOLOAD")
> [2]: https://patchwork.ozlabs.org/project/uboot/list/?series=382849&state=*
> [3]: https://github.com/open-source-firmware/flat-image-tree/releases/download/v0.8/fit-specification-v0.8.pdf
> [4]: https://lore.kernel.org/linux-arm-kernel/20231129172200.430674-1-sjg@chromium.org/T/#meb5bda548de8d8d403c67ee90f639923c8a182fa
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  common/image-fit.c | 6 ++++++
>  1 file changed, 6 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 0352dc5cbd0c..5ef5013bd41d 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -545,6 +545,7 @@ int fit_get_image_address(struct fit_handle *handle, void *configuration,
>  {
>  	struct device_node *image;
>  	const char *unit = name;
> +	const char *type;
>  	int ret;
>  
>  	if (!address || !property || !name)
> @@ -554,6 +555,11 @@ int fit_get_image_address(struct fit_handle *handle, void *configuration,
>  	if (ret)
>  		return ret;
>  
> +	/* Treat type = "kernel_noload" as if entry/load address is missing */
> +	ret = of_property_read_string(image, "type", &type);
> +	if (!ret && !strcmp(type, "kernel_noload"))
> +	    return -ENOENT;
> +
>  	ret = fit_get_address(image, property, address);
>  
>  	return ret;
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



      reply	other threads:[~2023-12-05  7:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 20:31 Ahmad Fatoum
2023-12-05  7:56 ` Sascha Hauer [this message]

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=20231205075650.GN1057032@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=sjg@chromium.org \
    /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