From: Luca Ceresoli via buildroot <buildroot@buildroot.org>
To: Arnout Vandecappelle <arnout@mind.be>
Cc: "Köry Maincent" <kory.maincent@bootlin.com>,
"Heiko Thiery" <heiko.thiery@gmail.com>,
"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH] uboot: allow taking the entire default environment from a text file
Date: Mon, 15 Jul 2024 15:51:44 +0200 [thread overview]
Message-ID: <20240715155144.227dab3e@booty> (raw)
In-Reply-To: <bb557f20-2d9c-4b1b-9b33-4072d41fe129@mind.be>
Hi Arnout,
On Fri, 12 Jul 2024 11:23:12 +0200
Arnout Vandecappelle <arnout@mind.be> wrote:
> Hi Luca,
>
> On 17/06/2024 18:00, Luca Ceresoli via buildroot wrote:
> > By default U-Boot builds a default environment from its own configuration
> > and a board-specific set of variables. However it also allows to bypass
> > this entirely and define the entire default environment from a text file.
> >
> > Expose this feature to Buildroot. This allows to have a file e.g. in
> > board/.../uboot.env which contains an easy to maintain text file with the
> > wanted default environment, without patching the U-Boot source code.
>
> Earlier, Heiko sent a similar patch but using a different U-Boot config option
> [1]. We're going to merge only one of them :-)
Wrong URL (below). i think you refer to this, dating almost a year ago
so congratulations for your memory:
https://lore.kernel.org/all/20230804085118.315117-1-heiko.thiery@gmail.com/
Thanks for letting me know about this.
> This one is a bit more elegant I think because it doesn't require discovering
> the vendor directory.
Ok, good to know, so let me refine it and send a v2.
> > --- a/boot/uboot/Config.in
> > +++ b/boot/uboot/Config.in
> > @@ -136,6 +136,35 @@ config BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES
> > that will be merged to the main U-Boot configuration file.
> > endif
> >
> > +config BR2_TARGET_UBOOT_USE_DEFAULT_ENV_FILE
> > + bool "Generate default environment from text file"
>
> I think that rather than two options, we want just one string option. If it's
> empty, it is disabled.
OK.
> > + select BR2_TARGET_UBOOT_NEEDS_XXD
> > + help
> > + Define the entire U-Boot default environment from a file,
> > + disabling all the logic to generate it from the U-Boot source
> > + code and other configuration values.
> > +
> > + Based on the USE_DEFAULT_ENV_FILE and DEFAULT_ENV_FILE U-Boot
> > + configuration variables.
> > +
> > + Requires U-Boot >= v2018.05.
> > +
> > +config BR2_TARGET_UBOOT_DEFAULT_ENV_FILE
> > + string "Text file with default environment"
> > + depends on BR2_TARGET_UBOOT_USE_DEFAULT_ENV_FILE
> > + help
> > + Text file containing the variables to be used as the default
> > + environment in U-Boot.
> > +
> > + From the U-Boot documentation:
> > +
> > + The format is the same as accepted by the mkenvimage tool, with
> > + lines containing key=value pairs. Blank lines and lines
> > + beginning with '#' are ignored.
> > +
> > + For more info see:
> > + https://docs.u-boot.org/en/latest/usage/environment.html#external-environment-file
>
> Excellent help text!
Thanks!
[that's because I'm lazy: finding the info was painful, I don't want to
do that again so let's write it down, upstream it and let the Internet
make it available to the future myself :) ]
> > --- a/boot/uboot/uboot.mk
> > +++ b/boot/uboot/uboot.mk
> > @@ -390,6 +390,14 @@ UBOOT_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
> > # override again. In addition, host-ccache is not ready at kconfig
> > # time, so use HOSTCC_NOCCACHE.
> > UBOOT_KCONFIG_OPTS = $(UBOOT_MAKE_OPTS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTLDFLAGS=""
> > +
> > +ifeq ($(BR2_TARGET_UBOOT_USE_DEFAULT_ENV_FILE),y)
> > +UBOOT_DEFAULT_ENV_FILE = $(call qstrip,$(BR2_TARGET_UBOOT_DEFAULT_ENV_FILE))
> > +define UBOOT_KCONFIG_DEFAULT_ENV_FILE
> > + $(call KCONFIG_SET_OPT,CONFIG_USE_DEFAULT_ENV_FILE,y)
> > + $(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENV_FILE,"$(shell readlink -f $(UBOOT_DEFAULT_ENV_FILE))")
>
> I think we mostly use `` rather than $(shell ...) - with the backticks, it's
> much easier to understand when it's going to be evaluated.
I did some quick tests with the backticks and wasn't able to make it
work, but if you have a suggestion to make it work I'll be glad to try
that.
So I'm sending v2 still using $(shell ...) for the time being.
About which is the "common habit", I found very few cases with both, so
no obvious winner apparently. However in this same file
(boot/uboot/uboot.mk) there are two readlink usages already, both using
the $(shell ...) pattern. Disclaimer: both have been added by me :)
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2024-07-15 13:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-17 16:00 [Buildroot] [PATCH] uboot: allow taking the entire default environment from a text file Luca Ceresoli via buildroot
2024-06-28 13:20 ` Kory Maincent via buildroot
2024-07-12 9:23 ` Arnout Vandecappelle via buildroot
2024-07-15 13:51 ` Luca Ceresoli via buildroot [this message]
2024-07-15 14:49 ` Arnout Vandecappelle via buildroot
2024-07-16 12:40 ` Luca Ceresoli via buildroot
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=20240715155144.227dab3e@booty \
--to=buildroot@buildroot.org \
--cc=arnout@mind.be \
--cc=heiko.thiery@gmail.com \
--cc=kory.maincent@bootlin.com \
--cc=luca.ceresoli@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
/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