yaloml 发表于 2010-08-17 21:51:24

求助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: *** 错误 1
make: *** 错误 2
make: Leaving directory `/opt/arm-linux/linux-2.6.24-magus'


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

先谢谢乐!

yaloml 发表于 2010-08-17 21:54:29

自顶!

T-Bagwell 发表于 2010-08-17 21:56:04

makefile的问题
CROSS_COMPILER配置的不对吧?
如果你是不是复制错了,就是这个设置的不对
要如果你没复制错
就是少了个CROSS的C

yaloml 发表于 2010-08-17 22:10:00

回复 3# T-Bagwell


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


PS:i love T-bag too!

yaloml 发表于 2010-08-17 22:35:51

回复 3# T-Bagwell


    完整的错误信息


# make
make -C /linux-2.6.24-magus SUBDIRS=/home/yalom/cp/text2 modules
make: Entering directory `/linux-2.6.24-magus'
  CC   /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: *** 错误 1
make: *** 错误 2
make: Leaving directory `/linux-2.6.24-magus'
make: *** 错误 2

T-Bagwell 发表于 2010-08-17 23:30:10

make -n看一下呢?

yaloml 发表于 2010-08-17 23:35:12

又修改了一下makefile
其中交叉编译改成CROSS_COMPILE=/usr/local/arm/3.4.6/arm-linux/bin/arm-linux-

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

# 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:39:59

回复 6# T-Bagwell


    make -n返回一大堆信息,依然没有生成.ko文件

T-Bagwell 发表于 2010-08-17 23:41:51

回复  T-Bagwell


    make -n返回一大堆信息,依然没有生成.ko文件
yaloml 发表于 2010-08-17 23:39 http://linux.chinaunix.net/bbs/images/common/back.gif


    信息贴出来看看

yaloml 发表于 2010-08-17 23:48:02

回复 9# T-Bagwell


    make -C /opt/arm-linux/linux-2.6.24-magus SUBDIRS=/home/yalom/cp/text2 modules
make: 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   /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: Leaving directory `/opt/arm-linux/linux-2.6.24-magus'
页: [1] 2
查看完整版本: 求助linux模块编译!