[U-Boot] NAND: Fix saving of redundand environment

Submitted by Alexander Holler on Jan. 20, 2011, 1:17 a.m.

Details

Message ID 1295486268-7009-1-git-send-email-holler@ahsoftware.de
State Accepted
Commit 920a5dd2325438a82b6ac8102c5ea5e0c43276fd
Headers show

Commit Message

Alexander Holler Jan. 20, 2011, 1:17 a.m.
When redundand environments are used the serial needs
to get increased, otherwise the old one will still be used.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
 common/env_nand.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Scott Wood Jan. 26, 2011, 11:47 p.m.
On Thu, Jan 20, 2011 at 02:17:48AM +0100, Alexander Holler wrote:
> When redundand environments are used the serial needs
> to get increased, otherwise the old one will still be used.
> 
> Signed-off-by: Alexander Holler <holler@ahsoftware.de>
> ---
>  common/env_nand.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/common/env_nand.c b/common/env_nand.c
> index 2682f07..a4480cb 100644
> --- a/common/env_nand.c
> +++ b/common/env_nand.c
> @@ -205,7 +205,7 @@ int saveenv(void)
>  		return 1;
>  	}
>  	env_new.crc   = crc32(0, env_new.data, ENV_SIZE);
> -	env_new.flags = ACTIVE_FLAG;
> +	++env_new.flags; /* increase the serial */
>  
>  	if(gd->env_valid == 1) {
>  		puts("Erasing redundant NAND...\n");

Applied to u-boot-nand-flash.

Looks like this got broken in ea882baf9c17cd142c99e3ff640d3ab01daa5cec
(New implementation for internal handling of environment variables.)

Which made lots of style changes at the same time as functional, making it
hard to see what else of substance was changed. :-(

-Scott

Patch hide | download patch | download mbox

diff --git a/common/env_nand.c b/common/env_nand.c
index 2682f07..a4480cb 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -205,7 +205,7 @@  int saveenv(void)
 		return 1;
 	}
 	env_new.crc   = crc32(0, env_new.data, ENV_SIZE);
-	env_new.flags = ACTIVE_FLAG;
+	++env_new.flags; /* increase the serial */
 
 	if(gd->env_valid == 1) {
 		puts("Erasing redundant NAND...\n");