mtd/drivers/mtd redboot.c,1.15,1.16

ijc at infradead.org ijc at infradead.org
Mon Nov 22 06:32:16 EST 2004


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv17971/drivers/mtd

Modified Files:
	redboot.c 
Log Message:
Search for a directory entry named "FIS directory" rather the "RedBoot"
since RedBoot can potentially be in another device but there should
always be a FIS directory present (or we wouldn't be looking for it...).

Also search all blocks not just the first 3 since the directory is often at
the end of flash rather than the beginning.


Index: redboot.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/redboot.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- redboot.c	10 Aug 2004 07:55:16 -0000	1.15
+++ redboot.c	22 Nov 2004 11:32:13 -0000	1.16
@@ -50,6 +50,7 @@
 	char *nullname;
 	int namelen = 0;
 	int nulllen = 0;
+	int numslots;
 #ifdef CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED
 	static char nullstring[] = "unallocated";
 #endif
@@ -71,12 +72,16 @@
 		goto out;
 	}
 
-	/* RedBoot image could appear in any of the first three slots */
-	for (i = 0; i < 3; i++) {
-		if (!memcmp(buf[i].name, "RedBoot", 8))
+	numslots = (master->erasesize / sizeof(struct fis_image_desc));
+	for (i = 0; i < numslots; i++) {
+		if (buf[i].name[0] == 0xff) {
+			i = numslots;
+			break;
+		}
+		if (!memcmp(buf[i].name, "FIS directory", 14))
 			break;
 	}
-	if (i == 3) {
+	if (i == numslots) {
 		/* Didn't find it */
 		printk(KERN_NOTICE "No RedBoot partition table detected in %s\n",
 		       master->name);
@@ -84,7 +89,7 @@
 		goto out;
 	}
 
-	for (i = 0; i < master->erasesize / sizeof(struct fis_image_desc); i++) {
+	for (i = 0; i < numslots; i++) {
 		struct fis_list *new_fl, **prev;
 
 		if (buf[i].name[0] == 0xff)





More information about the linux-mtd-cvs mailing list