1.了解 NandFlash 信息 :
FS2410开发板的Nand Flash 型号K91208 ;
PageSize = 512 Bytes + 16 Bytes(OOB);
BlockSize = 32 pages *(512 Bytes + 16 Bytes(OOB)) = 32 pages * 528 Bytes = 16K +512 Bytes(OOB) ;
DeviceSize = 4096 blocks * (32 *(512 Bytes + 16 Bytes(OOB))) = 4096 blocks * 16K +4096 *512 Bytes(OOB) = 64MBytes + 2KBytes (OOB) ;
所以 制作文件系统竟像时的 -e/--eraseblock = 0x4000 -s/--pagesize = 0x200 -p/--pad = 根文件系统分区大小,这里为20MBytes;
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2410-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2410-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 3946 at 0x000003da8000
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000400000 : "kernel-linux-2.6.35"
0x000000400000-0x000001800000 : "rootfs"
0x000001800000-0x000004000000 : "userdata"
Nand Flash 分区修改,linux-2.6.35/arch/arm/plat-s3c24xx/common-smdk.c 109 line;
2. 创建 jffs2 文件系统镜像 :sudo ~/bin/mkfs.jffs2 -e 0x4000 -s 0x200 -d filesystem -o filesystem.jffs2 -p 1400000
3. 复制文件系统镜像到/tftpboot/目录
4. tftp下载 jffs2文件系统镜像:
fs2410# tftp 30800000 filesystem.jffs2
TFTP from server 192.168.20.192; our IP address is 192.168.20.253
Filename 'filesystem.jffs2'.
Load address: 0x30800000
Loading: #################################################################
####################
done
Bytes transferred = 5062656 (4d4000 hex)
5. 擦写nand flash 擦除跟文件系统分区部分的flash空间
fs2410# nand erase 400000 1400000
NAND erase: device 0 offset 4194304, size 20971520 ...
OK
6. 写jffs2文件系统镜像到nandflash 根文件系统分区
fs2410# nand write.jffs2 30800000 400000 4d4000 //烧写jffs2文件系统镜像,文件系统下载是多大,这里的烧录大小就写多大,否则会出现如下错误提示:
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x003f0000: 0x80b0 instead
NAND write: device 0 offset 4194304, size 5062656 ...
5062656 bytes written: OK
7. 烧录ok,设置启动参数
setenv bootargs root=/dev/mtdblock2 rootfstype=jffs2 rw console=ttySAC0,115200 init=/linuxrc mem=64M
saveenv
8. 开始启动系统;
fs2410# tftp 30800000 uImage ;bootm 30800000
TFTP from server 192.168.20.192; our IP address is 192.168.20.253
Filename 'uImage'.
Load address: 0x30800000
Loading: #################################################################
#################################################################
##############################
done
Bytes transferred = 2348164 (23d484 hex)
## Booting image at 30800000 ...
Image Name: Linux-2.6.35
Created: 2011-01-24 6:22:17 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2348100 Bytes = 2.2 MB
Load Address: 30108000
Entry Point: 30108000
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Linux version 2.6.35 (pingo@pingo-laptop) (gcc version 3.4.5) #38 Mon Jan 24 14:22:06 CST 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: SMDK2410
Ignoring unrecognised tag 0x54410010
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410A (id 0x32410002)
S3C24XX Clocks, Copyright 2004 Simtec Electronics
S3C2410: core 202.800 MHz, memory 101.400 MHz, peripheral 50.700 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
... ...
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
... ...
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2410-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2410-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 3946 at 0x000003da8000
Creating 4 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "u-boot"
0x000000040000-0x000000400000 : "kernel-linux-2.6.35"
0x000000400000-0x000001800000 : "rootfs"
0x000001800000-0x000004000000 : "userdata"
... ...
Empty flash at 0x004d08c4 ends at 0x004d0a00
VFS: Mounted root (jffs2 filesystem) on device 31:2.
Freeing init memory: 164K
mount: mounting sysfs on sys failed: Device or resource busy
Please press Enter to activate this console. #
# ls
bin lib root usr
button_irq_test linuxrc sbin var
buttons_drv.ko mnt sys
dev netlink-arm test-ex
etc proc tmp
以上---
相关链接:
http://hi.baidu.com/yysirius/blog/item/2b014da72e510193d14358ea.html/cmtid/6ec82173ae5270128701b0de
http://blog.sina.com.cn/s/blog_4a082210010005dq.html
http://blogold.chinaunix.net/u2/74383/showart_1144731.html