2011-01-20 198 views
10

我的最終目標是爲舊的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 
+0

找到MIPS系統和exec ** **文件在其上的任何二進制應用程序和與我們共享的輸出 – karlphillip 2011-01-20 20:09:35

+0

好了,文件的輸出用於從所述系統可執行的是: ELF 32位LSB的可執行,MIPS,MIPS-I版本1(SYSV),動態鏈接(使用共享庫),剝離 感謝您的所有幫助。 – sagenite 2011-01-20 22:11:28

回答

9

你是對的,你需要一個適當的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使它發生。