From: Tim R. <tim...@us...> - 2002-04-27 10:33:56
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv7626/src/blob Modified Files: load_kernel.c main.c shannon.c Log Message: use load_kernel if any of zimage, jffs2, cramfs are defined Index: load_kernel.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- load_kernel.c 27 Apr 2002 07:32:40 -0000 1.4 +++ load_kernel.c 27 Apr 2002 10:26:50 -0000 1.5 @@ -33,6 +33,8 @@ #endif #include <blob/arch.h> +#include <blob/command.h> +#include <blob/errno.h> #include <blob/error.h> #include <blob/load_kernel.h> #include <blob/util.h> @@ -71,21 +73,12 @@ printf("."); } - - -void load_kernel(blob_status_t *blob_status) +int load_kernel_part(blob_status_t *blob_status, struct part_info *part) { int i; u32 size; - struct part_info part; - -/* FIXME this is hardcoded, should use flash[].size */ -#define MAIN_BLOCK_SIZE 2 * 64 * 1024 - part.erasesize = MAIN_BLOCK_SIZE; - part.size = KERNEL_FLASH_LEN; - part.offset = (char *) KERNEL_FLASH_BASE; - for (i = 0; loader[i] && !loader[i]->check_magic(&part); i++) + for (i = 0; loader[i] && !loader[i]->check_magic(part); i++) ; if (!loader[i]) { @@ -96,9 +89,9 @@ } else { printf("loading kernel from %s ...", loader[i]->name); if ((size = loader[i]->load_kernel((u32 *)KERNEL_RAM_BASE, - &part, "/boot/linux")) == 0) { + part, "/boot/linux")) == 0) { eprintf("error loading kernel!\n"); - return; + return(EINVAL); } } @@ -106,4 +99,49 @@ blob_status->kernelType = fromFlash; printf("loaded 0x%08x (%d) bytes\n", size, size); + return(ENOERROR); +} + +int load_kernel(blob_status_t *blob_status) +{ + struct part_info part; + +/* FIXME this is hardcoded, should use flash[].size */ +#define MAIN_BLOCK_SIZE 2 * 64 * 1024 + part.erasesize = MAIN_BLOCK_SIZE; + part.size = KERNEL_FLASH_LEN; + part.offset = (char *) KERNEL_FLASH_BASE; + + return load_kernel_part(blob_status, &part); +} + +#if defined(CONFIG_CRAMFS_SUPPORT) || defined(CONFIG_ZIMAGE_SUPPORT) || defined(CONFIG_JFFS2_SUPPORT) +static int loadkernel_cmd(int argc, char *argv[]) +{ + struct part_info part; + static blob_status_t blob_status; + +/* FIXME this is hardcoded, should use flash[].size */ +#define RAMDISK_BLOCK_SIZE 2 * 64 * 1024 + part.erasesize = RAMDISK_BLOCK_SIZE; + part.size = RAMDISK_FLASH_LEN; + part.offset = (char *) RAMDISK_FLASH_BASE; + blob_status.kernelSize = 0; + return load_kernel_part(&blob_status, &part); } + +static char loadkernel_help[] = "loadkernel\n" +"Use dynamic methods: " +#ifdef CONFIG_CRAMFS_SUPPORT +"cramfs " +#endif +#ifdef CONFIG_ZIMAGE_SUPPORT +"zImage " +#endif +#ifdef CONFIG_JFFS2_SUPPORT +"jffs2 " +#endif +"to load the kernel from ramdisk\n"; + +__commandlist(loadkernel_cmd, "loadkernel", loadkernel_help); +#endif Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- main.c 27 Apr 2002 08:10:31 -0000 1.44 +++ main.c 27 Apr 2002 10:26:50 -0000 1.45 @@ -56,7 +56,7 @@ #include <blob/util.h> #include <blob/uucodec.h> #include <blob/xmodem.h> - +#include <blob/load_kernel.h> static int do_reload(char *what); @@ -433,11 +433,17 @@ type = blob_status.paramType; #endif } else if(strncmp(argv[1], "kernel", 7) == 0) { +#if KERNEL_FLASH_BASE == RAMDISK_FLASH_BASE + printerrprefix(); + printf("configured for kernel in ramdisk\n", argv[1]); + return -EINVAL; +#else src = (u32 *)KERNEL_RAM_BASE; dst = (u32 *)KERNEL_FLASH_BASE; numBytes = blob_status.kernelSize; maxSize = KERNEL_FLASH_LEN; type = blob_status.kernelType; +#endif } else if(strncmp(argv[1], "ramdisk", 8) == 0) { src = (u32 *)RAMDISK_RAM_BASE; dst = (u32 *)RAMDISK_FLASH_BASE; @@ -636,12 +642,16 @@ printf("Loading paramater block from flash "); #endif } else if(strncmp(what, "kernel", 7) == 0) { +#if defined(CONFIG_CRAMFS_SUPPORT) || defined(CONFIG_ZIMAGE_SUPPORT) || defined(CONFIG_JFFS2_SUPPORT) + return load_kernel(&blob_status); +#else dst = (u32 *)KERNEL_RAM_BASE; src = (u32 *)KERNEL_FLASH_BASE; numWords = KERNEL_FLASH_LEN / 4; blob_status.kernelSize = 0; blob_status.kernelType = fromFlash; printf("Loading kernel from flash "); +#endif } else if(strncmp(what, "ramdisk", 8) == 0) { dst = (u32 *)RAMDISK_RAM_BASE; src = (u32 *)RAMDISK_FLASH_BASE; Index: shannon.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/shannon.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- shannon.c 27 Apr 2002 08:10:31 -0000 1.10 +++ shannon.c 27 Apr 2002 10:26:50 -0000 1.11 @@ -70,7 +70,7 @@ serial_driver = &sa11x0_serial_driver; /* tweak blob config */ - blob_status.boot_delay = 0; + blob_status.boot_delay = 1; } __initlist(shannon_init_hardware, INIT_LEVEL_DRIVER_SELECTION); |