From: Tim R. <tim...@us...> - 2002-02-14 10:18:03
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv32523/src/blob Modified Files: compr_zlib.c cramfs.c jffs2.c load_kernel.c main.c zImage.c Log Message: move load_kernel to load_kernel.c Index: compr_zlib.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/compr_zlib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- compr_zlib.c 14 Feb 2002 09:59:34 -0000 1.1 +++ compr_zlib.c 14 Feb 2002 10:17:59 -0000 1.2 @@ -36,6 +36,7 @@ */ #include "blob/types.h" +#include "blob/main.h" #include "blob/load_kernel.h" #include "blob/mini_inflate.h" Index: cramfs.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/cramfs.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- cramfs.c 14 Feb 2002 09:59:34 -0000 1.1 +++ cramfs.c 14 Feb 2002 10:17:59 -0000 1.2 @@ -27,6 +27,7 @@ * nature of cramfs, this shouldn't be a big deal */ #include "blob/types.h" +#include "blob/main.h" #include "blob/load_kernel.h" #include "blob/mini_inflate.h" Index: jffs2.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/jffs2.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- jffs2.c 14 Feb 2002 09:59:34 -0000 1.1 +++ jffs2.c 14 Feb 2002 10:17:59 -0000 1.2 @@ -65,6 +65,7 @@ #include "blob/types.h" +#include "blob/main.h" #include "blob/load_kernel.h" #include "blob/jffs2.h" #include "blob/crc32.h" Index: load_kernel.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- load_kernel.c 14 Feb 2002 09:59:34 -0000 1.1 +++ load_kernel.c 14 Feb 2002 10:17:59 -0000 1.2 @@ -27,11 +27,13 @@ */ #include "types.h" -#include "load_kernel.h" #include "config.h" #include "serial.h" #include "util.h" #include "main.h" +#include "load_kernel.h" + +#include <blob/arch.h> #ifdef CONFIG_CRAMFS_SUPPORT extern struct kernel_loader cramfs_load; @@ -87,3 +89,38 @@ { SerialOutputHex(hex); } + +void load_kernel(blob_status_t *blob_status) +{ + int i; + unsigned long 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++); + if (!loader[i]) { + SerialOutputString("unable to find kernel, loading raw data " + "and hoping for the best!\rloading"); + size = KERNEL_FLASH_LEN; + MyMemCpy((u32 *)KERNEL_RAM_BASE, (u32 *)KERNEL_FLASH_BASE, size >> 2); + + } else { + SerialOutputString("loading kernel from "); + SerialOutputString(loader[i]->name); + if ((size = loader[i]->load_kernel((u32 *)KERNEL_RAM_BASE, + &part)) == 0) { + SerialOutputString(" error loading kernel!\r"); + return; + } + } + SerialOutputString("loaded 0x"); + SerialOutputHex(size); + SerialOutputString(" bytes\r"); + blob_status->kernelSize = size; + blob_status->kernelType = fromFlash; +} + Index: main.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/main.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- main.c 14 Feb 2002 09:59:34 -0000 1.32 +++ main.c 14 Feb 2002 10:17:59 -0000 1.33 @@ -70,40 +70,6 @@ blob_status_t blob_status; static char *version_str = PACKAGE " version " VERSION " for " BOARD_NAME "\n"; -void load_kernel(blob_status_t *blob_status) -{ - int i; - unsigned long 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++); - if (!loader[i]) { - SerialOutputString("unable to find kernel, loading raw data " - "and hoping for the best!\rloading"); - size = KERNEL_FLASH_LEN; - MyMemCpy((u32 *)KERNEL_RAM_BASE, (u32 *)KERNEL_FLASH_BASE, size >> 2); - - } else { - SerialOutputString("loading kernel from "); - SerialOutputString(loader[i]->name); - if ((size = loader[i]->load_kernel((u32 *)KERNEL_RAM_BASE, - &part)) == 0) { - SerialOutputString(" error loading kernel!\r"); - return; - } - } - SerialOutputString("loaded 0x"); - SerialOutputHex(size); - SerialOutputString(" bytes\r"); - blob_status->kernelSize = size; - blob_status->kernelType = fromFlash; -} - int main(void) { int numRead = 0; Index: zImage.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/zImage.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- zImage.c 14 Feb 2002 09:59:34 -0000 1.1 +++ zImage.c 14 Feb 2002 10:17:59 -0000 1.2 @@ -24,6 +24,7 @@ */ #include "blob/types.h" +#include "blob/main.h" #include "blob/load_kernel.h" #define ZIMAGE_MAGIC 0x016f2818 |