From: Mike Frysinger Date: Fri, 24 Jul 2009 21:51:27 +0000 (-0400) Subject: env: kill off default_environment_size X-Git-Tag: v2009.08-rc2~20 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=18304f7675e84252965b4e24cba279071f1da472;p=u-boot env: kill off default_environment_size The only environment type that uses this variable is spi flash, and that is only because it is reimplementing the common set_default_env() function. So fix the spi flash code and kill off the default_environment_size in the process. Signed-off-by: Mike Frysinger --- diff --git a/common/env_common.c b/common/env_common.c index 6be3bb04ac..be64d1307b 100644 --- a/common/env_common.c +++ b/common/env_common.c @@ -139,11 +139,6 @@ uchar default_environment[] = { "\0" }; -#if defined(CONFIG_ENV_IS_IN_NAND) /* Environment is in Nand Flash */ \ - || defined(CONFIG_ENV_IS_IN_SPI_FLASH) -int default_environment_size = sizeof(default_environment); -#endif - void env_crc_update (void) { env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE); diff --git a/common/env_dataflash.c b/common/env_dataflash.c index fed919e675..27a3bbcca0 100644 --- a/common/env_dataflash.c +++ b/common/env_dataflash.c @@ -35,7 +35,6 @@ extern int write_dataflash (unsigned long addr_dest, unsigned long addr_src, unsigned long size); extern int AT91F_DataflashInit (void); extern uchar default_environment[]; -/* extern int default_environment_size; */ uchar env_get_char_spec (int index) diff --git a/common/env_flash.c b/common/env_flash.c index 00792cd38c..b860c48db2 100644 --- a/common/env_flash.c +++ b/common/env_flash.c @@ -83,7 +83,6 @@ static ulong end_addr_new = CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1; #endif /* CONFIG_ENV_ADDR_REDUND */ extern uchar default_environment[]; -extern int default_environment_size; uchar env_get_char_spec (int index) diff --git a/common/env_mgdisk.c b/common/env_mgdisk.c index 363ee68c27..b9de1ed0d3 100644 --- a/common/env_mgdisk.c +++ b/common/env_mgdisk.c @@ -29,7 +29,6 @@ /* references to names in env_common.c */ extern uchar default_environment[]; -extern int default_environment_size; char * env_name_spec = "MG_DISK"; diff --git a/common/env_nand.c b/common/env_nand.c index 8052fb79e5..ca631af195 100644 --- a/common/env_nand.c +++ b/common/env_nand.c @@ -59,7 +59,6 @@ /* references to names in env_common.c */ extern uchar default_environment[]; -extern int default_environment_size; char * env_name_spec = "NAND"; diff --git a/common/env_nowhere.c b/common/env_nowhere.c index 78e8f8eb4e..ccc068b8e8 100644 --- a/common/env_nowhere.c +++ b/common/env_nowhere.c @@ -34,7 +34,6 @@ DECLARE_GLOBAL_DATA_PTR; env_t *env_ptr = NULL; extern uchar default_environment[]; -extern int default_environment_size; void env_relocate_spec (void) diff --git a/common/env_nvram.c b/common/env_nvram.c index 562edd0499..2628fe4348 100644 --- a/common/env_nvram.c +++ b/common/env_nvram.c @@ -58,7 +58,6 @@ env_t *env_ptr = (env_t *)CONFIG_ENV_ADDR; char * env_name_spec = "NVRAM"; extern uchar default_environment[]; -extern int default_environment_size; #ifdef CONFIG_AMIGAONEG3SE uchar env_get_char_spec (int index) diff --git a/common/env_sf.c b/common/env_sf.c index 2f52e2561b..6575b6da39 100644 --- a/common/env_sf.c +++ b/common/env_sf.c @@ -47,7 +47,6 @@ DECLARE_GLOBAL_DATA_PTR; /* references to names in env_common.c */ extern uchar default_environment[]; -extern int default_environment_size; char * env_name_spec = "SPI Flash"; env_t *env_ptr; @@ -143,16 +142,7 @@ err_probe: err_crc: puts("*** Warning - bad CRC, using default environment\n\n"); - if (default_environment_size > CONFIG_ENV_SIZE) { - gd->env_valid = 0; - puts("*** Error - default environment is too large\n\n"); - return; - } - - memset(env_ptr, 0, sizeof(env_t)); - memcpy(env_ptr->data, default_environment, default_environment_size); - env_ptr->crc = crc32(0, env_ptr->data, ENV_SIZE); - gd->env_valid = 1; + set_default_env(); } int env_init(void)