From: Wolfgang Denk Date: Mon, 23 Mar 2009 09:17:38 +0100 Subject: [U-Boot] [PATCH] Make flash protection work, when the environment is in EEPROM In-Reply-To: <20090321135934.12464.65400.stgit@localhost> References: <20090321135934.12464.65400.stgit@localhost> Message-ID: <20090323081738.912F6832E406@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Stefan, In message <20090321135934.12464.65400.stgit@localhost> Jon Smirl wrote: > From: Eric Schumann > > 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. > > Signed-off-by: Eric Schumann > Signed-off-by: Sascha Hauer > --- > 0 files changed, 0 insertions(+), 0 deletions(-) > > diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c > index 391d169..1436131 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[4]; > + getenv_r ("unlock", s, sizeof(s)); > #endif > > #define BANK_BASE(i) (((phys_addr_t [CFI_MAX_FLASH_BANKS])CONFIG_SYS_FLASH_BANKS_LIST)[i]) Please change "char s[4];" into "char s[256];", otherwise: Acked-by: Wolfgang Denk Best regards, Wolfgang Denk -- 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 don't see any direct evidence ... but, then, my crystal ball is in dire need of an ectoplasmic upgrade. :-) -- Howard Smith