本文主要是介绍MTK Android P/Q system/vendor/super快速打包,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、Android 新版本默认开启了动态分区,把system vendor product等分区打包成一个super分区。这对于我们使用替换分区的方法来排查问题不是很方便,直接替换一个super也不知道到底是哪个部分导致的。所以我们需要自己制作super.img来缩小范围。下面讲讲如何快速生成system、vendor、super,以及vbmeta(校验image,不匹配可能会导致不开机)
二、快速生成system.img
传统做法,使用系统自带打包命令:make snod ,这个命令在老版本android还是比较快的,但是新系统因为在执行打包之前还是会include 很多makefile,导致效率不高
新方法:通过out/build-full_$(PROJECT_NAME).ninja 这个文件可以找到各种image的生成命令。
只不过有的image生成命令很长,我们需要提取关键信息即可,因为我们是基于系统整编过的基础上,很多依赖直接使用即可无需重新生成
注意:若开启了把system当做跟目录,out/target/product/$(PROJECT_NAME)/root也会打包进system
需要source lunch
build/make/tools/releasetools/build_image.py out/target/product/$(PROJECT_NAME)/system out/target/product/$(PROJECT_NAME)/obj/PACKAGING/systemimage_intermediates/system_image_info.txt out/target/product/$(PROJECT_NAME)/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/$(PROJECT_NAME)/systemcp out/target/product/$(PROJECT_NAME)/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/$(PROJECT_NAME)/system.img
三、生成vbmeta_system.img
out/host/linux-x86/bin/avbtool make_vbmeta_image --algorithm SHA256_RSA2048 --key device/mediatek/system/common/system_prvk.pem --padding_size 4096 --rollback_index 0 --include_descriptors_from_image out/target/product/$(PROJECT_NAME)/system.img --include_descriptors_from_image out/target/product/$(PROJECT_NAME)/product.img --output out/target/product/$(PROJECT_NAME)/vbmeta_system.img
若替换super里的system ,需要同时更新此文件并download
四、生成vendor.img
build/make/tools/releasetools/build_image.py out/target/product/$(PROJECT_NAME)/vendor out/target/product/$(PROJECT_NAME)/obj/PACKAGING/vendor_intermediates/vendor_image_info.txt out/target/product/$(PROJECT_NAME)/vendor.img out/target/product/$(PROJECT_NAME)/system
五、生成vbmeta_vendor.img
out/host/linux-x86/bin/avbtool make_vbmeta_image --algorithm SHA256_RSA2048 --key device/mediatek/vendor/common/vendor_prvk.pem --padding_size 4096 --rollback_index 0 --include_descriptors_from_image out/target/product/$(PROJECT_NAME)/vendor.img --output out/target/product/$(PROJECT_NAME)/vbmeta_vendor.img
若替换super里的vendor ,需要同时更新此文件并download
六、生成super.img
需要source lunch
./build/make/tools/releasetools/build_super_image.py out/target/product/$(PROJECT_NAME)/obj/PACKAGING/superimage_debug_intermediates/misc_info.txt out/target/product/$(PROJECT_NAME)/super_new.img
七、生成vbmeta.img
/bin/bash -c "(mkdir -p out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys ) && (out/host/linux-x86/bin/avbtool extract_public_key --key device/mediatek/vendor/common/boot_prvk.pem --output out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/boot.avbpubkey ) && (out/host/linux-x86/bin/avbtool extract_public_key --key device/mediatek/vendor/common/recovery_prvk.pem --output out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/recovery.avbpubkey ) && (out/host/linux-x86/bin/avbtool extract_public_key --key device/mediatek/system/common/system_prvk.pem --output out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/vbmeta_system.avbpubkey ) && (out/host/linux-x86/bin/avbtool extract_public_key --key device/mediatek/vendor/common/vendor_prvk.pem --output out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/vbmeta_vendor.avbpubkey ) && (out/host/linux-x86/bin/avbtool make_vbmeta_image --chain_partition boot:3:out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/boot.avbpubkey --include_descriptors_from_image out/target/product/$(PROJECT_NAME)/dtbo.img --chain_partition recovery:1:out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/recovery.avbpubkey --chain_partition vbmeta_system:2:out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/vbmeta_system.avbpubkey --chain_partition vbmeta_vendor:4:out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys/vbmeta_vendor.avbpubkey --algorithm SHA256_RSA2048 --key device/mediatek/system/common/oem_prvk.pem --padding_size 4096 --rollback_index 0 --output out/target/product/$(PROJECT_NAME)/vbmeta.img ) && (rm -rf out/target/product/$(PROJECT_NAME)/obj/avb_chain_keys )"
替换super,不用更新vbmeta.img
使用时将$(PROJECT_NAME)替换为你的工程名
这篇关于MTK Android P/Q system/vendor/super快速打包的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!