[U-Boot] [PATCH] env: Update env addr for mmc environment driver

Pankit Garg pankit.garg at nxp.com
Fri Mar 15 10:18:49 UTC 2019


Signed-off-by: Pankit Garg <pankit.garg at nxp.com>
---
 env/mmc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/env/mmc.c b/env/mmc.c
index c3cf35d..f5d16cf 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -313,6 +313,7 @@ static int env_mmc_load(void)
 	int ret;
 	int dev = mmc_get_env_dev();
 	const char *errmsg;
+	env_t *ep = NULL;
 
 	mmc = find_mmc_device(dev);
 
@@ -333,6 +334,10 @@ static int env_mmc_load(void)
 		goto fini;
 	}
 
+	ep = (env_t *)buf;
+	if (crc32(0, ep->data, ENV_SIZE) == ep->crc)
+		gd->env_addr    = (ulong)&(ep->data);
+
 	ret = env_import(buf, 1);
 
 fini:
-- 
1.9.1



More information about the U-Boot mailing list