From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 3/5] Allow U-Boot scripts to be placed in a .env file
Date: Wed, 26 Jun 2013 13:56:55 -0600 [thread overview]
Message-ID: <51CB4787.1070302@wwwdotorg.org> (raw)
In-Reply-To: <1372106765-18401-4-git-send-email-sjg@chromium.org>
On 06/24/2013 02:46 PM, 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>/env
> directory called <board>.env (or common.env if you want the same
> environment for all boards).
I'm not entirely sure how useful common.env is.
Consider that many different Tegra boards, from different vendors, all
share the same environment. For example boards/compulab/trimslice shares
the core environment with boards/nvidia/*. IIUC, common.env wouldn't
work in this case, since the vendor is different. To solve that, we
could easily symlink board/compulab/env/trimslice.env ->
board/nvidia/env/something.env. But in that case, why not always rely on
creating symlinks, instead of having the common.env fallback work too?
Also consider that compulab makes a ton of boards only some of which use
Tegra, so even a common.env in board/compulab/env wouldn't be that useful.
> diff --git a/Makefile b/Makefile
> +$(obj)include/generated/environment.inc: $(obj)include/generated/environment.in
> + @$(XECHO) Generating $@ ; \
> + set -e ; \
> + : Process the environment file ; \
> + echo -n "CONFIG_EXTRA_ENV_TEXT=" >$@ ; \
> + echo -n "#define CONFIG_EXTRA_ENV_TEXT " >$(ENV_HEADER) ; \
> + awk -f tools/scripts/env2string.awk $< | \
> + tee -a $(ENV_HEADER) >>$@ ; \
That generates two different files. Doesn't this confuse make a bit,
since if make needs to create $(ENV_HEADER) (which isn't $@ for that
rule) it won't know how to? I've certainly seen problems due to similar
make setups in the past. Perhaps even though it's a bit extra build-time
work, the two files should be generated separately? Or, is there some
reason here that there won't be a problem?
> diff --git a/README b/README
> +For example, for snapper9260 you would create a text file called
> +board/bluewater/env/snapper9260.env containing the environment text.
> +
> +>>>
> +bootcmd=
> + if [ -z ${tftpserverip} ]; then
> + echo "Use 'setenv tftpserverip a.b.c.d' to set IP address."
> + fi
> +
> + usb start; setenv autoload n; bootp;
> + tftpboot ${tftpserverip}:
> + bootm
> +failed=
> + echo boot failed - please check your image
> +<<<
Presumably the parser looks for something like /^[A-Z]=/i to know when
to "switch" to a new environment variable. Is some form of escaping
useful if you want to include that form of text in your environment
variable's value? If the parser is somehow smarter than that, it might
be worth explaining the syntax structure a little more above.
> diff --git a/tools/scripts/env2string.awk b/tools/scripts/env2string.awk
> +# We begin and end with "
I'm not sure what the " means at the end of that line.
next prev parent reply other threads:[~2013-06-26 19:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 20:46 [U-Boot] [PATCH v2 0/5] env: Add support for environment files Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 1/5] sandbox: Support 'env import' and 'env export' Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 2/5] Make 'run' use run_command_list() instead of run_command() Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 3/5] Allow U-Boot scripts to be placed in a .env file Simon Glass
2013-06-26 19:56 ` Stephen Warren [this message]
2013-10-20 20:47 ` Simon Glass
2013-10-25 15:34 ` Stephen Warren
2013-06-24 20:46 ` [U-Boot] [PATCH v2 4/5] env: Allow environment files to use the C preprocessor Simon Glass
2013-06-26 20:05 ` Stephen Warren
2013-10-20 21:09 ` Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 5/5] RFC: tegra: Convert to using environment files Simon Glass
2013-06-26 20:16 ` Stephen Warren
2013-10-20 21:15 ` Simon Glass
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=51CB4787.1070302@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.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