准备交叉编译工具链arm-linux-xxx
并将交叉编译工具链的路径加到环境变量里面
下载2.6.22.6的内核源码linux-2.6.22.6.tar.bz2
将内核源码放到linux系统下,解压
root@linuxidc:/source/kernel/linux-2.6.22.6# tar -jxvf linux-2.6.22.6.tar.bz2
进入解压后的目录
root@linuxidc:/source/kernel/linux-2.6.22.6# cd linux-2.6.22.6
移植内核
修改Makefile,修改编译器和目标平台
将
185 ARCH ?= $(SUBARCH)
186 CROSS_COMPILE ?=
改为
185 ARCH := arm
186 CROSS_COMPILE := arm-linux-
注意:请再次确认一下环境变量中是否有交叉编译工具链
root@linuxidc:/source/kernel/linux-2.6.22.6# arm-linux-gcc -v
复制参考板的config文件到内核源码树根目录
root@linuxidc:/source/kernel/linux-2.6.22.6# cp arch/arm/configs/s3c2410_defconfig ./.config
移植网卡
编写网卡驱动,修改相应的Makefile和Kconfig文件
我是在linux把网卡驱动写好,然后复制到源码树的响应目录
root@linuxidc:/source/kernel/linux-2.6.22.6# cp /mnt/hgfs/shared/network/cs8900a.* drivers/net/
然后修改Makefile,
root@linuxidc:/source/kernel/linux-2.6.22.6# vim drivers/net/Makefile
添加
obj-$(CONFIG_CS8900a) += cs8900a.o
修改Kconfig
root@linuxidc:/source/kernel/linux-2.6.22.6# vim drivers/net/Kconfig
在
866 config DM9000
867 tristate "DM9000 support"
868 depends on (ARM || MIPS) && NET_ETHERNET
869 select CRC32
870 select MII
871 ---help---
872 Support for DM9000 chipset.
873
874 To compile this driver as a module, choose M here and read
875 <file:Documentation/networking/net-modules.txt>. The module will be
876 called dm9000.
后添加
878 config CS8900a
879 tristate "CS8900a support"
880 depends on ARM && NET_ETHERNET
881 --help---
882 support for cs8900a chipset
883 to compile this driver as a module,
884
配置内核
make menuconfig
Network device support --->
Ethernet (10 or 100Mbit) --->
<*> CS8900a support