Skip to contentSkip to conversation

Add "memenv" command, to set environment from a memory area

PATCH New Alessandro Rubini 2 participants 3 messages Oct 31, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add "memenv" command, to set environment from a memory area

From: Alessandro Rubini <[email protected]>

This command reads a memory area (up to a specified length) and assigns the content to an environment variable. Any newlines are turned into semicolons, and any hash is makes all the rest of the line to be turned into spaces.

The command is meant to allow downloading a shell script from the network or a storage device and then run it using the "run" command. This greatly simplifies the task of upgrading a system from within the boot loader, or just running some tests automatically, without the need to define the specific commands at compile time.

---
 README              |    2 ++
 common/cmd_nvedit.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 0 deletions(-)
README +2 -0
index ebee20f..ef989b4 100644
@@ -594,6 +594,7 @@ The following options need to be configured:
 		CONFIG_CMD_KGDB		* kgdb
 		CONFIG_CMD_LOADB	  loadb
 		CONFIG_CMD_LOADS	  loads
+		CONFIG_CMD_MEMENV	* set environment from memory
 		CONFIG_CMD_MEMORY	  md, mm, nm, mw, cp, cmp, crc, base,
 					  loop, loopw, mtest
 		CONFIG_CMD_MISC		  Misc functions like sleep etc
@@ -2802,6 +2803,7 @@ sspi	- SPI utility commands
 base	- print or set address offset
 printenv- print environment variables
 setenv	- set environment variables
+memenv	- set variable from memory are, stripping newlines
 saveenv - save environment variables to persistent storage
 protect - enable or disable FLASH write protection
 erase	- erase FLASH memory
common/cmd_nvedit.c +49 -0

61 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#1 lore raw

PATCH 1/1 Add "memenv" command, to set environment from a memory area

Dear Alessandro,

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

This command reads a memory area (up to a specified length) and assigns the content to an environment variable. Any newlines are turned into semicolons, and any hash is makes all the rest of the line to be turned into spaces.

Doesn't this more or less duplicate the function of the "autoscr" command?

Quoted 5 lines

The command is meant to allow downloading a shell script from the network or a storage device and then run it using the "run" command. This greatly simplifies the task of upgrading a system from within the boot loader, or just running some tests automatically, without the need to define the specific commands at compile time.

Yes, this duplicates "autoscr" (which will be renamed into "source" soon).

I think we don't need this?

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
What the gods would destroy they first submit to  an  IEEE  standards
committee.
#2 lore raw

PATCH 1/1 Add "memenv" command, to set environment from a memory area

Quoted 3 lines

Doesn't this more or less duplicate the function of the "autoscr" command?

After checking the source, it addresses the same needs.

While I looked hard, I didn't find this feature. After I wrote it for a client and later found another client did it by himself, I posted it to the list on Jul 4th and got only one positive comment, so I finally went ahead.

I should have looked better, it seems.

Thanks
/alessandro