Hi<br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">> noah_read_ccm_regs: Booting from WEIM: NOR<br>


> imx-esdhc@mci0: registered as mci0<br>
> mci@mci0: registered disk0<br>
> imx25_devices_init: Adding NOR flash device<br>
> cfi_flash@cfi_flash0: cfi flash (id=01000000 vend=000002 manu=000001<br>
> devid=00007E extid=002301) at a0000000, size 64MB<br>
</div></div></blockquote><div><br></div><div>BTW, see this beautiful NOR support when booting as a second stage boot loader? :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">> sid1-noah:/ mkdir /mnt<br>
> sid1-noah:/ mount /dev/disk0.0 fat /mnt<br>
> sid1-noah:/ time cp /mnt/console_image.jffs2 /mnt/console_image.jffs2-backup<br>
> BUG: failure at common/block.c:248/block_put()!<br>
> BUG!<br>
<br>
</div></div>to BUG here seems a bit harsh. block_put calls block_get and then BUGs<br>
when block_get fails. Presumely block_cache fails here. Can you add a<br>
printf int block_cache after blk->ops->read and print the error value?<br></blockquote><div><br></div><div><div>sid1-noah:/ mount /dev/disk0.0 fat /mnt</div><div>block_cache: blk->ops->read returned 0</div><div>

sid1-noah:/ cp /mnt/coblock_cache: blk->ops->read returned 0</div><div>nsole_image.jffs2 /mnt/console_image.jffs2-backup</div><div>block_cache: blk->ops->read returned 0</div><div>block_cache: blk->ops->read returned 0</div>

<div>block_cache: blk->ops->read returned 0</div><div>block_cache: blk->ops->read returned 0</div><div>block_cache: blk->ops->read returned 0</div><div>block_cache: blk->ops->read returned 0</div>
<div>
block_cache: blk->ops->read returned -110</div><div>BUG: failure at common/block.c:249/block_put()!</div><div>BUG!</div><div>[<83f34814>] (unwind_backtrace+0x0/0x8c) from [<83f1bf04>] (panic+0x28/0x3c)</div>

<div>[<83f1bf04>] (panic+0x28/0x3c) from [<83f05900>] (block_put+0x48/0x8c)</div><div>[<83f05900>] (block_put+0x48/0x8c) from [<83f059ec>] (block_write+0xa8/0x120)</div><div>[<83f059ec>] (block_write+0xa8/0x120) from [<83f2d2e8>] (cdev_write+0x30/0x34)</div>

<div>[<83f2d2e8>] (cdev_write+0x30/0x34) from [<83f307e0>] (disk_write+0x24/0x30)</div><div>[<83f307e0>] (disk_write+0x24/0x30) from [<83f2f92c>] (f_write+0x160/0x27c)</div><div>[<83f2f92c>] (f_write+0x160/0x27c) from [<83f305a0>] (fat_write+0x18/0x30)</div>

<div>[<83f305a0>] (fat_write+0x18/0x30) from [<83f31090>] (write+0xac/0xd0)</div><div>[<83f31090>] (write+0xac/0xd0) from [<83f216d4>] (copy_file+0xec/0x17c)</div><div>[<83f216d4>] (copy_file+0xec/0x17c) from [<83f19050>] (do_cp+0x124/0x158)</div>

<div>[<83f19050>] (do_cp+0x124/0x158) from [<83f07bb0>] (execute_command+0x38/0x7c)</div><div>[<83f07bb0>] (execute_command+0x38/0x7c) from [<83f03bc8>] (run_list_real+0x8a0/0x998)</div><div>[<83f03bc8>] (run_list_real+0x8a0/0x998) from [<83f03e04>] (parse_stream_outer+0x144/0x240)</div>

<div>[<83f03e04>] (parse_stream_outer+0x144/0x240) from [<83f041fc>] (run_shell+0x3c/0x5c)</div><div>[<83f041fc>] (run_shell+0x3c/0x5c) from [<83f09640>] (start_barebox+0xd4/0x110)</div><div>[<83f09640>] (start_barebox+0xd4/0x110) from [<8010206c>] (0x8010206c)</div>

</div><div><br></div><div>Those dreaded -110.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I just saw that there's room for optimization. In block_put we call<br>
block_get which reads from the device, just to overwrite the data<br>
afterwards.</blockquote><div><br></div><div>Yep, good point.</div><div><br></div><div>Let me know if I you need more printf()'s sprinkled over your code.</div><div><br></div><div>Regards</div><div>Roberto</div></div>