*************1、给板子添加新的驱动****************

一、       驱动程序编译进内核的步骤
在 linux 内核中增加程序需要完成以下三项工作:
1. 将编写的源代码复制到 Linux 内核源代码的相应目录;
2. 在目录的 Kconfig 文件中增加新源代码对应项目的编译配置选项;
3. 在目录的 Makefile 文件中增加对新源代码的编译条目。

bq27501驱动编译到内核中

***********************2、在内核中make时出现的错误**************

 build linux kernel的错误

cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mapcs"
cc1: error: unrecognized command line option "-mno-sched-prolog"
cc1: error: unrecognized command line option "-mabi=aapcs-linux"
cc1: error: unrecognized command line option "-mno-thumb-interwork"
arch/arm/kernel/asm-offsets.c:1: error: bad value (armv5t) for -march= switch
arch/arm/kernel/asm-offsets.c:1: error: bad value (strongarm) for -mtune= switch
 
原因是:CROSS_COMPILE没有设置正确
使用命令:
make ARCH=arm CROSS_COMPILE=arm-linux- 
或修改makefile:

#ARCH   ?= $(SUBARCH)
ARCH = arm
#CROSS_COMPILE ?=
CROSS_COMPILE = arm-linux-
 

 

修改Makefile

   cd    linux-2.6.35.7  

   vi   Makefile

 191 ARCH            ?= arm

 192 CROSS_COMPILE   ?= arm-linux-

 

相关文章: