From: Eric Schumann Date: Sat, 21 Mar 2009 13:59:34 +0000 (-0400) Subject: Make flash protection work, when the environment is in EEPROM X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=3a3baf3ee61e6b28af3b49ebabc9ab4f6015aa48;p=u-boot.git Make flash protection work, when the environment is in EEPROM On the pcm030 the environment is located in the onboard EEPROM. But we want to handle flash sector protection in a safe manner. So we must read the unlock environment variable from EEPROM instead from flash. This patch is required as long the evironment is saved into the EEPROM. Stefan: Additional change as suggested by Wolfgang, use bigger char array (instead of 4). Signed-off-by: Eric Schumann Signed-off-by: Sascha Hauer Acked-by: Wolfgang Denk Signed-off-by: Stefan Roese --- diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c index 391d169a48..631b969bbc 100644 --- a/drivers/mtd/cfi_flash.c +++ b/drivers/mtd/cfi_flash.c @@ -2009,7 +2009,9 @@ unsigned long flash_init (void) #endif #ifdef CONFIG_SYS_FLASH_PROTECTION - char *s = getenv("unlock"); + /* read environment from EEPROM */ + char s[64]; + getenv_r ("unlock", s, sizeof(s)); #endif #define BANK_BASE(i) (((phys_addr_t [CFI_MAX_FLASH_BANKS])CONFIG_SYS_FLASH_BANKS_LIST)[i])