MIPS android 编译总结

http://www.huomo.cn/developer/article-b8f0.html

1. 参考文档
1.1 Obtaining MIPS Android Source Code    (http://www.mipsandroid.com/documents/show/1)
1.2 Compiling Android for MIPS (http://www.awakecoding.com/index.php?option=com_content&view=article&id=21:compiling-android-for-mips)
1.3 移植Android到MIPS平台(续) (http://my.unix-center.net/~Simon_fu/?p=557)
2. 环境准备
2.1 安装ubuntu(使用virtulbox)
2.2 安装其他需要工具
sudo apt-get install gcc build-essential git-core libreadline-dev zip curl wget valgrind python eclipse ecj flex bison gperf libsdl-dev libwxgtk2.6-dev libgmp3-dev libsds-dev clearsilver-dev libclearsilver-perl python-clearsilver gcc-multilib g++-multilib 
2.3 安装java jdk
sudo apt-get sun-java5-jdk
sudo update-alternatives --config java  (选择刚安装完的JDK目录)
sudo update-alternatives --config javac
sudo update-alternatives --config javadoc
2.4 安装mips-4.3 toolchain
此步骤可省略,使用android自带的prebuilt toolchain即可 3. 源码下载
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir mipsandroid
$ cd mipsandroid
$ repo init -u git://public.mipsandroid.com/mips/platform/manifest.git -b mips-eclair
$ repo sync 4. 编译
4.1 准备
在mipsandroid下添加env.sh如下
export TOP='pwd'
export J2RE_HOME=/usr/lib/jvm/java-1.5.0-sun/jre
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
export ANDROID_JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
source build/envsetup.sh
export USE_CCACHE=1
export TARGET_ARCH_VERSION=mips32r2
export TARGET_ARCH=mips
export ANDROID_PRODUCT_OUT=~/android/mipsandroid/out/target/product/generic
export PATH=$PATH:~/android/mipsandroid/out/host/linux-x86/bin/ 4.2 步骤
source env.sh
make
4.3 此时已生成emulator和对应的system.img ramdisk.img userdata.img(kernel-qemu使用prebuilt的) 4.3问题总结
之前由于PRODUCT指定不对,造成编译出的init使用了hard float point的libc,重新make clean;make解决 5.编译SDK
5.1 执行
在4步骤完成后
make sdk 5.2 问题总结
5.2.1 提示crtbegin_so.S找不到
修改bionic/libc/Android.mk如下,注释掉
#ifeq ($(TARGET_ARCH),mips)
# we only need begin_so/end_so for mips, since it needs an appropriate .init
# section in the shared library with a function to call all the entries in
# .ctors section.
#GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtbegin_so.o
#$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtbegin_so.S
#    @mkdir -p $(dir $@)
#    $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
#ALL_GENERATED_SOURCES += $(GEN) #GEN := $(TARGET_OUT_STATIC_LIBRARIES)/crtend_so.o
#$(GEN): $(LOCAL_PATH)/arch-$(TARGET_ARCH)/bionic/crtend_so.S
#    @mkdir -p $(dir $@)
#    $(TARGET_CC) $(libc_crt_target_cflags) -o $@ -c $<
#ALL_GENERATED_SOURCES += $(GEN)
#endif # TARGET_ARCH == mips      5.2.2 生成的linux sdk使用不正常,发现kernel-qemu拷贝的是arm的,将其替换即可 6.编译windows SDK
6.1 步骤
1)将mipsandroid拷贝到cygwin里
2)windows安装java jdk
3)修改env.sh
export TOP='pwd'
export J2RE_HOME=/cygdrive/c/Java/jdk1.5.0_20/jre
export JAVA_HOME=/cygdrive/c/Java/jdk1.5.0_20
export ANDROID_JAVA_HOME=/cygdrive/c/Java/jdk1.5.0_20
source build/envsetup.sh
export TARGET_ARCH_VERSION=mips32r2
export TARGET_ARCH=mips
export ANDROID_PRODUCT_OUT=~/android/mipsandroid/out/target/product/generic
export PATH=$PATH:/cygdrive/c/Java/jdk1.5.0_20/bin
4)修改make_windows_sdk.sh,增加acp编译(android 2.2),修改cygwin目录,删除adb/fastboot编译(android 2.2),如下 a) CYG_MGWZ_PATH=/cygdrive/c/cygwin/bin/mgwz.dll                                                           ->  CYG_MGWZ_PATH=/cygdrive/e/cygwin/bin/mgwz.dll b) SDK_NUMBER=`echo $filename | sed -n 's/^.*_\([^_./]\+\)_[^_.]*\..*$/\1/p'` ->  SDK_NUMBER=2.2 c)    aapt adb aidl \
etc1tool \
prebuilt \
dexdump dmtracedump \
fastboot \
->
acp aapt aidl \
etc1tool \
prebuilt \
dexdump dmtracedump \ d) cp -v out/host/windows-x86/bin/*.{exe,dll} "$TOOLS"/ ->  cp -v out/host/windows-x86/bin/*.exe "$TOOLS"/ e)
[[ -n $NEED_MGWZ ]] && cp -v $CYG_MGWZ_PATH "$TOOLS"/ ->
[[ -n $NEED_MGWZ ]] && cp -v $CYG_MGWZ_PATH "$TOOLS"/  
cp -v /cygdrive/e/cygwin/bin/cygz.dll "$TOOLS"/
cp -v /cygdrive/e/cygwin/bin/cygwin1.dll "$TOOLS"/ f)
[[ -n $NEED_MGWZ ]] && cp -v "$TOOLS"/mgwz.dll "$PLATFORM_TOOLS"/
->
[[ -n $NEED_MGWZ ]] && cp -v "$TOOLS"/mgwz.dll "$PLATFORM_TOOLS"/
cp -v "$TOOLS"/cygz.dll "$PLATFORM_TOOLS"/
cp -v "$TOOLS"/cygwin1.dll "$PLATFORM_TOOLS"/ 5)修改external/sqlite/dist/shell.c
#if defined(HAVE_READLINE) && HAVE_READLINE==1  -> #if 0
# include <readline/readline.h>
# include <readline/history.h>
6.2 安装使用
kernel-qemu还是arm的,替换成mips的

你可能感兴趣的:(java,android,linux,python,git)