[U-Boot] [PATCH v3 03/28] env: sf: define API to override sf environment address

Rajesh Bhagat rajesh.bhagat at nxp.com
Tue Oct 9 10:41:54 UTC 2018


Defines env_sf_get_env_addr API to override sf environment address,
required to support multiple environment.

Signed-off-by: Rajesh Bhagat <rajesh.bhagat at nxp.com>
---
Change in v3: None
Change in v2: None

 env/sf.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/env/sf.c b/env/sf.c
index 494510533a..df22fd520b 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -297,10 +297,17 @@ out:
 }
 #endif
 
+#ifdef CONFIG_ENV_ADDR
+__weak void *env_sf_get_env_addr(void)
+{
+	return (void *)CONFIG_ENV_ADDR;
+}
+#endif
+
 #if defined(INITENV) && defined(CONFIG_ENV_ADDR)
 static int env_sf_init(void)
 {
-	env_t *env_ptr = (env_t *)(CONFIG_ENV_ADDR);
+	env_t *env_ptr = (env_t *)env_sf_get_env_addr();
 
 	if (crc32(0, env_ptr->data, ENV_SIZE) == env_ptr->crc) {
 		gd->env_addr	= (ulong)&(env_ptr->data);
-- 
2.17.1



More information about the U-Boot mailing list