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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章