linux 内核nandsim的使用

it2022-05-05  103

 

If you wish to use the mtd nandsim device as a simulator for testingyaffs, you can follow these steps:1) Make sure you have a recent 2.6 kernel with a recent MTD tree. (Ifyou ask the MTD folk, they'll tell you to run the mtd patchin scriptfrom the latest cvs version of MTD.)2) Configure your kernel to enable the mtd nand support and nandsimdriver. Make sure that the following are set in .config:CONFIG_MTD=mCONFIG_MTD_CHAR=mCONFIG_MTD_BLOCK=mCONFIG_MTD_NAND=mCONFIG_MTD_NAND_NANDSIM=mYou can set them to 'y' rather than 'm' if you don't want the modulesform.3) make and install your kernel and modules in the usual way, then boot.4) To use the nandsim, you need to load some MTD modules, unless you'veconfigured MTD into the kernel:modprobe mtdblockmodprobe mtdcharmodprobe nandsim5) Verify that the nandsim device has loaded properly:cat /proc/mtdYou will see something likedev: size erasesize namemtd0: 00800000 00002000 "NAND simulator partition"If everything went well.6) what the nand device is called will depend on your Linux distro, andwhether you are using devfs or udev, but the '0', or whatever mtdreports as the device associated with the simulator, in the above willshow up in the name. On my ubuntu system, if /proc/mtd reports 'mtd0'then the block device is /dev/mtdblock0 and the char device is/dev/mtd0.7) You can mount yaffs on the nandsim in the usual way. I have/mnt/nand as the directory I mount on, so I would mount usingmount -t yaffs /dev/mtdblock0 /mnt/nand -------------------------------------[root@urbetter /]# cd /lib/modules/2.6.28.6/extra/[root@urbetter extra]# lschr_dev.ko  nandsim.ko  test.ko     text        usr_app[root@urbetter extra]# insmod nandsim.ko NAND device: Manufacturer ID: 0x98, Chip ID: 0x39 (Toshiba NAND 128MiB 1,8V 8-bit)flash size: 128 MiBpage size: 512 bytesOOB area size: 16 bytessector size: 16 KiBpages number: 262144pages per sector: 32bus width: 8bits in sector size: 14bits in page size: 9bits in OOB size: 4flash size with OOB: 135168 KiBpage address bytes: 4sector address bytes: 3options: 0x62Scanning device for bad blocksCreating 1 MTD partitions on "NAND 128MiB 1,8V 8-bit":0x00000000-0x08000000 : "NAND simulator partition 0"[root@urbetter extra]# cat /proc/mtd dev:    size   erasesize  namemtd0: 00040000 00020000 "Bootloader"mtd1: 003c0000 00020000 "Kernel"mtd2: 05000000 00020000 "Rootfs"mtd3: 0ac00000 00020000 "File System"mtd4: 08000000 00004000 "NAND simulator partition 0"[root@urbetter extra]# ls /dev/mtd/dev/mtd0       /dev/mtd1ro     /dev/mtd3       /dev/mtd4ro     /dev/mtdblock2/dev/mtd0ro     /dev/mtd2       /dev/mtd3ro     /dev/mtdblock0  /dev/mtdblock3/dev/mtd1       /dev/mtd2ro     /dev/mtd4       /dev/mtdblock1  /dev/mtdblock4[root@urbetter extra]# ls /dev/mtd4 /dev/mtdblock4 -lcrw-rw----    1 root     root      90,   8 Jan  2 06:39 /dev/mtd4brw-rw----    1 root     root      31,   4 Jan  2 06:39 /dev/mtdblock4[root@urbetter extra]# ls chr_dev.ko  nandsim.ko  test.ko     text        usr_app[root@urbetter extra]# mkdir test[root@urbetter extra]# mount /dev/mtdblock4 test yaffs: dev is 32505860 name is "mtdblock4"yaffs: passed flags ""yaffs: Attempting MTD mount on 31.4, "mtdblock4"yaffs_read_super: isCheckpointed 0[root@urbetter extra]# cd test[root@urbetter test]# lslost+found[root@urbetter test]# df -hFilesystem                Size      Used Available Use% Mounted on/dev/root                 9.4G      6.6G      2.3G  74% /tmpfs                    34.8M         0     34.8M   0% /dev/shm/dev/mtdblock3          172.0M      1.1M    170.9M   1% /mnt/disk/dev/mtdblock4          128.0M     96.0K    127.9M   0% /lib/modules/2.6.28.6/extra/test

转载于:https://www.cnblogs.com/jiffies/archive/2012/11/01/2749818.html

相关资源:各显卡算力对照表!

最新回复(0)