Android Q编译问题
在编译Qcom Android Q版本时碰到错误
可以看到build/make/tools/releasetools/add_img_to_target_files
脚本的CheckAbOtaImages
函数中出现错误了
def CheckAbOtaImages(output_zip, ab_partitions):
"""Checks that all the listed A/B partitions have their images available.
The images need to be available under IMAGES/ or RADIO/, with the former takes
a priority.
Args:
output_zip: The output zip file (needs to be already open), or None to
find images in OPTIONS.input_tmp/.
ab_partitions: The list of A/B partitions.
Raises:
AssertionError: If it can't find an image.
"""
for partition in ab_partitions:
img_name = partition.strip() + ".img"
# Assert that the image is present under IMAGES/ now.
if output_zip:
# Zip spec says: All slashes MUST be forward slashes.
images_path = "IMAGES/" + img_name
radio_path = "RADIO/" + img_name
available = (images_path in output_zip.namelist() or
radio_path in output_zip.namelist())
else:
images_path = os.path.join(OPTIONS.input_tmp, "IMAGES", img_name)
radio_path = os.path.join(OPTIONS.input_tmp, "RADIO", img_name)
available = os.path.exists(images_path) or os.path.exists(radio_path)
assert available, "Failed to find " + img_name
ab_partitions
就是文件out/target/product/${product}/obj/PACKAGING/target_files_intermediates/kona-target_files-eng.${user}/META/ab_partitions.txt
# ab_partitions 内容:
boot
vendor
odm
dtbo
vbmeta
遍历ab_partitions.txt
文件,判断output_zip
中是否包含这些img,如果没有就去IMAGE
和RADIO
下查找文件是否存在
确实我们BOOT下面没有boot.img,那为什么了?继续源码发现了这个
果断看下这个文件
misc_info.txt
是在build/core/Makefile
中生成的,后来对比了下原生AOSP是没有这个的,也就是说这是高通添加的
# build/core/Makefile
ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
$(hide) echo "no_boot=true" >> $(zip_root)/META/misc_info.txt
endif
# device/qcom/common/generate_extra_images.mk
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),true)
INSTALLED_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
endif
ifeq ($(PRODUCT_BUILD_SYSTEM_IMAGE),true)
INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
endif
ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),true)
INSTALLED_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
endif
ifneq ($(TARGET_NO_RECOVERY), true)
INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
else
INSTALLED_RECOVERYIMAGE_TARGET :=
endif
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
INSTALLED_USBIMAGE_TARGET := $(PRODUCT_OUT)/usbdisk.img
endif
可以看到INSTALLED_BOOTIMAGE_TARGET
为未定义才会设置no_boot
所以只要定义TARGET_NO_KERNEL
为false
应该就可以了.