[U-Boot-Users] RFC: hidden environment variables

Wolfgang Denk wd at denx.de
Tue Apr 24 02:06:00 CEST 2007


In message <462D3F00.10103 at freescale.com> you wrote:
> 
> I don't like the idea of an environment variable that the user can edit but shouldn't. 
> Every times the user does 'print', it shows up.  "Look, but don't touch" is not a good 
> user interface paradigm.

Actually it may be useful, though.

> If I write code that stores data in an internal format, especially one that's subject to 
> change, of course I know better than the user what's good for him.  If the user 

Sorry, but this is a pretty arrogant position. You  don't  know  what
the  user  want's  to do. You cannot know that. And you stop him from
doing clever things.

Just to give you one example: we use a linear search for  environment
variables.  Some  of  them  are  important  for the initialization of
U-Boot (like "baudrate"), others are probably completely  unused  for
normal  boot operations. Especially on slow devices like EEPROM on an
I2C bus the boot time depends a lot on the order of the  variables  -
ther  ecan be differences of 5...10 seconds between having "baudrate"
the first or the last variable  in  your  envrionment.  So  it  is  a
perfectly  sensible  optimization  procedure  to  run  a  script that
performs a "printenv" command, sort the variables by  some  criteria,
and  uses  a  series  of "setenv" commands to erase and re-create the
environment.

Maybe this is not a very good example; only few people  (perfromance-
crazy beancounters like me) will ever do that. But it explains what I
mean:  I don't intend to do anything to your variables, I'm not going
to change them in any way, yet I need to be able to display  them  by
using printenv and re-writing them using setenv.

Otherwise your modification will restict my freedom to work with  the
system like I want to do it.


> manipulates the data incorrectly when he's been told (via the documentation) not to touch 
> it, then the code is just exposing itself to more crashes.

No, not the code. The user.

With the same argument we could demand that the protect and the erase
commands be disabled, because the user can be so stupid to erase  the
U-Boot image in flash.

> How do I not support setenv() if the data is in an environment variable?  If the variable 

You do not support it, it's just there.

> I need is called "jumpers", then what's to stop the user from just doing "setenv jumpers 
> 'blablabla'" and breaking my code?

He doesn't break your code. He breaks his board. He has many other
ways to do this already.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, HRB 165235 Munich, CEO: Wolfgang Denk
Office:  Kirchenstr. 5,       D-82194 Groebenzell,            Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"There are things that are so serious that you can  only  joke  about
them"                                                    - Heisenberg




More information about the U-Boot mailing list