七、配置内核
在配置内核前,先拷贝s3c2410开发板的默认配置到内核根目录下,以简化配置过程。
#pwd
/home/tekkaman/working/kernel/linux-2.6.22.2
# cp arch/arm/configs/s3c2410_defconfig .config
# make menuconfig
以下是在 s3c2410_defconfig 基础上要配置的选项(有一些必须的选项在s3c2410_defconfig里已经选上了,所以我没有写出来。以下的选项非特别说明,可能不用选,我没有做实验证明哪些要、哪些不要,所以有兴趣的可以自己做实验看看,欢迎发E-Mail告诉我结果。谢谢)
General setup --->
[*] Configure standard kernel features (for small systems) --->
选上这项,否则文件系统中的一些选项不会出现
System Type --->
S3C2410 Machines --->
[*] SMDK2410/A9M2410 留下这项就够了,其他全部“N”掉
“N”掉 S3C2412 Machines ---> 、 S3C2440 Machines ---> 和 S3C2443 Machines ---> 里的所有选项,都是和2410无关的选项。
Boot options --->
将 (root=/dev/hda1 ro init=/bin/bash console=ttySAC0) Default kernel command string
改成 (noinitrd root=/dev/mtdblock4 rootfstype=cramfs console=ttySAC0,115200 init=/linuxrc mem=64M) Default kernel command string
#说明:
#mtdblock4代表第5个flash分区,用来作根文件系统rootfs;
# console=ttySAC0,115200使kernel启动期间的信息全部输出到串口0上,波特率为115200;
# 2.6内核对于串口的命名改为ttySAC0,但这不影响用户空间的串口编程。
# 用户空间的串口编程针对的仍是/dev/ttyS0等
# mem=64M表示内存是64M,如果是32则设为32M
在实践中,我发现“rootfstype=cramfs”这句还是挺重要的。如果没有这句,系统启动时即使分区挂载正确了,但是文件系统的类型有可能出错。在这里定义过,就不会出错了。这里的选项也和根文件系统的配置有关。(我先使用cramfs做跟文件系统,以后再换JFFS2或是YAFFS)
Userspace binary formats --->
< > Kernel support for a.out and ECOFF binaries (去除该选项,a.out和ECOFF是两种可执行文件的格式,在ARM-Linux下一般都用ELF,所以这两种基本用不上。)
Networking --->
Networking options --->
<*> Packet socket
[*] Packet socket: mmapped IO
-我移植 斯达康 的XI-735 无限网卡,所以我选了WLAN(802.11)的选项,不需的可以不选-
Wireless --->
--- Improved wireless configuration API
--- Wireless extensions
<*> Generic IEEE 802.11 Networking Stack (mac80211)
[*] Enable LED triggers
[ ] Enable debugging output (NEW)
<*> Generic IEEE 802.11 Networking Stack
[ ] Enable full debugging output (NEW)
--- IEEE 802.11 WEP encryption (802.1x)
< > IEEE 802.11i CCMP support (NEW)
< > IEEE 802.11i TKIP encryption (NEW)
<*> Software MAC add-on to the IEEE 802.11 networking stack
[ ] Enable full debugging output (NEW)
Device Drivers --->
“N”掉 Parallel port support ---> 里的所有选项。
Plug and Play support --->里的所有选项一定要“N”掉,不然编译会出错!!!!!!!!
Network device support --->
Ethernet (10 or 100Mbit) --->
“N”掉< > DM9000 support和< > Generic Media Independent Interface device support
-------以下一定要选上,是AX88796的驱动------
[*] Other ISA cards
<*> NE2000/NE1000 support
-----------------------------
“N”掉 [ ] Ethernet (1000 Mbit) --->和 [ ] Ethernet (10000 Mbit) --->
Wireless LAN --->
[*] Wireless LAN (pre-802.11)
[*] Wireless LAN (IEEE 802.11)
USB Network Adapters --->
<*> Multi-purpose USB Networking Framework
<*> MMC/SD card support --->
Real Time Clock --->
“N”掉 [ ] Set system time from RTC on startup and resume
#接下来做的是针对文件系统的设置,我实验时目标箱上要挂的根文件系统是cramfs,故做如下配置
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(注意:不要试图按照旧内核的方法增加 devfs 的支持,因为在这个内核里已经彻底删除了
devfs的源代码。我曾试图将旧内核的devfs源代码复制过来,不过编译会出错!
补救的办法就是用BusyBox的mdev来代替,在讲根文件系统的建立时我会说明,你也可以到网上找mdev的资料。)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
File systems -->
< > Second extended fs support #去除对ext2的支持
< > Ext3 journalling file system support #去除对ext3的支持
<*> Kernel automounter support
<*> Kernel automounter version 4 support (also supports v3)
<*> Filesystem in Userspace support
Pseudo filesystems -->
[*] Virtual memory file system support (former shm fs)
<*> Userspace-driven configuration filesystem (EXPERIMENTAL)
Miscellaneous filesystems -->
<*> YAFFS2 file system support
“N”掉[ ]Autoselect yaffs2 format 和
[ ]Cache short names in RAM ,因为这是给每页大于1024B的NAND Flash设计的
<*> Journalling Flash File System v2 (JFFS2) support
(0) JFFS2 debugging verbosity (0 = quiet, 2 = noisy)
[*] JFFS2 write-buffering support
[ ] JFFS2 summary support (EXPERIMENTAL)
[ ] JFFS2 XATTR support (EXPERIMENTAL)
[*] Advanced compression options for JFFS2
[*] JFFS2 ZLIB compression support
[*] JFFS2 RTIME compression support
[*] JFFS2 RUBIN compression support
JFFS2 default compression mode (priority) --->
Network File Systems -->
<*> NFS file system support
--以下最好选上,因为在挂载NFS时可能出现protocol不支持的情况--
[*]Provide NFSv3 client support
[*]Provide client support for the NFSv3 ACL protocol extension
[*] Provide NFSv4 client support (EXPERIMENTAL)
[*] Allow direct I/O on NFS files
-------------------------------------------------------------------------
<*> NFS server support
[*] Provide NFSv3 server support
[*]Provide server support for the NFSv3 ACL protocol extension
[*] Provide NFSv4 server support (EXPERIMENTAL)
--- Provide NFS server over TCP support
[*] Root file system on NFS
保存退出,产生.config文件。
八、编译内核
#make zImage