android-5.1编译配置(van)
必备文件: archives1211.tgz ubuntu_install_1204.tgz 安装指引: ubuntu_install_1204/readme.txt 工作目录结构: git ├── vanzo_team vanzo:tools/vanzo_team.git └── vanzo_team2 vanzo:tools/vanzo_team2.git git2 ├── vanzo_team vanzo2:tools/vanzo_team.git └── vanzo_team2 vanzo2:tools/vanzo_team2.git build_projects vanzo:tools/build_projects.git build_projects2 vanzo2:tools/build_projects2.git 其他注意事项: 因为新的编译脚本频繁调用vanzo_team*的公共库文件,代码里面采用了直接引用的方式, 所以需要本地环境定制python的library path: ~/git2/vanzo_team/songlixin/config/ln.sh
脚本
am编译脚本核心内容: zprojects/scripts/mk.sh 11 source zprojects/$project_name/$project_name.env 12 source build/envsetup.sh 18 lunch full_$VANZO_INNER_BOARD_PROJECT_BY_NAME_VALUE-user 23 make -j32 所以想要实现编译快速迭代,可以手动source env文件和envsetup.sh文件,然后按照标准android编译即可。
编译
ccache
ccache对编译速度影响的试验(基于6735 n325b-ubtel): ccache不打开时完整编译:#### make completed successfully (01:57:30 (hh:mm:ss)) #### ccache打开后第二次编译:#### make completed successfully (01:23:19 (hh:mm:ss)) #### (此时.ccache目录870MB) ccache增大容量后第二次编译:#### make completed successfully (37:05 (mm:ss)) #### (此时.ccache目录17GB) ccache安装及增容命令: sudo apt-get install ccache; ccache -M 50G; (ccache默认最大cache为1GB,远远不够)
编译命令
repo init -u vanzo2:platform_lp1_6735m/manifest.git -m vtrunk.xml repo sync -j32 repo start work --all ln -s ~/build_projects2/prebuilts-51-64bit prebuilts nohup ./am n320a-kewei-35m -d // eng版本.如果要user版本,把'-d'参数去掉即可;nohup为不输出log,直接保存在nohup.out文件中
JDK版本需求
4.4: OracleJDK6 5.0: OpenJDK7 可以同时安装,所以一台机器既可以编译4.4也可以编译5.0, 通过update-alternatives切换即可. (详见老宋脚本git/vanzo_team/songlixin/ubuntu_install_1204/local_install_jre64.sh) (也可以使用"refactor 155 0"和"refactor 155 1"进行java版本切换)
调试
selinux
android 5.0默认启用selinux,权限控制严格很多. 如果碰到诸如: E/SELinux ( 127): avc: denied { add } for service=themes.add scontext=u:r:shell:s0 tcontext=u:object_r:default_android_service:s0 tclass=service_manager E/ServiceManager( 127): add_service('themes.add',60) uid=1000 - PERMISSION DENIED 或是: W/FileUtils( 681): Failed to chmod(/data/resource-cache): android.system.ErrnoException: chmod failed: EACCES (Permission denied) 的错误,可以从selinux着手去调查. 具体selinux配置在源码'external/sepolicy'目录,但我们的修改一般会overlay,放在'device/mediatek/common/sepolicy'目录.