On Wed, Aug 06, 2008 at 09:42:07PM +0200, Guennadi Liakhovetski wrote: > block = offs / CFG_NAND_BLOCK_SIZE; > + blocks = (uboot_size + offs - ((block - 1) * CFG_NAND_BLOCK_SIZE) - 1) / > + CFG_NAND_BLOCK_SIZE; > blockcopy_count = 0; > > - while (blockcopy_count < (uboot_size / CFG_NAND_BLOCK_SIZE)) { > + while (blockcopy_count < blocks) { > if (!nand_is_bad_block(mtd, block)) { > /* > * Skip bad blocks > */ > for (page = 0; page < CFG_NAND_PAGE_COUNT; page++) { > nand_read_page(mtd, block, page, dst); > - dst += CFG_NAND_PAGE_SIZE; > + /* Overwrite skipped pages */ > + if (read >= offs) > + dst += CFG_NAND_PAGE_SIZE; > + read += CFG_NAND_PAGE_SIZE;
This looks wrong if offs isn't within the first block. I've pushed a fixed and simplified version to nand-flash/testing -- can you test it? -Scott ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users