[PATCH 11/15] tidy-second-phase-stub.patch

Andy Green andy at openmoko.com
Wed Aug 13 01:59:44 CEST 2008


Clean up the jump into the full SDRAM copy of bootloader that is made now.
Adjust the compiler options.

Signed-off-by: Andy Green <andy at openmoko.com>
---

 Makefile             |    5 ++++-
 src/kboot-stage1.lds |    6 ++----
 src/start_kboot.c    |   49 ++++++++-----------------------------------------
 3 files changed, 14 insertions(+), 46 deletions(-)

diff --git a/Makefile b/Makefile
index 1f2936b..b279e25 100644
--- a/Makefile
+++ b/Makefile
@@ -25,7 +25,10 @@ BUILD_VERSION := ${BUILD_BRANCH}_${BUILD_HEAD}
 LDS	= src/kboot-stage1.lds
 INCLUDE	= include
 IMAGE_DIR	= image
-CFLAGS	= -Wall -Werror -I $(INCLUDE) -g -c -DBUILD_HOST="${BUILD_HOST}" -DBUILD_VERSION="${BUILD_VERSION}" -DBUILD_DATE="${BUILD_DATE}"
+CFLAGS	= -Wall -Werror -fno-builtin -ffreestanding -fno-strict-aliasing \
+	  -fno-common -ffixed-r8 -I $(INCLUDE) -g -c \
+	  -DBUILD_HOST="${BUILD_HOST}" -DBUILD_VERSION="${BUILD_VERSION}" \
+	  -DBUILD_DATE="${BUILD_DATE}"
 LDFLAGS = 
 #START	= start.o lowlevel_init.o
 S_SRCS	= src/start.S src/lowlevel_init.S
diff --git a/src/kboot-stage1.lds b/src/kboot-stage1.lds
index 551d354..4b93b52 100644
--- a/src/kboot-stage1.lds
+++ b/src/kboot-stage1.lds
@@ -34,10 +34,8 @@ SECTIONS
 	{
 	  src/start.o	(.text)
 	  src/lowlevel_init.o(.text)
-	  src/start_kboot.o	(.text)
-	  src/start_kboot.o	(.rodata)
-	  *(.text)
-	  *(.rodata)
+	  src/start_kboot.o	(.text .rodata)
+	  *(.text .rodata)
 	}
 
 	. = ALIGN(4);
diff --git a/src/start_kboot.c b/src/start_kboot.c
index b4256d2..10badfa 100644
--- a/src/start_kboot.c
+++ b/src/start_kboot.c
@@ -28,18 +28,8 @@
 #include "kboot.h"
 #include <neo_gta02.h>
 
-/*
-unsigned char buf[]={
-0x0d,0xc0,0xa0,0xe1,0x00,0xd8,0x2d,0xe9,0x04,0xb0,0x4c,0xe2,0x4c,0x20,0x9f,0xe5,
-0x05,0x30,0xa0,0xe3,0x00,0x30,0x82,0xe5,0x44,0x20,0x9f,0xe5,0x44,0x30,0x9f,0xe5,
-0x00,0x30,0x82,0xe5,0x40,0x20,0x9f,0xe5,0x3c,0x30,0x9f,0xe5,0x00,0x30,0x93,0xe5,
-0x01,0x30,0xc3,0xe3,0x00,0x30,0x82,0xe5,0x28,0x00,0x9f,0xe5,0x0b,0x00,0x00,0xeb,
-0x24,0x20,0x9f,0xe5,0x20,0x30,0x9f,0xe5,0x00,0x30,0x93,0xe5,0x01,0x30,0x83,0xe3,
-0x00,0x30,0x82,0xe5,0x0c,0x00,0x9f,0xe5,0x04,0x00,0x00,0xeb,0xf0,0xff,0xff,0xea,
-0x10,0x00,0x00,0x56,0x18,0x00,0x00,0x56,0xff,0xff,0x00,0x00,0x14,0x00,0x00,0x56,
-0x01,0x00,0x50,0xe2,0xfd,0xff,0xff,0x1a,0x0e,0xf0,0xa0,0xe1,0x0a};
-*/
-#define stringify(x) #x
+#define stringify2(s) stringify1(s)
+#define stringify1(s) #s
 
 extern void bootloader_second_phase(void);
 
@@ -50,29 +40,9 @@ void start_kboot(void)
 	port_init();
 	serial_init(0x11, UART2);
 
-	puts("Openmoko KBOOT BUILD_HOST BUILD_VERSION BUILD_DATE\n");
-
-#if 0
-	while(1) {
-		serial_putc(2, '0');
-		serial_putc(2, 'x');
-		print32((unsigned int)&n);
-		serial_putc(2, ' ');
-		serial_putc(2, '0');
-		serial_putc(2, 'x');
-		print32((unsigned int)p);
-		serial_putc(2, ' ');
-		serial_putc(2, '0');
-		serial_putc(2, 'x');
-		print32((unsigned int)hello);
-
-		serial_putc(2, '\n');
-
-		blue_on(1);
-		n++;
-	}
-
-#endif
+	puts("Openmoko KBOOT "stringify2(BUILD_HOST)" "
+			      stringify2(BUILD_VERSION)" "
+			      stringify2(BUILD_DATE)"\n");
 
 	/*
 	 * pull the whole U-Boot image into SDRAM
@@ -82,12 +52,9 @@ void start_kboot(void)
 		while(1)
 			blink_led();
 
-		serial_putc(2, '0');
-		serial_putc(2, 'x');
-		print32((unsigned int)bootloader_second_phase);
-		serial_putc(2, ' ');
-		serial_putc(2, '\n');
-
+	/*
+	 * jump to bootloader_second_phase() running from DRAM copy
+	 */
 
 	(phase2)();
 }





More information about the openmoko-kernel mailing list