消息关闭
    暂无新消息!
以前用arm-Linux-gcc可用,所以说明是装了交叉编译环境的吧?然后这两天在写驱动,在用Makefile的时候看到有人会写上CROSS_COMPILE=arm-linux- ARCH=arm,于是也仿照,(好像这句话的意思是编译出arm开发的文件?)但是make后却报错,去掉这句话则没事了。想请教大神这些错怎么改啊?
[root@EmbedSky tq2440_hello]# make
make -C /usr/src/kernels/2.6.27.5-117.fc10.i686 M=/lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello modules ARCH=arm CROSS_COMPILE=arm-linux- 
make[1]: Entering directory `/usr/src/kernels/2.6.27.5-117.fc10.i686'
  CC [M]  /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.o
In file included from include/asm/system.h:10,
                 from include/asm/processor.h:17,
                 from include/linux/prefetch.h:14,
                 from include/linux/list.h:6,
                 from include/linux/module.h:9,
                 from /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/linux/kernel.h:195: warning: 'regparm' attribute directive ignored
include/linux/kernel.h:197: warning: 'regparm' attribute directive ignored
include/linux/kernel.h:217: warning: 'regparm' attribute directive ignored
In file included from include/linux/thread_info.h:47,
                 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 /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/asm/thread_info.h:174: error: invalid register name for 'current_stack_pointer'
In file included from include/linux/rwsem.h:22,
                 from include/linux/notifier.h:14,
                 from include/linux/memory_hotplug.h:6,
                 from include/linux/mmzone.h:560,
                 from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/asm/rwsem.h:48: warning: 'regparm' attribute directive ignored
include/asm/rwsem.h:50: warning: 'regparm' attribute directive ignored
include/asm/rwsem.h:52: warning: 'regparm' attribute directive ignored
include/asm/rwsem.h:54: warning: 'regparm' attribute directive ignored
In file included from include/asm/smp.h:12,
                 from include/linux/smp.h:28,
                 from include/linux/topology.h:33,
                 from include/linux/mmzone.h:683,
                 from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/asm/mpspec.h:9:25: error: mach_mpspec.h: No such file or directory
In file included from include/asm/smp.h:12,
                 from include/linux/smp.h:28,
                 from include/linux/topology.h:33,
                 from include/linux/mmzone.h:683,
                 from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/asm/mpspec.h:39: error: 'MAX_MP_BUSSES' undeclared here (not in a function)
In file included from include/asm/smp.h:15,
                 from include/linux/smp.h:28,
                 from include/linux/topology.h:33,
                 from include/linux/mmzone.h:683,
                 from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/asm/io_apic.h:149: error: 'MAX_IRQ_SOURCES' undeclared here (not in a function)
In file included from include/linux/smp.h:28,
                 from include/linux/topology.h:33,
                 from include/linux/mmzone.h:683,
                 from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/asm/smp.h:187:28: error: mach_apicdef.h: No such file or directory
In file included from include/linux/smp.h:28,
                 from include/linux/topology.h:33,
                 from include/linux/mmzone.h:683,
                 from include/linux/gfp.h:4,
                 from include/linux/kmod.h:22,
                 from include/linux/module.h:13,
                 from /lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.c:2:
include/asm/smp.h: In function 'hard_smp_processor_id':
include/asm/smp.h:191: error: implicit declaration of function 'GET_APIC_ID'
make[2]: *** [/lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello/hello_test.o] Error 1
make[1]: *** [_module_/lib/modules/2.6.27.5-117.fc10.i686/build/drivers/char/tq2440_hello] Error 2
make[1]: Leaving directory `/usr/src/kernels/2.6.27.5-117.fc10.i686'
make: *** [all] Error 2


makefile文件如下:
obj-m :=hello_test.o
KDIR := /usr/src/kernels/2.6.27.5-117.fc10.i686
all:
make -C $(KDIR) M=$(PWD) modules CROSS_COMPILE=arm-linux- ARCH=arm
clean:
rm -f *.ko *.o *.mod.o *.mod.c *.symvers *.bak *.order

跪求大神指点迷津啊!拜托拜托!

budong 

1个回答

︿ 0
给你个参考案例:
CROSS_COMPILE :=/home/admin/CrossCompile/linux-devkit/bin/arm-linux-gnueabi-
KERNELDIR :=/home/admin/linux-3.4.5

PWD :=$(shell pwd)
CC =$(CROSS_COMPILE)gcc

DEVICE = omap_xxx
OBJECTS :=omap_yyy_xxx.o
obj-m := $(DEVICE).o
$(DEVICE)-objs := $(OBJECTS)
default:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *.ko *.mod.o *.mod.c