Re: [PATCH] FIT: support kernel images with type = "kernel_noload"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx/T/#meb5bda548de8d8d403c67ee90f639923c8a182fa
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> ---
>  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 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux