android 工程编译方法

编译Android 5.x ¶

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64

其余步骤同4.x

编译Android 4.x

source build/envsetup.sh
lunch xxx

target name请查阅 http://wiki-server3.sdm.com/AP-Android/wiki/product%20build

编译整个工程

kheader
make

编译u-boot

make bootloader

编译bootimage

make bootimage

编译system

make systemimage

编译Android 2.3.5

#编译整个工程
./mk -o=2sim sp6820gb_trout2 n

#清除整个工程
./mk -o=2sim sp6820gb_trout2 c

#编译kernel  
./mk -o=2sim sp6820gb_trout2 u k

#编译Wi-Fi module
./mk -o=2sim sp6820gb_trout2 u ko 3rdparty/wifi/Trout_WIFI/

#编译FM module
./mk -o=2sim sp6820gb_trout2 u ko 3rdparty/fm/Trout_FM/

#查看详细帮助
./mk -dh

Android 2.3.5在64位系统编译会遇到以下两个问题

问题1:

frameworks/base/libs/utils/RefBase.cpp:507:67: error: passing ‘const android::RefBase::weakref_impl’ as ‘this’ argument of ‘void android::RefBase::weakref_impl::trackMe(bool, bool)’ discards qualifiers [-fpermissive]

[out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1

解决方法:

$vim frameworks/base/libs/utils/Android.mk

#LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -fpermissive

问题2:

error: “_FORTIFY_SOURCE” redefined [-Werror]

解决方法:

$vim build/core/combo/HOST_linux-x86.mk

#HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0
HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0


你可能感兴趣的:(android 工程编译方法)