Index: linux-2.4.20-tst/arch/mips/brcm-boards/bcm947xx/setup.c
===================================================================
--- linux-2.4.20-tst.orig/arch/mips/brcm-boards/bcm947xx/setup.c	2006-06-13 18:31:07.000000000 -0700
+++ linux-2.4.20-tst/arch/mips/brcm-boards/bcm947xx/setup.c	2006-06-19 01:50:51.000000000 -0700
@@ -183,47 +183,42 @@
 }
 
 #ifdef CONFIG_MTD_PARTITIONS
+// PMON is 256k
+// MTD_ERASE_SIZE is 64K
+#define PMON_SIZE 262144 
+#define MTD_ERASE_SIZE 65536
 
 static struct mtd_partition bcm947xx_parts[] = {
-	{ name: "pmon",	offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ },
+	{ name: "pmon",	offset: 0, size: 0, mask_flags: MTD_WRITEABLE, },
 	{ name: "linux", offset: 0, size: 0, },
 	{ name: "rootfs", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ },
 #ifdef MULTILANG_SUPPORT
-	{ name: "lang", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ }, /* for multilang*/
+	{ name: "lang", offset: 0, size: 0, /*mask_flags: MTD_WRITEABLE,*/ },
 #endif
 	{ name: "nvram", offset: 0, size: 0, },
+	{ name: "jffs2", offset: 0, size: 0, },
 	{ name: NULL, },
 };
 
-struct mtd_partition * __init
-init_mtd_partitions(struct mtd_info *mtd, size_t size)
+static int __init
+find_root(struct mtd_info *mtd, size_t size, struct mtd_partition *part)
 {
-	struct minix_super_block *minixsb;
-	struct ext2_super_block *ext2sb;
-	struct romfs_super_block *romfsb;
 	struct cramfs_super *cramfsb;
 	struct squashfs_super_block *squashfsb;
 	struct trx_header *trx;
+
 	unsigned char buf[512];
 	int off;
-#ifdef MULTILANG_SUPPORT
-	struct lang_header *lang;  /* for multilang */
-	int off1;
-#endif
 	size_t len;
 
-	minixsb = (struct minix_super_block *) buf;
-	ext2sb = (struct ext2_super_block *) buf;
-	romfsb = (struct romfs_super_block *) buf;
 	cramfsb = (struct cramfs_super *) buf;
 	squashfsb = (struct squashfs_super_block *) buf;
 	trx = (struct trx_header *) buf;
-#ifdef MULTILANG_SUPPORT
-	lang = (struct lang_header *) buf;  /* for multilang */
-#endif
+
+	part->size = 0;
 
 	/* Look at every 64 KB boundary */
-	for (off = 0; off < size; off += (64 * 1024)) {
+	for (off = part->offset; off < size; off += MTD_ERASE_SIZE) {
 		memset(buf, 0xe5, sizeof(buf));
 
 		/*
@@ -233,73 +228,68 @@
 		    len != sizeof(buf))
 			continue;
 
-		/* Try looking at TRX header for rootfs offset */
-		if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
-			bcm947xx_parts[1].offset = off;
-			if (le32_to_cpu(trx->offsets[1]) > off)
-				off = le32_to_cpu(trx->offsets[1]);
-			continue;
-		}
+                /* Try looking at TRX header for rootfs offset */
+                if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
+			printk("Examining trx header @ offset: 0x%lx, with magic: 0x%lx\n", off, le32_to_cpu(trx->magic));
+                        if (le32_to_cpu(trx->offsets[1]) > off) {
+                                off = le32_to_cpu(trx->offsets[1]);
+				printk("Skipping to trx->rootfs_offset: 0x%lx\n", off);
+			}
+                }
 
-		/* romfs is at block zero too */
-		if (romfsb->word0 == ROMSB_WORD0 &&
-		    romfsb->word1 == ROMSB_WORD1) {
-			printk(KERN_NOTICE
-			       "%s: romfs filesystem found at block %d\n",
-			       mtd->name, off / BLOCK_SIZE);
-			goto done;
-		}
+                /* need to find cramfs */
+                if (cramfsb->magic == CRAMFS_MAGIC) {
+                        printk(KERN_NOTICE
+                               "%s: cramfs filesystem found at block %d\n",
+                               mtd->name, off / BLOCK_SIZE);
+
+                        part->size = cramfsb->size;
+                        goto done;
+                }
+
+                /* or squashfs */
+                if (squashfsb->s_magic == SQUASHFS_MAGIC) {
+                        printk(KERN_NOTICE
+                                "%s: squashfs filesystem found at block %d (off:0x%lx)\n",
+                               mtd->name, off / BLOCK_SIZE, off);
+                        part->size = squashfsb->bytes_used+2048;
+                        goto done;
+                }
+
+       }
+        printk(KERN_NOTICE
+               "%s: Couldn't find valid cramfs image\n",
+               mtd->name);
+        return -1;
+
+done:
+        part->offset = off;
+        return 0;
+}
 
