[U-Boot] [PATCH] Tools: set multiple variable with fw_setenv utility

Wolfgang Denk wd at denx.de
Fri May 21 21:11:18 CEST 2010


Dear Stefano,

In message <4BF6B724.6090307 at denx.de> you wrote:
> 
> > Adding spaces to the variable value? This makes little sense to me.
> > It's just a waste of storage space and boot time.
> 
> Well, I can agree with you, however I have already seen this case...

I believe you. I have seen stranger things before ;-)

> > Why cannot you process each variable when you read it? The we would
> > not need any array or list at all.
> 
> There is a reason, please tell me how good it is ;-)
> 
> I thought the code could be used not only as it is, but integrated in an
> application linking the required object (only one, fw_env.o).
> An application could internally generate a list of pairs variable/values
> and needs a function to set them in the u-boot environment. This is the
> reason of the int fw_setenv_multiple(fw_env_list *list, int count)
> function. No need to use an external file, no need to call fw_setenv as
> external process. An application could link fw_env.o and call
> fw_setenv_multiple().
> 
> I agree with you that I can do everything in a single pass if we do not
> provide such kind of external interface.

Even then you probably can. Actually it may be easier for the
aplication, too, when you provide something similar to classic file
I/O interface - fw_env_open() would initialize the in-memory copy of
the environment data, fw_env_write() could be called repeatedly to
set or delete variables, one at a time, and fw_env_close() would
finally compute the CRC and write the data out to persistent storage.

I guess in most cases such an interface is easier for the appli-
cation, too, because it can handle variables as they appear, and it
does not need to provide yet another array (with all the size
limitations) for intermediate storage.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
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
"One planet is all you get."


More information about the U-Boot mailing list