Skip to contentSkip to conversation

make fw_setenv write multiple variables

PATCH New Nikos Mavrogiannopoulos 3 participants 7 messages Apr 30, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make fw_setenv write multiple variables

This patch makes fw_setenv write multiple variables on a single command line. That is "fw_setenv var1 value1 var2 value2" will write all variables and values without the need to erase multiple times the environment.

regards,
Nikos

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Allow-fw_setenv-to-write-multiple-variables-in-the-s.patch
Type: text/x-patch
Size: 0 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090430/434eb942/attachment.bin

#1 lore raw

PATCH 1/1 make fw_setenv write multiple variables

Dear Nikos Mavrogiannopoulos,

Quoted 5 lines · In message <[email protected]> you wrote:

This patch makes fw_setenv write multiple variables on a single command line. That is "fw_setenv var1 value1 var2 value2" will write all variables and values without the need to erase multiple times the environment.

I reject this as it would introduce serious incompatibilities with the existing interfaces, both in fw_setenv and in the U-Boot setenv command.

Not to mention that it would be extremely error prone.

But I understand that such a functionality may be useful - just your interface design is bogus.

What about the following alternative: add an option to fw_setenv to read the commands (evventually even with an [optional?] leading "setenv") from a file (or from stdin, if no file name or '-' is given). Then you can have one set of parameters per line, and no argument counting or similar things are needed.

What do you think?

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Another dream that failed.  There's nothing sadder.
	-- Kirk, "This side of Paradise", stardate 3417.3
#2 lore raw

PATCH 1/1 make fw_setenv write multiple variables

In reply to Nikos Mavrogiannopoulos
Quoted 4 lines

This patch makes fw_setenv write multiple variables on a single command line. That is "fw_setenv var1 value1 var2 value2" will write all variables and values without the need to erase multiple times the environment.

IIRC fw_setenv uses the first word as key and all the rest as the value. Judging on the description of your patch, this will probably break this behaviour.

I wrote a fw_editenv with -k/-v flags a couple of years ago in order to get around this, but i don't remember if I submitted it to the list.

Signature · 11 lines
  greetz, marc
Mediocrity finds safety in standardization.
		-- Frederick Crane
crichton 2.6.26 #1 PREEMPT Tue Jul 29 21:17:59 CDT 2008 GNU/Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090430/2e68db27/attachment.pgp 
#3 lore raw

PATCH 1/1 make fw_setenv write multiple variables

In reply to Nikos Mavrogiannopoulos

If I didn't in the past, I did now; this is what we are using to write from the firmware to do bulk changes in the u-boot config space.

The patch is against 1.3.3

Signature · 19 lines
  greetz, marc
(1) Never draw what you can copy.
(2) Never copy what you can trace.
(3) Never trace what you can cut out and paste down.
crichton 2.6.26 #1 PREEMPT Tue Jul 29 21:17:59 CDT 2008 GNU/Linux
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fw_editenv.diff
Type: text/x-diff
Size: 5203 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090430/0dca99a3/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090430/0dca99a3/attachment.pgp 
#4 lore raw

PATCH 1/1 make fw_setenv write multiple variables

Dear Marc,

Quoted 5 lines · In message <[email protected]> you wrote:

If I didn't in the past, I did now; this is what we are using to write from the firmware to do bulk changes in the u-boot config space.

The patch is against 1.3.3

Thanks a lot.

Hm... this seems a lot of code to deal with a trivial issue. I think implementing my idea (reading the input line by line from a text file) would be much easier to implement and easier to use as well.

And of course the patch doesn't apply any more against current code.

[Not to mention that the Signed-off-by: line is missing, plus there are coding style issues.]

Best regards,

Wolfgang Denk

Signature · 4 lines
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
God made the integers; all else is the work of Man.       - Kronecker
#5 lore raw

PATCH 1/1 make fw_setenv write multiple variables

Quoted 3 lines

Hm... this seems a lot of code to deal with a trivial issue. I ?think implementing ?my ?idea ?(reading ?the ?input line by line from a text file) would be much easier to implement and easier to use as well.

Yeah, probably.

IIRC, I tried to stick as close to the fw_Xenv code structure as possible; as such, this basically copies the fw_setenv block and modifies it without interfering or breaking in the upstream code.

Quoted 1 line

And of course the patch doesn't apply any more against current code.

I haven't looked at it, but unless there are large differences and rewrites in fw_env.c; the block of code should apply pretty easily: that's one of the underlying reasons keeping to current fw_env.c code separate and adding on it.

Quoted 2 lines

[Not to mention that the Signed-off-by: line is missing, plus there are coding style issues.]

I didn't expect it to get applied: I just used it as input to the

fw_setenv key val val val val

example

Signature · 5 lines
br, marc

The best approach for you requires two steps. The first step is
reading the Manual.
    Wolfgang Denk - u-boot mailing list
#6 lore raw

PATCH 1/1 make fw_setenv write multiple variables

Dear Marc Leeman,

Quoted 4 lines · In message <[email protected]> you…

IIRC, I tried to stick as close to the fw_Xenv code structure as possible; as such, this basically copies the fw_setenv block and modifies it without interfering or breaking in the upstream code.

Indeed. That code duplication is another problem, which for itself would be reason enough to reject the patch. It's unmaintainable.

Best regards,

Wolfgang Denk

Signature · 5 lines
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
Men of peace usually are [brave].
	-- Spock, "The Savage Curtain", stardate 5906.5