[U-Boot] [PATCH] env: kill off default_environment_size
Mike Frysinger
vapier at gentoo.org
Fri Jul 24 23:51:27 CEST 2009
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 <vapier at gentoo.org>
---
common/env_common.c | 5 -----
common/env_dataflash.c | 1 -
common/env_flash.c | 1 -
common/env_mgdisk.c | 1 -
common/env_nand.c | 1 -
common/env_nowhere.c | 1 -
common/env_nvram.c | 1 -
common/env_sf.c | 12 +-----------
8 files changed, 1 insertions(+), 22 deletions(-)
diff --git a/common/env_common.c b/common/env_common.c
index 6be3bb0..be64d13 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 fed919e..27a3bbc 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 00792cd..b860c48 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 363ee68..b9de1ed 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 8052fb7..ca631af 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 78e8f8e..ccc068b 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 562edd0..2628fe4 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 2f52e25..6575b6d 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)
--
1.6.3.3
More information about the U-Boot
mailing list