Subject: Serial kernel loading & DEC21143(bios-1.06)

From: "¹éº´±â" <[email-masked]>
Date: Fri, 25 Feb 2000 21:43:53 KST

Hi all...

Thank you for your helps....

I have three more questions.

I made a bios-1.06 and wrote to bootrom successfully.
And then...

1) How can I load arm linux kernel using serial at CFG> prompt ?
   
   EBSA285 manual boot
   1- Boot Method : serial
   2- Image Number : 2
   3- Root device : 0000
   4- Argument :
   b-boot     p- pci config
   CFG>

2) Is there anyone who success to load kernel using DEC21143 ?
   Or... DEC21143 Ethernet driver is supported ..?

3) When I booted using bios-1.06, My ebsa282 hanged at pci_read_config_word().
   Who has the same experience ?

Thank you.

ByungGi Baek.
==================================================
[email-masked] ByungGi Baek.
==================================================
No. 1 우리 인터넷, 다음
평생 쓰는 무료 E-mail 주소 한메일넷
지구촌 한글 검색서비스 Daum FIREBALL
http://www.daum.net

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]
++        Please use [email-masked] for           ++
++                        kernel-related discussions.                      ++

---

From: Nicolas Pitre <[email-masked]>
Date: Fri, 25 Feb 2000 09:58:31 -0500 (EST)

> 1) How can I load arm linux kernel using serial at CFG> prompt ?

Apply the attached patch against bios-1.06.  It fixes the serial code plus
other minor things.

>    Or... DEC21143 Ethernet driver is supported ..?

Never tried.

>    Who has the same experience ?

It certainly won't help for your DEC21143 to work.

Nicolas
diff -urN 1.06/bios/Changes bios/Changes
--- 1.06/bios/Changes	Sun Nov 28 16:14:50 1999
+++ bios/Changes	Thu Feb 24 10:43:46 2000
@@ -10,3 +10,11 @@
 
     Nicolas Pitre <[email-masked]>
 	- added y-modem upload boot method
+
+Changes to 1.06:
+    Nicolas Pitre <[email-masked]>
+	- fixed y-modem code
+	- fixed linker script (.bss wasn't fully initialized)
+	- added flash image boot method
+
+
diff -urN 1.06/bios/Makefile bios/Makefile
--- 1.06/bios/Makefile	Sat Nov 20 09:49:50 1999
+++ bios/Makefile	Thu Feb 24 10:40:49 2000
@@ -1,7 +1,11 @@
 .EXPORT_ALL_VARIABLES:
 
-#TEXTADDR	=0x411000a0
+# This is for the bios to be launched from a flash bank by angel (with FMU?).
 TEXTADDR	=0x411000c0
+
+# This is for the ultimate boot instance... with nothing else.
+#TEXTADDR	=0x41000080
+
 DATAADDR	=0x1000
 CROSS_COMPILE	=arm-linux-
 
diff -urN 1.06/bios/drivers/char/Makefile bios/drivers/char/Makefile
--- 1.06/bios/drivers/char/Makefile	Sun Nov 28 16:15:20 1999
+++ bios/drivers/char/Makefile	Tue Jan 25 16:20:41 2000
@@ -1,5 +1,5 @@
 
 L_TARGET	:= char.a
-L_OBJS		:= vga.o ry.o
+L_OBJS		:= vga.o ry.o flash.o
 
 include $(TOPDIR)/Rules.make
diff -urN 1.06/bios/drivers/char/flash.c bios/drivers/char/flash.c
--- 1.06/bios/drivers/char/flash.c	Wed Dec 31 19:00:00 1969
+++ bios/drivers/char/flash.c	Wed Jan 26 15:07:56 2000
@@ -0,0 +1,78 @@
+/*
+ * flash.c : boot method for booting a kernel directly from flash
+ * (C) 2000 Nicolas Pitre <[email-masked]>
+ *
+ * This code boots the kernel directly from flash.  For this to work, 
+ * some parameters must be set in linux/arch/arm/boot/compressed/Makefile
+ * for the CONFIG_FOOTBRIDGE section as follows:
+ *
+ *   ZTEXTADDR        = (value of KERNEL_IMG_ADDR below)
+ *   ZRELADDR         = 0x00008000
+ *   ZBSSADDR         = 0x00200000
+ *
+ * Also you must ensure your zImage doesn't contain any variable data 
+ * section.  For this run:
+ *
+ * 	size linux/arch/arm/boot/compressed/vmlinux
+ *
+ * after compiling. Note: you might need to use 'arm-linux-size' instead if
+ * you are cross-compiling.  You must get an output like this:
+ *
+ *    text    data     bss     dec     hex filename
+ *  484696       0   33848  518544   7e990 arch/arm/boot/compressed/vmlinux
+ *
+ * Here 'data' must be 0.  If you have an older kernel source tree than 2.3.x,
+ * you might need to use a patched linux/lib/inflate.c (simply copying the
+ * one from a 2.3.x source tree should do).
+ *
+ * Finally the kernel's zImage must be flashed at KERNEL_IMG_ADDR.
+ */
+
+#include <bios/boot.h>
+#include <bios/bootdev.h>
+#include <bios/stdio.h>
+
+
+#define KERNEL_IMG_ADDR	(0x41000000 + 64*1024)
+#define MAGIC_SIG	0x016f2818	/* in arch/arm/boot/compressed/head.S */
+
+
+static int flash_probe( void )
+{
+	long *ptr = (long *)KERNEL_IMG_ADDR;
+
+	/*
+	 * Check for zImage signature and if it can be executed in place. 
+	 * Those values are found in linux/arch/arm/boot/compressed/head.S
+	 */
+	if( ptr[9] != MAGIC_SIG ) return -1;
+	if( ptr[10] != (long)ptr ) {
+		/* see comments at the beginning of this file */
+		printf( "\nWrong ZTEXTADDR for zImage in flash at %p\n", ptr );
+		return -1;
+	}
+	return 0;
+}
+
+
+static int flash_load( void )
+{
+	load_addr = KERNEL_IMG_ADDR;
+	return 0;
+}
+
+
+static int flash_dummy( void )
+{
+	return 0;
+}
+
+
+struct bootdev boot_flash = {
+	"flash image",
+        flash_probe,
+        flash_probe,	/* start */
+        flash_load,
+        flash_dummy	/* stop */
+};
+
diff -urN 1.06/bios/drivers/char/ry.c bios/drivers/char/ry.c
--- 1.06/bios/drivers/char/ry.c	Sun Nov 28 16:16:51 1999
+++ bios/drivers/char/ry.c	Tue Jan 25 17:24:53 2000
@@ -41,7 +41,7 @@
 
 static void tx( int c )
 {
-  while (*((volatile int *)(SERBASE + 0x18)) & 8);
+  while (*((volatile int *)(SERBASE + 0x18)) & (1<<5));
   *((volatile int *)(SERBASE)) = c;
 }
 
@@ -51,9 +51,9 @@
   unsigned int expire = centisecs + timeout * 100;
 
   while( centisecs <= expire ){
-    if ( ! *((volatile unsigned int *)(SERBASE + 0x18)) & 16) {
+    if ( ! (*((volatile int *)(SERBASE + 0x18)) & (1<<4)) ) {
       c = *((volatile int *)(SERBASE));
-      return c;
+      return c & 0xff;
     }
   }
   return TIMEOUT;
@@ -193,10 +193,11 @@
 {
   int res;
 
-  printf ("Now send file with ymodem...\n" );
+  printf( "\nNow send file with y-modem (^X to abort) ...\n" );
   pout = (unsigned long *)load_addr;
   res = wcreceive();
-  printf( "Transfer %s, press any key.\n", 
+  wait_cs( 50 );
+  printf( "\n\nTransfer %s, press any key.\n", 
           (res == OK) ? "complete" : "failed" );
   getc();
   return res;
@@ -208,7 +209,7 @@
 }
 
 struct bootdev boot_serial = {
-        "serial",
+        "serial port",
         serial_dummy,
         serial_dummy,
         serial_load,
diff -urN 1.06/bios/elfbios.lds bios/elfbios.lds
--- 1.06/bios/elfbios.lds	Sun Nov 28 16:22:12 1999
+++ bios/elfbios.lds	Wed Jan 26 16:09:52 2000
@@ -11,19 +11,19 @@
         *(.gnu.warning)
         *(.rodata)
 	. = ALIGN(4);
-    _etext = .;			/* End of text section          */
   }
+  _etext = .;			/* End of text section          */
 
   .data : {			/* Data                         */
     _data = .;
         *(.data)
-    _edata = .;			/* End of data section          */
   }
+  _edata = .;			/* End of data section          */
   _data_sz = SIZEOF(.data);
 
   .bss : {
      _bss_start = .;		/* BSS                          */
         *(.bss)
-     _end = . ;
    }
+   _end = .;
 }
diff -urN 1.06/bios/include/bios/config.h bios/include/bios/config.h
--- 1.06/bios/include/bios/config.h	Sun Oct  4 09:51:14 1998
+++ bios/include/bios/config.h	Tue Jan 25 16:25:34 2000
@@ -25,17 +25,22 @@
 /* Define this if you wish your machine to have the capability of booting
  * using an image stored on another machine via a TCP/IP network.
  */
 #define CONFIG_BOOT_NET
 
 /* Define this if you wish your machine to have the capability of booting
  * from an IDE hard disk.
  */
 #define CONFIG_BOOT_IDE
 
 /* Define this if you wish your machine to have the capability of booting
  * from a SCSI hard disk.
  */
 #undef CONFIG_BOOT_SCSI
+
+/* Define this if you wish your machine to have the capability of booting
+ * with a kernel image directly from Flash.
+ */
+#define CONFIG_BOOT_FLASH
 
 /*============================================================================
  * Network Configuration
diff -urN 1.06/bios/init/crt0.S bios/init/crt0.S
--- 1.06/bios/init/crt0.S	Sun Nov 28 16:16:51 1999
+++ bios/init/crt0.S	Thu Jan 27 16:39:10 2000
@@ -128,11 +128,6 @@
  * Detect RAM multiplexer settings
  */
 
- mov r0, r4
- bl ser_printhex
- mov r0, #':'
- bl ser_printc
-
 	mov	r0, r4			@ check for presence
 	add	r1, r4, #64
 	bl	testram
@@ -152,11 +147,6 @@
 	orr	r1, r0, #1 << 22
 	bl	testram
 	orreq	r5, r5, #1
-
- mov r0, r5
- bl ser_printhex
- mov r0, #'\n'
- bl ser_printc
 
 	adr	r1, ram_modes		@ convert test -> mux
 	ldrb	r6, [r1, r5]
diff -urN 1.06/bios/init/main.c bios/init/main.c
--- 1.06/bios/init/main.c	Sun Nov 28 16:32:52 1999
+++ bios/init/main.c	Thu Jan 27 19:05:31 2000
@@ -25,6 +25,7 @@
 extern struct bootdev boot_net;
 extern struct bootdev boot_ide;
 extern struct bootdev boot_scsi;
+extern struct bootdev boot_flash;
 extern struct bootdev boot_serial;
 
 static struct bootdev *first;
@@ -38,6 +39,9 @@
 #ifdef CONFIG_BOOT_NET
 	&boot_net,
 #endif
+#ifdef CONFIG_BOOT_FLASH
+	&boot_flash,
+#endif
 	&boot_serial,
 	NULL
 };
@@ -172,8 +181,9 @@
 				bd = first;
 			break;
 
 		case '2':
 			img_nr = (img_nr + 1) & 3;
+			break;
 
 		case '3':
 			{