Merge changes from topic "no-more-boot-debug-gki-sc-v2-dev" into sc-v2-dev

* changes:
  Stop building boot-(debug|with-debug-ramdisk)-*.img for GSI/GKI
  Refactor build logic of boot-debug & vendor_boot-debug
  Skip building boot-(test-harness|debug).img if not needed
This commit is contained in:
Yi-yo Chiang 2021-12-10 05:36:27 +00:00 committed by Android (Google) Code Review
commit 806d08f61d
4 changed files with 100 additions and 23 deletions

View file

@ -2327,14 +2327,14 @@ ifneq ($(BOARD_NAND_SPARE_SIZE),)
$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
endif
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
# -----------------------------------------------------------------
# the debug ramdisk, which is the original ramdisk plus additional
# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
# When /force_debuggable is present, /init will load userdebug sepolicy
# and property files to allow adb root, if the device is unlocked.
ifneq ($(BUILDING_DEBUG_BOOT_IMAGE)$(BUILDING_DEBUG_VENDOR_BOOT_IMAGE),)
ifdef BUILDING_RAMDISK_IMAGE
BUILT_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-debug.img
INSTALLED_DEBUG_RAMDISK_TARGET := $(BUILT_DEBUG_RAMDISK_TARGET)
@ -2391,15 +2391,15 @@ ramdisk_debug-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_DEBUG_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
endif # BUILDING_RAMDISK_IMAGE
endif # BUILDING_DEBUG_BOOT_IMAGE || BUILDING_DEBUG_VENDOR_BOOT_IMAGE
# -----------------------------------------------------------------
# the boot-debug.img, which is the kernel plus ramdisk-debug.img
#
# Note: it's intentional to skip signing for boot-debug.img, because it
# can only be used if the device is unlocked with verification error.
ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
ifdef BUILDING_DEBUG_BOOT_IMAGE
ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-debug,$(BOARD_KERNEL_BINARIES)), \
$(PRODUCT_OUT)/$(k).img)
@ -2454,15 +2454,13 @@ bootimage_debug-nodeps: $(MKBOOTIMG) $(BOARD_GKI_SIGNING_KEY_PATH) $(AVBTOOL)
echo "make $@: ignoring dependencies"
$(foreach b,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call build-debug-bootimage-target,$b))
endif # TARGET_NO_KERNEL
endif # INSTALLED_BOOTIMAGE_TARGET
endif # BUILDING_DEBUG_BOOT_IMAGE
ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
ifeq ($(BUILDING_RAMDISK_IMAGE),true)
# -----------------------------------------------------------------
# vendor debug ramdisk
# Combines vendor ramdisk files and debug ramdisk files to build the vendor debug ramdisk.
#
ifdef BUILDING_DEBUG_VENDOR_BOOT_IMAGE
INTERNAL_VENDOR_DEBUG_RAMDISK_FILES := $(filter $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)/%, \
$(ALL_GENERATED_SOURCES) \
$(ALL_DEFAULT_INSTALLED_MODULES))
@ -2534,14 +2532,13 @@ $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(INTERNAL_VENDOR_RAMDISK_FRAGMENT_T
$(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
$(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),$(call test-key-sign-vendor-bootimage,$@))
endif # BUILDING_RAMDISK_IMAGE
endif # BUILDING_VENDOR_BOOT_IMAGE
endif # BUILDING_DEBUG_VENDOR_BOOT_IMAGE
# -----------------------------------------------------------------
# The test harness ramdisk, which is based off debug_ramdisk, plus a
# few additional test-harness-specific properties in adb_debug.prop.
ifneq ($(BUILDING_DEBUG_BOOT_IMAGE)$(BUILDING_DEBUG_VENDOR_BOOT_IMAGE),)
ifdef BUILDING_RAMDISK_IMAGE
BUILT_TEST_HARNESS_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-test-harness.img
INSTALLED_TEST_HARNESS_RAMDISK_TARGET := $(BUILT_TEST_HARNESS_RAMDISK_TARGET)
@ -2594,15 +2591,14 @@ ramdisk_test_harness-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
$(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
$(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_TEST_HARNESS_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
endif # BUILDING_RAMDISK_IMAGE
endif # BUILDING_DEBUG_BOOT_IMAGE || BUILDING_DEBUG_VENDOR_BOOT_IMAGE
# -----------------------------------------------------------------
# the boot-test-harness.img, which is the kernel plus ramdisk-test-harness.img
#
# Note: it's intentional to skip signing for boot-test-harness.img, because it
# can only be used if the device is unlocked with verification error.
ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
ifdef BUILDING_DEBUG_BOOT_IMAGE
ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-test-harness,$(BOARD_KERNEL_BINARIES)), \
@ -2641,15 +2637,12 @@ bootimage_test_harness-nodeps: $(MKBOOTIMG) $(BOARD_GKI_SIGNING_KEY_PATH) $(AVBT
echo "make $@: ignoring dependencies"
$(foreach b,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET),$(call build-boot-test-harness-target,$b))
endif # TARGET_NO_KERNEL
endif # INSTALLED_BOOTIMAGE_TARGET
endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true
endif # BUILDING_DEBUG_BOOT_IMAGE
ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
ifeq ($(BUILDING_RAMDISK_IMAGE),true)
# -----------------------------------------------------------------
# vendor test harness ramdisk, which is a vendor ramdisk combined with
# a test harness ramdisk.
ifdef BUILDING_DEBUG_VENDOR_BOOT_IMAGE
INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET := $(call intermediates-dir-for,PACKAGING,vendor_boot-test-harness)/vendor_ramdisk-test-harness.cpio$(RAMDISK_EXT)
@ -2684,8 +2677,8 @@ $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET): $(INTERNAL_VENDOR_RAMDISK_FRA
$(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
$(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),$(call test-key-sign-vendor-bootimage,$@))
endif # BUILDING_RAMDISK_IMAGE
endif # BUILDING_VENDOR_BOOT_IMAGE
endif # BUILDING_DEBUG_VENDOR_BOOT_IMAGE
# Creates a compatibility symlink between two partitions, e.g. /system/vendor to /vendor
# $1: from location (e.g $(TARGET_OUT)/vendor)

View file

@ -439,6 +439,86 @@ else ifeq ($(PRODUCT_BUILD_RAMDISK_IMAGE),false)
endif
.KATI_READONLY := BUILDING_RAMDISK_IMAGE
# Are we building a debug vendor_boot image
BUILDING_DEBUG_VENDOR_BOOT_IMAGE :=
# Can't build vendor_boot-debug.img if BOARD_BUILD_SYSTEM_ROOT_IMAGE is true,
# because building debug vendor_boot image requires a ramdisk.
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
$(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but so is BOARD_BUILD_SYSTEM_ROOT_IMAGE. \
Skip building the debug vendor_boot image.)
endif
# Can't build vendor_boot-debug.img if we're not building a ramdisk.
else ifndef BUILDING_RAMDISK_IMAGE
ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
$(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a ramdisk image. \
Skip building the debug vendor_boot image.)
endif
# Can't build vendor_boot-debug.img if we're not building a vendor_boot.img.
else ifndef BUILDING_VENDOR_BOOT_IMAGE
ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
$(warning PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE is true, but we're not building a vendor_boot image. \
Skip building the debug vendor_boot image.)
endif
else
ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),)
BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true
else ifeq ($(PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE),true)
BUILDING_DEBUG_VENDOR_BOOT_IMAGE := true
endif
endif
.KATI_READONLY := BUILDING_DEBUG_VENDOR_BOOT_IMAGE
_has_boot_img_artifact :=
ifneq ($(strip $(TARGET_NO_KERNEL)),true)
ifdef BUILDING_BOOT_IMAGE
_has_boot_img_artifact := true
endif
# BUILDING_RECOVERY_IMAGE && BOARD_USES_RECOVERY_AS_BOOT implies that
# recovery is being built with the file name *boot.img*, which still counts
# as "building boot.img".
ifdef BUILDING_RECOVERY_IMAGE
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
_has_boot_img_artifact := true
endif
endif
endif
# Are we building a debug boot image
BUILDING_DEBUG_BOOT_IMAGE :=
# Can't build boot-debug.img if BOARD_BUILD_SYSTEM_ROOT_IMAGE is true,
# because building debug boot image requires a ramdisk.
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
$(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but so is BOARD_BUILD_SYSTEM_ROOT_IMAGE. \
Skip building the debug boot image.)
endif
# Can't build boot-debug.img if we're not building a ramdisk.
else ifndef BUILDING_RAMDISK_IMAGE
ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
$(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a ramdisk image. \
Skip building the debug boot image.)
endif
# Can't build boot-debug.img if we're not building a boot.img.
else ifndef _has_boot_img_artifact
ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
$(warning PRODUCT_BUILD_DEBUG_BOOT_IMAGE is true, but we're not building a boot image. \
Skip building the debug boot image.)
endif
else
ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),)
BUILDING_DEBUG_BOOT_IMAGE := true
# Don't build boot-debug.img if we're already building vendor_boot-debug.img.
ifdef BUILDING_DEBUG_VENDOR_BOOT_IMAGE
BUILDING_DEBUG_BOOT_IMAGE :=
endif
else ifeq ($(PRODUCT_BUILD_DEBUG_BOOT_IMAGE),true)
BUILDING_DEBUG_BOOT_IMAGE := true
endif
endif
.KATI_READONLY := BUILDING_DEBUG_BOOT_IMAGE
_has_boot_img_artifact :=
# Are we building a userdata image
BUILDING_USERDATA_IMAGE :=
ifeq ($(PRODUCT_BUILD_USERDATA_IMAGE),)

View file

@ -385,7 +385,9 @@ _product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE
_product_single_value_vars += PRODUCT_BUILD_USERDATA_IMAGE
_product_single_value_vars += PRODUCT_BUILD_RECOVERY_IMAGE
_product_single_value_vars += PRODUCT_BUILD_BOOT_IMAGE
_product_single_value_vars += PRODUCT_BUILD_DEBUG_BOOT_IMAGE
_product_single_value_vars += PRODUCT_BUILD_VENDOR_BOOT_IMAGE
_product_single_value_vars += PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE
_product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE
_product_single_value_vars += PRODUCT_BUILD_SUPER_EMPTY_IMAGE

View file

@ -71,6 +71,8 @@ PRODUCT_EXTRA_VNDK_VERSIONS := \
# Do not build non-GSI partition images.
PRODUCT_BUILD_CACHE_IMAGE := false
PRODUCT_BUILD_DEBUG_BOOT_IMAGE := false
PRODUCT_BUILD_DEBUG_VENDOR_BOOT_IMAGE := false
PRODUCT_BUILD_USERDATA_IMAGE := false
PRODUCT_BUILD_VENDOR_IMAGE := false
PRODUCT_BUILD_SUPER_PARTITION := false