android R(Qualcomm平台)编译相关记录

前言

此篇为调试记录,基于两个大的方向来归纳这篇文章要提的内容:

1.ninja编译命令提高调试效率

2.高通的源码在R上引入了QSSI(Qualcomm Single System Image),从字面上来看,就是要将system独立出来解耦,为厂商升级最新的android版本铺路.

细节描述

针对编译

未对ninja编译做分析,旨在让参与模块的小伙伴们能有方式提高调试效率,调试android R版本的都知道编译调试带来的痛苦.

./prebuilts/build-tools/linux-x86/bin/ninja -f out/combined-bengal.ninja -j32 aboot

如上面调试aboot模块,在全编译之后,可以后期用上述命令单编译,当然还可以是bootimage vendorimage等等.

另外需要注意的一点是android Q之后,Google启用了动态分区,system 、vendor、product等分区的大小是动态可变的,而且存在分区表中的分区是super,

这里不重点介绍动态分区,但是开启了动态分区的版本 ,如果是需要调试验证问题,比如在vendor中做了修改,那在编译完之后,就需要重新打包super image,

重新打包super的命令看了之后补上(Todo).

补充:看了一眼build.sh脚本里的用法,高通已经做了几个版本的迭代了

vendor\qcom\opensource\core-utils\build\build.sh

# Version 0:
#     Supports just the basic make commands (passes on all args like -j32 to the make command).
# Version 1:
#     Supports dist command as well - needed for target-files/ota generation.
#     Usage: ./build.sh dist -j32
#     This triggers make dist for qssi and target lunch, generates target-files, merges them
#     and triggers ota generation.
# Version 2:
#     Supports custom copy paths for dynamic patition images when compiled with dist.
#     option : --dp_images_path=<custom-copy-path>
# Version 3:
#     Supports segmenting the build into qssi only, target only and merge only steps and
#     enabling users to call specific steps or full build by giving no separate steps.
#     options: --qssi_only, --target_only, --merge_only
#     Usage: ./build.sh dist -j32 --qssi_only (for only qssi build) or ./build.sh dist -j32 (for full build)
#     Note: qssi_only and target_only options can be given together but merge_only should not be combined with
#           any other options.
# Version 4:
#     Supports lunch qssi variant to build qssi only images.
#     enables users to build standalone qssi images independent of any targets
#     option(s): --qssi_only
#     Usage: ./build.sh dist -j32 --qssi_only or ./build.sh dist -j32. Either way the outcome will be the same
#     Note: --target_only and --merge_only options will throw an error with lunch qssi variant

version0,version1 ------基本支持full编译

version2 ------动态分区Image拷贝客制化

version3 ------支持模块化编译,如:

./build.sh --qssi_only 仅编译qssi

./build.sh --target_only 仅编译oem target product

./build.sh --merge_only merge上述两部分的镜像内容,之前提到的合并super image的情形,还有包括打包最终的merge ota、merge target-file都可以用此命令完成.

version4 ------ 只lunch qssi可独立编译出qssi only image

命令暂时没有一个个去验证,调试阶段时间紧,主要是自己试到的和道听途说的总结

编译system
build.sh dist qssi_only -j8
build.sh dist merge_only -j8
编译vendor.img
build.sh vendorimage dist target_only -j8
build.sh dist merge_only -j8
build.sh dist merge_only -j8会生成super.img

QSSI的做法

按我目前的粗浅理解,systemimage的编译独立于其他模块,

所以编译脚本的执行贯彻的也是如此,第一阶段的TARGET_PRODUCT就是qssi.

source build/envsetup.sh
lunch qssi-userdebug

等待编译完成,执行第二阶段其他image的编译,TARGET_PRODUCT即为oem project.

整体编译时间至少是在4小时以上,所以凡是涉及到需要全编译的调试,就得折腾的鸡飞狗跳,但谁叫我们吃的就是这碗饭呢,乐观面对,毕竟这才是生活的本质.

猜你喜欢

转载自blog.csdn.net/jeephao/article/details/111823543