From 42879ff5363526c60e16d33404b216ce5f80c772 Mon Sep 17 00:00:00 2001 From: Daniel Norman Date: Tue, 6 Oct 2020 11:09:56 -0700 Subject: [PATCH] Various fixes to PRODUCT_BUILD_ variables. - Introduces PRODUCT_BUILD_VENDOR_BOOT_IMAGE. - Controls vendor_boot.img, replacing TARGET_NO_VENDOR_BOOT. - Matches the naming convention of other similar vars. - Guards boot-debug.img behind BUILDING_BOOT_IMAGE - Restructures BUILDING_BOOT_IMAGE to give priority to PRODUCT_BUILD_BOOT_IMAGE, as do other partitions. - ^ for BUILDING_RECOVERY_IMAGE. Test: PRODUCT_BUILD_{BOOT,RECOVERY,VENDOR_BOOT}_IMAGE := false m dist Observe no boot, boot-debug, recovery, or vendor_boot images. Bug: 169968221 Bug: 170423509 Change-Id: I629bf08ba08e5db14c1bf92bb338fb3ce59d5b73 --- core/Makefile | 2 ++ core/board_config.mk | 33 +++++++++++++++++++++++---------- core/product.mk | 1 + 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/core/Makefile b/core/Makefile index 71043343b..48ba059e7 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2094,6 +2094,7 @@ endif # BUILDING_RAMDISK_IMAGE # # 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. +ifdef BUILDING_BOOT_IMAGE ifneq ($(strip $(TARGET_NO_KERNEL)),true) ifneq ($(strip $(BOARD_KERNEL_BINARIES)),) INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-debug,$(BOARD_KERNEL_BINARIES)), \ @@ -2148,6 +2149,7 @@ bootimage_debug-nodeps: $(MKBOOTIMG) $(foreach b,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call build-debug-bootimage-target,$b)) endif # TARGET_NO_KERNEL +endif # BUILDING_BOOT_IMAGE ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true) ifeq ($(BUILDING_RAMDISK_IMAGE),true) diff --git a/core/board_config.mk b/core/board_config.mk index 95d8af88f..05b6b29c1 100644 --- a/core/board_config.mk +++ b/core/board_config.mk @@ -342,23 +342,29 @@ endif # Are we building a boot image BUILDING_BOOT_IMAGE := -ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) - BUILDING_BOOT_IMAGE := -else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),) - ifdef BOARD_BOOTIMAGE_PARTITION_SIZE +ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),) + ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) + BUILDING_BOOT_IMAGE := + else ifdef BOARD_BOOTIMAGE_PARTITION_SIZE BUILDING_BOOT_IMAGE := true endif else ifeq ($(PRODUCT_BUILD_BOOT_IMAGE),true) - BUILDING_BOOT_IMAGE := true + ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) + $(warning *** PRODUCT_BUILD_BOOT_IMAGE is true, but so is BOARD_USES_RECOVERY_AS_BOOT.) + $(warning *** Skipping building boot image.) + BUILDING_BOOT_IMAGE := + else + BUILDING_BOOT_IMAGE := true + endif endif .KATI_READONLY := BUILDING_BOOT_IMAGE # Are we building a recovery image BUILDING_RECOVERY_IMAGE := -ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) - BUILDING_RECOVERY_IMAGE := true -else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),) - ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE +ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),) + ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) + BUILDING_RECOVERY_IMAGE := true + else ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) BUILDING_RECOVERY_IMAGE := true endif @@ -372,7 +378,14 @@ endif BUILDING_VENDOR_BOOT_IMAGE := ifdef BOARD_BOOT_HEADER_VERSION ifneq ($(call math_gt_or_eq,$(BOARD_BOOT_HEADER_VERSION),3),) - ifneq ($(TARGET_NO_VENDOR_BOOT),true) + ifneq ($(TARGET_NO_VENDOR_BOOT),) + $(warning TARGET_NO_VENDOR_BOOT has been deprecated. Please use PRODUCT_BUILD_VENDOR_BOOT_IMAGE.) + ifneq ($(TARGET_NO_VENDOR_BOOT),true) + BUILDING_VENDOR_BOOT_IMAGE := true + endif + else ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),) + BUILDING_VENDOR_BOOT_IMAGE := true + else ifeq ($(PRODUCT_BUILD_VENDOR_BOOT_IMAGE),true) BUILDING_VENDOR_BOOT_IMAGE := true endif endif diff --git a/core/product.mk b/core/product.mk index 624501ea8..666e39049 100644 --- a/core/product.mk +++ b/core/product.mk @@ -380,6 +380,7 @@ _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_VENDOR_BOOT_IMAGE _product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE # List of boot jars delivered via apex