⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default-env.patch

📁 Uboot常用的移植patches, 方便定制移植到s3c2440
💻 PATCH
字号:
common/env_common.c (default_env): new function that resets the environment to  the default valuecommon/env_common.c (env_relocate): use default_env instead of own copycommon/env_nand.c (env_relocate_spec): use default_env instead of own copyinclude/environment.h: added default_env prototype- Werner Almesberger <werner@openmoko.org>Index: u-boot/common/env_common.c===================================================================--- u-boot.orig/common/env_common.c+++ u-boot/common/env_common.c@@ -195,6 +195,25 @@ 	} } +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__,@@ -238,23 +257,8 @@ 		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 @@ 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 @@ 	unsigned char	data[ENV_SIZE]; /* Environment data		*/ } env_t; ++void default_env(void);+ #endif	/* _ENVIRONMENT_H_ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -