PATCH: bootldr.c

From: Chris McKillop (cdm@qnx.com)
Date: Tue Apr 17 2001 - 14:54:17 EDT


Added in QNX support to bootldr.c. Currently only works on the iPaq but
that should be fine for now. Will look into adding a better discovery
algorithim in the future.

Index: bootldr.c
===================================================================
RCS file: /cvs/bootldr/bootldr.c,v
retrieving revision 1.39
diff -u -r1.39 bootldr.c
--- bootldr.c 2001/04/17 18:34:17 1.39
+++ bootldr.c 2001/04/17 18:50:50
@@ -600,7 +600,6 @@
 {
     if (squelch_serial())
         return;
-
   /* wait for space in the TX FIFO */
 #ifdef CONFIG_SKIFF
   while (CSR_READ_BYTE(UARTFLG_REG) & UART_TX_FIFO_BUSY);
@@ -1061,6 +1060,7 @@
    getc_errno = 0; /* reset errno */
 
    while (!SERIAL_CHAR_READY()) {
+
        if ((ch = get_pushed_char()) != -1)
            return (ch);
    
@@ -1367,8 +1367,8 @@
     const char* prefix_in,
     int just_show)
 {
- char* p;
- char* endp;
+ unsigned char* p;
+ unsigned char* endp;
   const char* prefix;
   int cmdnum;
   char cmdbuf[1024];
@@ -1827,6 +1827,7 @@
                         vaddr_t kernel_region_start, size_t kernel_region_size, int argc, const char **argv)
 {
    unsigned long *kernel_region_words = (unsigned long *)kernel_region_start;
+ unsigned long *qnx_image_words = (unsigned long *)QNX_IMAGE_START;
    unsigned long boot_magic = kernel_region_words[0];
    unsigned long kernel_image_size = kernel_region_words[1];
    unsigned long kernel_image_dest = kernel_region_words[2];
@@ -1846,6 +1847,7 @@
    long download_kernel = 0;
    long kernel_in_ram = 0;
    long copy_ramdisk = 0;
+ void (*qnx_start_func)( void );
 
    get_param_value("dram_size", &dram_size);
    get_param_value("os", (long*)&os);
@@ -1873,6 +1875,25 @@
       kernel_image_maxsize = kernel_region_size;
    }
 
+
+ /* Check for a QNX image */
+ if( strncmp( os, "autoselect" ) == 0 ||
+ strncmp( os, "qnx" ) == 0 )
+ {
+ putstr( "Looking for a QNX image...\n\r" );
+ putLabeledWord( "qnx_magic=", qnx_image_words[0x1000] );
+
+ /* The IPL has 4K so the startup header is offset by 1k words */
+ if( qnx_image_words[1024] == QNX_IMAGE_MAGIC )
+ {
+ putstr( "Booting a QNX kernel:\r\n" );
+ qnx_start_func = (void *)QNX_IMAGE_START;
+ flush_caches();
+ let_uart_drain(SA1100_UART3_UTSR1);
+ qnx_start_func();
+ }
+ }
+
    if (boot_magic == 0xFFFFFFFFL) {
       putstr("no boot image in flash\r\n");
       
@@ -1887,8 +1908,7 @@
       putstr("expecting to boot a netbsd kernel\r\n");
       bootingLinux = 0;
    }
-
-
+
    putLabeledWord("boot_magic=", boot_magic);
    putLabeledWord("kernel_image_first_word=", kernel_image_first_word);
 



This archive was generated by hypermail 2.1.5 : Fri Jan 17 2003 - 17:47:02 EST