海之梦fly 发表于 2012-8-30 09:39:03

hello 驱动编译不过去了

原来做的好使,暑假回来make 就不行了呢?是内核的问题吗?

源码如下 :/********************
2 hello.c qudong
3 duopin:2012.4.22
4 ********************/
5
6
7 #include <linux/init.h>
8 #include <linux/module.h>
9 MODULE_LICENSE("GPL");
10
11 static int hello_init(void)
12 {
13 //use printk ,not printf--k is kernel
14    printk(KERN_ALERT "Hello, world!!\nthis is my hello world!!\n");
15    return 0;
16 }
17
18 static void hello_exit(void)
19 {
20    printk(KERN_ALERT "Goodbye, curel world--pin\n");
21    return 0;
}

makefile:
KERNELDIR=/opt/EmbedSky/linux-2.6.30.4
2 PWD:=$(shell pwd)
3 INSTALLDIR=$(PWD)
4 CC=arm-linux-gcc
5 obj-m := hello.o
6 modules:   
7         $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
8
9 clean:   
10         rm -rf *.o *.ko *.mod.c *.markers *.order *.symvers   
11 .PHONY:modules clean
在别机器好make通过的。


# ls
hello.cMakefile
# make
make -C /opt/EmbedSky/linux-2.6.30.4      M=/opt/EmbedSky/modulesmy430/hello      modules
make: Entering directory `/opt/EmbedSky/linux-2.6.30.4'
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 /opt/EmbedSky/linux-2.6.30.4/Module.symvers
         is missing; modules will have no dependencies and modversions.
CC /opt/EmbedSky/modulesmy430/hello/hello.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 /opt/EmbedSky/modulesmy430/hello/hello.c:8:
/opt/EmbedSky/linux-2.6.30.4/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 /opt/EmbedSky/modulesmy430/hello/hello.c:8:
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:111:5: warning: "__LINUX_ARM_ARCH__" is not defined
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:117:5: warning: "__LINUX_ARM_ARCH__" is not defined
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:121:35: warning: "__LINUX_ARM_ARCH__" is not defined
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:247:5: warning: "__LINUX_ARM_ARCH__" is not defined
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:254:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:320,
               from include/linux/list.h:7,
               from include/linux/module.h:9,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
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'
include/asm-generic/cmpxchg-local.h:44: error: implicit declaration of function 'local_irq_restore'
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/system.h:322:5: warning: "__LINUX_ARM_ARCH__" is not defined
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 /opt/EmbedSky/modulesmy430/hello/hello.c:8:
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/bitops.h:237:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/thread_info.h:16,
               from include/linux/thread_info.h:55,
               from include/linux/preempt.h:9,
               from include/linux/spinlock.h:50,
               from include/linux/seqlock.h:29,
               from include/linux/time.h:8,
               from include/linux/stat.h:60,
               from include/linux/module.h:10,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/fpstate.h:32:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/spinlock.h:359,
               from include/linux/seqlock.h:29,
               from include/linux/time.h:8,
               from include/linux/stat.h:60,
               from include/linux/module.h:10,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/atomic.h:24:5: warning: "__LINUX_ARM_ARCH__" is not defined
In file included from include/linux/time.h:9,
               from include/linux/stat.h:60,
               from include/linux/module.h:10,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/math64.h: In function 'div_u64_rem':
include/linux/math64.h:43: error: '__LINUX_ARM_ARCH__' undeclared (first use in this function)
include/linux/math64.h:43: error: (Each undeclared identifier is reported only once
include/linux/math64.h:43: error: for each function it appears in.)
In file included from include/linux/gfp.h:4,
               from include/linux/kmod.h:22,
               from include/linux/module.h:13,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/mmzone.h:18:26: error: linux/bounds.h: No such file or directory
In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/page.h:197,
               from include/linux/mmzone.h:20,
               from include/linux/gfp.h:4,
               from include/linux/kmod.h:22,
               from include/linux/module.h:13,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:18:25: error: mach/memory.h: No such file or directory
In file included from /opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/page.h:197,
               from include/linux/mmzone.h:20,
               from include/linux/gfp.h:4,
               from include/linux/kmod.h:22,
               from include/linux/module.h:13,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'virt_to_phys':
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:167: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'phys_to_virt':
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:172: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'virt_to_bus':
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:196: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h: In function 'bus_to_virt':
/opt/EmbedSky/linux-2.6.30.4/arch/arm/include/asm/memory.h:201: error: 'CONFIG_DRAM_BASE' undeclared (first use in this function)
In file included from include/linux/gfp.h:4,
               from include/linux/kmod.h:22,
               from include/linux/module.h:13,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/mmzone.h:256:5: warning: "MAX_NR_ZONES" is not defined
In file included from include/linux/gfp.h:4,
               from include/linux/kmod.h:22,
               from include/linux/module.h:13,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/mmzone.h: At top level:
include/linux/mmzone.h:290: error: 'MAX_NR_ZONES' undeclared here (not in a function)
In file included from include/linux/notifier.h:14,
               from include/linux/memory_hotplug.h:6,
               from include/linux/mmzone.h:644,
               from include/linux/gfp.h:4,
               from include/linux/kmod.h:22,
               from include/linux/module.h:13,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/rwsem.h:22:65: error: asm/rwsem.h: No such file or directory
In file included from include/linux/memory_hotplug.h:6,
               from include/linux/mmzone.h:644,
               from include/linux/gfp.h:4,
               from include/linux/kmod.h:22,
               from include/linux/module.h:13,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/notifier.h:62: error: field 'rwsem' has incomplete type
In file included from include/linux/tracepoint.h:18,
               from include/linux/module.h:19,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/rcupdate.h:64:2: error: #error "Unknown RCU implementation specified to kernel configuration"
In file included from include/linux/module.h:19,
               from /opt/EmbedSky/modulesmy430/hello/hello.c:8:
include/linux/tracepoint.h: In function 'tracepoint_synchronize_unregister':
include/linux/tracepoint.h:153: error: implicit declaration of function '__synchronize_sched'
/opt/EmbedSky/modulesmy430/hello/hello.c: In function 'hello_exit':
/opt/EmbedSky/modulesmy430/hello/hello.c:21: warning: 'return' with a value, in function returning void
make: *** 错误 1
make: *** 错误 2
make: Leaving directory `/opt/EmbedSky/linux-2.6.30.4'
make: *** 错误 2

Jangel 发表于 2012-8-30 09:43:48

它错误信息有提示
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.

include/linux/autoconf.h or include/config/auto.conf 这个文件缺失
在内核源码目录里运行 'make oldconfig && make prepare'
你的内核没有设置好

安仔 发表于 2012-8-30 09:44:11

你的内核目录下有Module.symver这个文件吗?没有要配置内核从新编译并且应该还要make module

海之梦fly 发表于 2012-8-30 10:25:00

安仔 发表于 2012-8-30 09:44 static/image/common/back.gif
你的内核目录下有Module.symver这个文件吗?没有要配置内核从新编译并且应该还要make module

是这样 的,好国。可我没动内核的,怎么是这样的?内核不稳定?

海之梦fly 发表于 2012-8-30 10:25:50

Jangel 发表于 2012-8-30 09:43 static/image/common/back.gif
它错误信息有提示
include/linux/autoconf.h or include/config/auto.conf are missing.
Run 'make old ...

可我没动内核的,怎么是这样的?内核不稳定?

安仔 发表于 2012-8-30 11:40:53

内核自己下的?

海之梦fly 发表于 2012-8-30 11:47:18

安仔 发表于 2012-8-30 11:40 static/image/common/back.gif
内核自己下的?

TQ自带的,光盘的

Jangel 发表于 2012-8-30 13:37:12

海之梦fly 发表于 2012-8-30 10:25 static/image/common/back.gif
可我没动内核的,怎么是这样的?内核不稳定?

天嵌给的是源码,没有编译过的

海之梦fly 发表于 2012-8-30 15:13:50

Jangel 发表于 2012-8-30 13:37 static/image/common/back.gif
天嵌给的是源码,没有编译过的

内核我以前编译过的,hello驱动在以前也好用的。有一个月没动内核了,所以出现现在问题?

Jangel 发表于 2012-8-30 15:36:30

海之梦fly 发表于 2012-8-30 15:13 static/image/common/back.gif
内核我以前编译过的,hello驱动在以前也好用的。有一个月没动内核了,所以出现现在问题?

不可能吧 除非你遇到灵异事件...
页: [1]
查看完整版本: hello 驱动编译不过去了