Re: [PATCH v2 02/23] bbu: make it possible to check multiple of-compatibles

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

 



On Mon, Mar 13, 2023 at 02:41:41PM +0100, Marco Felsch wrote:
> It is possible that one barebox can rule multiple platforms e.g.
> multiple platform revision each has a dedicated device tree and of
> compatible. While it is possible to add multiple of-compatibles via
> IMD_USED_OF() (see: zii-imx8mq-dev) we didn't allowed it to flash it
> without 'force'. Fix this by check all possible IMD_TYPE_OF_COMPATIBLE
> image metadata types.
> 
> Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
> ---
>  common/bbu.c | 42 +++++++++++++++++++++++++++---------------
>  1 file changed, 27 insertions(+), 15 deletions(-)
> 
> diff --git a/common/bbu.c b/common/bbu.c
> index 3ec17216cb..a9b3fef7a0 100644
> --- a/common/bbu.c
> +++ b/common/bbu.c
> @@ -154,36 +154,44 @@ struct bbu_handler *bbu_find_handler_by_device(const char *devicepath)
>  	return NULL;
>  }
>  
> -static int bbu_check_of_compat(struct bbu_data *data)
> +static int bbu_check_of_compat(struct bbu_data *data, unsigned short of_compat_nr)
>  {
> +	const struct imd_header *imd = data->imd_data;
> +	const struct imd_header *of_compat;
>  	struct device_node *root_node;
>  	const char *machine, *str;
>  	int ret;
> -	const struct imd_header *of_compat;
>  
>  	if (!IS_ENABLED(CONFIG_OFDEVICE) || !IS_ENABLED(CONFIG_IMD))
>  		return 0;

This patch breaks barebox update when the update image doesn't contain
any IMD_TYPE_OF_COMPATIBLE entries. To fix this we need this here:

	if (!of_compat_nr)
		return 0;

I fixed this up.

Sascha


-- 
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