[Balloon-svn] r1209 - balloon/branches/menuconfig/bootldr

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: subversion@balloonboard.org
Date:  
To: balloon-svn
Subject: [Balloon-svn] r1209 - balloon/branches/menuconfig/bootldr
Author: nick
Date: 2010-08-23 00:53:38 +0100 (Mon, 23 Aug 2010)
New Revision: 1209

Modified:
balloon/branches/menuconfig/bootldr/Makefile-level2
balloon/branches/menuconfig/bootldr/bootcmds.c
balloon/branches/menuconfig/bootldr/bootconfig.h
balloon/branches/menuconfig/bootldr/btflash.c
balloon/branches/menuconfig/bootldr/btflash.h
Log:
add bootldr uboot support. Needs mmap fixups for u-boot to detect NOR

Modified: balloon/branches/menuconfig/bootldr/Makefile-level2
===================================================================
--- balloon/branches/menuconfig/bootldr/Makefile-level2    2010-08-22 23:52:48 UTC (rev 1208)
+++ balloon/branches/menuconfig/bootldr/Makefile-level2    2010-08-22 23:53:38 UTC (rev 1209)
@@ -156,6 +156,11 @@
   ARCH_DEFS += -DCONFIG_BALLOON_DEBUG
 endif


+
+ifeq ($(CONFIG_BOOTLDR_UBOOT),y)
+ ARCH_DEFS += -DCONFIG_BOOTLDR_UBOOT=1
+endif
+
ifeq ($(CONFIG_BALLOON_SMALL),y)
ARCH_DEFS += -DCONFIG_MINIMAL=1
else

Modified: balloon/branches/menuconfig/bootldr/bootcmds.c
===================================================================
--- balloon/branches/menuconfig/bootldr/bootcmds.c    2010-08-22 23:52:48 UTC (rev 1208)
+++ balloon/branches/menuconfig/bootldr/bootcmds.c    2010-08-22 23:53:38 UTC (rev 1209)
@@ -347,6 +347,27 @@
                (vaddr_t)(((unsigned long)flashword) + kernelPartition->base), kernelPartition->size, argc, argv, 0);
 }


+#if defined(CONFIG_BOOTLDR_UBOOT)
+/* can have arguments or not */
+SUBCOMMAND(boot, uboot, command_boot_uboot, "boots binary in uboot partition", 0);
+void command_boot_uboot(int argc, const char **argv)
+{
+   struct FlashRegion *ubootPartition = btflash_get_partition("uboot");
+
+   if (ubootPartition) {
+      memcpy((void *)0xa0000000,(const void *)(ubootPartition->base),ubootPartition->size);
+      putLabeledWord("copied uboot from ",ubootPartition->base);
+      putLabeledWord("copied uboot size ",ubootPartition->size);
+
+      exec_string("jump 0xa0000000");
+   }
+   else
+      putstr("Ugh, no uboot partition\r\n");
+
+}
+#endif
+
+#if 0
 /*
  * Boot a QNX/Neutrino kernel.
  */
@@ -387,6 +408,7 @@
                     (unsigned long)qnx_image_words );
     return;
 }
+#endif


 #ifdef    CONFIG_YAFFS_BOOTLDR
 /* read kernel from yaffs file */


Modified: balloon/branches/menuconfig/bootldr/bootconfig.h
===================================================================
--- balloon/branches/menuconfig/bootldr/bootconfig.h    2010-08-22 23:52:48 UTC (rev 1208)
+++ balloon/branches/menuconfig/bootldr/bootconfig.h    2010-08-22 23:53:38 UTC (rev 1209)
@@ -111,7 +111,7 @@


 #define DRAM_MAX_BANK_SIZE    SZ_256M


-#define BANK_SWAP        // swaps bank 2 and 3
+// NCB 1/8/10 #define BANK_SWAP        // swaps bank 2 and 3


 #define DRAM_MAX_BANKS          4
 // debug


