从x86开始为MIPS路由器进行交叉编译
问题描述:
我的最终目标是为旧的Actiontec调制解调器/路由器编译无线工具,以便将其配置为无线以太网桥。目前它的无线功能(似乎)由管理大部分网络接口的二进制文件控制,但似乎他们使用库无线工具在内部使用至少一些功能。从x86开始为MIPS路由器进行交叉编译
我以前从来没有为不同的CPU架构交叉编译,也不知道如何完全识别我需要做的事情。我试图使用uClibc,因为它似乎在系统的其他部分中使用,但我不知道如何配置调制解调器环境的buildroot。我做了一个best guess在什么配置应该基于来自proc下面的信息,但somethings错误,因为一个简单的C应用程序,只返回0编译与它无法正常运行。
# cat /proc/version
Linux version 2.4.17_mvl21-malta-mips_fp_le ([email protected]) (gcc version 2.95.3 20010315 (release/MontaVista)) #1 Thu Apr 21 18:04:37 PDT 2005
# cat /proc/cpuinfo
processor : 0
cpu model : MIPS 4KEc V4.8
BogoMIPS : 149.91
wait instruction : no
microsecond timers : yes
extra interrupt vector : yes
hardware watchpoint : yes
VCED exceptions : not available
VCEI exceptions : not available
答
你是对的,你需要一个适当的MIPS工具链交叉编译应用程序和Buildroot能做到这一点。但你可能需要调整buildroot的menuconfig选项。 根据file
的输出,您的选项可能会更改。在我的系统,二进制应用程序通知如下:
ELF 32-bit MSB executable, MIPS, MIPS32 rel2 version 1 (SYSV)
这是我为我的Buildroot里面的menuconfig的启用的选项:
Target Architecture (mips) --->
Target Architecture Variant (mips 32r2) --->
Target ABI (o32) --->
Target options --->
Build options --->
(/opt/cross-mips-buildroot) Toolchain and header file location?
Toolchain --->
Toolchain type (Buildroot toolchain) --->
Kernel Headers (Linux 2.6.34.x kernel headers) --->
uClibc C library Version (uClibc 0.9.31.x) --->
[*] Build/install a shared libgcc?
[*] Enable compiler tls support
[*] Build gdb debugger for the Target
[*] Build gdb server for the Target
[*] Build gdb for the Host
GDB debugger Version (gdb 6.8) --->
[*] Enable large file (files > 2 GB) support?
[*] Enable WCHAR support
[*] Use software floating point by default
[*] Enable stack protection support
[*] Build/install c++ compiler and libstdc++?
[*] Include target utils in cross toolchain
Package Selection for the target --->
[*] BusyBox
[*] Run BusyBox's own full installation
Libraries --->
Networking --->
[*] libcurl
Text and terminal handling --->
[*] icu
-*- ncurses
Target filesystem options --->
Bootloaders --->
Kernel --->
本身安装在工具链的/ opt /交叉mips-buildroot。你可以找到/选择/交叉MIPS-buildroot的在/ usr/bin中/
尝试编译器和其他工具来编译一个简单的的Hello World应用程序,看看你是否能在MIPS系统内部运行它。
注意:此配置不会构建C++编译器。如果您需要它,您可以grep LIBSTDCPP .config
并检查它是否启用并将其更改为您喜欢的。然后make menuconfig
使它发生。
找到MIPS系统和exec ** **文件在其上的任何二进制应用程序和与我们共享的输出 – karlphillip 2011-01-20 20:09:35
好了,文件的输出用于从所述系统可执行的是: ELF 32位LSB的可执行,MIPS,MIPS-I版本1(SYSV),动态链接(使用共享库),剥离 感谢您的所有帮助。 – sagenite 2011-01-20 22:11:28