--- u-boot-1.2.0/common/cmd_nand.c
+++ u-boot-1.2.0/common/cmd_nand.c
@@ -491,83 +491,88 @@
 	ulong addr_end;
 	image_header_t *hdr;
 	int jffs2 = 0;
+	int search_offset;
 
 	s = strchr(cmd, '.');
 	if (s != NULL &&
 	    (!strcmp(s, ".jffs2") || !strcmp(s, ".jffs") || !strcmp(s, ".e") || !strcmp(s, ".i")))
 		jffs2 = 1;
 
-	printf("\nLoading from %s, offset 0x%lx\n", nand->name, offset);
-
-	cnt = nand->oobblock;
-	if (jffs2) {
-		nand_read_options_t opts;
-		memset(&opts, 0, sizeof(opts));
-		opts.buffer	= (u_char*) addr;
-		opts.length	= cnt;
-		opts.offset	= offset;
-		opts.quiet      = 1;
-		r = nand_read_opts(nand, &opts);
-	} else {
-	    r = nand_read(nand, offset, &cnt, (u_char *) addr);
-	}
-
-	if (r) {
-		puts("** Read error\n");
-		SHOW_BOOT_PROGRESS(-1);
-		return 1;
-	}
+	for(search_offset = offset; search_offset < offset + (nand->erasesize * 20); search_offset += nand->erasesize)
+	{
+		printf("Searching %s at offset 0x%lx...", nand->name, search_offset);
+
+		cnt = nand->oobblock;
+		if (jffs2) {
+			nand_read_options_t opts;
+			memset(&opts, 0, sizeof(opts));
+			opts.buffer	= (u_char*) addr;
+			opts.length	= cnt;
+				opts.offset	= search_offset;
+			opts.quiet      = 1;
+			r = nand_read_opts(nand, &opts);
+		} else {
+				r = nand_read(nand, search_offset, &cnt, (u_char *) addr);
+		}
 
-	if (aimage_v1_sanity_check ((aimage_v1_header_t *) addr, 0, CFG_BOOTM_LEN_COMPRESSED) == 0)
-		hdr = (image_header_t *) (addr + sizeof(aimage_v1_header_t));
-	else
-		hdr = (image_header_t *) addr;
+		if (r) {
+			puts(" Read error\n");
+			SHOW_BOOT_PROGRESS(-1);
+			continue;
+		}
 
-	if (ntohl(hdr->ih_magic) != IH_MAGIC) {
-		printf("\n** Bad Magic Number 0x%x **\n", hdr->ih_magic);
-		SHOW_BOOT_PROGRESS(-1);
-		return 1;
-	}
+		if (aimage_v1_sanity_check ((aimage_v1_header_t *) addr, 0, (8 * 1024 * 1024)) == 0)
+			hdr = (image_header_t *) (addr + sizeof(aimage_v1_header_t));
+		else
+			hdr = (image_header_t *) addr;
+
+		if (ntohl(hdr->ih_magic) != IH_MAGIC) {
+			printf(" magic number 0x%x\n", hdr->ih_magic);
+			SHOW_BOOT_PROGRESS(-1);
+			continue;
+		}
 
-//	print_image_hdr(hdr);
+		puts(" success!\n");
+		print_image_hdr(hdr);
 
-	addr_end = ((ulong) hdr) + sizeof(image_header_t) + ntohl(hdr->ih_size);
-	cnt = addr_end - addr;
+		addr_end = ((ulong) hdr) + sizeof(image_header_t) + ntohl(hdr->ih_size);
+		cnt = addr_end - addr;
 
-	if (jffs2) {
-		nand_read_options_t opts;
-		memset(&opts, 0, sizeof(opts));
-		opts.buffer	= (u_char*) addr;
-		opts.length	= cnt;
-		opts.offset	= offset;
-		opts.quiet      = 1;
-		r = nand_read_opts(nand, &opts);
-	} else {
-	    r = nand_read(nand, offset, &cnt, (u_char *) addr);
-	}
+		if (jffs2) {
+			nand_read_options_t opts;
+			memset(&opts, 0, sizeof(opts));
+			opts.buffer	= (u_char*) addr;
+			opts.length	= cnt;
+			opts.offset	= search_offset;
+			opts.quiet      = 1;
+			r = nand_read_opts(nand, &opts);
+		} else {
+			r = nand_read(nand, search_offset, &cnt, (u_char *) addr);
+		}
 
-	if (r) {
-		puts("** Read error\n");
-		SHOW_BOOT_PROGRESS(-1);
-		return 1;
-	}
+		if (r) {
+			puts(" read error\n");
+			SHOW_BOOT_PROGRESS(-1);
+			continue;
+		}
 
-	/* Loading ok, update default load address */
+		/* Loading ok, update default load address */
 
-	load_addr = (ulong) hdr;
+		load_addr = addr;
 
-	/* Check if we should attempt an auto-start */
-	if (((ep = getenv("autostart")) != NULL) && (strcmp(ep, "yes") == 0)) {
-		char *local_args[2];
-		extern int do_bootm(cmd_tbl_t *, int, int, char *[]);
+		/* Check if we should attempt an auto-start */
+		if (((ep = getenv("autostart")) != NULL) && (strcmp(ep, "yes") == 0)) {
+			char *local_args[2];
+			extern int do_bootm(cmd_tbl_t *, int, int, char *[]);
 
-		local_args[0] = cmd;
-		local_args[1] = NULL;
+			local_args[0] = cmd;
+			local_args[1] = NULL;
 
-		printf("Automatic boot of image at addr 0x%08lx ...\n", addr);
+			printf("Automatic boot of image at addr 0x%08lx ...\n", addr);
 
-		do_bootm(cmdtp, 0, 1, local_args);
-		return 1;
+			do_bootm(cmdtp, 0, 1, local_args);
+			continue;
+		}
 	}
 	return 0;
 }
