Update of /cvsroot/blob/blob/src/blob
In directory sc8-pr-cvs1:/tmp/cvs-serv24775/src/blob
Modified Files:
main.c flash-commands.c load_kernel.c
Log Message:
only load/flash/whatever those partitions which are defined (e.g. when loading kernel from jffs2, there is no KERNEL_FLASH_{BASE,LEN})
Index: main.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/main.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- main.c 14 Aug 2002 21:04:23 -0000 1.50
+++ main.c 24 Jan 2003 09:39:20 -0000 1.51
@@ -427,7 +427,7 @@
maxSize = BLOB_FLASH_LEN;
numBytes = blob_status.blobSize;
type = blob_status.blobType;
-#ifdef PARAM_START
+#ifdef PARAM_FLASH_BASE
} else if(strncmp(argv[1], "param", 6) == 0) {
src = (u32 *)PARAM_RAM_BASE;
dst = (u32 *)PARAM_FLASH_BASE;
@@ -435,24 +435,28 @@
numBytes = blob_status.paramSize;
type = blob_status.paramType;
#endif
+#ifdef KERNEL_FLASH_BASE
} else if(strncmp(argv[1], "kernel", 7) == 0) {
-#if KERNEL_FLASH_BASE == RAMDISK_FLASH_BASE
+# if defined(RAMDISK_FLASH_BASE) && (KERNEL_FLASH_BASE == RAMDISK_FLASH_BASE)
printerrprefix();
printf("configured for kernel in ramdisk\n");
return -EINVAL;
-#else
+# else
src = (u32 *)KERNEL_RAM_BASE;
dst = (u32 *)KERNEL_FLASH_BASE;
numBytes = blob_status.kernelSize;
maxSize = KERNEL_FLASH_LEN;
type = blob_status.kernelType;
+# endif
#endif
+#ifdef RAMDISK_FLASH_BASE
} else if(strncmp(argv[1], "ramdisk", 8) == 0) {
src = (u32 *)RAMDISK_RAM_BASE;
dst = (u32 *)RAMDISK_FLASH_BASE;
numBytes = blob_status.ramdiskSize;
maxSize = RAMDISK_FLASH_LEN;
type = blob_status.ramdiskType;
+#endif
} else {
printerror(EINVAL, argv[1]);
return 0;
@@ -568,7 +572,7 @@
#endif
}
-#ifdef PARAM_START
+#ifdef PARAM_FLASH_BASE
printf("param (0x%08x): ", PARAM_FLASH_BASE);
if(blob_status.paramType == fromFlash) {
printf("from flash\n");
@@ -585,6 +589,7 @@
printf("param : Not available\n");
#endif
+#ifdef KERNEL_FLASH_BASE
printf("kernel (0x%08x): ", KERNEL_FLASH_BASE);
if(blob_status.kernelType == fromFlash) {
printf("from flash\n");
@@ -597,7 +602,9 @@
printf("\n");
#endif
}
+#endif
+#ifdef RAMDISK_FLASH_BASE
printf("ramdisk (0x%08x): ", RAMDISK_FLASH_BASE);
if(blob_status.ramdiskType == fromFlash) {
printf("from flash\n");
@@ -610,6 +617,7 @@
printf("\n");
#endif
}
+#endif
return 0;
}
@@ -635,7 +643,7 @@
blob_status.blobSize = 0;
blob_status.blobType = fromFlash;
printf("Loading blob from flash ");
-#ifdef PARAM_START
+#ifdef PARAM_FLASH_BASE
} else if(strncmp(what, "param", 6) == 0) {
dst = (u32 *)PARAM_RAM_BASE;
src = (u32 *)PARAM_FLASH_BASE;
@@ -655,6 +663,7 @@
blob_status.kernelType = fromFlash;
printf("Loading kernel from flash ");
#endif
+#ifdef RAMDISK_FLASH_BASE
} else if(strncmp(what, "ramdisk", 8) == 0) {
dst = (u32 *)RAMDISK_RAM_BASE;
src = (u32 *)RAMDISK_FLASH_BASE;
@@ -662,6 +671,7 @@
blob_status.ramdiskSize = 0;
blob_status.ramdiskType = fromFlash;
printf("Loading ramdisk from flash ");
+#endif
} else {
printerror(EINVAL, what);
return 0;
Index: flash-commands.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/flash-commands.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- flash-commands.c 30 Apr 2002 23:28:25 -0000 1.3
+++ flash-commands.c 24 Jan 2003 09:39:20 -0000 1.4
@@ -50,17 +50,21 @@
if(strncmp(s, "blob", 5) == 0) {
*addr = (u32 *)BLOB_FLASH_BASE;
*length = BLOB_FLASH_LEN;
-#ifdef PARAM_START
+#ifdef PARAM_FLASH_BASE
} else if(strncmp(s, "param", 6) == 0) {
*addr = (u32 *)PARAM_FLASH_BASE;
*length = PARAM_FLASH_LEN;
#endif
+#ifdef KERNEL_FLASH_BASE
} else if(strncmp(s, "kernel", 7) == 0) {
*addr = (u32 *)KERNEL_FLASH_BASE;
*length = KERNEL_FLASH_LEN;
+#endif
+#ifdef RAMDISK_FLASH_BASE
} else if(strncmp(s, "ramdisk", 8) == 0) {
*addr = (u32 *)RAMDISK_FLASH_BASE;
*length = RAMDISK_FLASH_LEN;
+#endif
} else {
return -EINVAL;
}
Index: load_kernel.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- load_kernel.c 9 Jan 2003 01:40:25 -0000 1.12
+++ load_kernel.c 24 Jan 2003 09:39:20 -0000 1.13
@@ -114,10 +114,16 @@
}
if (!loader) {
+#if defined(KERNEL_FLASH_BASE)
+ /* if we have an old-style kernel partition, try that */
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
+ eprintf("Unable to find kernel");
+ return EINVAL;
+#endif
} else {
printf("Loading kernel from %s ...", loader->name);
if ((size = loader->load_kernel((u32 *)KERNEL_RAM_BASE,
|