Skip to contentSkip to conversation

saveenv: standardize enablement

PATCH New Mike Frysinger 2 participants 10 messages Dec 30, 2008 – Jan 28, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 saveenv: standardize enablement

Rather than special casing each environment type for enabling the saveenv command, have them all behave the same. This avoids bitrot as new env sources are added/removed.

---
 common/cmd_nvedit.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)
common/cmd_nvedit.c +8 -18
index 85025da..b93de13 100644
@@ -546,11 +546,8 @@ int getenv_r (char *name, char *buf, unsigned len)
 	return (-1);
 }
 
-#if ((defined(CONFIG_ENV_IS_IN_NVRAM) || defined(CONFIG_ENV_IS_IN_EEPROM) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))) \
-    && !defined(CONFIG_ENV_IS_NOWHERE))
+#if defined(CONFIG_CMD_ENV) && !defined(CONFIG_ENV_IS_NOWHERE)
+
 int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	extern char * env_name_spec;
@@ -560,6 +557,12 @@ int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	return (saveenv() ? 1 : 0);
 }
 
+U_BOOT_CMD(
+	saveenv, 1, 0,	do_saveenv,
+	"saveenv - save environment variables to persistent storage\n",
+	NULL
+);
+
 #endif
 
 
@@ -602,19 +605,6 @@ U_BOOT_CMD(
 	"    - delete environment variable 'name'\n"
 );
 
