加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 从x86交叉编译MIPS路由器

发布时间:2020-12-13 19:31:08 所属栏目:Linux 来源:网络整理
导读:我的最终目标是为我的旧的Actiontec调制解调器/路由器编译无线工具,所以我可以将其配置为无线到以太网桥.目前,无线功能(貌似)由管理大多数Web界面的相同二进制程序控制,但似乎他们使用库无线工具在内部使用至少一些功能. 我从来没有交叉编译不同的CPU架构,不
我的最终目标是为我的旧的Actiontec调制解调器/路由器编译无线工具,所以我可以将其配置为无线到以太网桥.目前,无线功能(貌似)由管理大多数Web界面的相同二进制程序控制,但似乎他们使用库无线工具在内部使用至少一些功能.

我从来没有交叉编译不同的CPU架构,不知道如何完全识别我需要做的事情.我试图使用uClibc,因为它似乎在系统的其余部分使用,但我不知道如何配置buildroot的调制解调器环境.我做了一个best guess的配置应该基于以下proc的信息,但是由于一个简单的C应用程序只返回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的菜单选项.
根据文件的输出,您的选项可能会更改.在我的系统上,二进制应用程序通知以下内容:

ELF 32位MSB可执行文件,MIPS,MIPS32 rel2版本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并检查是否启用,并将其更改为您的喜好.然后让menuconfig做到这一点.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读