-		/* so is cramfs */
-		if (cramfsb->magic == CRAMFS_MAGIC) {
-			printk(KERN_NOTICE
-			       "%s: cramfs filesystem found at block %d\n",
-			       mtd->name, off / BLOCK_SIZE);
-			goto done;
-		}
 
-		/* squashfs is at block zero too */
-		if (squashfsb->s_magic == SQUASHFS_MAGIC) {
-			printk(KERN_NOTICE
-			       "%s: squashfs filesystem found at block %d\n",
-			       mtd->name, off / BLOCK_SIZE);
-			goto done;
-		}
+#ifdef MULTILANG_SUPPORT
+static int __init
+find_lang(struct mtd_info *mtd, size_t size, struct mtd_partition *part)
+{
+	struct cramfs_super *cramfsb;
+	struct squashfs_super_block *squashfsb;
+	struct trx_header *trx;
+	struct lang_header *lang;  /* for multilang */
 
-		/*
-		 * Read block 1 to test for minix and ext2 superblock
-		 */
-		if (MTD_READ(mtd, off + BLOCK_SIZE, sizeof(buf), &len, buf) ||
-		    len != sizeof(buf))
-			continue;
+	unsigned char buf[512];
+	int off1;
+	size_t len;
 
-		/* Try minix */
-		if (minixsb->s_magic == MINIX_SUPER_MAGIC ||
-		    minixsb->s_magic == MINIX_SUPER_MAGIC2) {
-			printk(KERN_NOTICE
-			       "%s: Minix filesystem found at block %d\n",
-			       mtd->name, off / BLOCK_SIZE);
-			goto done;
-		}
+	part->size = 0;
 
-		/* Try ext2 */
-		if (ext2sb->s_magic == cpu_to_le16(EXT2_SUPER_MAGIC)) {
-			printk(KERN_NOTICE
-			       "%s: ext2 filesystem found at block %d\n",
-			       mtd->name, off / BLOCK_SIZE);
-			goto done;
-		}
-	}
+	cramfsb = (struct cramfs_super *) buf;
+	squashfsb = (struct squashfs_super_block *) buf;
+	trx = (struct trx_header *) buf;
+	lang = (struct lang_header *) buf;  /* for multilang */
 
