10

私の最終的な目標は、古い Actiontec モデム/ルーター用のワイヤレス ツールをコンパイルして、ワイヤレスからイーサネットへのブリッジとして構成できるようにすることです。現在、ワイヤレス機能は、ほとんどの Web インターフェイスを管理する同じバイナリによって (一見) 制御されていますが、少なくとも一部の機能については、ワイヤレス ツールが内部で使用するライブラリを使用しているようです。

これまで別の CPU アーキテクチャ用にクロス コンパイルしたことがなく、何をする必要があるかを完全に特定する方法がわかりません。システムの残りの部分で使用されているように見えるので、uClibc を使用しようとしていますが、モデム環境用に buildroot を構成する方法がわかりません。以下の proc からの情報に基づいて構成がどうあるべきかについて最善の推測をしましたが、それでコンパイルされた 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
4

3 に答える 3

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/cross-mips-buildroot にインストールされます。コンパイラとその他のツールは/opt/cross-mips-buildroot/usr/bin/ にあります。

簡単なHello Worldアプリケーションをコンパイルして、mips システム内で実行できるかどうかを確認してください。

注:この構成では、C++ コンパイラはビルドされません。必要に応じて、grep LIBSTDCPP .config有効になっているかどうかを確認して、好みに合わせて変更できます。それmake menuconfigを実現するために。

于 2011-01-20T20:07:39.100 に答える
1

チェックアウト:

http://www.kegel.com/crosstool/

GCC でのクロスコンパイルに関する権威あるサイトです。

于 2011-01-20T21:17:48.780 に答える