From 7a792e2f3fd515657da9dc0537a6e32a2cc06180 Mon Sep 17 00:00:00 2001 From: Michael Lauer Date: Sun, 5 Aug 2007 06:42:00 +0000 Subject: rename u-boot[-mkimage]-gta01[-native] to u-boot[-mkimage]-openmoko[-native] --- .../default-env.patch | 101 +++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 packages/uboot/u-boot-mkimage-openmoko-native/default-env.patch (limited to 'packages/uboot/u-boot-mkimage-openmoko-native/default-env.patch') diff --git a/packages/uboot/u-boot-mkimage-openmoko-native/default-env.patch b/packages/uboot/u-boot-mkimage-openmoko-native/default-env.patch new file mode 100644 index 0000000000..b9ae4f29fe --- /dev/null +++ b/packages/uboot/u-boot-mkimage-openmoko-native/default-env.patch @@ -0,0 +1,101 @@ +common/env_common.c (default_env): new function that resets the environment to + the default value +common/env_common.c (env_relocate): use default_env instead of own copy +common/env_nand.c (env_relocate_spec): use default_env instead of own copy +include/environment.h: added default_env prototype + +- Werner Almesberger + +Index: u-boot/common/env_common.c +=================================================================== +--- u-boot.orig/common/env_common.c ++++ u-boot/common/env_common.c +@@ -202,6 +202,25 @@ uchar *env_get_addr (int index) + } + } + ++void default_env(void) ++{ ++ if (sizeof(default_environment) > ENV_SIZE) ++ { ++ puts ("*** Error - default environment is too large\n\n"); ++ return; ++ } ++ ++ memset (env_ptr, 0, sizeof(env_t)); ++ memcpy (env_ptr->data, ++ default_environment, ++ sizeof(default_environment)); ++#ifdef CFG_REDUNDAND_ENVIRONMENT ++ env_ptr->flags = 0xFF; ++#endif ++ env_crc_update (); ++ gd->env_valid = 1; ++} ++ + void env_relocate (void) + { + DEBUGF ("%s[%d] offset = 0x%lx\n", __FUNCTION__,__LINE__, +@@ -245,23 +264,8 @@ void env_relocate (void) + gd->env_valid = 0; + #endif + +- if (gd->env_valid == 0) { +- if (sizeof(default_environment) > ENV_SIZE) +- { +- puts ("*** Error - default environment is too large\n\n"); +- return; +- } +- +- memset (env_ptr, 0, sizeof(env_t)); +- memcpy (env_ptr->data, +- default_environment, +- sizeof(default_environment)); +-#ifdef CFG_REDUNDAND_ENVIRONMENT +- env_ptr->flags = 0xFF; +-#endif +- env_crc_update (); +- gd->env_valid = 1; +- } ++ if (gd->env_valid == 0) ++ default_env(); + else { + env_relocate_spec (); + } +Index: u-boot/common/env_nand.c +=================================================================== +--- u-boot.orig/common/env_nand.c ++++ u-boot/common/env_nand.c +@@ -313,19 +313,7 @@ void env_relocate_spec (void) + static void use_default() + { + puts ("*** Warning - bad CRC or NAND, using default environment\n\n"); +- +- if (default_environment_size > CFG_ENV_SIZE){ +- 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; +- ++ default_env(); + } + #endif + +Index: u-boot/include/environment.h +=================================================================== +--- u-boot.orig/include/environment.h ++++ u-boot/include/environment.h +@@ -107,4 +107,7 @@ typedef struct environment_s { + unsigned char data[ENV_SIZE]; /* Environment data */ + } env_t; + ++ ++void default_env(void); ++ + #endif /* _ENVIRONMENT_H_ */ -- cgit v1.2.3