解决编译/home/module/hello.c:1: 错误:代码模式‘kernel’在 32 位模式下不受支持问题
来源:互联网 发布:视频模板制作软件 编辑:程序博客网 时间:2024/06/05 19:34
当时在自己的开发板GT2440上移植u-boot,linux,根文件系统时,一切移植好之后,想测试下insmod命令,于是写了个hello简单的模块测试程序,但是编译时遇到的一个奇怪的问题:
make之后总是出错:
/home/module/hello.c:1: 错误:代码模式‘kernel’在 32 位模式下不受支持
/home/module/hello.c:1: 对不起,尚未实现:未编译入对 64 位模式的支持
make[2]: *** [/home/module/hello.o] 错误 1
make[1]: *** [_module_/home/module] 错误 2
下面是makefile
KERNELDIR= /home/GT2440/rootfs/lib/modules/2.6.30/build/
PWD := $(shell pwd)
obj-m := hello.o
modules:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
modules_install:
cp hello.ko $(INSTALLDIR)
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions
.PHONY: modules modules_install clean
初学者,上面的makefile是上网找了很久,各种版本的杂糅版.....结果不对,make之后
提示
ake -C /GT2440/linux/linux2.6.30 M=/home/GT2440/test modules
make[1]: Entering directory `/GT2440/linux/linux-2.6.30'
CC [M] /home/GT2440/test/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/GT2440/test/hello.o] 错误 1
make[1]: *** [_module_/home/GT2440/] 错误 2
make[1]: Leaving directory `/GT2440/linux/linux-2.6.30'
根据自己分析,应该是不能识别CROSS_COMPILE,于是在linux内核目录下修改Makefile文件,修改如下:
ARCH=arm
CROSS_COMPILE=arm-linux-
在编译下hello.c模块,通过。
- 解决编译/home/module/hello.c:1: 错误:代码模式‘kernel’在 32 位模式下不受支持问题
- 解决编译内核模块helloworld.c:1: 错误:代码模式‘kernel’在 32 位模式下不受支持问题,未编译对64位的支持
- scala在cmd模式下执行文件报<console>:1: error: ';' expected but '.' found. scalac C:\hello.scala 错误
- windows下在命令行模式下使用MinGW编译C代码,出现cannot find ipthread
- 解决UNC路径不受支持问题
- Asp.net_解决vs运行报在安装 32 位 Oracle 客户端组件的情况下以 64 位模式运行,将出现此问题的bug方法
- 在安装office2003时,出现"安装程序包的语言不受系统支持"的错误,如何解决?
- OS X64下IIS设置支持32位模式
- 在命令行模式下如何编译运行Java代码
- VS2005下编译调试保护模式32位汇编程序总结
- VS2005下编译调试保护模式32位汇编程序总结
- Ubuntu14.04(32位)下Caffe(仅CPU模式)编译
- Kernel中Module调用编译问题
- 在64位 ubuntu下编译wine1.8.1出现错误的解决
- 解决 vmware kernel module updater 问题
- 如果在安装32位oracle 客户端组件时的情况下以64位模式运行,将出现问题
- 解决vmware在桥接模式下网络异常问题
- ubuntu下hello world kernel Module:MODPOST 0 modules
- 数据结构——查找
- Oracle 监听 启动报错 tns-12560 tns-00530 linux error:20:not a directory 解决方法
- Nagle算法
- 关于本文档 - Node.js API 文档
- linux无法启动mySQL解决办法,MySQL is running but PID file could not be found
- 解决编译/home/module/hello.c:1: 错误:代码模式‘kernel’在 32 位模式下不受支持问题
- YII framework下基于角色的访问控制(RBAC)
- hdu 4643GSM
- 淘宝分布式系统-TFS学习记录-第一天(编译安装2.6版本)
- Java中sleep()与wait()的区别
- mysql root权限修改、恢复
- hdu 4647Another Graph Game
- 小评s3c2440的替代品s3c2416
- 【学习】Linux网卡绑定、子接口及iptables