+ -
当前位置:首页 → 问答吧 → nand flash erase

nand flash erase

时间:2010-07-15

来源:互联网

uboot nand flash erase问题。
我的nand flash 32M,kernel 2.6.18, rootfs emb linux, cramfs.

nand flash分区如下:
static struct mtd_partition nand_partitions[] = {
  /* bootloader (UBL, U-Boot, BBT) in sectors: 0 - 14 */
  {
  .name = "bootloader",
  .offset = 0,
  .size = 32 * NAND_BLOCK_SIZE, //32x16 = 512k
  .mask_flags = MTD_WRITEABLE, /* force read-only */
  },
  /* bootloader params in the next sector 15 */
  {
  .name = "params",
  .offset = MTDPART_OFS_APPEND,
  .size = 96 * NAND_BLOCK_SIZE, //96x16 = 1536k = 1.5M
  .mask_flags = MTD_WRITEABLE, /* force read-only */
  },
  /* kernel in sectors: 16 */
  {
  .name = "kernel",
  .offset = MTDPART_OFS_APPEND,
  .size = SZ_2M, //2M
  .mask_flags = 0
  },
  /* rootfs */
  {
  .name = "filesystem1",
  .offset = MTDPART_OFS_APPEND,
  .size = SZ_16M + SZ_8M, //24M
  .mask_flags = 0
  },
  /*parameter*/
  {
  .name = "filesystem2",
  .offset = MTDPART_OFS_APPEND,
  .size = MTDPART_SIZ_FULL, //4M, /mnt/nand, save log,sysenv,
  .mask_flags = 0
  }
};

//系统启动后
# cat /proc/partitions  
major minor #blocks name  
   
  31 0 512 mtdblock0  
  31 1 1536 mtdblock1  
  31 2 2048 mtdblock2  
  31 3 24576 mtdblock3  
  31 4 4096 mtdblock4  
254 0 512 sbulla  
#
# cat /proc/mtd  
dev: size erasesize name  
mtd0: 00080000 00004000 "bootloader"  
mtd1: 00180000 00004000 "params"  
mtd2: 00200000 00004000 "kernel"  
mtd3: 01800000 00004000 "filesystem1"  
mtd4: 00400000 00004000 "filesystem2"  
#


我的问题是, 以下命令是厂家提供的,是可以执行成功的命令,我不理解其中到某些命令:
在U-boot烧写时,用以下命令:

tftpboot 0x80700000 uImage_ipnc_dm365 //可以理解
tftpboot 0x82000000 cramfsImage_ipnc_dm365.v1.2.4-debug-param //可以理解

nand erase 0x200000 0xDF0000 //不理解,本句的意思是把kernel分区和rootfs分区擦除,0xDF0000 = 13.9375M, 而内核和文件系统共2M+24M=26M,为什么不是#nand erase 0x200000 0x1A00000 (26M).

nand write 0x80700000 0x200000 0x200000 //可以理解,写内核到NAND FLASH, 从内存地址 0x80700000 读取大小为 0x200000(2M)的数据,写入nand flash,写入的起始地址为0x200000。

nand write 0x82000000 0x400000 0xBF0000 //不理解,写文件系统到NAND FLASH, 意思是从内存地址 0x82000000 读取大小为 0xBF0000(11.9375M)的数据,写入nand flash,写入的起始地址为0x400000。为什么只写0xBF0000(11.9375M)的数据,我的文件系统分区24M啊,实际的文件系统也 22M左右,why?

请各路高手看看。

,比如我在U-boot烧写文件系统时,我只想对文件系统filesystem1分区擦除然后升级文件系统,不擦内核和最后的分区(filesystem2),该怎么用nand erase命令,偏移多少,大小多少。如何精确的调整,我觉得这个值必须很精确,不然会影响到前一个分区和最后的分区的数据。

作者: pxebxp   发布时间: 2010-07-15

nand write 0x82000000 0x400000 0xBF0000

写了多少擦除多少

作者: linux初学三月   发布时间: 2010-07-16

这正是我要问的问题。

作者: pxebxp   发布时间: 2010-07-17