From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] CONFIG_BOOTDELAY and env_default.h
Date: Tue, 3 Jul 2018 12:04:41 -0400 [thread overview]
Message-ID: <20180703160441.GS4752@bill-the-cat.ec.rr.com> (raw)
In-Reply-To: <CAO5Uq5Q0vGjLV6FMT0kdiqgQO+egQde9OAS5n+CqTC7w8zdbng@mail.gmail.com>
On Mon, Jul 02, 2018 at 11:00:05AM +0100, Alex Kiernan wrote:
> On Mon, Jul 2, 2018 at 3:25 AM Tom Rini <trini@konsulko.com> wrote:
> >
> > On Fri, Jun 29, 2018 at 09:19:34PM -0700, Simon Glass wrote:
> > > +Tom
> > >
> > > Hi Alex,
> > >
> > > On 29 June 2018 at 02:31, Alex Kiernan <alex.kiernan@gmail.com> wrote:
> > > >
> > > > I've just been digging into a problem where I've got both
> > > > CONFIG_ENV_IS_NOWHERE set and CONFIG_BOOTDELAY set to -2 and it turns
> > > > out in env_default.h we have:
> > > >
> > > > #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
> > > > "bootdelay=" __stringify(CONFIG_BOOTDELAY) "\0"
> > > > #endifreason
> > > >
> > > > So the -ve values never make it into the default environment, which
> > > > means I don't have it at all when CONFIG_ENV_IS_NOWHERE.
> > > >
> > > > The (CONFIG_BOOTDELAY >= 0) seems to have been there forever
> > > > (c609719b8d1b2dca590e0ed499016d041203e403, Sun Nov 3 00:24:07 2002
> > > > +0000 is as far back as I've gone), but we've then changed the
> > > > behaviours of the bootdelay values in (the commit I was looking at was
> > > > 2fbb8462b0e18893b4b739705db047ffda82d4fc from Mon Jun 27 16:23:01 2016
> > > > +0900, but I'm not sure that's really the right one)
> > > >
> > > > I think we should change the code to a simple #if defined(CONFIG_BOOTDELAY)
> > > >
> > > > ?
> > >
> > > I don't know what the check was supposed to do and the comment on the
> > > 'bootdelay' env variable just says 'see CONFIG_BOOTDELAY'. Your
> > > solution sounds reasonable to me but perhaps Tom or Wolfgang have more
> > > insight.
> >
> > It seems like a historical oversight. But.. what happens before and
> > after when you have a negative bootdelay value in the default
> > environment?
> >
>
> It's a bit convoluted...
>
> There's bootmenu, where (CONFIG_BOOTDELAY >= 0) supplies a compile
> time default, which can be overridden by options to the command, or
> the bootmenu_delay environment variable. This never looks at the
> bootdelay environment variable, so I think we can ignore this one.
>
> Then there's autoboot, which reads the environment for bootdelay, but
> if that's not set then uses CONFIG_BOOTDELAY as a default.
>
> So whilst you end up with the default in all cases, it's only stored
> in the environment if it's >= 0.
>
> Looking at the only place bootdelay is read from the environment (in
> bootdelay_process):
>
> s = env_get("bootdelay");
> bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
>
> So if you have a compiled in -ve CONFIG_BOOTDELAY, there won't be a
> value for bootdelay in the default environment and we'll use the
> compile time default. Swap to storing all values of CONFIG_BOOTDELAY
> and you'll fetch it from the environment, rather than using the
> compile time default.
>
> So long as we don't remove the CONFIG_BOOTDELAY in this ternary
> expression, I think you end up with the same behaviour in every
> circumstance.
>
> The reason I tripped over it was some scripting in CONFIG_PREBOOT
> which was common between two configurations, but was expecting to
> differentiate between them based on bootdelay (which broke when it
> turned out to not be set).
OK. Please put out a patch and I'll pick it up after the release,
thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180703/de41d452/attachment.sig>
prev parent reply other threads:[~2018-07-03 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 9:31 [U-Boot] CONFIG_BOOTDELAY and env_default.h Alex Kiernan
2018-06-30 4:19 ` Simon Glass
2018-07-02 2:25 ` Tom Rini
2018-07-02 10:00 ` Alex Kiernan
2018-07-03 16:04 ` Tom Rini [this message]
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=20180703160441.GS4752@bill-the-cat.ec.rr.com \
--to=trini@konsulko.com \
--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