Android系统编译
先执行环境初始化:
source build/envsetup.sh && lunch aosp-eng
再执行make 模块名
,模块根据需求自选,例如:
make services
特别注意:
1、framework.jar,编译framework.jar要加-minux-apex,以前的make framework 不能编译出framework.jar,make framework-minus-apex
;
2、so模块需要加上路径编译,直接make 会报依赖错误,需要指定位置编译:make out/target/product/ohosqssi/system/lib/libandroid_runtime.so
编译命令说明
source build/envsetup.sh
引入了 build/envsetup.sh 脚本,该脚本的作用是初始化编译环境,并引入一些辅助的Shell函数,这其中就包括第二步使用 lunch
函数。
命令lunch aosp-eng
是调用 lunch 函数,并指定参数为”aosp-eng”。lunch 函数的参数用来指定此次编译的目标设备以及编译类型。在这里,这两个值分别是”aosp”和”eng”。”aosp”是 Android 源码中已经定义好的一种产品,是为模拟器而设置的。而编译类型会影响最终系统中包含的模块。如果在调用lunch函数的时候没有指定参数,那么该函数将输出列表以供选择,列表内容不同Android版本,不同厂家的基线源码会有所不同。
如何理解lunch和choosecombo
lunch执行已经设定好的脚本,而choosecombo则是一个选项一个选项的执行:
To select the set of things you want to build, and what items to build for, you use either the ‘choosecombo’ function or the ‘lunch’ function. ‘choosecombo’ will walk you through the different items you have to select, one-by-one, while ‘lunch’ allows you select some pre-set combinations.
参考链接:
https://blog.csdn.net/tkwxty/article/details/111684291
https://blog.csdn.net/daoshuti/article/details/101842404
https://elinux.org/Android_Build_System