首页 | 新闻 | 交流 | 问吧 | 文档 | 手册 | 下载 | 博客

收藏此问题 发表新评论

求助linux模块编译!

makefile如下:

ROSS_COMPILE=/usr/local/arm/3.4.6/arm-linux/bin/
ARCH:=arm
CC:=$(CROSS_COMPILE)gcc
LD:=$(CROSS_COMPILE)ld
obj-m = hello.o
module-objs = hello.o

KDIR = /opt/arm-linux/linux-2.6.24-magus
PWD = $(shell pwd)
default:
        $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
clean:
        rm -rf  *.o *.ko *~


kDIR是开发板的内核路径,已经编译好
#file vmlinux
vmlinux: ELF 32-bit LSB executable, ARM, version 1, statically linked, not stripped

执行make后显示错误:

cc1: error: invalid option `64'
cc1: error: invalid option `no-red-zone'
cc1: error: invalid option `cmodel=kernel'
cc1: error: invalid option `no-sse'
cc1: error: invalid option `no-mmx'
cc1: error: invalid option `no-sse2'
cc1: error: invalid option `no-3dnow'
cc1: error: invalid option `accumulate-outgoing-args'
make[2]: *** [/home/yalom/cp/text2/hello.o] 错误 1
make[1]: *** [_module_/home/yalom/cp/text2] 错误 2
make[1]: Leaving directory `/opt/arm-linux/linux-2.6.24-magus'


makefile应该没什么问题,错误原因是什么〉?是开发板代码的问题吗?

先谢谢乐!
昵称: yaloml  时间: 2010-08-17 21:51:00
自顶!
昵称: yaloml  时间: 2010-08-17 21:54:00
makefile的问题
CROSS_COMPILER配置的不对吧?
如果你是不是复制错了,就是这个设置的不对
要如果你没复制错
就是少了个CROSS的C
昵称: T-Bagwell  时间: 2010-08-17 21:56:00
回复 T-Bagwell


    不好意思,原本是有C的我复制的时候漏了。您是说cross-compile的路径不对吗?我交叉编译的路径的确是放在这的。


PS:i love T-bag too!
昵称: yaloml  时间: 2010-08-17 22:10:00
回复 T-Bagwell


    完整的错误信息


[root@Yalom text2]# make
make -C /linux-2.6.24-magus SUBDIRS=/home/yalom/cp/text2 modules
make[1]: Entering directory `/linux-2.6.24-magus'
  CC [M]  /home/yalom/cp/text2/hello.o
