天嵌 ARM开发社区

 找回密码
 注册
查看: 4396|回复: 9

hello 驱动编译不过去了

[复制链接]
海之梦fly 发表于 2012-8-30 09:39:03 | 显示全部楼层 |阅读模式
原来做的好使,暑假回来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通过的。


[root@tdp hello]# ls
hello.c  Makefile
[root@tdp hello]# make
make -C /opt/EmbedSky/linux-2.6.30.4      M=/opt/EmbedSky/modulesmy430/hello      modules  
make[1]: 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 [M]  /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[2]: *** [/opt/EmbedSky/modulesmy430/hello/hello.o] 错误 1
make[1]: *** [_module_/opt/EmbedSky/modulesmy430/hello] 错误 2
make[1]: Leaving directory `/opt/EmbedSky/linux-2.6.30.4'
make: *** [modules] 错误 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
你的内核目录下有Module.symver这个文件吗?没有要配置内核从新编译并且应该还要make module

是这样 的,好国。可我没动内核的,怎么是这样的?内核不稳定?
 楼主| 海之梦fly 发表于 2012-8-30 10:25:50 | 显示全部楼层
Jangel 发表于 2012-8-30 09:43
它错误信息有提示
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
内核自己下的?

TQ自带的,光盘的
Jangel 发表于 2012-8-30 13:37:12 | 显示全部楼层
海之梦fly 发表于 2012-8-30 10:25
可我没动内核的,怎么是这样的?内核不稳定?

天嵌给的是源码,没有编译过的
 楼主| 海之梦fly 发表于 2012-8-30 15:13:50 | 显示全部楼层
Jangel 发表于 2012-8-30 13:37
天嵌给的是源码,没有编译过的

内核我以前编译过的,hello驱动在以前也好用的。有一个月没动内核了,所以出现现在问题?
Jangel 发表于 2012-8-30 15:36:30 | 显示全部楼层
海之梦fly 发表于 2012-8-30 15:13
内核我以前编译过的,hello驱动在以前也好用的。有一个月没动内核了,所以出现现在问题?

不可能吧 除非你遇到灵异事件...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-4-28 18:21 , Processed in 1.046888 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表