mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andreas Schmidt <mail@schmidt-andreas.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] blspec: add checking of optional key machine-id
Date: Wed, 2 May 2018 13:02:14 +0200	[thread overview]
Message-ID: <20180502110214.zsdcwbt3qdgy2y7u@pengutronix.de> (raw)
In-Reply-To: <20180429160125.3193-1-mail@schmidt-andreas.de>

Hi Andreas,

On Sun, Apr 29, 2018 at 06:01:25PM +0200, Andreas Schmidt wrote:
> For filtering of Bootloader Spec entries, Bootloader Spec
> specify an optional key machine-id. By set the
> global.boot.machine-id variable the checking of machine-id
> key in Bootloader Spec entries will be activate. If the
> variable and key match, appropriate boot entry will be
> booting. If it not match boot entry will be ignore and
> barebox check the next boot entry.
> 
> Signed-off-by: Andreas Schmidt <mail@schmidt-andreas.de>
> ---
> Hi,
> we use the same barebox for all our devices. The devices have
> same CPU-module but different interface boards. So the bootloader
> has to choose the right boot entry. To determine the right boot entry we
> decide to use Bootloader Spec. But we have a issue: Currently, only oftree 
> compatibility is checking by barebox for Bootloader Spec entries. But all 
> our ofstrees are compatible with our barebox, because we use only one. So
> we need a additional possibility to check witch Bootloader Spec entry
> is the right one for appropriate device. I guess, for such an use case
> Bootloader Spec specify "machine-id" key. This patch implement the support
> for machine-id key.
> The machine-id key is optional. I decide to activate the checking of this
> key only if "global.boot.machine_id" variable is set to non-empty value.
> If "global.boot.machine_id" not set machine-id key will be ignored, 
> independent if it exists in Bootloader Spec entry or not.

I like the idea and the patch looks mosty fine.

> +static bool entry_is_match_machine_id(struct blspec_entry *entry)
> +{
> +	int ret = true;
> +	const char *env_machineid = getenv_nonempty("global.boot.machine_id");
> +
> +	if (env_machineid) {
> +		const char *machineid = blspec_entry_var_get(entry, "machine-id");
> +		if (!machineid || strcmp(machineid, env_machineid)) {
> +			pr_info("ignoring entry with missmatched machine-id \"%s\"\n",
> +				env_machineid);

Don't you want to print the machine id of the current entry rather than
the desired machine id?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2018-05-02 11:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-29 16:01 Andreas Schmidt
2018-05-02 11:02 ` Sascha Hauer [this message]
2018-05-02 13:23   ` [PATCH v2] " Andreas Schmidt
2018-05-08  6:13     ` Sascha Hauer
2018-05-02 14:32 ` [PATCH] " Jan Lübbe
2018-05-03  8:42   ` Andreas Schmidt
2018-05-03  9:34     ` Jan Lübbe
2018-05-03 15:31       ` Andreas Schmidt

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=20180502110214.zsdcwbt3qdgy2y7u@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=mail@schmidt-andreas.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