xfortune 发表于 2012-05-23 07:24

Illegal instruction

问题跟踪
1.
# ./hello
-/bin/sh: ./hello: not found
原因是没有静态库
编译的时候:
arm-linux-gcc -static -o hello hello.c
但是问题依然没有完全的解决,出现
# ./hello
Illegal instruction
这个问题
wind@Thinkpad-T60:~/Work/TQ$ file hello1
hello1: ELF 32-bit LSB executable, ARM, version 1, statically linked, for GNU/Linux 2.0.0, not stripped
这是用gcc编译出来的a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, not stripped

思考:
是不是内核版本的问题??
为什么arm-linux-gcc 编译出来的文件是2.0.0版本的呢??

tempname2 发表于 2012-05-24 09:01

没看明白是什么意思。你确定不是x86的程序在ARM上跑或者是反过来?

xfortune 发表于 2012-05-24 10:41

回复 2# tempname2


    哈哈,没有。。
问题解决了。EABI问题。。
前辈们解决了好多遍的问题。。
到处是资料。

xfortune 发表于 2012-05-24 22:39

驱动程序:
#include <linux/***.h> 是在linux-2.6.29/include/linux下面寻找源文件。
#include <asm/***.h> 是在linux-2.6.29/arch/arm/include/asm下面寻找源文件。
#include <mach/***.h> 是在linux-2.6.29/arch/arm/mach-s3c2410/include/mach下面寻找源文件。


#include <linux/module.h>//最基本的文件,支持动态添加和卸载模块。Hello World驱动要这一个文件就可以了
#include <linux/fs.h>//包含了文件操作相关struct的定义,例如大名鼎鼎的struct file_operations
#include <linux/errno.h>//包含了对返回值的宏定义,这样用户程序可以用perror输出错误信息。
#include <linux/types.h>//对一些特殊类型的定义,例如dev_t, off_t, pid_t.其实这些类型大部分都是unsigned int型通过一连串的typedef变过来的,只是为了方便阅读。
#include <linux/cdev.h>//对字符设备结构cdev以及一系列的操作函数的定义。
#include <linux/wait.h>//等代队列相关头文件
应用程序:
#include <fcntl.h> //包含了open()函数的flags,mode参数的宏定义。

xfortune 发表于 2012-05-24 22:40

驱动程序的头文件。。

yan9919 发表于 2013-01-22 14:31

怎么解决的没有看明白

cliffordl 发表于 2013-04-11 10:58

回复 1# xfortune


    编译时,指定新的头文件?

cliffordl 发表于 2013-04-11 11:08

回复 3# xfortune


    具体怎么解决的啊。

xfortune 发表于 2013-04-13 12:04

回复 8# cliffordl


    我当时是,编译环境的问题,交叉编译没有安装好

cliffordl 发表于 2013-04-15 08:39

回复 9# xfortune


    能不能具体点啊。谢谢了。
页: [1] 2
查看完整版本: Illegal instruction