PC ubuntu添加yaffs2支持+nandflash模拟

http://comments.gmane.org/gmane.linux.file-systems.yaffs/3522


Setup environment

1 . Install mtd tools

sudo apt-get install mtd-utils

 

2. Install “git” tool for download

sudo apt-get install git-core

 

3. Download newest yaffs2 filesystem code

sudo git clone git://www.aleph1.co.uk/yaffs2

 

Config yaffs2 filesystem

1. Generate yaffs.ko

cd xxx/yaffs2

cp ./ yportenv_multi.h ./yportenv.h

sudo make modules

These commands will generate yaffs2multi.ko

 

2. Insmod needed ko files

sudo modprobe mtd

sudo modprobe mtdchar

sudo modprobe mtdblock

cd xxx/yaffs2

insmod ./yaffs2multi.ko

Then, use “cat /proc/filesystem “, you will see that “yaffs2” file system is listed in the supported filesystem.

 

3. Use nandsim to generate a simulated nand flash device

sudo modprobe nandsim first_id_byte=0x20 second_id_byte=0xa2 third_id_byte=0x00 fourth_id_byte=0x15

 

Generate a yaffs2image using mkyaffs2image

1. Create rootfs

Create  “rootfs” dir anywhere, and add bin/, etc/, lib/, root/, tmp/  subdirectory,  “hello.txt” file.

2. Generate

xxx/mkyaffs2image xxx/rootfs rootfs.image

The rootfs.image is needed to write to nand flash.

 

Mount yaffs2 image to nand flash

1. Erase flash

sudo flash_eraseall /dev/mtd0

 

2. Write image to flash

nandwrite -a -o /dev/mtd0 rootfs.image

 

3. Mount

Create xxx/yaffs2_mount

mount -t yaffs2 /dev/mtdblock0 xxx/yaffs2

cd xxx/yaffs2

You will see bin/, etc/, lib/, root/, tmp, and hello.txt, which are created when generating yaffs2 image file.

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值