Modified: balloon/branches/menuconfig/bootldr/btflash.c
===================================================================
--- balloon/branches/menuconfig/bootldr/btflash.c    2010-08-22 23:52:48 UTC (rev 1208)
+++ balloon/branches/menuconfig/bootldr/btflash.c    2010-08-22 23:53:38 UTC (rev 1209)
@@ -289,7 +289,10 @@


 #if defined(CONFIG_BALLOON_FPGA)
 #include "fpga.h"
+#else
+#define FPGA_IMAGE_ADDRESS 0x100000L
 #endif
+#define    FPGA_IMAGE_SIZE 0x100000L


 static struct FlashDescriptor flashDescriptor_MBM29LV650UE_1x16=  {
    "MBM29LV650UE_1x16", 
@@ -297,15 +300,14 @@
    &amdFlashAlgorithm_1x16,
    sizeof(flashSectors_MBM29LV650UE_1x16)/sizeof(dword) - 1, flashSectors_MBM29LV650UE_1x16,
    { "bootldr",   0x00000000, BOOTLDR_SIZE, LFR_BOOTLDR },
+#if defined(CONFIG_BOOTLDR_UBOOT)
+   { "uboot",     BOOTLDR_SIZE, FPGA_IMAGE_ADDRESS - BOOTLDR_SIZE, 0 },
+#endif
 #if  defined(CONFIG_MACH_BALLOON) && defined(CONFIG_PXA)
 #if defined(CONFIG_BALLOON_FPGA)
-#define    FPGA_IMAGE_SIZE 0x100000L
    { "fpga",      FPGA_IMAGE_ADDRESS, FPGA_IMAGE_SIZE, 0 },
-#else
-#define FPGA_IMAGE_ADDRESS BOOTLDR_SIZE
-#define    FPGA_IMAGE_SIZE 0
 #endif
-   { "kernel",      FPGA_IMAGE_ADDRESS+FPGA_IMAGE_SIZE, BOOT_SIZE, 0 },
+   { "kernel",      FPGA_IMAGE_ADDRESS + FPGA_IMAGE_SIZE, BOOT_SIZE, 0 },
 #endif
 #if defined(CONFIG_NAND) && defined(CONFIG_YAFFS_BOOTLDR)
    { "boot",      0x00000000, BOOT_SIZE, LFR_NAND | LFR_NAND_YAFFS },   
@@ -324,9 +326,11 @@
    &amdFlashAlgorithm_1x16,
    sizeof(flashSectors_MBM29LV650UE_1x16)/sizeof(dword) - 1, flashSectors_MBM29LV650UE_1x16,
    { "bootldr",   0x00000000, BOOTLDR_SIZE, LFR_BOOTLDR },
+#if defined(CONFIG_BOOTLDR_UBOOT)
+   { "uboot",     BOOTLDR_SIZE, FPGA_IMAGE_ADDRESS - BOOTLDR_SIZE, 0 },
+#endif
 #if  defined(CONFIG_MACH_BALLOON) && defined(CONFIG_PXA)
 #if defined(CONFIG_BALLOON_FPGA)
-#define FPGA_IMAGE_SIZE 0x100000L
    { "fpga",      FPGA_IMAGE_ADDRESS, FPGA_IMAGE_SIZE, 0 },
 #else
 #define FPGA__IMAGE_ADDRESS BOOTLDR_SIZE
@@ -350,13 +354,14 @@
    &amdFlashAlgorithm_1x16,
    sizeof(flashSectors_MBM29LV650UE_1x16)/sizeof(dword) - 1, flashSectors_MBM29LV650UE_1x16,
    { "bootldr",   0x00000000, BOOTLDR_SIZE, LFR_BOOTLDR },
+#if defined(CONFIG_BOOTLDR_UBOOT)
+   { "uboot",     BOOTLDR_SIZE, FPGA_IMAGE_ADDRESS - BOOTLDR_SIZE, 0 },
+#endif
 #if  defined(CONFIG_MACH_BALLOON) && defined(CONFIG_PXA)
 #if defined(CONFIG_BALLOON_FPGA)
-#define FPGA_IMAGE_SIZE 0x100000L
    { "fpga",      FPGA_IMAGE_ADDRESS, FPGA_IMAGE_SIZE, 0 },
 #else
 #define FPGA__IMAGE_ADDRESS BOOTLDR_SIZE
-#define FPGA_IMAGE_SIZE 0
 #endif
    { "kernel",      FPGA_IMAGE_ADDRESS+FPGA_IMAGE_SIZE, BOOT_SIZE, 0 },
 #endif
@@ -2491,13 +2496,14 @@
     btflash_define_partition(flashDescriptor->params.name, 
                  flashDescriptor->params.base,
                  flashDescriptor->params.size,
-                 flashDescriptor->params.flags);   
+                 flashDescriptor->params.flags);
 #endif
