r1080 - trunk/src/target/u-boot/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Thu Feb 22 23:50:20 CET 2007


Author: werner
Date: 2007-02-22 23:49:54 +0100 (Thu, 22 Feb 2007)
New Revision: 1080

Added:
   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/preboot-override.patch
Log:
preliminary checkin of small start.S changes



Added: 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-22 21:36:56 UTC (rev 1079)
+++ trunk/src/target/u-boot/patches/boot-from-ram-and-nand.patch	2007-02-22 22:49:54 UTC (rev 1080)
@@ -0,0 +1,77 @@
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -157,17 +157,18 @@ reset:
+ 	str	r1, [r0]
+ #endif	/* CONFIG_S3C2400 || CONFIG_S3C2410 */
+ 
+-	/*
+-	 * 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)
+ 	bl	cpu_init_crit
+ #endif
+ 
+-#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 ?	    */
++	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:
+ 	ldr	pc, _done_relocate	/* jump to relocated code */
+ _done_relocate:
+ 	.word	done_relocate
+-done_relocate:
+-#else /* NAND_BOOT */
+-relocate:
+-copy_myself:
++
++nand_load:
++#if !defined(CONFIG_SKIP_LOWLEVEL_INIT) && defined(CONFIG_LL_INIT_NAND_ONLY)
++	bl	cpu_init_crit
++#endif
++
+ 	/* mov	r10, lr */
+ 
+ 	@ reset NAND
+@@ -274,7 +277,7 @@ notmatch:
+ #endif
+ 1:	b	1b
+ done_nand_read:
+-#endif /* NAND_BOOT */
++done_relocate:
+ 
+ #if defined(CONFIG_USE_IRQ) && defined(CONFIG_S3C2410)
+ 	/* In the case of the S3C2410, if we've somehow magically (JTAG, ...)
+Index: u-boot/include/configs/neo1973.h
+===================================================================
+--- u-boot.orig/include/configs/neo1973.h
++++ u-boot/include/configs/neo1973.h
+@@ -26,14 +26,10 @@
+ #ifndef __CONFIG_H
+ #define __CONFIG_H
+ 
+-#if defined(BUILD_FOR_RAM)
+-/* If we want to start u-boot from inside RAM */
+-#define CONFIG_SKIP_LOWLEVEL_INIT	1
+-#else
+-/* we want to start u-boot directly from within NAND flash */
++/* we want to be able to start u-boot directly from within NAND flash */
++#define CONFIG_LL_INIT_NAND_ONLY
+ #define CONFIG_S3C2410_NAND_BOOT	1
+ #define CONFIG_S3C2410_NAND_SKIP_BAD	1
+-#endif
+ 
+ /*
+  * High Level Configuration Options

Added: trunk/src/target/u-boot/patches/boot-from-ram-reloc.patch
===================================================================
--- trunk/src/target/u-boot/patches/boot-from-ram-reloc.patch	2007-02-22 21:36:56 UTC (rev 1079)
+++ trunk/src/target/u-boot/patches/boot-from-ram-reloc.patch	2007-02-22 22:49:54 UTC (rev 1080)
@@ -0,0 +1,70 @@
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ 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	    */
+ 	adr	r0, _start		/* r0 <- current position of code   */
+ 	ldr	r1, _TEXT_BASE		/* test if we run from flash or RAM */
+ 	cmp     r0, r1                  /* don't reloc during debug         */
+-	beq     stack_setup
++	beq     done_relocate
+ 
+ 	ldr	r2, _armboot_start
+ 	ldr	r3, _bss_start
+@@ -181,8 +180,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 */
++	ldr	pc, _done_relocate	/* jump to relocated code */
++_done_relocate:
++	.word	done_relocate
++done_relocate:
+ #else /* NAND_BOOT */
+ relocate:
+ copy_myself:
+@@ -270,11 +275,13 @@ 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 */
+ 
+ 	/* Set up the stack						    */
+ stack_setup:
+Index: u-boot/include/configs/neo1973.h
+===================================================================
+--- u-boot.orig/include/configs/neo1973.h
++++ u-boot/include/configs/neo1973.h
+@@ -28,7 +28,6 @@
+ 
+ #if defined(BUILD_FOR_RAM)
+ /* If we want to start u-boot from inside RAM */
+-#define CONFIG_SKIP_RELOCATE_UBOOT	1
+ #define CONFIG_SKIP_LOWLEVEL_INIT	1
+ #else
+ /* we want to start u-boot directly from within NAND flash */

