Kernel内核的裁剪及移植(四)

八、配置和编译内核
到现在,一个简单的内核就准备好了,我们还需要做一些配置,然后编译,内核才能
正常使用。
在内核源代码的根目录下运行make menuconfig命令,进入配置界面:
[root@localhost gspca]# cd ../../../..
[root@localhost linux-2.6.24.4]# make menuconfig

 1、选择硬件系统
做如下选择:
System Type --->
S3C2410 Machines --->
[*] SMDK2410/A9M2410
[*] IPAQ H1940
[*] Acer N30
[*] Simtec Electronics BAST (EB2410ITX)
[*] NexVision OTOM Board
[*] AML M5900 Series
[*] Thorcom VR1000
[*] QT2410

其他的:

S3C2400 Machines --->
S3C2412 Machines --->
S3C2440 Machines --->
S3C2442 Machines --->
S3C2443 Machines --->
上面的四个选项下的所有选项都不要选,以减小内核体积。
2、配置LCD驱动
做如下选择:
Device Drivers --->
Graphics support --->
<*> Support for frame buffer devices --->
<*> S3C2410 LCD framebuffer support

[*] Bootup logo --->

--- Bootup logo
[*] Standard black and white Linux logo
[*] Standard 16-color Linux logo
[*] Standard 224-color Linux logo

这样,在内核启动的时候,在LCD的左上角就会出现Linux的LOGO,一只小企鹅。

3、配置NAND Flash驱动
做如下选择:
Device Drivers --->
<*> Memory Technology Device (MTD) support --->
<*> NAND Device Support --->
<*> NAND Flash support for S3C2410/S3C2440 SoC

4、配置网卡驱动

做如下选择:

Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
--- Ethernet (10 or 100Mbit)
-*- Generic Media Independent Interface device support
<*> ASIX AX88796 NE2000 clone support
[ ] ASIX AX88796 external 93CX6 eeprom support
< > SMC 91C9x/91C1xxx support
< > DM9000 support
< > Broadcom 440x/47xx ethernet support

 

5、配置文件系统
做如下配置,以支持CRAMFS文件系统和YAFFS文件系统,为了调试方便,也
选上NFS文件系统的支持:
File systems --->
Miscellaneous filesystems --->
<*> YAFFS2 file system support
-*- 512 byte / page devices
[ ] Use older-style on-NAND data format with pageStatus byte
[ ] Lets Yaffs do its own ECC
-*- 2048 byte (or larger) / page devices
[*] Autoselect yaffs2 format
[ ] Disable lazy loading
[ ] Turn off wide tnodes
[ ] Force chunk erase check
[*] Cache short names in RAM
< > Journalling Flash File System v2 (JFFS2) support
<*> Compressed ROM file system support (cramfs)

 

[*] Network File Systems --->

--- Network File Systems
<*> NFS file system support
[*] 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
[*] Root file system on NFS

6.配置摄像头驱动

要内核支持中星的摄像头
Device Drivers --->
Multimedia devices --->
Video For Linux

USB support --->

Support for Host-side USB
---USB Host Controller Drivers
OHCI HCD support

USB SPCA5XX Sunplus/Vimicro/Sonix jpeg Cameras

这样,内核的配置基本上就做好了。如果有兴趣,可以自己查看内核的其他配

置,并决定是否选择某项功能,以适合自己的开发板。
在内核源文件的根目录下运行如下命令编译内核:
[root@localhost linux-2.6.24.4]# make
编译完成后,会在内核的boot/arch/arm目录下生成zImage文件。这个文件就
是内核的镜像文件。经过处理,可以启动,后面会详细介绍。

九、用U-Boot启动内核

编译U-Boot时在源代码的tools目录下会生成一个mkimage可执行文件,用这个工具
可以对前面编译内核时生成的zImage进行处理,以供U-Boot启动。
把mkimage 拷贝到一个目录下,比如我的就是/root/2410-s,把上面编译生成的
zImage也拷贝到该目录下,运行如下命令生成 uImage:
[root@localhost 2410-s]# ./mkimage -A arm -T kernel -C none -O linux -a 0x30008000 -e 0x30008040 -d zImage -n 'Linux-2.6.24' uImage
Image Name:    Linux-2.6.24
Created:       Fri Nov 19 11:26:54 2010
Image Type:    ARM Linux Kernel Image (uncompressed)
Data Size:     1733868 Bytes = 1693.23 kB = 1.65 MB
Load Address: 0x30008000
Entry Point: 0x30008040
[root@localhost 2410-s]#

这样会在这个目录下生成uImage,把uImage放入主机的TFTP目录下,启动开发板,

用U-Boot的tftp命令下载uImage到SDRAM,并启动。U-Boot中的操作如下:
[UP-2410-S #]tftp
然后运行bootm启动内核:
[UP-2410-S #]bootm

你可能感兴趣的:(linux,职场,kernel,休闲,linux内核)