[PATCH 2/3] blspec: add new blspec.compatible.extra variable

Sascha Hauer sha at pengutronix.de
Thu Sep 21 05:57:22 PDT 2023


On Wed, Sep 20, 2023 at 02:37:19PM +0200, Rouven Czerwinski wrote:
> The blspec.compatible.extra variable will be used to specify extra
> compatibles that are also used to match during bootloader specification
> entry parsing. This means that even if your internal barebox device tree
> machine compatible is "vendor,bareboxcompatible", but your bootloader
> specification device tree contains "vendor,linuxcompatible", it is
> possible to boot this entry by setting blspec.compatible.extra to
> "vendor,linuxcompatible".
> 
> More than one compatible is possible as well, the compatibles will need
> to be space separated (since "," is already used for the vendor hardware
> distinction).
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski at pengutronix.de>
> ---
>  common/blspec.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 56 insertions(+)
> 
> diff --git a/common/blspec.c b/common/blspec.c
> index f8d47f20d2..e361a02333 100644
> --- a/common/blspec.c
> +++ b/common/blspec.c
> @@ -19,10 +19,20 @@
>  #include <net.h>
>  #include <fs.h>
>  #include <of.h>
> +#include <magicvar.h>
> +#include <linux/list.h>
>  #include <linux/stat.h>
>  #include <linux/err.h>
>  #include <mtd/ubi-user.h>
>  
> +struct list_head *blspec_extra_list;

Replace with:

static LIST_HEAD(blspec_extra_list)

and fix the fallout.

> +char *blspec_extra_string;

Should also be static.

> +
> +struct blspec_extra_entry {
> +	char *compatible;
> +	struct list_head list;
> +};
> +
>  /*
>   * blspec_entry_var_set - set a variable to a value
>   */
> @@ -830,8 +840,54 @@ static int blspec_bootentry_provider(struct bootentries *bootentries,
>  	return found;
>  }
>  
> +static int blspec_extra_set(struct param_d *p, void *priv)
> +{

Generally it seems unnecessary to use the setter to create a list from
these entries.

Instead you could just parse blspec_extra_string directly when you need it.

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 |



More information about the barebox mailing list