从x86交叉编译MIPS路由器 [英] Cross compiling for MIPS router from x86

查看:28
本文介绍了从x86交叉编译MIPS路由器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的最终目标是为我的旧Actiontec调制解调器/路由器编译无线工具,这样我就可以将其配置为无线到以太网桥。目前,它的无线功能(似乎)由管理大部分Web界面的同一个二进制文件控制,但似乎他们至少使用了无线工具内部使用的库来实现部分功能。

我以前从未为不同的CPU架构交叉编译过,不确定如何完全确定我需要做什么。我正在尝试使用uClibc,因为它似乎是在系统的睡觉中使用的,但是我不确定如何为调制解调器环境配置buildroot。我根据下面proc中的信息进行了best guess配置,但有些地方是错误的,因为使用它编译的仅返回0的简单C应用程序无法正常运行。

# cat /proc/version 
Linux version 2.4.17_mvl21-malta-mips_fp_le (root@localhost.localdomain) (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/Cross-mips-buildroot。您可以在/opt/cross-mips-buildroot/usr/bin/

上找到编译器和其他工具

尝试编译一个简单的hello world应用程序,看看是否可以在MIPS系统中运行它。

注意:此配置不会生成C++编译器。如果需要,您可以grep LIBSTDCPP .config检查是否启用,并根据自己的喜好进行更改。然后make menuconfig使其发生。

这篇关于从x86交叉编译MIPS路由器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