一、开发环境
宿主机:Fedora9.0 或 ubuntu10.04
开发板:tiny6410
编译器:4.3.2
二、内核移植
1.下载源码
ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.tar.bz2
linux-2.6.38
2.解压
( 进入根目录下的/home/poplar/expr4/kernel目录,解压源码)
tar xvfj /home/poplar/expr4/kernel/linux-2.6.38.tar.bz2
3.修改架构,编译器(需要在arm上运行,所以用交叉编译器)
解压完进入解压出来的linux-2.6.38目录
#cd linux-2.6.38
#vi Makefile (或者用gedit)
191行改为
ARCH ?= arm
CROSS_COMPILE ?= arm-linux- (找到其交叉编译环境)
4.生成默认配置文件
#cp arch/arm/configs/s3c6400_defconfig .config
如省略这个操作的话后面会找不到System Type
Linux内核中已经自带了关于我们6410开发板的配置。
5.修改配置项
#make menuconfig
System Type->[*] MINI6410 选上,
6.拷贝NAND FLASH驱动到根目录下的/home/poplar/expr4/kernel下的linux-2.6.38里相应的文件位置处(以下的文件在实验五文件夹里有)
drivers/mtd/nand/s3c_nand.c
arch/arm/plat-samsung/include/plat/regs-nand.h
drivers/mtd/nand/s3c_nand_mlc.fo
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/Kconfig
7修改nand 驱动makefile
输入指令#cd drivers/mtd/nand
#vi Makefile
drivers/mtd/nand/Makefile中20行增加
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand.o
末尾再增加
obj-$(CONFIG_MTD_NAND_S3C) += s3c_nand_mlc.fo
8.增加相应选项
输入指令#cd /home/poplar/expr4/kernel/linux-2.6.38
Device Drivers--->
<*> Memory Technology Device (MTD) support --->
[*] MTD partitioning support
[*] Command line partition table parsing
<*> Direct char device access to MTD devices
<*> Caching block device access to MTD devices
<*> NAND Device Support --->
< > NAND Flash support for Samsung S3C SoCs 去掉不要选
<*> NAND Flash support for S3C SoC
[*] S3C NAND Hardware ECC
三、 添加yaffs2文件系统的支持
首先向内核源代码中加入支持yaffs2的源代码】
解压yaffs2.tar.bz2
#cd /home/poplar/expr4/kernel
#tar xvfj /home/poplar/expr4/kernel/yaffs2.tar.bz2
进入解压出的目录#cd yaffs2
执行如下命令
./patch-ker.sh c m +内核源码路径(/home/poplar/expr4/kernel/linux-2.6.38)
然后进入内核源码目录
#cd /home/poplar/expr4/kernel/linux-2.6.38
执行make menuconfig
选择File systems
选择 [*] Miscellaneous filesystems --->
选择上<*> yaffs2 file system support以及与yaffs2相关选项。
配置结果如下:
退出保存
四、 添加对UBIFS文件系统的支持
1. 配置内核支持UBIFS
#make menuconfig
Device Drivers --->
Memory Technology Device (MTD) support --->
Enable UBI - Unsorted block images --->
2.配置mtd支持UBI接口
File systems --->
Miscellaneous filesystems --->
UBIFS file system support
3.再次make
#make zImage
一、 下载到开发板(见实验三操作说明)
先将zImage用DNW下载到开发板,然后将开关拨动到nand方式启动,观察超级终端
此时启动会出现如下问题
如果成功,如下图:
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
VFP support v0.3: implementor 41 architecture 1 part 20 variant b rev 5
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
mmc0: mmc_rescan_try_freq: trying to init card at 300000 Hz
mmc0: mmc_rescan_try_freq: trying to init card at 200000 Hz
UBIFS: recovery needed
usb 1-1: new full speed USB device using s3c2410-ohci and address 2
mmc0: mmc_rescan_try_freq: trying to init card at 100000 Hz
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 0, name "FriendlyARM-root"
UBIFS: file system size: 2061287424 bytes (2012976 KiB, 1965 MiB, 1997 LEBs)
UBIFS: journal size: 12517376 bytes (12224 KiB, 11 MiB, 13 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:10.
hwclock: can't open '/dev/misc/rtc': No such file or directory
[01/Jan/1970:00:00:18 +0000] boa.c:173 - unable to create socket: Function not implemented
open device leds: No such file or directory
/usr/sbin/alsactl: load_state:1610: No soundcards found...
ifconfig: socket: Function not implemented
Try to bring eth0 interface up......cat: can't open '/sys/class/net/eth0/address': No such file or directory
ifconfig: socket: Function not implemented
route: socket: Function not implemented
Done