-#if ((defined(CONFIG_ENV_IS_IN_NVRAM) || defined(CONFIG_ENV_IS_IN_EEPROM) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_FLASH)) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_NAND)) \
-    || (defined(CONFIG_CMD_ENV) && defined(CONFIG_CMD_ONENAND))) \
-    && !defined(CONFIG_ENV_IS_NOWHERE))
-U_BOOT_CMD(
-	saveenv, 1, 0,	do_saveenv,
-	"saveenv - save environment variables to persistent storage\n",
-	NULL
-);
-
-#endif
-
 #if defined(CONFIG_CMD_ASKENV)
 
 U_BOOT_CMD(
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 saveenv: standardize enablement

Quoted 3 lines · On Tuesday 30 December 2008 02:59:25 Mike Frysinger wrote:

Rather than special casing each environment type for enabling the saveenv command, have them all behave the same. This avoids bitrot as new env sources are added/removed.

ping ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090125/75825444/attachment.pgp

#2 lore raw

PATCH 1/1 saveenv: standardize enablement

In reply to Mike Frysinger

Dear Mike Frysinger,

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

Rather than special casing each environment type for enabling the saveenv command, have them all behave the same. This avoids bitrot as new env sources are added/removed.

---
 common/cmd_nvedit.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 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
Our way is peace.
	-- Septimus, the Son Worshiper, "Bread and Circuses",
	   stardate 4040.7.
#3 lore raw

PATCH 1/1 saveenv: standardize enablement

Dear Mike,

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

Rather than special casing each environment type for enabling the saveenv command, have them all behave the same. This avoids bitrot as new env sources are added/removed.

---
 common/cmd_nvedit.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

This patch breaks support for the

This board is a bit unusual as it is ROM based - it has CONFIG_ENV_IS_IN_FLASH set because the default environment is embedded in the ROM, but does not enable the flash driver (because there is no flash on the board). So the test in "common/cmd_nvedit.c":

549 #if defined(CONFIG_CMD_ENV) && !defined(CONFIG_ENV_IS_NOWHERE)

fails - it enables do_saveenv(), but there is no underlying saveenv() function. Result:

common/libcommon.a(cmd_nvedit.o): In function `do_saveenv':
common/cmd_nvedit.c:557: undefined reference to `saveenv'
make: *** [u-boot] Error 1

Please fix.

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
Never underestimate the bandwidth of a station wagon full of tapes.
                                -- Dr. Warren Jackson, Director, UTCS
#4 lore raw

PATCH 1/1 saveenv: standardize enablement

Quoted 11 lines · On Wednesday 28 January 2009 03:17:06 Wolfgang Denk wrote:
Quoted 8 lines · In message <[email protected]> you wrote:

Rather than special casing each environment type for enabling the saveenv command, have them all behave the same. This avoids bitrot as new env sources are added/removed.

---
 common/cmd_nvedit.c |   26 ++++++++------------------
 1 files changed, 8 insertions(+), 18 deletions(-)

This patch breaks support for the

looks like the actual board name was missed in your e-mail ?
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090128/bb863ef4/attachment-0001.pgp

#5 lore raw

PATCH 1/1 saveenv: standardize enablement

Dear Mike Frysinger,

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

This patch breaks support for the

looks like the actual board name was missed in your e-mail ?

Oops.

... for the SPD823TS board.

Thanks.

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
Unser Kopf ist rund, damit das Denken die Richtung wechseln kann.
                                                   -- Francis Picabia
#6 lore raw

PATCH 1/1 SPD823TS: do not define CONFIG_CMD_ENV

In reply to Wolfgang Denk

Since the SPD823TS board does not actually have any writable flash to save its environment, undefine CONFIG_CMD_ENV so the "saveenv" command is disabled.

This fixes the build error:
common/libcommon.a(cmd_nvedit.o): In function `do_saveenv':
common/cmd_nvedit.c:557: undefined reference to `saveenv'
make: *** [u-boot] Error 1

---
 include/configs/SPD823TS.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/SPD823TS.h +1 -0
index 9201346..d4154d2 100644
@@ -67,6 +67,7 @@
 
 #define CONFIG_CMD_IDE
 
+#undef CONFIG_CMD_ENV
 #undef CONFIG_CMD_FLASH
 
 
Signature · 1 line
1.6.1.1
#7 lore raw

PATCH 1/1 SPD823TS: do not define CONFIG_CMD_ENV

Quoted 3 lines · On Wednesday 28 January 2009 13:48:55 Mike Frysinger wrote:

Since the SPD823TS board does not actually have any writable flash to save its environment, undefine CONFIG_CMD_ENV so the "saveenv" command is disabled.

btw, i find the "CONFIG_CMD_ENV -> saveenv" bindings a bit confusing. any qualms with doing a giant sed to convert it to CONFIG_CMD_SAVEENV ?
sed -i 's:CONFIG_CMD_ENV\>:CONFIG_CMD_SAVEENV:g' \
include/*.h include/configs/*.h common/*.c README
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090128/0a3dfca6/attachment.pgp

#8 lore raw

PATCH 1/1 SPD823TS: do not define CONFIG_CMD_ENV

Dear Mike Frysinger,

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

btw, i find the "CONFIG_CMD_ENV -> saveenv" bindings a bit confusing. any qualms with doing a giant sed to convert it to CONFIG_CMD_SAVEENV ? sed -i 's:CONFIG_CMD_ENV\>:CONFIG_CMD_SAVEENV:g' \
include/*.h include/configs/*.h common/*.c README

Feel free to go on.

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
There's an old proverb that says just about whatever you want it to.
#9 lore raw

PATCH 1/1 SPD823TS: do not define CONFIG_CMD_ENV

In reply to Mike Frysinger

Dear Mike Frysinger,

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

Since the SPD823TS board does not actually have any writable flash to save its environment, undefine CONFIG_CMD_ENV so the "saveenv" command is disabled.

This fixes the build error:
common/libcommon.a(cmd_nvedit.o): In function `do_saveenv':
common/cmd_nvedit.c:557: undefined reference to `saveenv'
make: *** [u-boot] Error 1

Quoted 4 lines
---
 include/configs/SPD823TS.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Signature · 6 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
The night sky over the planet Krikkit is the least interesting  sight
in the entire Universe.
                 - Douglas Adams _Life, the Universe, and Everything_