$p_w_picpath_update的实现

a. chksum
参考busybox cksum.c的源码,拆分使得可以分块读入数据进行计算。

b. nand programming
不管erase, read, write,算法类似:
for(mtdoffset = 0; mtdoffset < _meminfo.size; mtdoffset += _meminfo.erasesize)
{
       Check whether bad block;
       if(bad block) continue;
       read / write /erase
}

 

顺便提一下,mtd的参考:

mtd-utils

$sudo apt-get install git git-core
$git clone git://git.infradead.org/mtd-utils.git

help on mtd utils:
http://blog.chinaunix.net/u1/37510/showart_1952244.html
http://book.opensourceproject.org.cn/embedded/embeddedprime/opensource/0136130550/ch10lev1sec4.html

源码见附件: