momo zone

调核人的blog

mips for android 交叉编译工具链

在这里下载:http://developer.mips.com/android/download-android-ndk/

解包后进入./build/tools 目录 可以定制一个特定android 平台的工具链:

./make-standalone-toolchain.sh –platform=android-9 –install-dir=/root/android-ndk-r7bm/android-mips-9 –ndk-dir=/root/android-ndk-r7bm –arch=mips

Auto-config: –toolchain=mips-linux-android-4.4.3
Copying prebuilt binaries…
Copying sysroot headers and libraries…
Copying libstdc++ headers and libraries…
Copying files to: /root/android-ndk-r7bm/android-mips-9
Cleaning up…
Done.

这样就把android 3.2的mips  gcc ,库文件,头文件安装到了指定目录,方便环境搭建。

搜索路径如下:

 # /root/android-ndk-r7bm/android-mips-9/bin/mips-linux-android-gcc -print-search-dirs

install: /root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/mips-linux-android/4.4.3/

programs: =
/root/android-ndk-r7bm/android-mips-9/bin/../libexec/gcc/mips-linux-android/4.4.3/:
/root/android-ndk-r7bm/android-mips-9/bin/../libexec/gcc/:
/root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/mips-linux-android/4.4.3/../../../../mips-linux-android/bin/mips-linux-android/4.4.3/:
/root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/mips-linux-android/4.4.3/../../../../mips-linux-android/bin/

libraries: =
/root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/mips-linux-android/4.4.3/:
/root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/:
/root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/mips-linux-android/4.4.3/../../../../mips-linux-android/lib/mips-linux-android/4.4.3/:
/root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/mips-linux-android/4.4.3/../../../../mips-linux-android/lib/:
/root/android-ndk-r7bm/android-mips-9/bin/../sysroot/lib/mips-linux-android/4.4.3/:
/root/android-ndk-r7bm/android-mips-9/bin/../sysroot/lib/:
/root/android-ndk-r7bm/android-mips-9/bin/../sysroot/usr/lib/mips-linux-android/4.4.3/:
/root/android-ndk-r7bm/android-mips-9/bin/../sysroot/usr/lib/

默认的gnu 库在这里:

# /root/android-ndk-r7bm/android-mips-9/bin/mips-linux-android-gcc -print-libgcc-file-name
/root/android-ndk-r7bm/android-mips-9/bin/../lib/gcc/mips-linux-android/4.4.3/libgcc.a

指定编译出来的mips指令集版本:

-mips32

-mips32r2

-march=mips32|mips32r2 / -mtune=mips32|mips32r2

 

export ANDROID_NDK=”/root/android-ndk-r7bm/android-mips-9″
export PATH=”$ANDROID_NDK/bin:$PATH”
export CFLAGS=”-mips32r2 -DANDROID -mandroid -fomit-frame-pointer”
export CXXFLAGS=”$CFLAGS”
export CC=”mips-linux-android-gcc $CFLAGS”
export CXX=”mips-linux-android-g++ $CXXFLAGS”
export AR=”mips-linux-android-ar”
export RANLIB=”mips-linux-android-ranlib”
export STRIP=”mips-linux-android-strip –strip-unneeded”
export LD=”mips-linux-android-ld”

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: