Skip to contentSkip to conversation

Added simple hack to ignore the environment variables in flash.

RFC New Jason Kridner 1 participant 1 message Jan 14, 2009

lore
Share & tools
lore
#0 lore raw

RFC 1/1 Added simple hack to ignore the environment variables in flash.

I'm looking for a way to get u-boot to ignore the environment variables in flash if there is an autoscript on the SD card. The easiest way I can find is to simply ignore the environment variables completely and boot u-boot itself off of the SD card.

I see there are some other CONFIG's that do somewhat the same thing, but not quite.

On a Beagle Board, the experience is:
* No SD card with u-boot.bin, boot u-boot.bin w/o OVERRIDE and read environment from flash.
* SD card with u-boot.bin w/ OVERRIDE is read. Environment in flash is ignored so default environment is used. The board defaults cause it to read an autoscr file from the SD card, allowing you to always boot, even if the environment variables in the flash are bad and there is no access to the serial console.

Any comments on if the below can be a suitable approach?

---
 common/env_common.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
common/env_common.c +5 -1
index 6be3bb0..6f39f10 100644
@@ -251,8 +251,12 @@ void env_relocate (void)
 	DEBUGF ("%s[%d] malloced ENV at %p\n", __FUNCTION__,__LINE__,env_ptr);
 #endif
 
+#ifdef CONFIG_OVERRIDE_BOOTENV
+	gd->env_valid = 0;
+#endif
 	if (gd->env_valid == 0) {
-#if defined(CONFIG_GTH)	|| defined(CONFIG_ENV_IS_NOWHERE)	/* Environment not changable */
+#if defined(CONFIG_GTH)	|| defined(CONFIG_ENV_IS_NOWHERE) \
+	|| defined(CONFIG_OVERRIDE_BOOTENV)			/* Environment not changable */
 		puts ("Using default environment\n\n");
 #else
 		puts ("*** Warning - bad CRC, using default environment\n\n");
Signature · 1 line
1.6.0.4.790.gaa14a