r3973 - trunk/src/target/u-boot/patches
werner at sita.openmoko.org
werner at sita.openmoko.org
Tue Jan 29 13:37:39 CET 2008
Author: werner
Date: 2008-01-29 13:37:35 +0100 (Tue, 29 Jan 2008)
New Revision: 3973
Added:
trunk/src/target/u-boot/patches/nor-default-env.patch
Log:
This patch makes u-boot use the default environment is booting from NOR. That
way, we can be sure no contamination occurs from a possibly severely upset
NAND.
nor-default-env.patch:
- cpu/arm920t/start.S, common/env_common.c (env_relocate): new configuration
option CFG_DEFAULT_ENV_IF_NOR to use the default environment (and not try to
load it from NAND) if booting from NOR
- cpu/arm920t/start.S (booted_from_nor): set this flag if booting from NOR
- include/configs/neo1973_gta02.h: set CFG_DEFAULT_ENV_IF_NOR
Signed-off-by: Werner Almesberger <werner at openmoko.org>
Added: trunk/src/target/u-boot/patches/nor-default-env.patch
===================================================================
--- trunk/src/target/u-boot/patches/nor-default-env.patch 2008-01-29 11:58:15 UTC (rev 3972)
+++ trunk/src/target/u-boot/patches/nor-default-env.patch 2008-01-29 12:37:35 UTC (rev 3973)
@@ -0,0 +1,91 @@
+This patch makes u-boot use the default environment is booting from NOR. That
+way, we can be sure no contamination occurs from a possibly severely upset
+NAND.
+
+nor-default-env.patch:
+- cpu/arm920t/start.S, common/env_common.c (env_relocate): new configuration
+ option CFG_DEFAULT_ENV_IF_NOR to use the default environment (and not try to
+ load it from NAND) if booting from NOR
+- cpu/arm920t/start.S (booted_from_nor): set this flag if booting from NOR
+- include/configs/neo1973_gta02.h: set CFG_DEFAULT_ENV_IF_NOR
+
+Signed-off-by: Werner Almesberger <werner at openmoko.org>
+
+Index: u-boot/common/env_common.c
+===================================================================
+--- u-boot.orig/common/env_common.c
++++ u-boot/common/env_common.c
+@@ -34,6 +34,10 @@
+ extern char *preboot_override;
+ #endif
+
++#ifdef CFG_DEFAULT_ENV_IF_NOR
++extern unsigned char booted_from_nor;
++#endif
++
+ DECLARE_GLOBAL_DATA_PTR;
+
+ #ifdef CONFIG_AMIGAONEG3SE
+@@ -257,6 +261,13 @@
+ gd->env_valid = 0;
+ #endif
+
++#ifdef CFG_DEFAULT_ENV_IF_NOR
++ if (booted_from_nor && gd->env_valid) {
++ puts("NOR boot, using default environment\n\n");
++ gd->env_valid = 0;
++ }
++#endif
++
+ if (gd->env_valid == 0)
+ default_env();
+ else {
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -99,6 +99,16 @@
+ .word booted_from_nand
+ #endif /* CONFIG_S3C2410_NAND_BOOT */
+
++#ifdef CFG_DEFAULT_ENV_IF_NOR
++.globl booted_from_nor
++booted_from_nor:
++ .word 0
++_booted_from_nor:
++ .word booted_from_nor
++_end_if_0:
++ .word __bss_start-_start
++#endif /* CFG_DEFAULT_ENV_IF_NOR */
++
+ _TEXT_BASE:
+ .word TEXT_BASE
+
+@@ -382,6 +392,15 @@
+ stmia r1!, {r3-r10} /* copy to target address [r1] */
+ cmp r0, r2 /* until source end address [r2] */
+ ble copy_loop
++
++#ifdef CFG_DEFAULT_ENV_IF_NOR
++ ldr r0, _end_if_0 /* are we booting from NOR ? */
++ cmp r0, r2
++ ldreq r0, _booted_from_nor /* remember that we've booted from */
++ moveq r1, #1 /* NOR */
++ streqb r1, [r0]
++#endif /* CFG_DEFAULT_ENV_IF_NOR */
++
+ mov r0, #0 /* flush v3/v4 cache */
+ mcr p15, 0, r0, c7, c7, 0
+ ldr pc, _done_relocate /* jump to relocated code */
+Index: u-boot/include/configs/neo1973_gta02.h
+===================================================================
+--- u-boot.orig/include/configs/neo1973_gta02.h
++++ u-boot/include/configs/neo1973_gta02.h
+@@ -206,6 +206,7 @@
+ */
+
+ #define CFG_ENV_IS_IN_NAND 1
++#define CFG_DEFAULT_ENV_IF_NOR
+ #define CFG_ENV_SIZE 0x40000 /* 128k Total Size of Environment Sector */
+ #define CFG_ENV_OFFSET_OOB 1 /* Location of ENV stored in block 0 OOB */
+ #define CFG_PREBOOT_OVERRIDE 1 /* allow preboot from memory */
More information about the commitlog
mailing list