linux(red hat)2.6总编译失败提示说头文件之类东西找请大家帮忙看看啊实没有办法才提问点分全部用了请大家帮帮忙只有led.c文件和Makefileled.c文件里面只基本init和exit源文件下:
(源文件放/1_led(包含led.c,Makefiel两文件)错误信息因字数限制我删除了些类似错误信息)
==========led.c===========
#include
#include
MODULE_LICENSE("GPL");
static int __init led_init(void)
{
printk("hello driver!\n");
return 0;
}
static void __exit led_exit(void)
{
printk("Byebye driver!\n");
}
module_init(led_init)
module_exit(led_exit)
========Makefile============
KERNEL_PATH=/linux-2.6.29 #编译所需内核源码根目录
SOURCE_PATH=$(shell pwd)
obj-m = led.o
all:
make -C $(KERNEL_PATH) M=$(SOURCE_PATH) modules
clean:
rm *.mod.c *.o *.ko .*.cmd modules.order Module.symvers .tmp_versions -rf
===========错误信息================
[root@localhost 1_led]# make
make -C /kernel M=/1_led modules
make[1]: Entering directory `/kernel'
ERROR: Kernel configuration is invalid.
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /kernel/Module.symvers
is missing; modules will have no dependencies and modversions.
CC [M] /1_led/led.o
cc1: error: include/linux/autoconf.h: No such file or directory
In file included from include/linux/prefetch.h:14,
from include/linux/list.h:6,
from include/linux/module.h:9,
from /1_led/led.c:1:
/kernel/arch/arm/include/asm/processor.h:109:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/list.h:7,
from include/linux/module.h:9,
from /1_led/led.c:1:
include/asm-generic/cmpxchg-local.h: In function '__cmpxchg_local_generic':
include/asm-generic/cmpxchg-local.h:23: error: implicit declaration of function 'local_irq_save'
In file included from include/linux/bitops.h:17,
from include/linux/kernel.h:15,
from include/linux/cache.h:4,
from include/linux/time.h:7,
from include/linux/stat.h:60,
from include/linux/module.h:10,
from /1_led/led.c:1:
/kernel/arch/arm/include/asm/memory.h: In function 'virt_to_phys':
/kernel/arch/arm/include/asm/memory.h:160: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
include/linux/tracepoint.h: In function 'tracepoint_synchronize_unregister':
include/linux/tracepoint.h:153: error: implicit declaration of function '__synchronize_sched'
make[2]: *** [/1_led/led.o] 错误 1
make[1]: *** [_module_/1_led] 错误 2
make[1]: Leaving directory `/kernel'
make: *** [all] 错误
解决办法:配置一次并编译一次。