Skip to contentSkip to conversation

env_mmc: fix cannot save env issue

PATCH New Lei Wen 2 participants 2 messages Oct 13, 2010

lore
Share & tools
lore

Lei Wen

author
#0 lore raw

PATCH 1/1 env_mmc: fix cannot save env issue

The env change its implementation after this log, while env mmc didn't change it immediately, which cause issue. Follow to the new style to fix it.

commit ea882baf9c17cd142c99e3ff640d3ab01daa5cec

Author: Wolfgang Denk <[email protected]>
Date:   Sun Jun 20 23:33:59 2010 +0200

New implementation for internal handling of environment variables.

---
 common/env_mmc.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
common/env_mmc.c +12 -1
index a51a905..23402bd 100644
@@ -29,6 +29,7 @@
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <mmc.h>
+#include <errno.h>
 
 /* references to names in env_common.c */
 extern uchar default_environment[];
@@ -96,13 +97,23 @@ inline int write_env(struct mmc *mmc, unsigned long size,
 
 int saveenv(void)
 {
+	env_t	env_new;
+	ssize_t	len;
+	char	*res;
 	struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
 
 	if (init_mmc_for_env(mmc))
 		return 1;
 
+	res = (char *)&env_new.data;
+	len = hexport('\0', &res, ENV_SIZE);
+	if (len < 0) {
+		error("Cannot export environment: errno = %d\n", errno);
+		return 1;
+	}
+	env_new.crc   = crc32(0, env_new.data, ENV_SIZE);
 	printf("Writing to MMC(%d)... ", CONFIG_SYS_MMC_ENV_DEV);
-	if (write_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, env_ptr)) {
+	if (write_env(mmc, CONFIG_ENV_SIZE, CONFIG_ENV_OFFSET, (u_char *)&env_new)) {
 		puts("failed\n");
 		return 1;
 	}
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 env_mmc: fix cannot save env issue

Dear Lei Wen,

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

The env change its implementation after this log, while env mmc didn't change it immediately, which cause issue. Follow to the new style to fix it.

commit ea882baf9c17cd142c99e3ff640d3ab01daa5cec

Author: Wolfgang Denk <[email protected]>
Date:   Sun Jun 20 23:33:59 2010 +0200
Quoted 6 lines

New implementation for internal handling of environment variables.

---
 common/env_mmc.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

Applied, 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
I have a theory that it's impossible to prove anything, but  I  can't
prove it.