原来的内核版本2.6.24.3,交叉编译工具为ELDK4.1,通过rcS启动脚本自动加载驱动,继电器的驱动能在目标板上正常加载,并且运行正常。
内核版本升级到2.6.30,交叉编译工具的版本也升级到ELDK4.2,但是通过rcS启动脚本加载继电器驱动的时候,出现错误提示:
relay1218: version magic '2.6.24.3 preempt mod_unload ARMv5 ' should be '2.6.30 mod_unload ARMv5 ' insmod: can't insert '/usr/relay1218.ko': invalid module format BusyBox v1.15.3 (2012-06-04 11:17:39 CST) multi-call binary Usage: mknod [OPTIONS] NAME TYPE MAJOR MINOR Create a special file (block, character, or pipe) Options: -m Create the special file using the specified mode (default a=rw) TYPEs include: b: Make a block device c or u: Make a character device p: Make a named pipe (MAJOR and MINOR are ignored)
# load drivers /sbin/insmod /usr/relay1218.ko rm -f /dev/relay1218dev mknod /dev/relay1218dev c `cat /proc/devices | grep "relay1218" | awk '{print $1}'` 0 chmod 664 /dev/relay1218dev
1. 检查驱动程序中的Makefile文件,其中的
KERNEL_SRC = /home/startech/Work/08src/linux-2.6.24.3/而目标板上用的内核是2.6.30,这就是安装驱动时出现错误提示的原因。
2. 将驱动中的Makefile中的变量KERNEL_SRC改为2.6.30内核
出现N多错误:
dingq@u1110-120628:~/startech_pdu/fw/dir-struct/pdu/drivers/att7053$ make make -C /home/dingq/wrk/pdu/kernel/linux-2.6.30/ M=/home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053 modules make[1]: Entering directory `/home/dingq/wrk/pdu/kernel/linux-2.6.30' CC [M] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.o In file included from include/linux/prefetch.h:14:0, from include/linux/list.h:6, from include/linux/module.h:9, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:115:30: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function) /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:115:1: error: requested alignment is not a constant /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:160:0: warning: "cache_line_size" redefined [enabled by default] include/linux/cache.h:64:0: note: this is the location of the previous definition /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:240:1: error: requested alignment is not a constant /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:271:1: error: requested alignment is not a constant /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h: In function ‘native_get_debugreg’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:497:3: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h: In function ‘native_set_debugreg’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:524:3: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ In file included from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic.h:4:0, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/thread_info.h:24, 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 /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h: At top level: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:213:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:227:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:243:49: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:259:33: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:272:33: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:287:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:305:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:324:49: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:341:48: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:350:48: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:399:39: error: unknown type name ‘atomic64_t’ In file included from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:458:0, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic.h:4, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/thread_info.h:24, 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 /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: include/asm-generic/atomic.h:23:1: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h: In function ‘atomic_long_read’: include/asm-generic/atomic.h:29:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:29:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:29:19: note: each undeclared identifier is reported only once for each function it appears in include/asm-generic/atomic.h:29:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:31:15: error: request for member ‘counter’ in something not a structure or union include/asm-generic/atomic.h: In function ‘atomic_long_set’: include/asm-generic/atomic.h:36:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:36:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:36:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:38:2: error: request for member ‘counter’ in something not a structure or union include/asm-generic/atomic.h: In function ‘atomic_long_inc’: include/asm-generic/atomic.h:43:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:43:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:43:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:45:2: error: implicit declaration of function ‘atomic64_inc’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_dec’: include/asm-generic/atomic.h:50:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:50:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:50:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:52:2: error: implicit declaration of function ‘atomic64_dec’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_add’: include/asm-generic/atomic.h:57:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:57:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:57:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:59:2: error: implicit declaration of function ‘atomic64_add’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_sub’: include/asm-generic/atomic.h:64:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:64:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:64:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:66:2: error: implicit declaration of function ‘atomic64_sub’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_sub_and_test’: include/asm-generic/atomic.h:71:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:71:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:71:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:73:2: error: implicit declaration of function ‘atomic64_sub_and_test’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_dec_and_test’: include/asm-generic/atomic.h:78:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:78:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:78:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:80:2: error: implicit declaration of function ‘atomic64_dec_and_test’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_inc_and_test’: include/asm-generic/atomic.h:85:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:85:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:85:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:87:2: error: implicit declaration of function ‘atomic64_inc_and_test’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_add_negative’: include/asm-generic/atomic.h:92:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:92:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:92:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:94:2: error: implicit declaration of function ‘atomic64_add_negative’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_add_return’: include/asm-generic/atomic.h:99:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:99:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:99:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:101:2: error: implicit declaration of function ‘atomic64_add_return’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_sub_return’: include/asm-generic/atomic.h:106:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:106:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:106:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:108:2: error: implicit declaration of function ‘atomic64_sub_return’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_inc_return’: include/asm-generic/atomic.h:113:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:113:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:113:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h: In function ‘atomic_long_dec_return’: include/asm-generic/atomic.h:120:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:120:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:120:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h: In function ‘atomic_long_add_unless’: include/asm-generic/atomic.h:127:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:127:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:127:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:129:2: error: implicit declaration of function ‘atomic64_add_unless’ [-Werror=implicit-function-declaration] In file included from include/linux/mmzone.h:16:0, from include/linux/gfp.h:4, from include/linux/kmod.h:22, from include/linux/module.h:13, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: include/linux/nodemask.h: In function ‘__first_node’: include/linux/nodemask.h:233:2: error: implicit declaration of function ‘find_first_bit’ [-Werror=implicit-function-declaration] include/linux/nodemask.h: In function ‘__next_node’: include/linux/nodemask.h:239:2: error: implicit declaration of function ‘find_next_bit’ [-Werror=implicit-function-declaration] include/linux/nodemask.h: In function ‘__first_unset_node’: include/linux/nodemask.h:257:2: error: implicit declaration of function ‘find_first_zero_bit’ [-Werror=implicit-function-declaration] In file included from include/linux/elf.h:7:0, from include/linux/module.h:14, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/elf.h: In function ‘start_ia32_thread’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/elf.h:165:2: error: implicit declaration of function ‘load_gs_index’ [-Werror=implicit-function-declaration] In file included from include/linux/slab_def.h:63:0, from include/linux/slab.h:157, from include/linux/percpu.h:5, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:4, from include/linux/module.h:20, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: include/linux/kmalloc_sizes.h: In function ‘kmalloc’: include/linux/kmalloc_sizes.h:5:5: warning: "CONFIG_X86_L1_CACHE_SHIFT" is not defined [-Wundef] include/linux/kmalloc_sizes.h:9:5: warning: "CONFIG_X86_L1_CACHE_SHIFT" is not defined [-Wundef] In file included from include/linux/module.h:20:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_inc’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:22:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_dec’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:28:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_add’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:34:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_sub’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:41:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_sub_and_test’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:59:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_dec_and_test’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:77:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_inc_and_test’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:95:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_add_negative’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:114:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_add_return’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:137:30: error: request for member ‘counter’ in something not a structure or union In file included from include/linux/module.h:22:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/module.h: At top level: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/module.h:68:2: error: #error unknown processor family In file included from include/linux/fs.h:362:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:8: include/linux/dcache.h: In function ‘dget’: include/linux/dcache.h:334:3: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ In file included from include/linux/fs.h:368:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:8: include/linux/radix-tree.h: In function ‘radix_tree_replace_slot’: include/linux/radix-tree.h:154:2: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: At top level: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:10:27: fatal error: asm/arch/gpio.h: No such file or directory cc1: some warnings being treated as errors compilation terminated. make[2]: *** [/home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.o] Error 1 make[1]: *** [_module_/home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053] Error 2 make[1]: Leaving directory `/home/dingq/wrk/pdu/kernel/linux-2.6.30' make: *** [all] Error 2
3. 首先解决asm/arch/gpio.h找不到的问题。
asm/arch/gpio.h位于原来的2.6.24.3目录下的目录结构linux-2.6.24.3/include/asm-arm/arch-at91下面,
而asm是asm-arm的软链接,arch是arch-at91的软链接;所以arm/arch/gpio.h实际上就是linux-2.6.30/include/asm-arm/arch-at91/gpio.h;
但在2.6.30内核下,目录结构变了。linux-2.6.30/include/asm-arm下面只有区区两个文件asm-offsets.h和mach-types.h,而且都是自动生成的文件。
针对不同厂家的GPIO文件到哪里去了呢?
dingq@u1110-120628:~/wrk/pdu/kernel/linux-2.6.30$ find . -name gpio.h ./arch/microblaze/include/asm/gpio.h ./arch/x86/include/asm/gpio.h ./arch/blackfin/mach-bf518/include/mach/gpio.h ./arch/blackfin/mach-bf538/include/mach/gpio.h ./arch/blackfin/mach-bf537/include/mach/gpio.h ./arch/blackfin/mach-bf527/include/mach/gpio.h ./arch/blackfin/mach-bf561/include/mach/gpio.h ./arch/blackfin/mach-bf533/include/mach/gpio.h ./arch/blackfin/include/asm/gpio.h ./arch/blackfin/mach-bf548/include/mach/gpio.h ./arch/xtensa/platforms/s6105/include/platform/gpio.h ./arch/xtensa/variants/s6000/include/variant/gpio.h ./arch/xtensa/include/asm/gpio.h ./arch/h8300/include/asm/gpio.h ./arch/arm/mach-mmp/include/mach/gpio.h ./arch/arm/mach-ixp2000/include/mach/gpio.h ./arch/arm/mach-sa1100/include/mach/gpio.h ./arch/arm/mach-imx/include/mach/gpio.h ./arch/arm/mach-mv78xx0/include/mach/gpio.h ./arch/arm/mach-davinci/include/mach/gpio.h ./arch/arm/mach-s3c6400/include/mach/gpio.h ./arch/arm/mach-pnx4008/include/mach/gpio.h ./arch/arm/plat-omap/include/mach/gpio.h ./arch/arm/mach-at91/include/mach/gpio.h ./arch/arm/mach-ixp4xx/include/mach/gpio.h ./arch/arm/mach-s3c2410/include/mach/gpio.h ./arch/arm/plat-pxa/include/plat/gpio.h ./arch/arm/plat-mxc/include/mach/gpio.h ./arch/arm/mach-iop32x/include/mach/gpio.h ./arch/arm/mach-ks8695/include/mach/gpio.h ./arch/arm/mach-pxa/include/mach/gpio.h ./arch/arm/mach-kirkwood/include/mach/gpio.h ./arch/arm/mach-ep93xx/include/mach/gpio.h ./arch/arm/mach-iop33x/include/mach/gpio.h ./arch/arm/mach-ns9xxx/include/mach/gpio.h ./arch/arm/mach-orion5x/include/mach/gpio.h ./arch/arm/mach-gemini/include/mach/gpio.h ./arch/arm/plat-orion/include/plat/gpio.h ./arch/arm/mach-l7200/include/mach/gpio.h ./arch/arm/include/asm/gpio.h ./arch/sparc/include/asm/gpio.h ./arch/powerpc/include/asm/gpio.h ./arch/mips/include/asm/mach-generic/gpio.h ./arch/mips/include/asm/pmc-sierra/msp71xx/gpio.h ./arch/mips/include/asm/mach-au1x00/gpio.h ./arch/mips/include/asm/mach-pnx833x/gpio.h ./arch/mips/include/asm/gpio.h ./arch/mips/include/asm/mach-rc32434/gpio.h ./arch/mips/include/asm/mach-bcm47xx/gpio.h ./arch/sh/include/asm/gpio.h ./arch/sh/include/cpu-sh3/cpu/gpio.h ./arch/avr32/include/asm/gpio.h ./arch/avr32/mach-at32ap/include/mach/gpio.h ./include/asm-generic/gpio.h ./include/config/generic/gpio.h ./include/config/i2c/gpio.h ./include/linux/mfd/wm8350/gpio.h ./include/linux/mfd/pcf50633/gpio.h ./include/linux/gpio原来都挪到了linux-2.6.30/arch目录下,驱动程序的源程序中将头文件包含语句
#include <asm/arch/gpio.h>
改为
#include <../arch/arm/mach-at91/include/mach/gpio.h>
使用make命令重新编译
dingq@u1110-120628:~/startech_pdu/fw/dir-struct/pdu/drivers/att7053$ make make -C /home/dingq/wrk/pdu/kernel/linux-2.6.30/ M=/home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053 modules make[1]: Entering directory `/home/dingq/wrk/pdu/kernel/linux-2.6.30' CC [M] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.o In file included from include/linux/prefetch.h:14:0, from include/linux/list.h:6, from include/linux/module.h:9, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:115:30: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function) /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:115:1: error: requested alignment is not a constant /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:160:0: warning: "cache_line_size" redefined [enabled by default] include/linux/cache.h:64:0: note: this is the location of the previous definition /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:240:1: error: requested alignment is not a constant /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:271:1: error: requested alignment is not a constant /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h: In function ‘native_get_debugreg’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:497:3: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h: In function ‘native_set_debugreg’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/processor.h:524:3: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ In file included from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic.h:4:0, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/thread_info.h:24, 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 /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h: At top level: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:213:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:227:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:243:49: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:259:33: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:272:33: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:287:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:305:41: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:324:49: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:341:48: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:350:48: error: unknown type name ‘atomic64_t’ /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:399:39: error: unknown type name ‘atomic64_t’ In file included from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic_64.h:458:0, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/atomic.h:4, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/thread_info.h:24, 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 /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: include/asm-generic/atomic.h:23:1: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h: In function ‘atomic_long_read’: include/asm-generic/atomic.h:29:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:29:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:29:19: note: each undeclared identifier is reported only once for each function it appears in include/asm-generic/atomic.h:29:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:31:15: error: request for member ‘counter’ in something not a structure or union include/asm-generic/atomic.h: In function ‘atomic_long_set’: include/asm-generic/atomic.h:36:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:36:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:36:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:38:2: error: request for member ‘counter’ in something not a structure or union include/asm-generic/atomic.h: In function ‘atomic_long_inc’: include/asm-generic/atomic.h:43:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:43:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:43:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:45:2: error: implicit declaration of function ‘atomic64_inc’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_dec’: include/asm-generic/atomic.h:50:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:50:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:50:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:52:2: error: implicit declaration of function ‘atomic64_dec’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_add’: include/asm-generic/atomic.h:57:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:57:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:57:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:59:2: error: implicit declaration of function ‘atomic64_add’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_sub’: include/asm-generic/atomic.h:64:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:64:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:64:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:66:2: error: implicit declaration of function ‘atomic64_sub’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_sub_and_test’: include/asm-generic/atomic.h:71:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:71:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:71:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:73:2: error: implicit declaration of function ‘atomic64_sub_and_test’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_dec_and_test’: include/asm-generic/atomic.h:78:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:78:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:78:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:80:2: error: implicit declaration of function ‘atomic64_dec_and_test’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_inc_and_test’: include/asm-generic/atomic.h:85:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:85:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:85:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:87:2: error: implicit declaration of function ‘atomic64_inc_and_test’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_add_negative’: include/asm-generic/atomic.h:92:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:92:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:92:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:94:2: error: implicit declaration of function ‘atomic64_add_negative’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_add_return’: include/asm-generic/atomic.h:99:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:99:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:99:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:101:2: error: implicit declaration of function ‘atomic64_add_return’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_sub_return’: include/asm-generic/atomic.h:106:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:106:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:106:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:108:2: error: implicit declaration of function ‘atomic64_sub_return’ [-Werror=implicit-function-declaration] include/asm-generic/atomic.h: In function ‘atomic_long_inc_return’: include/asm-generic/atomic.h:113:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:113:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:113:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h: In function ‘atomic_long_dec_return’: include/asm-generic/atomic.h:120:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:120:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:120:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h: In function ‘atomic_long_add_unless’: include/asm-generic/atomic.h:127:2: error: unknown type name ‘atomic64_t’ include/asm-generic/atomic.h:127:19: error: ‘atomic64_t’ undeclared (first use in this function) include/asm-generic/atomic.h:127:31: error: expected expression before ‘)’ token include/asm-generic/atomic.h:129:2: error: implicit declaration of function ‘atomic64_add_unless’ [-Werror=implicit-function-declaration] In file included from include/linux/mmzone.h:16:0, from include/linux/gfp.h:4, from include/linux/kmod.h:22, from include/linux/module.h:13, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: include/linux/nodemask.h: In function ‘__first_node’: include/linux/nodemask.h:233:2: error: implicit declaration of function ‘find_first_bit’ [-Werror=implicit-function-declaration] include/linux/nodemask.h: In function ‘__next_node’: include/linux/nodemask.h:239:2: error: implicit declaration of function ‘find_next_bit’ [-Werror=implicit-function-declaration] include/linux/nodemask.h: In function ‘__first_unset_node’: include/linux/nodemask.h:257:2: error: implicit declaration of function ‘find_first_zero_bit’ [-Werror=implicit-function-declaration] In file included from include/linux/elf.h:7:0, from include/linux/module.h:14, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/elf.h: In function ‘start_ia32_thread’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/elf.h:165:2: error: implicit declaration of function ‘load_gs_index’ [-Werror=implicit-function-declaration] In file included from include/linux/slab_def.h:63:0, from include/linux/slab.h:157, from include/linux/percpu.h:5, from /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:4, from include/linux/module.h:20, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: include/linux/kmalloc_sizes.h: In function ‘kmalloc’: include/linux/kmalloc_sizes.h:5:5: warning: "CONFIG_X86_L1_CACHE_SHIFT" is not defined [-Wundef] include/linux/kmalloc_sizes.h:9:5: warning: "CONFIG_X86_L1_CACHE_SHIFT" is not defined [-Wundef] In file included from include/linux/module.h:20:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_inc’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:22:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_dec’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:28:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_add’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:34:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_sub’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:41:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_sub_and_test’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:59:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_dec_and_test’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:77:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_inc_and_test’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:95:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_add_negative’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:114:20: error: request for member ‘counter’ in something not a structure or union /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h: In function ‘local_add_return’: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/local.h:137:30: error: request for member ‘counter’ in something not a structure or union In file included from include/linux/module.h:22:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:4: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/module.h: At top level: /home/dingq/wrk/pdu/kernel/linux-2.6.30/arch/x86/include/asm/module.h:68:2: error: #error unknown processor family In file included from include/linux/fs.h:362:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:8: include/linux/dcache.h: In function ‘dget’: include/linux/dcache.h:334:3: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ In file included from include/linux/fs.h:368:0, from /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:8: include/linux/radix-tree.h: In function ‘radix_tree_replace_slot’: include/linux/radix-tree.h:154:2: error: invalid application of ‘sizeof’ to incomplete type ‘struct bug_entry’ /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: At top level: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:47:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:48:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:49:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:56:6: warning: function declaration isn’t a prototype [-Wstrict-prototypes] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:126:6: warning: function declaration isn’t a prototype [-Wstrict-prototypes] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘att7053resetChannel’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:133:25: error: ‘NR_AIC_IRQS’ undeclared (first use in this function) /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: At top level: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:146:6: warning: function declaration isn’t a prototype [-Wstrict-prototypes] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘att7053selectChannel’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:152:25: error: ‘NR_AIC_IRQS’ undeclared (first use in this function) /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘spi_out’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:163:29: error: ‘NR_AIC_IRQS’ undeclared (first use in this function) /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘spi_in’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:183:29: error: ‘NR_AIC_IRQS’ undeclared (first use in this function) /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘att7053read’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:196:25: error: ‘NR_AIC_IRQS’ undeclared (first use in this function) /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘att7053write’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:210:25: error: ‘NR_AIC_IRQS’ undeclared (first use in this function) /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘myatt_open’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:236:26: error: ‘NR_AIC_IRQS’ undeclared (first use in this function) /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function ‘myatt_ioctl’: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:271:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:279:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:285:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:296:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:302:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:308:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:314:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:320:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:326:9: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: At top level: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:429:5: warning: initialization from incompatible pointer type [enabled by default] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:429:5: warning: (near initialization for ‘myatt_fops.read’) [enabled by default] cc1: some warnings being treated as errors make[2]: *** [/home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.o] Error 1 make[1]: *** [_module_/home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053] Error 2 make[1]: Leaving directory `/home/dingq/wrk/pdu/kernel/linux-2.6.30' make: *** [all] Error 2找不到arm/arch/gpio.h的提示消失了。
4. 但错误还是一大堆,从第一个错误开始看起,include/linux/prefetch.h的第14行
#include <asm/processor.h>
竟然调用的是linux-2.6.30/arch/x86/include/asm/processor.h,我要交叉编译arm,怎么会出来x86目录下的内容?
哦,原来驱动的Makefile文件中需要通过命令行方式来指定交叉编译工具和目标系统的;
将Makefile中的
make -C $(KERNEL_SRC) M=$(PWD) modules
改为
make ARCH=arm CROSS_COMPILE=arm-linux- -C $(KERNEL_SRC) M=$(PWD) modules
重新使用make命令编译
dingq@u1110-120628:~/startech_pdu/fw/dir-struct/pdu/drivers/att7053$ make make ARCH=arm CROSS_COMPILE=arm-linux- -C /home/dingq/wrk/pdu/kernel/linux-2.6.30/ M=/home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053 modules make[1]: Entering directory `/home/dingq/wrk/pdu/kernel/linux-2.6.30' CC [M] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.o /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:47: warning: function declaration isn't a prototype /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:48: warning: function declaration isn't a prototype /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:49: warning: function declaration isn't a prototype /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:56: warning: function declaration isn't a prototype /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:126: warning: function declaration isn't a prototype /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:146: warning: function declaration isn't a prototype /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function 'myatt_ioctl': /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:271: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:279: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:285: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:296: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:302: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:308: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:314: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:320: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:326: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int' /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: At top level: /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:429: warning: initialization from incompatible pointer type /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c: In function 'myatt_read': /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.c:388: warning: 'value' is used uninitialized in this function Building modules, stage 2. MODPOST 1 modules CC /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.mod.o LD [M] /home/dingq/startech_pdu/fw/dir-struct/pdu/drivers/att7053/att7053.ko make[1]: Leaving directory `/home/dingq/wrk/pdu/kernel/linux-2.6.30'成功生成驱动程序att7053.ko。