public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: U-Boot Mailing List <u-boot@lists.denx.de>,
	Rasmus Villemoes <rasmus.villemoes@prevas.dk>,
	Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Wolfgang Denk <wd@denx.de>,
	Joe Hershberger <joe.hershberger@ni.com>
Subject: Re: [PATCH v8 4/8] env: Allow U-Boot scripts to be placed in a .env file
Date: Tue, 19 Oct 2021 10:25:29 -0400	[thread overview]
Message-ID: <20211019142529.GE7964@bill-the-cat> (raw)
In-Reply-To: <CAPnjgZ3THSM=TYvkGQJanmD0SwUzWsmcYWTG=vUaHiqFje3VfQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2655 bytes --]

On Tue, Oct 19, 2021 at 08:11:08AM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Tue, 19 Oct 2021 at 08:07, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Mon, Oct 18, 2021 at 12:13:18PM -0600, Simon Glass wrote:
> >
> > > At present U-Boot environment variables, and thus scripts, are defined
> > > by CONFIG_EXTRA_ENV_SETTINGS. It is painful to add large amounts of text
> > > to this file and dealing with quoting and newlines is harder than it
> > > should be. It would be better if we could just type the script into a
> > > text file and have it included by U-Boot.
> > >
> > > Add a feature that brings in a .env file associated with the board
> > > config, if present. To use it, create a file in a board/<vendor>
> > > directory, typically called <board>.env and controlled by the
> > > CONFIG_ENV_SOURCE_FILE option.
> > >
> > > The environment variables should be of the form "var=value". Values can
> > > extend to multiple lines. See the README under 'Environment Variables:'
> > > for more information and an example. Note that environment variables may
> > > not end in + but can start with other strange characters, including
> > > underscore, comma and slash.
> > >
> > > In many cases environment variables need access to the U-Boot CONFIG
> > > variables to select different options. Enable this so that the environment
> > > scripts can be as useful as the ones currently in the board config files.
> > > This uses the C preprocessor, means that comments can be included in the
> > > environment using /* ... */
> > >
> > > Also support += to allow variables to be appended to. This is needed when
> > > using the preprocessor.
> > >
> > > Signed-off-by: Simon Glass <sjg@chromium.org>
> >
> > As much as I and others appreciate that you've written the parser here
> > in a classic UNIX tool, awk, since a lot of the problems also seem to
> > stem from having the parser be able to handle previously valid
> > environment variables, if this was written in Python say, would we have
> > this problem?
> 
> Well ideally I'd like to avoid Python in this case as it is in the
> compilation path. I am not sure yet what Wolfgang actually wants,
> apart from variable names ending with + which I would like to
> disallow.
> 
> So if we can clearly understand the goal, then we might be able to do
> it in awk, but, again, can we just disallow '+' in var names ?

If we say that everything that's valid in the environment today needs to
continue to be valid, so that includes '+' and only disallowing '=' and
NUL as Wolfgang has said, can you update the awk parser to handle it?

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2021-10-19 14:25 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 18:13 [PATCH v8 0/8] env: Allow environment in text files Simon Glass
2021-10-18 18:13 ` [PATCH v8 1/8] binman: Allow timeout to occur in the image or its section Simon Glass
2021-10-19 14:19   ` Marek Behún
2021-10-31 12:57     ` Simon Glass
2021-10-18 18:13 ` [PATCH v8 2/8] sandbox: Drop distro_boot Simon Glass
2021-10-19 14:20   ` Marek Behún
2021-10-18 18:13 ` [PATCH v8 3/8] doc: Move environment documentation to rST Simon Glass
2021-10-19 14:21   ` Marek Behún
2021-10-18 18:13 ` [PATCH v8 4/8] env: Allow U-Boot scripts to be placed in a .env file Simon Glass
2021-10-19 10:57   ` Wolfgang Denk
2021-10-19 14:07   ` Tom Rini
2021-10-19 14:11     ` Simon Glass
2021-10-19 14:25       ` Tom Rini [this message]
2021-10-19 15:31         ` Simon Glass
2021-10-19 16:20           ` Wolfgang Denk
2021-10-19 16:24             ` Simon Glass
2021-10-19 16:30               ` Tom Rini
2021-10-19 16:39                 ` Simon Glass
2021-10-19 16:44                   ` Tom Rini
2021-10-19 18:21                     ` Simon Glass
2021-10-21  9:10                   ` Wolfgang Denk
2021-10-21  9:05                 ` Wolfgang Denk
2021-10-21  9:02               ` Wolfgang Denk
2021-10-19 16:05       ` Wolfgang Denk
2021-10-19 16:14         ` Simon Glass
2021-10-19 15:57     ` Wolfgang Denk
2021-10-19 15:11   ` Marek Behún
2021-10-18 18:13 ` [PATCH v8 5/8] sandbox: Use a text-based environment Simon Glass
2021-10-19 14:32   ` Marek Behún
2021-10-19 15:52     ` Simon Glass
2021-10-19 16:07       ` Marek Behún
2021-10-18 18:13 ` [PATCH v8 6/8] doc: Mention CONFIG_DEFAULT_ENV_FILE Simon Glass
2021-10-19 14:34   ` Marek Behún
2021-10-19 15:52     ` Simon Glass
2021-10-19 16:07       ` Marek Behún
2021-10-19 18:20         ` Simon Glass
2021-10-18 18:13 ` [PATCH v8 7/8] doc: Improve environment documentation Simon Glass
2021-10-19 14:36   ` Marek Behún
2021-10-18 18:13 ` [PATCH v8 8/8] bootm: Tidy up use of autostart env var Simon Glass
2021-10-19 14:38   ` Marek Behún
2021-10-19 10:48 ` [PATCH v8 0/8] env: Allow environment in text files Wolfgang Denk

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=20211019142529.GE7964@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=joe.hershberger@ni.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=wd@denx.de \
    --cc=xypron.glpk@gmx.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