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,如果没有就去IMAGERADIO下查找文件是否存在

确实我们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_KERNELfalse应该就可以了.

posted @ 2021-12-09 16:14  梦过无声  阅读(492)  评论(0编辑  收藏  举报