-	printk(KERN_NOTICE
-	       "%s: Couldn't find valid ROM disk image\n",
-	       mtd->name);
-
- done:
-#if MULTILANG_SUPPORT
-/* below for multilang */
-	/* Look at every 64 KB boundary */
-	for (off1 = 0; off1 < size; off1 += (64 * 1024)) {
+	/* Search for lang partition */
+	for (off1 = part->offset; off1 < size; off1 += MTD_ERASE_SIZE) {
 		memset(buf, 0xe5, sizeof(buf));
 
 		/*
@@ -311,14 +301,13 @@
 
 		/* Try looking at TRX header for rootfs offset */
 		if (le32_to_cpu(trx->magic) == TRX_MAGIC) {
-			printk("le32_to_cpu(trx->magic)=0x%lx trx->magic=0x%lx\n", le32_to_cpu(trx->magic), trx->magic);
+			printk("Examining trx header @ offset: 0x%lx, with magic: 0x%lx\n", off1, le32_to_cpu(trx->magic));
+			//printk("le32_to_cpu(trx->magic)=0x%lx trx->magic=0x%lx\n", le32_to_cpu(trx->magic), trx->magic);
 			//bcm947xx_parts[1].offset = off1;
-			printk("bcm947xx_parts[1].offset=0x%lx trx->offsets[1]=0x%lx off\n", bcm947xx_parts[2].offset);
 			if (le32_to_cpu(trx->offsets[2]) > off1) {
 				off1 = le32_to_cpu(trx->offsets[2]);
-				printk("ok1 off1=0x%lx\n", off1);
+				printk("Skipping to trx->lang_offset: 0x%lx\n", off1);
 			}
-			continue;
 		}
 
 		/* so is cramfs */
@@ -326,19 +315,27 @@
 			printk(KERN_NOTICE
 			       "%s: lang cramfs filesystem found at block %d (0x%lx)\n",
 			       mtd->name, off1 / BLOCK_SIZE, off1);
+                        part->size = cramfsb->size;
 			goto done1;
 		}
   
   		/* squashfs is at block zero too */
   		if (squashfsb->s_magic == SQUASHFS_MAGIC) {
   			printk(KERN_NOTICE
-  			       "%s: lang squashfs filesystem found at block %d (0x%lx)\n",
+  			       "%s: lang squashfs filesystem found at block %d (off:0x%lx)\n",
    			       mtd->name, off1 / BLOCK_SIZE, off1);
+                        part->size = squashfsb->bytes_used+2048;
    			goto done1;
    		}
 
 	}
+        printk(KERN_NOTICE
+               "%s: Couldn't find valid lang image\n",
+               mtd->name);
+        return -1;
+
 done1:
+	/*
 	printk("off=0x%lx off1=0x%lx size=0x%lx\n", off, off1, size);
 
 	if(off1 == 0 || off1 == size )
@@ -346,30 +343,81 @@
 		off1 = size - 0x60000;  // 0x3d0000 only lang.js
 		printk("(Not Found Lang Block)off=0x%lx off1=0x%lx size=0x%lx\n", off, off1, size);
 	}
-/* for multilang -> */
+	*/
+
+	part->offset = off1;
+	return 0;
+
+}
+#endif //MULTILANG_SUPPORT
+
+struct mtd_partition * __init
+init_mtd_partitions(struct mtd_info *mtd, size_t size)
+{
+
+	/* Size pmon */
+        bcm947xx_parts[0].offset=0;
+        bcm947xx_parts[0].size=PMON_SIZE;
+	printk("pmon: offset=0x%lx size=0x%lx\n",  bcm947xx_parts[0].offset, bcm947xx_parts[0].size);
+
+	/* Find and size rootfs */
+        bcm947xx_parts[2].offset=PMON_SIZE;
+	find_root(mtd,size,&bcm947xx_parts[2]);
+	printk("root: offset=0x%lx size=0x%lx\n",  bcm947xx_parts[2].offset, bcm947xx_parts[2].size);
+
+#ifdef MULTILANG_SUPPORT
+	/* Find and size nvram */
 	bcm947xx_parts[4].offset = size - ROUNDUP(NVRAM_SPACE, mtd->erasesize);
 	bcm947xx_parts[4].size = size - bcm947xx_parts[4].offset;
+
+	/* Find and size lang */
+        bcm947xx_parts[3].offset=bcm947xx_parts[2].offset+bcm947xx_parts[2].size;
+	find_lang(mtd,size,&bcm947xx_parts[3]);
+	printk("lang: offset=0x%lx size=0x%lx\n",  bcm947xx_parts[3].offset, bcm947xx_parts[3].size);
 	printk("nvram: offset=0x%lx size=0x%lx\n",  bcm947xx_parts[4].offset, bcm947xx_parts[4].size);
 
-	bcm947xx_parts[3].offset = off1;
-	bcm947xx_parts[3].size = bcm947xx_parts[4].offset - bcm947xx_parts[3].offset;
-/* <- for multilang */
+	/* Size linux (kernel and rootfs) */
+	bcm947xx_parts[1].offset = bcm947xx_parts[0].size;
+	bcm947xx_parts[1].size = bcm947xx_parts[4].offset - bcm947xx_parts[1].offset;
 #else
 	/* Find and size nvram */
 	bcm947xx_parts[3].offset = size - ROUNDUP(NVRAM_SPACE, mtd->erasesize);
 	bcm947xx_parts[3].size = size - bcm947xx_parts[3].offset;
-#endif
-	/* Find and size rootfs */
-	if (off < size) {
-		bcm947xx_parts[2].offset = off;
-		bcm947xx_parts[2].size = bcm947xx_parts[3].offset - bcm947xx_parts[2].offset;
-	}
+	printk("nvram: offset=0x%lx size=0x%lx\n",  bcm947xx_parts[3].offset, bcm947xx_parts[3].size);
 
 	/* Size linux (kernel and rootfs) */
+	bcm947xx_parts[1].offset = bcm947xx_parts[0].size;
 	bcm947xx_parts[1].size = bcm947xx_parts[3].offset - bcm947xx_parts[1].offset;
+#endif
 
-	/* Size pmon */
-	bcm947xx_parts[0].size = bcm947xx_parts[1].offset - bcm947xx_parts[0].offset;
+        /* Calculate leftover flash, and assign it to the jffs partition */
+        size_t spot;
+        size_t len;
+        size_t mask;
+        //  Get the offset to the end of the root_fs
+#ifdef MULTILANG_SUPPORT
+        spot=bcm947xx_parts[3].offset+bcm947xx_parts[3].size;
+#else
+        spot=bcm947xx_parts[2].offset+bcm947xx_parts[2].size;
+#endif
+        //  Round it up to an erase size boundary
+        //Add the erasesize & mask to boundary (modulus)
+	spot+=mtd->erasesize-1;
+        mask=mtd->erasesize;
+        mask=mask-1;
+        mask=mask^0xffffffff;
+        spot&=mask;
+        //  eg. length = flashsize - start position - nvram size
+        len=size-spot;
+#ifdef MULTILANG_SUPPORT
+        len=len-bcm947xx_parts[4].size;
+        bcm947xx_parts[5].offset = spot;
+        bcm947xx_parts[5].size = len;
+#else
+        len=len-bcm947xx_parts[3].size;
+        bcm947xx_parts[4].offset = spot;
+        bcm947xx_parts[4].size = len;
+#endif
 
 	return bcm947xx_parts;
 }
