r1083 - trunk/src/target/u-boot/patches
werner at sita.openmoko.org
werner at sita.openmoko.org
Fri Feb 23 16:54:09 CET 2007
Author: werner
Date: 2007-02-23 16:54:01 +0100 (Fri, 23 Feb 2007)
New Revision: 1083
Added:
trunk/src/target/u-boot/patches/dontask.patch
trunk/src/target/u-boot/patches/wakeup-reason-nand-only.patch
Modified:
trunk/src/target/u-boot/patches/boot-from-ram-and-nand.patch
trunk/src/target/u-boot/patches/boot-from-ram-reloc.patch
trunk/src/target/u-boot/patches/dynenv-harden.patch
trunk/src/target/u-boot/patches/enable-splash-bmp.patch
trunk/src/target/u-boot/patches/preboot-override.patch
trunk/src/target/u-boot/patches/series
trunk/src/target/u-boot/patches/uboot-neo1973-resume.patch
trunk/src/target/u-boot/patches/uboot-s3c2410-norelocate_irqvec_cpy.patch
Log:
preboot-override.patch: execute command string from RAM (overrides normal
operation)
uboot-neo1973-resume.patch: adjusted to fit with the other start.S patches
boot-from-ram-and-nand.patch: decide whether to boot from RAM or NAND at run
time
dynenv-harden.patch: "dynenv set" also updates environment offset in running
u-boot
uboot-s3c2410-norelocate_irqvec_cpy.patch: adjusted for other patches
wakeup-reason-nand-only.patch: make u-boot skip wakeup cause detection if not
booting from NAND (experimental)
boot-from-ram-reloc.patch: boot from anywhere in RAM
enable-splash-bmp.patch: refreshed
dontask.patch: new environment variable "dontask" to override interactive
prompt in various destructive NAND operations
Modified: trunk/src/target/u-boot/patches/boot-from-ram-and-nand.patch
===================================================================
--- trunk/src/target/u-boot/patches/boot-from-ram-and-nand.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/boot-from-ram-and-nand.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -1,3 +1,15 @@
+Auto-detect whether we're booting from RAM or NAND, and act accordingly. This
+allows us to use the same u-boot binary for all boot modes.
+
+include/configs/neo1973.h: introduced new config option
+ CONFIG_LL_INIT_NAND_ONLY to perform low-level initialization only when
+ booting from NAND
+include/configs/neo1973.h: got rid of BUILD_FOR_RAM
+cpu/arm920t/start.S: detect if we need to boot from NAND at run time (i.e., if
+ we're running at address 0)
+
+- Werner Almesberger <werner at openmoko.org>
+
Index: u-boot/cpu/arm920t/start.S
===================================================================
--- u-boot.orig/cpu/arm920t/start.S
@@ -2,3 +14,3 @@
+++ u-boot/cpu/arm920t/start.S
-@@ -157,17 +157,18 @@ reset:
+@@ -157,18 +157,21 @@ reset:
str r1, [r0]
@@ -10,25 +22,27 @@
- * we do sys-critical inits only at reboot,
- * not when booting from ram!
- */
--#ifndef CONFIG_SKIP_LOWLEVEL_INIT
-+#if !defined(CONFIG_SKIP_LOWLEVEL_INIT ) && !defined(CONFIG_LL_INIT_NAND_ONLY)
+ #ifndef CONFIG_SKIP_LOWLEVEL_INIT
++#ifndef CONFIG_LL_INIT_NAND_ONLY
bl cpu_init_crit
#endif
++#endif
+ #ifndef CONFIG_SKIP_RELOCATE_UBOOT
-#ifndef CONFIG_S3C2410_NAND_BOOT
-relocate: /* relocate U-Boot to RAM */
adr r0, _start /* r0 <- current position of code */
++
+#ifdef CONFIG_S3C2410_NAND_BOOT
-+ teq r0, #0 /* are we running from NAND ? */
++ teq r0, #0 /* are we running from NAND ? */
+ beq nand_load
+#endif /* CONFIG_S3C2410_NAND_BOOT */
+
+relocate: /* relocate U-Boot to RAM */
-+ adr r0, _start
ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */
beq done_relocate
-@@ -187,10 +188,12 @@ copy_loop:
+@@ -188,10 +191,13 @@ copy_loop:
ldr pc, _done_relocate /* jump to relocated code */
_done_relocate:
.word done_relocate
@@ -37,6 +51,7 @@
-relocate:
-copy_myself:
+
++#ifdef CONFIG_S3C2410_NAND_BOOT
+nand_load:
+#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && defined(CONFIG_LL_INIT_NAND_ONLY)
+ bl cpu_init_crit
@@ -45,15 +60,16 @@
/* mov r10, lr */
@ reset NAND
-@@ -274,7 +277,7 @@ notmatch:
+@@ -275,7 +281,8 @@ notmatch:
#endif
1: b 1b
done_nand_read:
-#endif /* NAND_BOOT */
++#endif /* CONFIG_S3C2410_NAND_BOOT */
+done_relocate:
+ #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
- #if defined(CONFIG_USE_IRQ) && defined(CONFIG_S3C2410)
- /* In the case of the S3C2410, if we've somehow magically (JTAG, ...)
+ /* Set up the stack */
Index: u-boot/include/configs/neo1973.h
===================================================================
--- u-boot.orig/include/configs/neo1973.h
Modified: trunk/src/target/u-boot/patches/boot-from-ram-reloc.patch
===================================================================
--- trunk/src/target/u-boot/patches/boot-from-ram-reloc.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/boot-from-ram-reloc.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -1,3 +1,15 @@
+This patch allows us to boot from anywhere in RAM. It mainly sets the stage
+for later patches. The only real changes here is the better handling of already
+cached code (e.g., if we were started by a previous instance of u-boot), and
+that we drop CONFIG_SKIP_RELOCATE_UBOOT from neo1973.h
+
+cpu/arm920t/start.S: if not relocating, instead of going straight to
+ stack_setup, jump to done_relocate, which may perform other setup tasks
+cpu/arm920t/start.S: after relocating, flush the cache and jump to the new code
+include/configs/neo1973.h: remove CONFIG_SKIP_RELOCATE_UBOOT
+
+- Werner Almesberger <werner at openmoko.org>
+
Index: u-boot/cpu/arm920t/start.S
===================================================================
--- u-boot.orig/cpu/arm920t/start.S
@@ -2,9 +14,3 @@
+++ u-boot/cpu/arm920t/start.S
-@@ -165,13 +165,12 @@ reset:
- bl cpu_init_crit
- #endif
-
--#ifndef CONFIG_SKIP_RELOCATE_UBOOT
- #ifndef CONFIG_S3C2410_NAND_BOOT
- relocate: /* relocate U-Boot to RAM */
+@@ -171,7 +171,7 @@ relocate: /* relocate U-Boot to RAM
adr r0, _start /* r0 <- current position of code */
@@ -17,15 +23,15 @@
ldr r2, _armboot_start
ldr r3, _bss_start
-@@ -181,8 +180,14 @@ relocate: /* relocate U-Boot to RAM
+@@ -181,8 +181,14 @@ relocate: /* relocate U-Boot to RAM
copy_loop:
ldmia r0!, {r3-r10} /* copy from source address [r0] */
stmia r1!, {r3-r10} /* copy to target address [r1] */
- cmp r0, r2 /* until source end addreee [r2] */
+ cmp r0, r2 /* until source end address [r2] */
ble copy_loop
-+ mov r0, #0
-+ mcr p15, 0, r0, c7, c7, 0 /* flush v3/v4 cache */
++ mov r0, #0 /* flush v3/v4 cache */
++ mcr p15, 0, r0, c7, c7, 0
+ ldr pc, _done_relocate /* jump to relocated code */
+_done_relocate:
+ .word done_relocate
@@ -33,26 +39,12 @@
#else /* NAND_BOOT */
relocate:
copy_myself:
-@@ -270,11 +275,13 @@ notmatch:
+@@ -270,7 +276,7 @@ notmatch:
1: b 1b
done_nand_read:
#endif /* NAND_BOOT */
--#else /* CONFIG_SKIP_RELOCATE_UBOOT */
-+
- #if defined(CONFIG_USE_IRQ) && defined(CONFIG_S3C2410)
- /* In the case of the S3C2410, if we've somehow magically (JTAG, ...)
- ended up in RAM, then that ram is mapped to 0x30000000 and not 0.
- So we need to copy the interrupt vectors, etc. */
-+ /* NB: do this always. In the worst case, we'll overwrite with
-+ identical data. */
-
- mov r0, #0
- ldr r1, _TEXT_BASE
-@@ -287,7 +294,6 @@ irqvec_cpy_next:
- bne irqvec_cpy_next
- irqvec_cpy_done:
- #endif /* CONFIG_USE_IRQ */
-#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
++#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
/* Set up the stack */
stack_setup:
Added: trunk/src/target/u-boot/patches/dontask.patch
===================================================================
--- trunk/src/target/u-boot/patches/dontask.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/dontask.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -0,0 +1,22 @@
+common/cmd_nand.c (yes): if the environment variable "dontask" is set to "y" or
+ "Y", non-interactively assume the answer was "yes". In all other cases, ask.
+
+- Werner Almesberger <werner at openmoko.org>
+
+Index: u-boot/common/cmd_nand.c
+===================================================================
+--- u-boot.orig/common/cmd_nand.c
++++ u-boot/common/cmd_nand.c
+@@ -165,8 +165,12 @@ out:
+
+ static int yes(void)
+ {
++ char *s;
+ char c;
+
++ s = getenv("dontask");
++ if (s && (s[0] =='y' || s[0] == 'Y') && !s[1])
++ return 1;
+ c = getc();
+ if (c != 'y' && c != 'Y')
+ return 0;
Modified: trunk/src/target/u-boot/patches/dynenv-harden.patch
===================================================================
--- trunk/src/target/u-boot/patches/dynenv-harden.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/dynenv-harden.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -4,6 +4,8 @@
allow use of partition name
common/cmd_dynenv.c (do_dynenv): indicate in no uncertain terms when an update
would not work due to Flash bits already cleared
+common/cmd_dynenv.c (do_dynenv): update CFG_ENV_OFFSET after successful "dynenv
+ set", so that we can write the new environment without having to reboot
- Werner Almesberger <werner at openmoko.org>
@@ -115,7 +117,16 @@
memcpy(buf+4, &addr, 4);
printf("%02x %02x %02x %02x - %02x %02x %02x %02x\n",
-@@ -72,8 +90,9 @@ int do_dynenv(cmd_tbl_t *cmdtp, int flag
+@@ -65,6 +83,8 @@ int do_dynenv(cmd_tbl_t *cmdtp, int flag
+ buf[4], buf[5], buf[6], buf[7]);
+
+ ret = mtd->write_oob(mtd, 8, size, (size_t *) &size, (u_char *) buf);
++ if (!ret)
++ CFG_ENV_OFFSET = addr;
+ } else
+ goto usage;
+
+@@ -72,8 +92,9 @@ int do_dynenv(cmd_tbl_t *cmdtp, int flag
return ret;
usage:
Modified: trunk/src/target/u-boot/patches/enable-splash-bmp.patch
===================================================================
--- trunk/src/target/u-boot/patches/enable-splash-bmp.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/enable-splash-bmp.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -22,7 +22,7 @@
===================================================================
--- u-boot.orig/include/configs/neo1973.h
+++ u-boot/include/configs/neo1973.h
-@@ -91,6 +91,7 @@
+@@ -86,6 +86,7 @@
/* CFG_CMD_IRQ | */ \
CFG_CMD_BOOTD | \
CFG_CMD_CONSOLE | \
@@ -30,7 +30,7 @@
CFG_CMD_ASKENV | \
CFG_CMD_RUN | \
CFG_CMD_ECHO | \
-@@ -249,19 +250,21 @@
+@@ -244,19 +245,21 @@
/* we have a board_late_init() function */
#define BOARD_LATE_INIT 1
Modified: trunk/src/target/u-boot/patches/preboot-override.patch
===================================================================
--- trunk/src/target/u-boot/patches/preboot-override.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/preboot-override.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -1,3 +1,16 @@
+Provide a place where the loader can patch the binary, such that it executes a
+command string from RAM. We use this for automated installs, where we can thus
+use the same u-boot binary for all stages.
+
+include/configs/neo1973.h: new option CFG_PREBOOT_OVERRIDE to allow setting of
+ the preboot command in memory
+cpu/arm920t/start.S: added variable "preboot_override" at known location
+ (_start+0x40)
+common/main.c (main_loop): if preboot_override is set, execute the command
+ string found there
+
+- Werner Almesberger <werner at openmoko.org>
+
Index: u-boot/cpu/arm920t/start.S
===================================================================
--- u-boot.orig/cpu/arm920t/start.S
@@ -2,6 +15,7 @@
+++ u-boot/cpu/arm920t/start.S
-@@ -77,6 +77,12 @@ _fiq: .word fiq
+@@ -77,6 +77,13 @@ _fiq: .word fiq
*************************************************************************
*/
++/* Must follow the .balign above, so we get a well-known address ! */
+#ifdef CFG_PREBOOT_OVERRIDE
@@ -12,9 +26,9 @@
+ .word 0
+#endif
+
- _TEXT_BASE:
- .word TEXT_BASE
-
+ #ifdef CONFIG_S3C2410_NAND_BOOT
+ .globl booted_from_nand
+ booted_from_nand:
Index: u-boot/include/configs/neo1973.h
===================================================================
--- u-boot.orig/include/configs/neo1973.h
@@ -54,7 +68,7 @@
#endif
#ifdef CONFIG_BOOTCOUNT_LIMIT
unsigned long bootcount = 0;
-@@ -364,8 +369,19 @@ void main_loop (void)
+@@ -364,8 +369,23 @@ void main_loop (void)
install_auto_complete();
#endif
@@ -65,6 +79,10 @@
+#endif
+#ifdef CFG_PREBOOT_OVERRIDE
+ if (preboot_override) {
++ /* for convenience, preboot_override may end in \n, not \0 */
++ p = strchr(preboot_override, '\n');
++ if (p)
++ *p = 0;
+ /* make sure we can overwrite the load area if we want to */
+ p = strdup(preboot_override);
+ /* clean the image in case we want to flash it */
@@ -75,7 +93,7 @@
# ifdef CONFIG_AUTOBOOT_KEYED
int prev = disable_ctrlc(1); /* disable Control C checking */
# endif
-@@ -381,7 +397,7 @@ void main_loop (void)
+@@ -381,7 +401,7 @@ void main_loop (void)
disable_ctrlc(prev); /* restore Control C checking */
# endif
}
Modified: trunk/src/target/u-boot/patches/series
===================================================================
--- trunk/src/target/u-boot/patches/series 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/series 2007-02-23 15:54:01 UTC (rev 1083)
@@ -14,9 +14,15 @@
uboot-cmd_s3c2410.patch
uboot-s3c2410-mmc.patch
env_nand_oob.patch
+dynenv-harden.patch
uboot-s3c2410_fb.patch
uboot-20061030-qt2410.patch
uboot-20061030-neo1973.patch
+
+# under construction, but intended for mainline
+boot-from-ram-reloc.patch
+boot-from-ram-and-nand.patch
+wakeup-reason-nand-only.patch
uboot-neo1973-resume.patch
# this will be somewhat more difficult
@@ -29,6 +35,7 @@
# those need to be cleaned up
bbt-create-optional.patch
nand-createbbt.patch
+dontask.patch
nand-badisbad.patch
dynpart-absorb-bad.patch
uboot-bbt-quiet.patch
@@ -43,4 +50,5 @@
cmd-unzip.patch
enable-splash-bmp.patch
-dynenv-harden.patch
+# for automated installation
+preboot-override.patch
Modified: trunk/src/target/u-boot/patches/uboot-neo1973-resume.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-neo1973-resume.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/uboot-neo1973-resume.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -4,9 +4,9 @@
Index: u-boot/cpu/arm920t/start.S
===================================================================
---- u-boot.orig/cpu/arm920t/start.S 2007-02-21 22:52:55.000000000 +0100
-+++ u-boot/cpu/arm920t/start.S 2007-02-21 23:21:08.000000000 +0100
-@@ -150,11 +150,33 @@
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -158,18 +158,55 @@ reset:
str r1, [r0]
# endif
@@ -40,13 +40,11 @@
+ bpl 1b
#endif /* CONFIG_S3C2400 || CONFIG_S3C2410 */
- /*
-@@ -163,7 +185,23 @@
- */
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
+ #ifndef CONFIG_LL_INIT_NAND_ONLY
bl cpu_init_crit
+ #endif
-#endif
-+
+#if defined(CONFIG_S3C2410)
+ /* ensure some refresh has happened */
+ mov r1, #4096
@@ -65,12 +63,12 @@
+#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
#ifndef CONFIG_SKIP_RELOCATE_UBOOT
- #ifndef CONFIG_S3C2410_NAND_BOOT
+ adr r0, _start /* r0 <- current position of code */
Index: u-boot/include/s3c2410.h
===================================================================
---- u-boot.orig/include/s3c2410.h 2007-02-21 15:52:58.000000000 +0100
-+++ u-boot/include/s3c2410.h 2007-02-21 15:54:34.000000000 +0100
-@@ -233,4 +233,40 @@
+--- u-boot.orig/include/s3c2410.h
++++ u-boot/include/s3c2410.h
+@@ -233,4 +233,40 @@ static inline S3C2410_SDI * S3C2410_GetB
rINTPND;\
}
/* Wait until rINTPND is changed for the case that the ISR is very short. */
@@ -111,4 +109,3 @@
+#define S3C2410_CLKSLOW_GET_SLOWVAL(x) ((x) & 7)
+
#endif /*__S3C2410_H__*/
-
Modified: trunk/src/target/u-boot/patches/uboot-s3c2410-norelocate_irqvec_cpy.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-s3c2410-norelocate_irqvec_cpy.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/uboot-s3c2410-norelocate_irqvec_cpy.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -1,15 +1,15 @@
If we've somehow magically make u-boot end up in RAM (JTAG, ...), then that RAM
is mapped to 0x30000000 and not 0, so we need to copy the interrupt vectors, etc.
-Index: u-boot.git/cpu/arm920t/start.S
+Index: u-boot/cpu/arm920t/start.S
===================================================================
---- u-boot.git.orig/cpu/arm920t/start.S 2007-02-04 14:25:20.000000000 +0100
-+++ u-boot.git/cpu/arm920t/start.S 2007-02-04 14:39:42.000000000 +0100
-@@ -277,6 +277,23 @@
- 1: b 1b
- done_nand_read:
- #endif /* NAND_BOOT */
-+#else /* CONFIG_SKIP_RELOCATE_UBOOT */
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -332,6 +332,24 @@ done_nand_read:
+ #endif /* CONFIG_S3C2410_NAND_BOOT */
+
+ done_relocate:
++
+#if defined(CONFIG_USE_IRQ) && defined(CONFIG_S3C2410)
+ /* In the case of the S3C2410, if we've somehow magically (JTAG, ...)
+ ended up in RAM, then that ram is mapped to 0x30000000 and not 0.
@@ -26,6 +26,7 @@
+ bne irqvec_cpy_next
+irqvec_cpy_done:
+#endif /* CONFIG_USE_IRQ */
- #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
++
+ #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
/* Set up the stack */
Added: trunk/src/target/u-boot/patches/wakeup-reason-nand-only.patch
===================================================================
--- trunk/src/target/u-boot/patches/wakeup-reason-nand-only.patch 2007-02-23 13:01:49 UTC (rev 1082)
+++ trunk/src/target/u-boot/patches/wakeup-reason-nand-only.patch 2007-02-23 15:54:01 UTC (rev 1083)
@@ -0,0 +1,68 @@
+This patch should get rid of spurious poweroff after booting from RAM.
+Experimental.
+
+cpu/arm920t/start.S: record in global variable "booted_from_nand" whether we
+ booted from NAND or not
+board/neo1973/neo1973.c (board_late_init): if booted from RAM, assume that
+ wakeup cause was "reset", and skip poweroff check
+
+- Werner Almesberger <werner at openmoko.org>
+
+Index: u-boot/board/neo1973/neo1973.c
+===================================================================
+--- u-boot.orig/board/neo1973/neo1973.c
++++ u-boot/board/neo1973/neo1973.c
+@@ -193,12 +193,16 @@ int board_init (void)
+
+ int board_late_init(void)
+ {
++ extern unsigned char booted_from_nand;
+ unsigned char tmp;
+ char buf[32];
+
+ /* Initialize the Power Management Unit with a safe register set */
+ pcf50606_init();
+
++ if (!booted_from_nand)
++ goto woken_by_reset;
++
+ /* obtain wake-up reason, save INT1 in environment */
+ tmp = pcf50606_reg_read(PCF50606_REG_INT1);
+ sprintf(buf, "0x%02x", tmp);
+@@ -241,6 +245,7 @@ int board_late_init(void)
+ neo1973_poweroff();
+ }
+
++woken_by_reset:
+ /* if there's no other reason, must be regular reset */
+ neo1973_wakeup_cause = NEO1973_WAKEUP_RESET;
+
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -77,6 +77,14 @@ _fiq: .word fiq
+ *************************************************************************
+ */
+
++#ifdef CONFIG_S3C2410_NAND_BOOT
++.globl booted_from_nand
++booted_from_nand:
++ .word 0
++_booted_from_nand:
++ .word booted_from_nand
++#endif /* CONFIG_S3C2410_NAND_BOOT */
++
+ _TEXT_BASE:
+ .word TEXT_BASE
+
+@@ -281,6 +289,9 @@ notmatch:
+ #endif
+ 1: b 1b
+ done_nand_read:
++ ldr r0, _booted_from_nand
++ mov r1, #1
++ strb r1, [r0]
+ #endif /* CONFIG_S3C2410_NAND_BOOT */
+ done_relocate:
+ #endif /* CONFIG_SKIP_RELOCATE_UBOOT */
More information about the commitlog
mailing list