[RFC PATCH] tools: env: Add an option to have an empty default environment

Chris Packham judge.packham at gmail.com
Wed Aug 19 09:47:49 CEST 2020

Hi Wolfgang,

On Tue, 18 Aug 2020, 10:27 PM Wolfgang Denk, <wd at denx.de> wrote:

> Dear Chris Packham,
> In message <20200813013727.8186-1-judge.packham at gmail.com> you wrote:
> > When building envtools via tools-only_defconfig the builtin defaults
> > are based on options in the defconfig. For example:
> >
> >   bootcmd=bootp; setenv bootargs root=/dev/nfs
> nfsroot=${serverip}:${rootpath}
> ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
> >   bootdelay=2
> >   baudrate=115200
> >   stdin=serial,cros-ec-keyb,usbkbd
> >   stdout=serial,vidconsole
> >   stderr=serial,vidconsole
> >   ethaddr=00:00:11:22:33:44
> >   eth3addr=00:00:11:22:33:45
> >   eth5addr=00:00:11:22:33:46
> >   eth6addr=00:00:11:22:33:47
> Having any specific MAC addresses set in the default environment has
> always been a strict No-Go as it is just begging for trouble.
> If this was a real example, that code should be fixed!!

Yes it's what you get if you build tools-only_defconfig as of 2020.07.
There's also various addresses that are bad for the boards I deal with.

> > These may or may not be sensible for any particular target. Rather than
> > trying to have a set of defaults that work for every target add a config
> > option to make the default environment completely empty.
> An empty default environment is even worse, as you are missing vital
> settings like baudrate, bootdelay etc.  There are good chances to
> brick your board with such settings.

I believe the baudrate has build time default that is suitable if nothing
is set. But yes there are things necessary for a board to boot an OS that
are undone by a blank environment. But the same also applies to the wrong
value. The current defaults render my boards expensive bricks.

What I think might be the best path forward is being able to supply
defaults via a file at run time. That way we can have a generic fw_setenv
but supply board specific defaults via a config file.

> Best regards,
> Wolfgang Denk
> --
> DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
> The word "fit", as I understand it, means "appropriate to a purpose",
> and I would say the body of the Dean is supremely appropriate to  the
> purpose of sitting around all day and eating big heavy meals.
>                                  - Terry Pratchett, _Moving Pictures_

More information about the U-Boot mailing list