Index: linux-2.4.20-tst/fs/jffs2/scan.c
===================================================================
--- linux-2.4.20-tst.orig/fs/jffs2/scan.c	2006-06-12 22:16:32.000000000 -0700
+++ linux-2.4.20-tst/fs/jffs2/scan.c	2006-06-19 01:50:51.000000000 -0700
@@ -57,7 +57,7 @@
 		printk(KERN_NOTICE args); \
 		 (*(noise))--; \
 		 if (!(*(noise))) { \
-			 printk(KERN_NOTICE "Further such events for this erase block will not be printed\n"); \
+			 /* printk(KERN_NOTICE "Further such events for this erase block will not be printed\n"); */ \
 		 } \
 	} \
 } while(0)
@@ -177,7 +177,8 @@
 		return 1;	/* special return code */
 	}
 	
-	noise = 10;
+	/* Irving - less noise - was at 10 */
+	noise = 0;
 
 	while(ofs < jeb->offset + c->sector_size) {
 		ssize_t retlen;
Index: linux-2.4.20-tst/drivers/net/Makefile
===================================================================
--- linux-2.4.20-tst.orig/drivers/net/Makefile	2006-06-19 01:30:35.000000000 -0700
+++ linux-2.4.20-tst/drivers/net/Makefile	2006-06-19 02:02:48.000000000 -0700
@@ -25,10 +25,10 @@
 list-multi	:=	rcpci.o
 rcpci-objs	:=	rcpci45.o rclanmtl.o
 
-#subdir-m += mac
+subdir-m += mac
 subdir-m += diag
-#subdir-m += ext_io
-#subdir-m += ctmisc
+subdir-m += ext_io
+subdir-m += ctmisc
 
 ifeq ($(CONFIG_HW_QOS),y)
 subdir-m += port_based_qos
