如何解决从头开始交叉编译 C 程序
我拥有一个运行基于 linux 内核的 Qualcomm LE 操作系统的锁定调制解调器。虽然我能够以用户身份通过 SSH 进入它,但我没有访问许多文件夹的提升权限。我想编译一个程序在这个设备上运行,所以我在我自己的基于 x86-64 的计算机上安装了 Ubuntu,但我不知道如何继续安装正确的 gcc 工具链并为三元组 arm-oe-linux-gnueabi
进行编译。我可以遵循哪些步骤来创建可在此设备上运行的二进制文件,而无需进行本机编译?
我在下面提供了相关的设备信息:
$ cat /proc/cpuinfo
processor : 0
model name : ARMv7 Processor rev 5 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xc07
CPU revision : 5
Hardware : Qualcomm Technologies,Inc MDM9207
Revision : 0000
Processor : ARMv7 Processor rev 5 (v7l)
$ cat /proc/version
Linux version 3.18.44 (buildfarm@bf-rmsz-04) (gcc version 4.9.3 (GCC) ) #1 PREEMPT Wed May 15 22:09:02 CST 2019
/ $ uname -a
Linux mdm9607 3.18.44 #1 PREEMPT Wed May 15 22:09:02 CST 2019 armv7l GNU/Linux
可执行的检索形式调制解调器:
$ readelf -h nativeApp
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement,little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: ARM
Version: 0x1
Entry point address: 0x12b0
Start of program headers: 52 (bytes into file)
Start of section headers: 16812 (bytes into file)
Flags: 0x5000000,Version5 EABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 10
Size of section headers: 40 (bytes)
Number of section headers: 32
Section header string table index: 31
我编译的可执行文件:
$ readelf -h compiledByMe
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement,little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: ARM
Version: 0x1
Entry point address: 0x10961
Start of program headers: 52 (bytes into file)
Start of section headers: 19180 (bytes into file)
Flags: 0x5000400,Version5 EABI,hard-float ABI
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 9
Size of section headers: 40 (bytes)
Number of section headers: 37
Section header string table index: 36
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。