Added: trunk/src/target/u-boot/patches/preboot-override.patch
===================================================================
--- trunk/src/target/u-boot/patches/preboot-override.patch	2007-02-22 21:36:56 UTC (rev 1079)
+++ trunk/src/target/u-boot/patches/preboot-override.patch	2007-02-22 22:49:54 UTC (rev 1080)
@@ -0,0 +1,86 @@
+Index: u-boot/cpu/arm920t/start.S
+===================================================================
+--- u-boot.orig/cpu/arm920t/start.S
++++ u-boot/cpu/arm920t/start.S
+@@ -77,6 +77,12 @@ _fiq:			.word fiq
+  *************************************************************************
+  */
+ 
++#ifdef CFG_PREBOOT_OVERRIDE
++.globl	preboot_override
++preboot_override:
++	.word	0
++#endif
++
+ _TEXT_BASE:
+ 	.word	TEXT_BASE
+ 
+Index: u-boot/include/configs/neo1973.h
+===================================================================
+--- u-boot.orig/include/configs/neo1973.h
++++ u-boot/include/configs/neo1973.h
+@@ -205,6 +205,7 @@
+ #define	CFG_ENV_IS_IN_NAND	1
+ #define CFG_ENV_SIZE		0x4000		/* 16k 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 */
+ 
+ #define NAND_MAX_CHIPS		1
+ #define CFG_NAND_BASE		0x4e000000
+Index: u-boot/common/main.c
+===================================================================
+--- u-boot.orig/common/main.c
++++ u-boot/common/main.c
+@@ -85,6 +85,11 @@ int do_mdm_init = 0;
+ extern void mdm_init(void); /* defined in board.c */
+ #endif
+ 
++#ifdef CFG_PREBOOT_OVERRIDE
++extern char *preboot_override;
++#endif
++
++
+ /***************************************************************************
+  * Watch for 'delay' seconds for autoboot stop or autoboot delay string.
+  * returns: 0 -  no key string, allow autoboot
+@@ -306,8 +311,8 @@ void main_loop (void)
+ 	char *s;
+ 	int bootdelay;
+ #endif
+-#ifdef CONFIG_PREBOOT
+-	char *p;
++#if defined(CONFIG_PREBOOT) || defined(CFG_PREBOOT_OVERRIDE)
++	char *p = NULL;
+ #endif
+ #ifdef CONFIG_BOOTCOUNT_LIMIT
+ 	unsigned long bootcount = 0;
+@@ -364,8 +369,19 @@ void main_loop (void)
+ 	install_auto_complete();
+ #endif
+ 
++#if defined(CONFIG_PREBOOT) || defined(CFG_PREBOOT_OVERRIDE)
+ #ifdef CONFIG_PREBOOT
+-	if ((p = getenv ("preboot")) != NULL) {
++	p = getenv ("preboot");
++#endif
++#ifdef CFG_PREBOOT_OVERRIDE
++	if (preboot_override) {
++		/* 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 */
++		preboot_override = NULL;
++	}
++#endif /* CFG_PREBOOT_OVERRIDE */
++	if (p) {
+ # ifdef CONFIG_AUTOBOOT_KEYED
+ 		int prev = disable_ctrlc(1);	/* disable Control C checking */
+ # endif
+@@ -381,7 +397,7 @@ void main_loop (void)
+ 		disable_ctrlc(prev);	/* restore Control C checking */
+ # endif
+ 	}
+-#endif /* CONFIG_PREBOOT */
++#endif /* CONFIG_PREBOOT || CFG_PREBOOT_OVERRIDE */
+ 
+ #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
+ 	s = getenv ("bootdelay");





More information about the commitlog mailing list