Update of /cvsroot/blob/blob/src/blob
In directory sc8-pr-cvs1:/tmp/cvs-serv2905
Modified Files:
load_kernel.c
Log Message:
Look for cramfs/jffs2 filesystems at RAMDISK_FLASH_BASE and for
zImage's at KERNEL_FLASH_BASE. All loader flavors can co-exist
peacefully now; search order is as before.
This is an interim solution until the new partition code is fully
integrated.
Index: load_kernel.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- load_kernel.c 9 Jan 2003 00:40:05 -0000 1.11
+++ load_kernel.c 9 Jan 2003 01:40:25 -0000 1.12
@@ -52,21 +52,39 @@
#define FODDER_RAM_BASE (0xC0F00000)
+const void *fodder_ram_base = (void *) FODDER_RAM_BASE;
-const struct kernel_loader *loader[] = {
+
+/* this will go away once we integrate the new partition code */
+struct hash_defined_partition hash_defined_part_table[] = {
#ifdef CONFIG_CRAMFS_SUPPORT
- &cramfs_load,
+ {
+ .loader = &cramfs_load,
+ .offset = (char *) RAMDISK_FLASH_BASE,
+ .size = RAMDISK_FLASH_LEN
+ },
#endif
#ifdef CONFIG_ZIMAGE_SUPPORT
- &zImage_load,
+ {
+ .loader = &zImage_load,
+ .offset = (char *) KERNEL_FLASH_BASE,
+ .size = KERNEL_FLASH_LEN
+ },
#endif
#ifdef CONFIG_JFFS2_SUPPORT
- &jffs2_load,
+ {
+ .loader = &jffs2_load,
+ .offset = (char *) RAMDISK_FLASH_BASE,
+ .size = RAMDISK_FLASH_LEN
+ },
#endif
- NULL
+ {
+ .loader = 0,
+ .offset = 0,
+ .size = 0
+ }
};
-const void *fodder_ram_base = (void *) FODDER_RAM_BASE;
/* function calls for blob */
void ldr_update_progress(void)
@@ -78,29 +96,32 @@
{
int i;
u32 size;
+ const struct kernel_loader *loader;
struct part_info part;
-#if defined(CONFIG_CRAMFS_SUPPORT) || defined(CONFIG_JFFS2_SUPPORT)
- part.offset = (char *) RAMDISK_FLASH_BASE;
- part.size = RAMDISK_FLASH_LEN;
-#else
- part.offset = (char *) KERNEL_FLASH_BASE;
- part.size = KERNEL_FLASH_LEN;
-#endif
- part.erasesize = flash_get_block_size((u32)part.offset);
+ for (i = 0; /**/ ; i++) {
+ loader = hash_defined_part_table[i].loader;
- for (i = 0; loader[i] && !loader[i]->check_magic(&part); i++)
- ;
+ if (!loader)
+ break;
+
+ part.offset = hash_defined_part_table[i].offset;
+ part.size = hash_defined_part_table[i].size;
+ part.erasesize = flash_get_block_size((u32)part.offset);
- if (!loader[i]) {
+ if (loader->check_magic(&part))
+ break;
+ }
+
+ if (!loader) {
eprintf("Unable to find kernel, loading raw data "
"and hoping for the best!\n");
size = KERNEL_FLASH_LEN;
MyMemCpy((u32 *)KERNEL_RAM_BASE, (u32 *)KERNEL_FLASH_BASE, size >> 2);
} else {
- printf("Loading kernel from %s ...", loader[i]->name);
- if ((size = loader[i]->load_kernel((u32 *)KERNEL_RAM_BASE,
- &part, "/boot/linux")) == 0) {
+ printf("Loading kernel from %s ...", loader->name);
+ if ((size = loader->load_kernel((u32 *)KERNEL_RAM_BASE,
+ &part, "/boot/linux")) == 0) {
eprintf("error loading kernel!\n");
return(EINVAL);
}
|