repo init --depth 1 -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r11
repo sync -c --no-clone-bundle --no-tags -j$(nproc --all)
源码准备好了,然后准备Xposed的
其中art分支要注意切换成自己将要编译的
准备相应版本的jdk
记得需要openJdk,而不是Oracle HotSpot jdk
这里我是没安装成功的,
sudo add-apt-repository ppa:openjdk-r/ppa
apt-get install libatk-adaptor libgail-common
上优快云下载一个手动安装如下
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jdk-7/bin/javac 9
sudo update-alternatives --install /usr/bin/java java /usr/lib/jdk-7/jre/bin/java 9
切换jdk版本
sudo update-alternatives --config java
sudo update-alternatives --config javac
apk改下后缀 放到outdir/java/XposedBridge.jar
xposed native代码放这里
┌─[an@parrot]─[~/myandroid/xposed/XposedTools]
└──╼ $perl -MCarp::Always build.pl -t arm,arm64:23
出现错误:
Last 10 lines from the log:
Export includes file: frameworks/compile/libbcc/Android.mk – out/target/product/generic/obj/SHARED_LIBRARIES/libbcc_intermediates/export_includes
Export includes file: frameworks/compile/libbcc/bcinfo/Android.mk – out/target/product/generic/obj/SHARED_LIBRARIES/libbcinfo_intermediates/export_includes
Export includes file: external/llvm/shared_llvm.mk – out/target/product/generic/obj/SHARED_LIBRARIES/libLLVM_intermediates/export_includes
flex-2.5.39: loadlocale.c:130: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_TIME) / sizeof (_nl_value_type_LC_TIME[0]))’ failed.
make: *** [build/core/binary.mk:646: out/host/linux-x86/obj/EXECUTABLES/rsg-generator_intermediates/spec.cpp] 已放弃
make: *** Waiting for unfinished jobs…
Export includes file: frameworks/compile/libbcc/bcinfo/Wrap/Android.mk – out/target/product/generic/obj/STATIC_LIBRARIES/libLLVMWrap_intermediates/export_include
删掉中间那个,对比下系统的版本,有点老, 把系统flex的软连接过去
我这里编译两个平台的,能够让armv5,armv7架构的机子都用上,大概一个platform编译一个小时吧。
lastest.zip是XosedInstaller的刷入包,我们使用“直接写入”功能就是用了这个。
参考[编译安卓]
source.android.com/setup/building
Build.pl 执行核心逻辑之编译修改过的art以及xposed native
Executing:
切换至aosp根目录
cd /home/an/myandroid/android-6.0
初始化编译环境,导出一些编译过程中所需要的命令,包括make
build/envsetup.sh >/dev/null
设置编译目标,eng是“具有额外进行调试多首选编译类型”
lunch aosp_arm-eng >/dev/null
使用make编译系统,安卓7.0时候正式引入使用go语言编写的Soong编译系统
使用方法:
target 可以是文件路径(相对于源码根目录)
target 可以是被Makefile定义的目标(如LOCAL_MODULE:=xposed)
make -j4 xposed libxposed_art libart libart-compiler libart-disassembler libsigchain dex2oat oatdump patchoat