【环境】
1:CentOS release 6.5 (Final)
2:u-boot-2010.12
3:TQ2440
4:交叉编译器:eldk
第一步:在内核里添加yaffs2的支持
1)下载源码
git clone git://www.aleph1.co.uk/yaffs2
2)给内核打补丁
./patch-ker.sh c m ../../linux-2.6.33.7 // 这里是内核源码路径
3)配置内核 (1:没有打过补丁的内核 2:已设置好交叉编译器)
make V=1 ARCH=arm CROSS_COMPILE=arm-linux- menuconfig
File systems --->
[*] Miscellaneous filesystems --->
<*> YAFFS2 file system support
-*- 512 byte / page devices
[*] Lets yaffs do its own ECC (TQ2440 取消这个选项)
-*- 2048 byte (or larger) / page devices
[*] Autoselect yaffs2 format
[*] Enable yaffs2 xattr support (2.6.33.7没有这个选项)
4)禁用内核NandFlash的ECC校样,并设置mtd分区,配置nand访问时序
arch/arm/plat-s3c24xx/common-smdk.c
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "Boot Agent 256k@0(bios)",
.size = SZ_256K,
.offset = 0,
},
#if 0
[1] = {
.name = "S3C2410 flash partition 1 128k(params)",
.offset = MTDPART_OFS_APPEND,
.size = SZ_128K,
},
[2] = {
.name = "S3C2410 flash partition 2 128k(toc)",
.offset = MTDPART_OFS_APPEND,
.size = SZ_128K,
},
[3] = {
.name = "S3C2410 flash partition 3 512k(eboot)",
.offset = MTDPART_OFS_APPEND,
.size = SZ_512K,
},
[4] = {
.name = "S3C2410 flash partition 4 1024k(logo)",
.offset = MTDPART_OFS_APPEND,
.size = SZ_1M,
},
#endif
[1] = {
.name = "S3C2410 flash partition 5 3m@2m(kernel)",
.offset = 0x00200000,
.size = SZ_1M * 3,
},
[2] = {
.name = "S3C2410 flash partition 6 -(root)",
.offset = 0x00500000,
.size = MTDPART_SIZ_FULL,
},
};
static struct s3c2410_nand_set smdk_nand_sets[] = {
[0] = {
.disable_ecc = 1,
.name = "NAND",
.nr_chips = 1,
.nr_partitions = ARRAY_SIZE(smdk_default_nand_part),
.partitions = smdk_default_nand_part,
},
};
static struct s3c2410_platform_nand smdk_nand_info = {
.tacls = 10,
.twrph0 = 25,
.twrph1 = 10,
.nr_sets = ARRAY_SIZE(smdk_nand_sets),
.sets = smdk_nand_sets,
};
5)重新编译内核
make V=1 ARCH=arm CROSS_COMPILE=arm-linux- bzImage
6)拷贝内核到TFTP目录
tony@Ubuntu:~/win/linux-2.6.35$ cp arch/arm/boot/uImage /tftpboot
7)重新启动开发板
# cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev tmpfs
nodev sockfs
nodev usbfs
nodev pipefs
nodev anon_inodefs
nodev rpc_pipefs
nodev devpts
ext3
ext2
cramfs
nodev ramfs
vfat
msdos
iso9660
nodev nfs
nodev jffs2
romfs
yaffs
yaffs2
nodev mtd_inodefs
第二步:实现u-boot对Yaffs2文件系统的支持
请参考:https://blog.csdn.net/chungle2011/article/details/79148905
第三步:用busybox制作yaffs2根文件系统
1)参看--》根文件系统制作
2)目标板NandFlash是64MB的,所以要使用mkyaffs2image_2这个版本的可执行文件来生成映像
./mkxxxximage_tools/usr/local/sbin/mkyaffs2image root_qt_4.5_2.6.30.4 root.bin
updatecramfs=tftpboot 0x30000000 root.bin;nand erase 0x500000 0x3C00000;nand write.yaffs2 0x30000000 0x500000 $(filesize);