Annotation of wikisrc/tutorials/using_the_nand_emulator_and_chfs.mdwn, revision 1.1
1.1 ! riz 1: Emulating a NAND flash device
! 2: -----------------------------
! 3:
! 4: A quick rundown on how to get started using the NAND flash emulator
! 5: in the NetBSD kernel:
! 6:
! 7: First, build a kernel with:
! 8:
! 9: pseudo-device nandemulator
! 10: flash* at flashbus?
! 11: nand* at nandbus?
! 12:
! 13: I created a new kernel config called "NAND" (on amd64):
! 14:
! 15: include "arch/amd64/conf/GENERIC"
! 16: pseudo-device nandemulator
! 17: flash* at flashbus?
! 18: nand* at nandbus?
! 19:
! 20: Note that at the present time, all the parameters of the NAND emulator are
! 21: hardcoded, so to change anything you'll need to edit
! 22: sys/dev/nand/nandemulator.c .
! 23:
! 24: Build and install the kernel, and boot from it. You'll notice the following
! 25: items appear:
! 26:
! 27: nandemulator0: NAND emulator
! 28: nand0 at nandemulator0: ONFI NAND Flash
! 29: nand0: vendor: NETBSD, model: NANDEMULATOR
! 30: nand0: page size: 2048 bytes, spare size: 64 bytes, block size: 131072 bytes
! 31: nand0: LUN size: 256 blocks, LUNs: 1, total storage size: 32 MB
! 32: flash0 at nand0: NAND flash partition size 32 MB, offset 0
! 33: flash0: erase size 128 KB, page size 2048 bytes, write size 2048 bytes
! 34:
! 35: You can then mount a chfs file system on the emulated flash device. The
! 36: file system is created on the first mount:
! 37:
! 38: # mount_chfs /dev/flash0 /mnt
! 39: # ls -l /mnt
! 40: # cp /netbsd /mnt
! 41: # ls -l /mnt
! 42: total 29216
! 43: -rwxr-xr-x 1 root wheel 14958233 Oct 13 16:29 netbsd
! 44: # umount /mnt
! 45: # mount_chfs /dev/flash0 /mnt
! 46: # ls -l /mnt
! 47: total 29216
! 48: -rwxr-xr-x 1 root wheel 14958233 Oct 13 16:29 netbsd
! 49: # ls -l /mnt
! 50: total 29216
! 51: -rwxr-xr-x 1 root wheel 14958233 Oct 13 16:29 netbsd
! 52: # md5 /mnt/netbsd /netbsd
! 53: MD5 (/mnt/netbsd) = 79184fe311657261e1744d77206716c8
! 54: MD5 (/netbsd) = 79184fe311657261e1744d77206716c8
! 55: # umount /mnt
! 56:
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb