From 8c66497e06bf803489c589df58ee591d71033274 Mon Sep 17 00:00:00 2001 From: Haavard Skinnemoen Date: Fri, 16 May 2008 11:10:35 +0200 Subject: Add support for environment in SPI flash This is pretty incomplete...it doesn't handle reading the environment before relocation, it doesn't support redundant environment, and it doesn't support embedded environment. But apart from that, it does seem to work. Signed-off-by: Haavard Skinnemoen --- common/cmd_nvedit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common/cmd_nvedit.c') diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 9c5d1fc..49f134a 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -58,8 +58,9 @@ DECLARE_GLOBAL_DATA_PTR; !defined(CFG_ENV_IS_IN_DATAFLASH) && \ !defined(CFG_ENV_IS_IN_NAND) && \ !defined(CFG_ENV_IS_IN_ONENAND) && \ + !defined(CFG_ENV_IS_IN_SPI_FLASH) && \ !defined(CFG_ENV_IS_NOWHERE) -# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|NOWHERE} +# error Define one of CFG_ENV_IS_IN_{NVRAM|EEPROM|FLASH|DATAFLASH|ONENAND|SPI_FLASH|NOWHERE} #endif #define XMK_STR(x) #x -- cgit v1.1 From 75678c807a6272ecc5541eb32898c93887f08400 Mon Sep 17 00:00:00 2001 From: "Steven A. Falco" Date: Thu, 12 Jun 2008 13:22:12 -0400 Subject: Make setenv() return status Currently, the setenv function does not return an error code. This patch allows to test for errors. Signed-off-by: Steve Falco --- common/cmd_nvedit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'common/cmd_nvedit.c') diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index 49f134a..b102ae3 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -380,13 +380,13 @@ int _do_setenv (int flag, int argc, char *argv[]) return 0; } -void setenv (char *varname, char *varvalue) +int setenv (char *varname, char *varvalue) { char *argv[4] = { "setenv", varname, varvalue, NULL }; if (varvalue == NULL) - _do_setenv (0, 2, argv); + return _do_setenv (0, 2, argv); else - _do_setenv (0, 3, argv); + return _do_setenv (0, 3, argv); } #ifdef CONFIG_HAS_UID -- cgit v1.1 From f6a69559d64498a04e1e0b087a9b920e5775f866 Mon Sep 17 00:00:00 2001 From: "Steven A. Falco" Date: Thu, 12 Jun 2008 13:24:42 -0400 Subject: cmd_nvedit.c: clean up syntax highlighting My text-editor (vim) has a bit of trouble syntax-highlighting the cmd_nvedit.c file, because it apparently does not parse C ifdef/else/endif. The following patch does not change the behavior of the code at all, but does allow the editor to properly syntax-highlight the file. Signed-off-by: Steve Falco --- common/cmd_nvedit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'common/cmd_nvedit.c') diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index b102ae3..85a0f94 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -180,11 +180,12 @@ int _do_setenv (int flag, int argc, char *argv[]) * Ethernet Address and serial# can be set only once, * ver is readonly. */ + if ( #ifdef CONFIG_HAS_UID /* Allow serial# forced overwrite with 0xdeaf4add flag */ - if ( ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) || + ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) || #else - if ( (strcmp (name, "serial#") == 0) || + (strcmp (name, "serial#") == 0) || #endif ((strcmp (name, "ethaddr") == 0) #if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR) -- cgit v1.1