【環境】
1:Ubuntu 10.10
2:u-boot-2010.03
3:linux-2.6.35
4:優龍FS2410
5:交叉編譯器:arm-none-linux-gnueabi-gcc version 4.3.2
1)解壓內核
tar jxf linux-2.6.35.tar.bz2
2)修改頂層Makefile
ww.linuxidc.com@linuxidc:~/win/linux-2.6.35$ vim Makefile
修改191和192行(可以先找到編譯器的絕對路徑)
ARCH ?= arm
CROSS_COMPILE ?= /home/tony/toolchain/bin/arm-none-linux-gnueabi-
3)拷貝配置文件
ww.linuxidc.com@linuxidc:~/win/linux-2.6.35$ cp arch/arm/configs/s3c2410_defconfig .config
4)配置內核
ww.linuxidc.com@linuxidc:~/win/linux-2.6.35$ make menuconfig
查看類型是否為S3C2410
System Type --->
ARM system type (Samsung S3C2410, S3C2412, S3C2413, ……) --->
用新交叉編譯器需選擇EABI
Kernel Features --->
[*] Use the ARM EABI to compile the kernel
[*] Allow old ABI binariesto run with this kernel (EXPERIMENTAL) (NEW)
5)將cs8900.c和cs8900.h兩個文件拷貝到linux-2.6.35/drivers/net/arm/下
6)修改linux-2.6.35/drivers/net/arm/vim Kconfig,添加cs8900內核配置項
添加
config S3C2410_CS8900
tristate "CS8900 support"
depends on NET_ETHERNET && ARM && ARCH_SMDK2410
---help---
support for cs8900 chipset base Ethernet cards, if you have a networkcard of this type.
7)修改linux-2.6.35/drivers/net/arm/vim Makefile
添加:obj-$(CONFIG_S3C2410_CS8900) += cs8900.o
8)添加地址映射定義
修改文件:linux-2.6.35/arch/arm/mach-s3c2410/include/mach$vim map.h
添加:
/* CS8900a */
#define pSMDK2410_ETH_IO __phys_to_pfn(0x19000000)
#define vSMDK2410_ETH_IO 0xE0000000
#define SMDK2410_ETH_IRQ IRQ_EINT9
9)添加平台代碼
修改文件:linux-2.6.35/arch/arm/mach-s3c2410$vim mach-smdk2410.c
在59行添加一句:
57 static struct map_desc smdk2410_iodesc[]__initdata = {
58 /*nothing here yet */
59 {vSMDK2410_ETH_IO, pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE}
60};
10)配置內核,使之支持cs8900網卡
ww.linuxidc.com@linuxidc:~/win/linux-2.6.35$ make menuconfig
Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
<*> CS8900 support
11)重新編譯內核
ww.linuxidc.com@linuxidc:~/win/linux-2.6.35$ make zImage
********************************************************************
** 備注:如果想生成uImage **
** cp u-boot-2010.03/tools/mkimge /usr/bin/ **
********************************************************************
12)拷貝zImage到tftpboot目錄進行測試
ww.linuxidc.com@linuxidc:~/win/linux-2.6.35$cp arch/arm/boot/zImage /tftpboot
13)在開發板設置參數
setenv serverip 192.168.7.103
setenv ipaddr 192.168.7.163
setenv gatewayip 192.168.7.1
setenv ethaddr 08:00:3e:26:0a:5b
setenv bootcmd tftp 30800000 uImage \; bootm
/*** setenv bootcmd tftp 33000000 zImage \; go 33000000 如果用zImage用這個***/
setenv bootargs console=ttySAC0,115200 init=/linuxrc root=/dev/nfs nfsroot=192.168.7.103:/opt/filesystem ip=192.168.7.163
測試前提:已配置好TFTP、NFS服務
注①:/opt/filesystem為自己的已移植好的文件系統目錄
注②:serverip為Ubuntu的IP,ipaddr為開發板的IP
14)如果想燒寫到nand flash,讓內核從nand啟動,依次設置如下u-boot參數
tftp 33000000 uImage
nand erase 40000 300000
nand write 33000000 40000 300000
setenv bootcmd nand read 33000000 40000 300000 \; bootm 33000000