分类: LINUX
2011-12-29 11:45:28
1、修改Makefile文件,修改平台和交叉编译工具
ARCH=arm
CROSS_COMPILE=arm-softfloat-linux-gnu-
2、拷贝arch/arm/configs/s3c2410_defconfig.到顶目录,主要是选着一个和开发板相似的默认配置
cp arch/arm/configs/smdk2410_defconfig .config
3、添加cs8900网卡的驱动
1、修改drivers/net/arm/Makefile文件添加:
obj-$(CONFIG_ARM_CS8900) += cs8900.o
2、修改drivers/net/arm/Kconfig文件添加:
config ARM_CS8900
tristate "CS8900 support"
depends on NET_ETHERNET && ARM && ARCH_SMDK2410
help
support for cs8900 chipset based Ethernet cards , if you have a network card of this type
3、编译配置内核
# make menuconfig
Device Drivers --->
[*] Network device support --->
[*] Ethernet (10 or 100Mbit) --->
<*> CS8900 support
4、修改arch/arm/mach-s3c2410/mach-smdk2410.c文件
static struct map_desc smdk2410_iodesc[] __initdata最后添加:
{vSMDK2410_ETH_IO, pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE}
5、修改arch/arm/mach-s3c2410/include/mach/map.h文件增加:
/* CS8900 */
#define pSMDK2410_ETH_IO __phys_to_pfn(0x19000000)
#define vSMDK2410_ETH_IO 0xE0000000
#define SMDK2410_ETH_IRQ IRQ_EINT9
6.把以下两个文件cs8900.c cs8900.h添加进drivers/net/arm/内,然后编译内核。
这样就可以完成了,有可能在编译途中会出现错误,如
arch/arm/mach-s3c2410/built-in.o:(.init.data+0x724): undefined reference to `s3c_device_usb'
arch/arm/mach-s3c2410/built-in.o:(.init.data+0x724): undefined reference to `s3c_device_nand'
那是因为我们的arch/arm/mach-s3c2410/Kconfig 配置文件中有点问题,在config ARCH_SMDK2410这个段里明显比其他段少点东西
config ARCH_SMDK2410
bool "SMDK2410/A9M2410"
select CPU_S3C2410
select MACH_SMDK
select S3C_DEV_USB_HOST
select S3C_DEV_NAND
我们把S3C_DEV_USB_HOST和 S3C_DEV_NAND添加上去就ok了 然后make zImage生成内核,用tftp下载就可以启动了
遇到上述问题,先在板文件、arch/arm/plat-samsung或者其他的板文件中查找相关的.c文件
如dev-nand.c中有
struct platform_device s3c_device_nand = {
.name = "s3c2410-nand",
.id = -1,
.num_resources = ARRAY_SIZE(s3c_nand_resource),
.resource = s3c_nand_resource,
};
——————————
在Makefile中查看有
obj-$(CONFIG_S3C_DEV_NAND) += dev-nand.o
————-——————
在该板文件中看Kconfig
config S3C_DEV_NAND
bool
help
Compile in platform device definition for NAND controller
说明s3c2410-nand被别人定义了,则要在arch/arm/mach-s3c2410的Kconfig中
要对2410配置:
config ARCH_SMDK2410
bool "SMDK2410/A9M2410"
select CPU_S3C2410
select MACH_SMDK
help
应改为:
config ARCH_SMDK2410
bool "SMDK2410/A9M2410"
select CPU_S3C2410
select MACH_SMDK
select S3C_DEV_USB_HOST
select S3C_DEV_NAND
select S3C2410_SETUP_TS
help
———————————
内核编译时报如下错误:
fs/binfmt_aout.c: In function 'load_aout_binary':
fs/binfmt_aout.c:355: error:'TASK_SIZE_26' undeclared (first use in this function)
fs/binfmt_aout.c:355: error: (Each undeclared identifier is reported only once
fs/binfmt_aout.c:355: error: for each function it appears in.)
make[1]: *** [fs/binfmt_aout.o] Error 1
make: *** [fs] Error 2
原来是把Userspace binary formats ---> Kernel support for a.out and ECOFF binaries 这一个选项选上了。