-#if defined(CONFIG_MACH_BALLOON)
-        btflash_define_partition(flashDescriptor->kernel.name,
-                                 flashDescriptor->kernel.base,
-                                 flashDescriptor->kernel.size,
-                                 flashDescriptor->kernel.flags);
+#if defined(CONFIG_BOOTLDR_UBOOT)
+        btflash_define_partition(flashDescriptor->uboot.name,
+                                 flashDescriptor->uboot.base,
+                                 flashDescriptor->uboot.size,
+                                 flashDescriptor->uboot.flags);
+#endif
 #if defined(CONFIG_BALLOON_FPGA)
         btflash_define_partition(flashDescriptor->fpga.name,
                                  flashDescriptor->fpga.base,
@@ -2505,6 +2511,11 @@
                                  flashDescriptor->fpga.flags);


 #endif
+#if defined(CONFIG_MACH_BALLOON)
+        btflash_define_partition(flashDescriptor->kernel.name,
+                                 flashDescriptor->kernel.base,
+                                 flashDescriptor->kernel.size,
+                                 flashDescriptor->kernel.flags);
 #if defined(CONFIG_NAND)
     btflash_define_partition(flashDescriptor->boot.name, 
                  flashDescriptor->boot.base,
@@ -2592,16 +2603,16 @@
   }
   if (base == 0xffffffff)
       base = partition_next_base();
-  
+
   partition = btflash_get_partition(partition_name);
   //
-  for (i=partition_table->npartitions-1; i >0 ; i--){
-      if (base <  partition_table->partition[i].base){
-      // move it up
-      partition_table->partition[i+1] = partition_table->partition[i];
-      partition = &partition_table->partition[i];
-      }
-  }
+//  for (i=partition_table->npartitions-1; i >0 ; i--){
+//      if (base <  partition_table->partition[i].base){
+//      // move it up
+//      partition_table->partition[i+1] = partition_table->partition[i];
+//      partition = &partition_table->partition[i];
+//      }
+//  }
   if (partition == NULL) {
     partition = &partition_table->partition[partition_table->npartitions];
   }
@@ -2638,7 +2649,7 @@
       putstr("no partition table!\r\n");
       return;
   }
-  
+
   partition = btflash_get_partition(partition_name);
   for (i=0; i < partition_table->npartitions; i++){
       FlashRegion *partition = &partition_table->partition[i];
@@ -2663,7 +2674,6 @@
   putstr("> deleted\r\n");
   partition_table->npartitions--;


-
}



Modified: balloon/branches/menuconfig/bootldr/btflash.h
===================================================================
--- balloon/branches/menuconfig/bootldr/btflash.h    2010-08-22 23:52:48 UTC (rev 1208)
+++ balloon/branches/menuconfig/bootldr/btflash.h    2010-08-22 23:53:38 UTC (rev 1209)
@@ -65,11 +65,14 @@
    unsigned long *sectors;
    struct FlashRegion bootldr;
     //struct FlashRegion params;
+#if defined(CONFIG_BOOTLDR_UBOOT)
+    struct FlashRegion uboot;
+#endif
 #if defined(CONFIG_MACH_BALLOON)
-    struct FlashRegion kernel;
 #if defined(CONFIG_BALLOON_FPGA)
     struct FlashRegion fpga;
 #endif
+    struct FlashRegion kernel;
     struct FlashRegion boot;
 #endif
     struct FlashRegion part3;// sometimes kernel, sometimes root depending