[PATCH 11/11] bootm: Support string substitution in bootargs

Simon Glass sjg at chromium.org
Tue Oct 20 21:23:15 CEST 2020


Hi Wolfgang,

On Tue, 20 Oct 2020 at 07:26, Wolfgang Denk <wd at denx.de> wrote:
>
> Dear Simon,
>
> In message <CAPnjgZ2rAQZN_bdQ5C-9cB4u8F8PrhZkBWYx0zWxj_yEBrV2qw at mail.gmail.com> you wrote:
> >
> > > At the moment we have some cumbersome constructs like
> > >    set_bootargs="setenv bootargs bla ${var}"
> >
> > Yes it is a real pain. The substitution happens on first parse two, so
> > you have to put these commands in separate variables if you are
> > building things up.
>
> Come on, is it really that big a problem?
>
> You define all your needed settings (foo, bar, baz, and maybe uuid),
> and then you run a single command
>
>         setenv bootargs "${foo} ${bar} %{baz} ${uuid}"
>
> ?
>
> Yes, it takes one additional step, but it's simple and does not need
> extra code.

It is actually not simple, for three reasons:

1. With zboot the args come from the kernel setup.bin and must be modified
2. With Chrome OS the args come from the kernel partition and must be
augmented / substituted
3. The above command cannot be in the same env var as anything else,
since substitution breaks in that case

So you end up with a really complicated mess of environment variables
and scripts that is barely manageable. I want it to be simple.

See here for example (this only deals with 3 above, not 1 and 2, which
would still need custom code without my series)

https://chromium.googlesource.com/chromiumos/third_party/u-boot/+/refs/heads/chromeos-v2013.06/include/configs/chromeos.h#204

>
> [And if someone bothered to update hush to a recent version, and
> while doing so revisited the adaptions needed for U-Boot, we could
> also do much better.  IIRC, things like command substitution were
> omitted then because of the code size it would have required; given
> today's resources this might be an optional feature for many.]

Yes I agree, so long as the code size increase is not horrific.

+Tom Rini what do you think?

Regards,
Simon


More information about the U-Boot mailing list