cc1: error: invalid option `64'
cc1: error: invalid option `no-red-zone'
cc1: error: invalid option `cmodel=kernel'
cc1: error: invalid option `no-sse'
cc1: error: invalid option `no-mmx'
cc1: error: invalid option `no-sse2'
cc1: error: invalid option `no-3dnow'
cc1: error: invalid option `accumulate-outgoing-args'
make[2]: *** [/home/yalom/cp/text2/hello.o] 错误 1
make[1]: *** [_module_/home/yalom/cp/text2] 错误 2
make[1]: Leaving directory `/linux-2.6.24-magus'
make: *** [default] 错误 2
昵称: yaloml  时间: 2010-08-17 22:35:00
make -n看一下呢?
昵称: T-Bagwell  时间: 2010-08-17 23:30:00
又修改了一下makefile
其中交叉编译改成CROSS_COMPILE=/usr/local/arm/3.4.6/arm-linux/bin/arm-linux-

提示没有此文件即 arm-linux-gcc
是我的交叉编译没安装好吗??????
可是我

[root@Yalom 3.4.6]# arm-linux-gcc -v
Reading specs from /usr/local/arm/3.4.6/lib/gcc/arm-linux/3.4.6/specs
Configured with: /home/codyliang/Projects/toolchain/crosstool-0.43/build/arm-linux/gcc-3.4.6-glibc-2.3.6/gcc-3.4.6/configure --target=arm-linux --host=i686-host_pc-linux-gnu --prefix=/usr/local/arm/3.4.6 --with-float=soft --with-headers=/usr/local/arm/3.4.6/arm-linux/include --with-local-prefix=/usr/local/arm/3.4.6/arm-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit --enable-languages=c,c++,java --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.6

不是显示已经安装好了吗????越来越多问题了!哎,快疯了
昵称: yaloml  时间: 2010-08-17 23:35:00
回复 T-Bagwell


    make -n返回一大堆信息,依然没有生成.ko文件
昵称: yaloml  时间: 2010-08-17 23:39:00


QUOTE:
回复  T-Bagwell


    make -n返回一大堆信息,依然没有生成.ko文件
yaloml 发表于 2010-08-17 23:39




    信息贴出来看看
昵称: T-Bagwell  时间: 2010-08-17 23:41:00
回复 T-Bagwell


    make -C /opt/arm-linux/linux-2.6.24-magus SUBDIRS=/home/yalom/cp/text2 modules
make[1]: Entering directory `/opt/arm-linux/linux-2.6.24-magus'
mkdir -p /home/yalom/cp/text2/.tmp_versions ; rm -f /home/yalom/cp/text2/.tmp_versions/*
test -e /opt/arm-linux/linux-2.6.24-magus/Module.symvers || ( \
        echo; \
        echo "  WARNING: Symbol version dump /opt/arm-linux/linux-2.6.24-magus/Module.symvers"; \
        echo "           is missing; modules will have no dependencies and modversions."; \
        echo )
make -f scripts/Makefile.build obj=/home/yalom/cp/text2
set -e;            echo '  CC [M]  /home/yalom/cp/text2/hello.o'; /usr/local/arm/3.4.6/arm-linux/bin/arm-linux-gcc -Wp,-MD,/home/yalom/cp/text2/.hello.o.d  -nostdinc -isystem /usr/lib/gcc/i686-redhat-linux/4.4.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration  -Os  -m64 -mno-red-zone -mcmodel=kernel -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -funit-at-a-time -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -maccumulate-outgoing-args  -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -fno-omit-frame-pointer -fno-optimize-sibling-calls       -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)" -c -o /home/yalom/cp/text2/hello.o /home/yalom/cp/text2/hello.c;  scripts/basic/fixdep /home/yalom/cp/text2/.hello.o.d /home/yalom/cp/text2/hello.o '/usr/local/arm/3.4.6/arm-linux/bin/arm-linux-gcc -Wp,-MD,/home/yalom/cp/text2/.hello.o.d  -nostdinc -isystem /usr/lib/gcc/i686-redhat-linux/4.4.2/include -D__KERNEL__ -Iinclude  -include include/linux/autoconf.h -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration  -Os  -m64 -mno-red-zone -mcmodel=kernel -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -funit-at-a-time -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -maccumulate-outgoing-args  -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -fno-omit-frame-pointer -fno-optimize-sibling-calls       -DMODULE -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(hello)"  -D"KBUILD_MODNAME=KBUILD_STR(hello)" -c -o /home/yalom/cp/text2/hello.o /home/yalom/cp/text2/hello.c' > /home/yalom/cp/text2/.hello.o.tmp; rm -f /home/yalom/cp/text2/.hello.o.d; mv -f /home/yalom/cp/text2/.hello.o.tmp /home/yalom/cp/text2/.hello.o.cmd
{ echo /home/yalom/cp/text2/hello.ko; echo /home/yalom/cp/text2/hello.o; } > /home/yalom/cp/text2/.tmp_versions/hello.mod
:
echo '  Building modules, stage 2.';
make -f /opt/arm-linux/linux-2.6.24-magus/scripts/Makefile.modpost
echo '  MODPOST 0 modules'; scripts/mod/modpost   -i /opt/arm-linux/linux-2.6.24-magus/Module.symvers -I /home/yalom/cp/text2/Module.symvers -o /home/yalom/cp/text2/Module.symvers -w -s -w vmlinux
make[1]: Leaving directory `/opt/arm-linux/linux-2.6.24-magus'
昵称: yaloml  时间: 2010-08-17 23:48:00
编译器没设置对
你这样

CROSS_COMPILE=arm-linux
昵称: T-Bagwell  时间: 2010-08-17 23:54:00