diff options
27 files changed, 278 insertions, 115 deletions
diff --git a/core/Makefile b/core/Makefile index 28edc8714b..2d56edb9ee 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2645,6 +2645,48 @@ endif # TARGET_NO_KERNEL endif # INSTALLED_BOOTIMAGE_TARGET endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true +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. + +INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET := $(call intermediates-dir-for,PACKAGING,vendor_boot-test-harness)/vendor_ramdisk-test-harness.cpio$(RAMDISK_EXT) + +# Exclude recovery files in the default vendor ramdisk if including a standalone +# recovery ramdisk in vendor_boot. +ifeq (true,$(BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT)) +ifneq (true,$(BOARD_INCLUDE_RECOVERY_RAMDISK_IN_VENDOR_BOOT)) +$(INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET): $(INTERNAL_RECOVERY_RAMDISK_FILES_TIMESTAMP) +$(INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET): PRIVATE_ADDITIONAL_DIR := $(TARGET_RECOVERY_ROOT_OUT) +endif +endif + +# The vendor test harness ramdisk combines vendor ramdisk and test harness ramdisk. +$(INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) +$(INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET): $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS) + $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_VENDOR_RAMDISK_OUT) $(TARGET_TEST_HARNESS_RAMDISK_OUT) $(PRIVATE_ADDITIONAL_DIR) | $(COMPRESSION_COMMAND) > $@ + +# ----------------------------------------------------------------- +# vendor_boot-test-harness.img. +INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot-test-harness.img + +ifneq ($(BOARD_AVB_VENDOR_BOOT_KEY_PATH),) +$(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH) +endif + +# Depends on vendor_boot.img and vendor_ramdisk-test-harness.cpio$(RAMDISK_EXT) to build the new vendor_boot-test-harness.img +$(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) +$(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET): $(INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET) +$(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET): $(INTERNAL_VENDOR_RAMDISK_FRAGMENT_TARGETS) + $(call pretty,"Target vendor_boot test harness image: $@") + $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_TEST_HARNESS_RAMDISK_TARGET) $(INTERNAL_VENDOR_RAMDISK_FRAGMENT_ARGS) --vendor_boot $@ + $(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 + # Creates a compatibility symlink between two partitions, e.g. /system/vendor to /vendor # $1: from location (e.g $(TARGET_OUT)/vendor) # $2: destination location (e.g. /vendor) @@ -4005,25 +4047,16 @@ endif # BOARD_KERNEL_VERSION endif # BOARD_KERNEL_CONFIG_FILE ifneq ($(my_board_extracted_kernel),true) -ifndef INSTALLED_KERNEL_TARGET -$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \ - is true. Information about the updated kernel cannot be built into OTA update package. \ - You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \ - to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \ - or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \ - BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \ - manually.) -# Clear their values to indicate that these two files does not exist. -BUILT_KERNEL_CONFIGS_FILE := -BUILT_KERNEL_VERSION_FILE := -else - # Tools for decompression that is not in PATH. # Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script. # Algorithms that are in the script but not in this list will be found in PATH. my_decompress_tools := \ lz4:$(HOST_OUT_EXECUTABLES)/lz4 \ +endif # my_board_extracted_kernel + +ifneq ($(my_board_extracted_kernel),true) +ifdef INSTALLED_KERNEL_TARGET $(BUILT_KERNEL_CONFIGS_FILE): .KATI_IMPLICIT_OUTPUTS := $(BUILT_KERNEL_VERSION_FILE) $(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools) $(BUILT_KERNEL_CONFIGS_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair))) @@ -4032,12 +4065,46 @@ $(BUILT_KERNEL_CONFIGS_FILE): $(EXTRACT_KERNEL) $(firstword $(INSTALLED_KERNEL_T --output-configs $@ \ --output-release $(BUILT_KERNEL_VERSION_FILE) -my_decompress_tools := +my_board_extracted_kernel := true +endif # INSTALLED_KERNEL_TARGET +endif # my_board_extracted_kernel + +ifneq ($(my_board_extracted_kernel),true) +ifdef INSTALLED_BOOTIMAGE_TARGET +$(BUILT_KERNEL_CONFIGS_FILE): .KATI_IMPLICIT_OUTPUTS := $(BUILT_KERNEL_VERSION_FILE) +$(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools) +$(BUILT_KERNEL_CONFIGS_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair))) +$(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_UNPACKED_BOOTIMG := $(intermediates)/unpacked_bootimage +$(BUILT_KERNEL_CONFIGS_FILE): \ + $(HOST_OUT_EXECUTABLES)/unpack_bootimg \ + $(EXTRACT_KERNEL) \ + $(INSTALLED_BOOTIMAGE_TARGET) + $(HOST_OUT_EXECUTABLES)/unpack_bootimg --boot_img $(INSTALLED_BOOTIMAGE_TARGET) --out $(PRIVATE_UNPACKED_BOOTIMG) + $(EXTRACT_KERNEL) --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(PRIVATE_UNPACKED_BOOTIMG)/kernel \ + --output-configs $@ \ + --output-release $(BUILT_KERNEL_VERSION_FILE) +my_board_extracted_kernel := true +endif # INSTALLED_BOOTIMAGE_TARGET endif # my_board_extracted_kernel -my_board_extracted_kernel := -endif # INSTALLED_KERNEL_TARGET +ifneq ($(my_board_extracted_kernel),true) +$(warning Neither INSTALLED_KERNEL_TARGET nor INSTALLED_BOOTIMAGE_TARGET is defined when \ + PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS is true. Information about the updated kernel \ + cannot be built into OTA update package. You can fix this by: \ + (1) setting TARGET_NO_KERNEL to false and installing the built kernel to $(PRODUCT_OUT)/kernel,\ + so that kernel information will be extracted from the built kernel; or \ + (2) Add a prebuilt boot image and specify it in BOARD_PREBUILT_BOOTIMAGE; or \ + (3) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \ + BOARD_KERNEL_VERSION manually; or \ + (4) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS manually.) +# Clear their values to indicate that these two files does not exist. +BUILT_KERNEL_CONFIGS_FILE := +BUILT_KERNEL_VERSION_FILE := +endif + +my_decompress_tools := +my_board_extracted_kernel := endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS @@ -4205,13 +4272,22 @@ else ifeq ($(TARGET_PRODUCT),sdk) build_ota_package := false endif + # A target without a kernel may be one of the following: + # - A generic target. In this case, the OTA package usually isn't built. + # PRODUCT_BUILD_GENERIC_OTA_PACKAGE may be set to true to force OTA package + # generation. + # - A real device target, with TARGET_NO_KERNEL set to true and + # BOARD_PREBUILT_BOOTIMAGE set. In this case, it is valid to generate + # an OTA package. ifneq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true) ifneq ($(filter generic%,$(TARGET_DEVICE)),) build_ota_package := false endif - ifeq ($(TARGET_NO_KERNEL),true) - build_ota_package := false - endif + ifeq ($(INSTALLED_BOOTIMAGE_TARGET),) + ifeq ($(TARGET_NO_KERNEL),true) + build_ota_package := false + endif + endif # INSTALLED_BOOTIMAGE_TARGET == "" ifeq ($(recovery_fstab),) build_ota_package := false endif diff --git a/core/android_soong_config_vars.mk b/core/android_soong_config_vars.mk index 74558f56b5..39f01550fb 100644 --- a/core/android_soong_config_vars.mk +++ b/core/android_soong_config_vars.mk @@ -29,6 +29,14 @@ $(call add_soong_config_namespace,ANDROID) $(call add_soong_config_var,ANDROID,TARGET_ENABLE_MEDIADRM_64) $(call add_soong_config_var,ANDROID,BOARD_USES_ODMIMAGE) +ifeq (,$(filter com.google.android.conscrypt,$(PRODUCT_PACKAGES))) + # Prebuilt module SDKs require prebuilt modules to work, and currently + # prebuilt modules are only provided for com.google.android.xxx. If we can't + # find one of them in PRODUCT_PACKAGES then assume com.android.xxx are in use, + # and disable prebuilt SDKs. In particular this applies to AOSP builds. + MODULE_BUILD_FROM_SOURCE := true +endif + # TODO(b/172480615): Remove when platform uses ART Module prebuilts by default. ifeq (,$(filter art_module,$(SOONG_CONFIG_NAMESPACES))) $(call add_soong_config_namespace,art_module) @@ -37,6 +45,13 @@ endif ifneq (,$(findstring .android.art,$(TARGET_BUILD_APPS))) # Build ART modules from source if they are listed in TARGET_BUILD_APPS. SOONG_CONFIG_art_module_source_build := true +else ifeq (,$(filter-out modules_% mainline_modules_%,$(TARGET_PRODUCT))) + # Always build from source for the module targets. This ought to be covered by + # the TARGET_BUILD_APPS check above, but there are test builds that don't set it. + SOONG_CONFIG_art_module_source_build := true +else ifdef MODULE_BUILD_FROM_SOURCE + # Build from source if other Mainline modules are. + SOONG_CONFIG_art_module_source_build := true else ifneq (,$(filter true,$(NATIVE_COVERAGE) $(CLANG_COVERAGE))) # Always build ART APEXes from source in coverage builds since the prebuilts # aren't built with instrumentation. @@ -45,18 +60,36 @@ else ifneq (,$(filter true,$(NATIVE_COVERAGE) $(CLANG_COVERAGE))) else ifneq (,$(SANITIZE_TARGET)$(SANITIZE_HOST)) # Prebuilts aren't built with sanitizers either. SOONG_CONFIG_art_module_source_build := true + MODULE_BUILD_FROM_SOURCE := true else ifneq (,$(PRODUCT_FUCHSIA)) # Fuchsia picks out ART internal packages that aren't available in the # prebuilt. SOONG_CONFIG_art_module_source_build := true +else ifeq (,$(filter x86 x86_64,$(HOST_CROSS_ARCH))) + # We currently only provide prebuilts for x86 on host. This skips prebuilts in + # cuttlefish builds for ARM servers. + SOONG_CONFIG_art_module_source_build := true +else ifneq (,$(filter dex2oatds dex2oats,$(PRODUCT_HOST_PACKAGES))) + # Some products depend on host tools that aren't available as prebuilts. + SOONG_CONFIG_art_module_source_build := true +else ifeq (,$(filter com.google.android.art,$(PRODUCT_PACKAGES))) + # TODO(b/192006406): There is currently no good way to control which prebuilt + # APEX (com.google.android.art or com.android.art) gets picked for deapexing + # to provide dex jars for hiddenapi and dexpreopting. Instead the AOSP APEX is + # completely disabled, and we build from source for AOSP products. + SOONG_CONFIG_art_module_source_build := true else # This sets the default for building ART APEXes from source rather than # prebuilts (in packages/modules/ArtPrebuilt and prebuilt/module_sdk/art) in # all other platform builds. - SOONG_CONFIG_art_module_source_build ?= true + SOONG_CONFIG_art_module_source_build ?= false endif # Apex build mode variables ifdef APEX_BUILD_FOR_PRE_S_DEVICES $(call add_soong_config_var_value,ANDROID,library_linking_strategy,prefer_static) endif + +ifdef MODULE_BUILD_FROM_SOURCE +$(call add_soong_config_var_value,ANDROID,module_build_from_source,true) +endif diff --git a/core/build_id.mk b/core/build_id.mk index 2f9c3f3bf1..84429d27d3 100644 --- a/core/build_id.mk +++ b/core/build_id.mk @@ -18,4 +18,4 @@ # (like "CRB01"). It must be a single word, and is # capitalized by convention. -BUILD_ID=MASTER +BUILD_ID=SC diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk index 51238a36ca..0c806c1852 100644 --- a/core/dex_preopt_config.mk +++ b/core/dex_preopt_config.mk @@ -104,11 +104,11 @@ ifeq ($(WRITE_SOONG_VARIABLES),true) $(call add_json_bool, DisableGenerateProfile, $(filter false,$(WITH_DEX_PREOPT_GENERATE_PROFILE))) $(call add_json_str, ProfileDir, $(PRODUCT_DEX_PREOPT_PROFILE_DIR)) $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) - $(call add_json_list, UpdatableBootJars, $(PRODUCT_UPDATABLE_BOOT_JARS)) + $(call add_json_list, ApexBootJars, $(PRODUCT_APEX_BOOT_JARS)) $(call add_json_list, ArtApexJars, $(filter $(PRODUCT_BOOT_JARS),$(ART_APEX_JARS))) $(call add_json_list, SystemServerJars, $(PRODUCT_SYSTEM_SERVER_JARS)) $(call add_json_list, SystemServerApps, $(PRODUCT_SYSTEM_SERVER_APPS)) - $(call add_json_list, UpdatableSystemServerJars, $(PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS)) + $(call add_json_list, ApexSystemServerJars, $(PRODUCT_APEX_SYSTEM_SERVER_JARS)) $(call add_json_bool, BrokenSuboptimalOrderOfSystemServerJars, $(PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS)) $(call add_json_list, SpeedApps, $(PRODUCT_DEXPREOPT_SPEED_APPS)) $(call add_json_list, PreoptFlags, $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)) diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk index f365347f1b..1983022b5b 100644 --- a/core/dex_preopt_odex_install.mk +++ b/core/dex_preopt_odex_install.mk @@ -61,7 +61,7 @@ ifeq (,$(strip $(built_dex)$(my_prebuilt_src_file)$(LOCAL_SOONG_DEX_JAR))) endif # Don't preopt system server jars that are updatable. -ifneq (,$(filter %:$(LOCAL_MODULE), $(PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS))) +ifneq (,$(filter %:$(LOCAL_MODULE), $(PRODUCT_APEX_SYSTEM_SERVER_JARS))) LOCAL_DEX_PREOPT := endif @@ -275,7 +275,8 @@ endif my_dexpreopt_archs := my_dexpreopt_images := my_dexpreopt_images_deps := -my_dexpreopt_image_locations := +my_dexpreopt_image_locations_on_host := +my_dexpreopt_image_locations_on_device := my_dexpreopt_infix := boot ifeq (true, $(DEXPREOPT_USE_ART_IMAGE)) my_dexpreopt_infix := art @@ -348,7 +349,8 @@ ifdef LOCAL_DEX_PREOPT endif # TARGET_2ND_ARCH endif # LOCAL_MODULE_CLASS - my_dexpreopt_image_locations += $(DEXPREOPT_IMAGE_LOCATIONS_$(my_dexpreopt_infix)) + my_dexpreopt_image_locations_on_host += $(DEXPREOPT_IMAGE_LOCATIONS_ON_HOST$(my_dexpreopt_infix)) + my_dexpreopt_image_locations_on_device += $(DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICE$(my_dexpreopt_infix)) # Record dex-preopt config. DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT) @@ -387,7 +389,8 @@ ifdef LOCAL_DEX_PREOPT $(call end_json_map) $(call add_json_list, Archs, $(my_dexpreopt_archs)) $(call add_json_list, DexPreoptImages, $(my_dexpreopt_images)) - $(call add_json_list, DexPreoptImageLocationsOnHost, $(my_dexpreopt_image_locations)) + $(call add_json_list, DexPreoptImageLocationsOnHost, $(my_dexpreopt_image_locations_on_host)) + $(call add_json_list, DexPreoptImageLocationsOnDevice,$(my_dexpreopt_image_locations_on_device)) $(call add_json_list, PreoptBootClassPathDexFiles, $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)) $(call add_json_list, PreoptBootClassPathDexLocations,$(DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS)) $(call add_json_bool, PreoptExtractedApk, $(my_preopt_for_extracted_apk)) diff --git a/core/java_common.mk b/core/java_common.mk index 1798ca8452..f97f73c5fe 100644 --- a/core/java_common.mk +++ b/core/java_common.mk @@ -21,15 +21,20 @@ endif # Modules can override this logic by specifying # LOCAL_JAVA_LANGUAGE_VERSION explicitly. ifeq (,$(LOCAL_JAVA_LANGUAGE_VERSION)) - ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT))) - LOCAL_JAVA_LANGUAGE_VERSION := 1.7 - else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT))) - LOCAL_JAVA_LANGUAGE_VERSION := 1.8 - else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_USE_PREBUILT_SDKS)) - # TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules - LOCAL_JAVA_LANGUAGE_VERSION := 1.8 - else + ifdef LOCAL_IS_HOST_MODULE + # Host modules always default to 1.9 LOCAL_JAVA_LANGUAGE_VERSION := 1.9 + else + ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT))) + LOCAL_JAVA_LANGUAGE_VERSION := 1.7 + else ifneq (,$(filter $(LOCAL_SDK_VERSION), $(TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT))) + LOCAL_JAVA_LANGUAGE_VERSION := 1.8 + else ifneq (,$(LOCAL_SDK_VERSION)$(TARGET_BUILD_USE_PREBUILT_SDKS)) + # TODO(ccross): allow 1.9 for current and unbundled once we have SDK system modules + LOCAL_JAVA_LANGUAGE_VERSION := 1.8 + else + LOCAL_JAVA_LANGUAGE_VERSION := 1.9 + endif endif endif LOCAL_JAVACFLAGS += -source $(LOCAL_JAVA_LANGUAGE_VERSION) -target $(LOCAL_JAVA_LANGUAGE_VERSION) diff --git a/core/main.mk b/core/main.mk index 6f0277ec0e..c10a3cc541 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1524,6 +1524,9 @@ vendorbootimage: $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) .PHONY: vendorbootimage_debug vendorbootimage_debug: $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) +.PHONY: vendorbootimage_test_harness +vendorbootimage_test_harness: $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) + .PHONY: vendorramdisk vendorramdisk: $(INSTALLED_VENDOR_RAMDISK_TARGET) @@ -1589,6 +1592,7 @@ droidcore-unbundled: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ $(INSTALLED_VENDORIMAGE_TARGET) \ $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \ $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \ + $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) \ $(INSTALLED_VENDOR_RAMDISK_TARGET) \ $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ @@ -1808,6 +1812,7 @@ else ifeq ($(TARGET_BUILD_UNBUNDLED),$(TARGET_BUILD_UNBUNDLED_IMAGE)) $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) \ $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) \ $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \ + $(INSTALLED_VENDOR_TEST_HARNESS_BOOTIMAGE_TARGET) \ $(INSTALLED_VENDOR_RAMDISK_TARGET) \ $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \ ) diff --git a/core/product.mk b/core/product.mk index 015fe44ba9..eb99a9be46 100644 --- a/core/product.mk +++ b/core/product.mk @@ -228,7 +228,7 @@ _product_single_value_vars += PRODUCT_SUPPORTS_VERITY_FEC _product_list_vars += PRODUCT_SYSTEM_SERVER_APPS _product_list_vars += PRODUCT_SYSTEM_SERVER_JARS # List of system_server jars delivered via apex. Format = <apex name>:<jar name>. -_product_list_vars += PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS +_product_list_vars += PRODUCT_APEX_SYSTEM_SERVER_JARS # If true, then suboptimal order of system server jars does not cause an error. _product_single_value_vars += PRODUCT_BROKEN_SUBOPTIMAL_ORDER_OF_SYSTEM_SERVER_JARS @@ -368,7 +368,7 @@ _product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES # A list of <overridden-apex>:<override-apex> pairs that specifies APEX module # overrides to be applied to the APEX names in the boot jar variables -# (PRODUCT_BOOT_JARS, PRODUCT_UPDATABLE_BOOT_JARS etc). +# (PRODUCT_BOOT_JARS, PRODUCT_APEX_BOOT_JARS etc). _product_list_vars += PRODUCT_BOOT_JAR_MODULE_OVERRIDES # Controls for whether different partitions are built for the current product. @@ -389,8 +389,9 @@ _product_single_value_vars += PRODUCT_BUILD_VENDOR_BOOT_IMAGE _product_single_value_vars += PRODUCT_BUILD_VBMETA_IMAGE _product_single_value_vars += PRODUCT_BUILD_SUPER_EMPTY_IMAGE -# List of boot jars delivered via apex -_product_list_vars += PRODUCT_UPDATABLE_BOOT_JARS +# List of boot jars delivered via updatable APEXes, following the same format as +# PRODUCT_BOOT_JARS. +_product_list_vars += PRODUCT_APEX_BOOT_JARS # If set, device uses virtual A/B. _product_single_value_vars += PRODUCT_VIRTUAL_AB_OTA diff --git a/core/product_config.mk b/core/product_config.mk index 5c85fb85f1..a9f3d34efb 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -249,6 +249,15 @@ PRODUCT_BOOT_JARS += $(PRODUCT_BOOT_JARS_EXTRA) PRODUCT_BOOT_JARS := $(call qualify-platform-jars,$(PRODUCT_BOOT_JARS)) +# b/191127295: force core-icu4j onto boot image. It comes from a non-updatable APEX jar, but has +# historically been part of the boot image; even though APEX jars are not meant to be part of the +# boot image. +# TODO(b/191686720): remove PRODUCT_APEX_BOOT_JARS to avoid a special handling of core-icu4j +# in make rules. +PRODUCT_APEX_BOOT_JARS := $(filter-out com.android.i18n:core-icu4j,$(PRODUCT_APEX_BOOT_JARS)) +# All APEX jars come after /system and /system_ext jars, so adding core-icu4j at the end of the list +PRODUCT_BOOT_JARS += com.android.i18n:core-icu4j + # Replaces references to overridden boot jar modules in a boot jars variable. # $(1): Name of a boot jars variable with <apex>:<jar> pairs. define replace-boot-jar-module-overrides @@ -259,7 +268,7 @@ define replace-boot-jar-module-overrides endef $(call replace-boot-jar-module-overrides,PRODUCT_BOOT_JARS) -$(call replace-boot-jar-module-overrides,PRODUCT_UPDATABLE_BOOT_JARS) +$(call replace-boot-jar-module-overrides,PRODUCT_APEX_BOOT_JARS) $(call replace-boot-jar-module-overrides,ART_APEX_JARS) # The extra system server jars must be appended at the end after common system server jars. @@ -303,10 +312,10 @@ ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE endif endif -$(foreach pair,$(PRODUCT_UPDATABLE_BOOT_JARS), \ +$(foreach pair,$(PRODUCT_APEX_BOOT_JARS), \ $(eval jar := $(call word-colon,2,$(pair))) \ $(if $(findstring $(jar), $(PRODUCT_BOOT_JARS)), \ - $(error A jar in PRODUCT_UPDATABLE_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but $(jar) is))) + $(error A jar in PRODUCT_APEX_BOOT_JARS must not be in PRODUCT_BOOT_JARS, but $(jar) is))) ENFORCE_SYSTEM_CERTIFICATE := $(PRODUCT_ENFORCE_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT) ENFORCE_SYSTEM_CERTIFICATE_ALLOW_LIST := $(PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_REQUIREMENT_ALLOW_LIST) diff --git a/core/soong_config.mk b/core/soong_config.mk index ec67560aa0..e0fd9becc3 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -27,6 +27,7 @@ $(call add_json_str, Platform_version_name, $(PLATFORM_VERSION)) $(call add_json_val, Platform_sdk_version, $(PLATFORM_SDK_VERSION)) $(call add_json_str, Platform_sdk_codename, $(PLATFORM_VERSION_CODENAME)) $(call add_json_bool, Platform_sdk_final, $(filter REL,$(PLATFORM_VERSION_CODENAME))) +$(call add_json_val, Platform_sdk_extension_version, $(PLATFORM_SDK_EXTENSION_VERSION)) $(call add_json_csv, Platform_version_active_codenames, $(PLATFORM_VERSION_ALL_CODENAMES)) $(call add_json_str, Platform_security_patch, $(PLATFORM_SECURITY_PATCH)) $(call add_json_str, Platform_preview_sdk_version, $(PLATFORM_PREVIEW_SDK_VERSION)) @@ -141,7 +142,7 @@ $(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(fi $(call add_json_list, ModulesLoadedByPrivilegedModules, $(PRODUCT_LOADED_BY_PRIVILEGED_MODULES)) $(call add_json_list, BootJars, $(PRODUCT_BOOT_JARS)) -$(call add_json_list, UpdatableBootJars, $(PRODUCT_UPDATABLE_BOOT_JARS)) +$(call add_json_list, ApexBootJars, $(PRODUCT_APEX_BOOT_JARS)) $(call add_json_bool, VndkUseCoreVariant, $(TARGET_VNDK_USE_CORE_VARIANT)) $(call add_json_bool, VndkSnapshotBuildArtifacts, $(VNDK_SNAPSHOT_BUILD_ARTIFACTS)) diff --git a/core/sysprop.mk b/core/sysprop.mk index 0fc96e0ad5..ec181f5a1f 100644 --- a/core/sysprop.mk +++ b/core/sysprop.mk @@ -430,7 +430,7 @@ INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop $(eval $(call build-properties,\ odm,\ $(INSTALLED_ODM_BUILD_PROP_TARGET),\ - $(_prop_files),\ + $(_prop_files_),\ $(_prop_vars_),\ $(empty),\ $(empty),\ diff --git a/core/tasks/art-host-tests.mk b/core/tasks/art-host-tests.mk index d771b063e9..b9a349d0a1 100644 --- a/core/tasks/art-host-tests.mk +++ b/core/tasks/art-host-tests.mk @@ -29,6 +29,7 @@ $(art_host_tests_zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_art $(art_host_tests_zip) : $(COMPATIBILITY.art-host-tests.FILES) $(my_host_shared_lib_for_art_host_tests) $(SOONG_ZIP) echo $(sort $(COMPATIBILITY.art-host-tests.FILES)) | tr " " "\n" > $@.list grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true + $(hide) touch $@-host-libs.list $(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \ echo $$shared_lib >> $@-host-libs.list; \ done diff --git a/core/tasks/catbox.mk b/core/tasks/catbox.mk index 911c372ef9..443f4bbe95 100644 --- a/core/tasks/catbox.mk +++ b/core/tasks/catbox.mk @@ -15,6 +15,7 @@ test_suite_name := catbox test_suite_tradefed := catbox-tradefed test_suite_readme := test/catbox/tools/catbox-tradefed/README +test_suite_tools := $(HOST_OUT_JAVA_LIBRARIES)/catbox-report-lib.jar include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk diff --git a/core/version_defaults.mk b/core/version_defaults.mk index eb9d51e920..dbc32e1157 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -155,6 +155,12 @@ ifndef PLATFORM_SDK_VERSION endif .KATI_READONLY := PLATFORM_SDK_VERSION +# This is the sdk extension version of this tree. +PLATFORM_SDK_EXTENSION_VERSION :=$= 1 + +# This is the sdk extension version that PLATFORM_SDK_VERSION ships with. +PLATFORM_BASE_SDK_EXTENSION_VERSION :=$= 0 + ifeq (REL,$(PLATFORM_VERSION_CODENAME)) PLATFORM_PREVIEW_SDK_VERSION := 0 else @@ -240,7 +246,7 @@ ifndef PLATFORM_SECURITY_PATCH # It must be of the form "YYYY-MM-DD" on production devices. # It must match one of the Android Security Patch Level strings of the Public Security Bulletins. # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty. - PLATFORM_SECURITY_PATCH := 2021-08-05 + PLATFORM_SECURITY_PATCH := 2021-11-05 endif .KATI_READONLY := PLATFORM_SECURITY_PATCH diff --git a/target/board/BoardConfigGkiCommon.mk b/target/board/BoardConfigGkiCommon.mk index 1a8c6b1bb9..f480b936d9 100644 --- a/target/board/BoardConfigGkiCommon.mk +++ b/target/board/BoardConfigGkiCommon.mk @@ -22,6 +22,9 @@ BOARD_GKI_SIGNING_ALGORITHM := SHA256_RSA2048 # See b/178559811 for more details. BOARD_GKI_SIGNING_SIGNATURE_ARGS := --prop foo:bar +# Sets boot SPL. +BOOT_SECURITY_PATCH = $(PLATFORM_SECURITY_PATCH) + # Boot image with ramdisk and kernel BOARD_RAMDISK_USE_LZ4 := true BOARD_BOOT_HEADER_VERSION := 4 diff --git a/target/board/BoardConfigModuleCommon.mk b/target/board/BoardConfigModuleCommon.mk index 983247434e..24c01a58ef 100644 --- a/target/board/BoardConfigModuleCommon.mk +++ b/target/board/BoardConfigModuleCommon.mk @@ -4,7 +4,3 @@ # Required for all module devices. TARGET_USES_64_BIT_BINDER := true - -# Necessary to make modules able to use the VNDK via 'use_vendor: true' -# TODO(b/185769808): look into whether this is still used. -BOARD_VNDK_VERSION := current diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk index d10580edfb..49ae216981 100644 --- a/target/board/generic_arm64/BoardConfig.mk +++ b/target/board/generic_arm64/BoardConfig.mk @@ -56,6 +56,7 @@ include build/make/target/board/BoardConfigGsiCommon.mk include build/make/target/board/BoardConfigGkiCommon.mk BOARD_KERNEL-4.19-GZ_BOOTIMAGE_PARTITION_SIZE := 47185920 +BOARD_KERNEL-4.19-GZ-ALLSYMS_BOOTIMAGE_PARTITION_SIZE := 47185920 BOARD_KERNEL-5.4_BOOTIMAGE_PARTITION_SIZE := 67108864 BOARD_KERNEL-5.4-ALLSYMS_BOOTIMAGE_PARTITION_SIZE := 67108864 BOARD_KERNEL-5.4-GZ_BOOTIMAGE_PARTITION_SIZE := 47185920 @@ -78,6 +79,7 @@ BOARD_KERNEL_BINARIES := \ ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) BOARD_KERNEL_BINARIES += \ + kernel-4.19-gz-allsyms \ kernel-5.4-allsyms kernel-5.4-gz-allsyms kernel-5.4-lz4-allsyms \ kernel-5.10-allsyms kernel-5.10-gz-allsyms kernel-5.10-lz4-allsyms \ diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk index 39dc7ba378..b331af447b 100644 --- a/target/board/generic_arm64/device.mk +++ b/target/board/generic_arm64/device.mk @@ -29,12 +29,13 @@ $(call dist-for-goals, dist_files, kernel/prebuilts/5.10/arm64/prebuilt-info.txt ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) PRODUCT_COPY_FILES += \ - kernel/prebuilts/5.4/arm64/kernel-5.4:kernel-5.4-allsyms \ - kernel/prebuilts/5.4/arm64/kernel-5.4-gz:kernel-5.4-gz-allsyms \ - kernel/prebuilts/5.4/arm64/kernel-5.4-lz4:kernel-5.4-lz4-allsyms \ - kernel/prebuilts/5.10/arm64/kernel-5.10:kernel-5.10-allsyms \ - kernel/prebuilts/5.10/arm64/kernel-5.10-gz:kernel-5.10-gz-allsyms \ - kernel/prebuilts/5.10/arm64/kernel-5.10-lz4:kernel-5.10-lz4-allsyms \ + kernel/prebuilts/4.19/arm64/kernel-4.19-gz-allsyms:kernel-4.19-gz-allsyms \ + kernel/prebuilts/5.4/arm64/kernel-5.4-allsyms:kernel-5.4-allsyms \ + kernel/prebuilts/5.4/arm64/kernel-5.4-gz-allsyms:kernel-5.4-gz-allsyms \ + kernel/prebuilts/5.4/arm64/kernel-5.4-lz4-allsyms:kernel-5.4-lz4-allsyms \ + kernel/prebuilts/5.10/arm64/kernel-5.10-allsyms:kernel-5.10-allsyms \ + kernel/prebuilts/5.10/arm64/kernel-5.10-gz-allsyms:kernel-5.10-gz-allsyms \ + kernel/prebuilts/5.10/arm64/kernel-5.10-lz4-allsyms:kernel-5.10-lz4-allsyms \ endif diff --git a/target/board/generic_x86_64/device.mk b/target/board/generic_x86_64/device.mk index e195bd3fad..f31a49155b 100755 --- a/target/board/generic_x86_64/device.mk +++ b/target/board/generic_x86_64/device.mk @@ -23,8 +23,8 @@ $(call dist-for-goals, dist_files, kernel/prebuilts/5.10/x86_64/prebuilt-info.tx ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) PRODUCT_COPY_FILES += \ - kernel/prebuilts/5.4/x86_64/kernel-5.4:kernel-5.4-allsyms \ - kernel/prebuilts/5.10/x86_64/kernel-5.10:kernel-5.10-allsyms \ + kernel/prebuilts/5.4/x86_64/kernel-5.4-allsyms:kernel-5.4-allsyms \ + kernel/prebuilts/5.10/x86_64/kernel-5.10-allsyms:kernel-5.10-allsyms \ endif diff --git a/target/product/base_system.mk b/target/product/base_system.mk index 50f1fb5f7f..14ce1af744 100644 --- a/target/product/base_system.mk +++ b/target/product/base_system.mk @@ -52,9 +52,7 @@ PRODUCT_PACKAGES += \ com.android.adbd \ com.android.appsearch \ com.android.conscrypt \ - com.android.cronet \ com.android.extservices \ - com.android.geotz \ com.android.i18n \ com.android.ipsec \ com.android.location.provider \ @@ -153,6 +151,7 @@ PRODUCT_PACKAGES += \ libgui \ libhardware \ libhardware_legacy \ + libincident \ libinput \ libinputflinger \ libiprouteutil \ diff --git a/target/product/default_art_config.mk b/target/product/default_art_config.mk index a93e573710..1a32fd9258 100644 --- a/target/product/default_art_config.mk +++ b/target/product/default_art_config.mk @@ -27,7 +27,7 @@ endif # # ART APEX jars (1) are defined in ART_APEX_JARS. System, system_ext, and non updatable boot jars # are defined below in PRODUCT_BOOT_JARS. All updatable APEX boot jars are part of -# PRODUCT_UPDATABLE_BOOT_JARS. +# PRODUCT_APEX_BOOT_JARS. # # The actual runtime ordering matching above is determined by derive_classpath service at runtime. # See packages/modules/SdkExtensions/README.md for more details. @@ -45,14 +45,12 @@ PRODUCT_BOOT_JARS += \ voip-common \ ims-common -# Non-updatable APEX jars. Keep the list sorted. -PRODUCT_BOOT_JARS += \ - com.android.i18n:core-icu4j - -# Updatable APEX boot jars. Keep the list sorted by module names and then library names. -PRODUCT_UPDATABLE_BOOT_JARS := \ +# APEX boot jars. Keep the list sorted by module names and then library names. +# Note: core-icu4j is moved back to PRODUCT_BOOT_JARS in product_config.mk at a later stage. +PRODUCT_APEX_BOOT_JARS := \ com.android.appsearch:framework-appsearch \ com.android.conscrypt:conscrypt \ + com.android.i18n:core-icu4j \ com.android.ipsec:android.net.ipsec.ike \ com.android.media:updatable-media \ com.android.mediaprovider:framework-mediaprovider \ @@ -65,12 +63,11 @@ PRODUCT_UPDATABLE_BOOT_JARS := \ com.android.tethering:framework-tethering \ com.android.wifi:framework-wifi -# Updatable APEX system server jars. Keep the list sorted by module names and then library names. -PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS := \ +# APEX system server jars. Keep the list sorted by module names and then library names. +PRODUCT_APEX_SYSTEM_SERVER_JARS := \ com.android.appsearch:service-appsearch \ com.android.media:service-media-s \ com.android.permission:service-permission \ - com.android.geotz:geotz # Minimal configuration for running dex2oat (default argument values). # PRODUCT_USES_DEFAULT_ART_CONFIG must be true to enable boot image compilation. diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk index ecce01a264..cb4fdcb332 100644 --- a/target/product/gsi/Android.mk +++ b/target/product/gsi/Android.mk @@ -117,7 +117,13 @@ VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR)) NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR)) PLATFORM_ABI_DUMPS := $(call find-abi-dump-paths,$(PLATFORM_ABI_DUMP_DIR)) +# Check for superfluous lsdump files. Since LSDUMP_PATHS only covers the +# libraries that can be built from source in the current build, and prebuilts of +# Mainline modules may be in use, we also allow the libs in STUB_LIBRARIES for +# NDK and platform ABIs. + $(check-vndk-abi-dump-list-timestamp): PRIVATE_LSDUMP_PATHS := $(LSDUMP_PATHS) +$(check-vndk-abi-dump-list-timestamp): PRIVATE_STUB_LIBRARIES := $(STUB_LIBRARIES) $(check-vndk-abi-dump-list-timestamp): $(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \ $(call filter-abi-dump-paths,LLNDK VNDK-SP VNDK-core,$(PRIVATE_LSDUMP_PATHS)), \ @@ -126,13 +132,15 @@ $(check-vndk-abi-dump-list-timestamp): echo -e "Found unexpected ABI reference dump files under $(VNDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dump files.") $(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \ - $(call filter-abi-dump-paths,NDK,$(PRIVATE_LSDUMP_PATHS)), \ + $(call filter-abi-dump-paths,NDK,$(PRIVATE_LSDUMP_PATHS)) \ + $(addsuffix .lsdump,$(PRIVATE_STUB_LIBRARIES)), \ $(notdir $(NDK_ABI_DUMPS)))))) $(if $(added_ndk_abi_dumps), \ echo -e "Found unexpected ABI reference dump files under $(NDK_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dump files.") $(eval added_platform_abi_dumps := $(strip $(sort $(filter-out \ - $(call filter-abi-dump-paths,PLATFORM,$(PRIVATE_LSDUMP_PATHS)), \ + $(call filter-abi-dump-paths,PLATFORM,$(PRIVATE_LSDUMP_PATHS)) \ + $(addsuffix .lsdump,$(PRIVATE_STUB_LIBRARIES)), \ $(notdir $(PLATFORM_ABI_DUMPS)))))) $(if $(added_platform_abi_dumps), \ echo -e "Found unexpected ABI reference dump files under $(PLATFORM_ABI_DUMP_DIR). It is caused by mismatch between Android.bp and the dump files. Run \`find \$${ANDROID_BUILD_TOP}/$(PLATFORM_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_platform_abi_dumps)) ')' -delete\` to delete the dump files.") diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk index 8591a83e06..d924d0bc11 100644 --- a/target/product/gsi_release.mk +++ b/target/product/gsi_release.mk @@ -71,3 +71,6 @@ PRODUCT_BUILD_USERDATA_IMAGE := false PRODUCT_BUILD_VENDOR_IMAGE := false PRODUCT_BUILD_SUPER_PARTITION := false PRODUCT_BUILD_SUPER_EMPTY_IMAGE := false + +# Always build modules from source +MODULE_BUILD_FROM_SOURCE := true diff --git a/target/product/iorap_large_memory_config.mk b/target/product/iorap_large_memory_config.mk index 9aa664214d..0c6c89af93 100644 --- a/target/product/iorap_large_memory_config.mk +++ b/target/product/iorap_large_memory_config.mk @@ -12,7 +12,3 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -# Disable Camera pinner by default -PRODUCT_PRODUCT_PROPERTIES += \ - pinner.pin_camera=false diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index c583d013b3..babfc7dcad 100644 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -704,6 +704,31 @@ def AddApexInfo(output_zip): common.ZipWrite(output_zip, output_file, arc_name) +def AddVbmetaDigest(output_zip): + """Write the vbmeta digest to the output dir and zipfile.""" + + # Calculate the vbmeta digest and put the result in to META/ + boot_images = OPTIONS.info_dict.get("boot_images") + # Disable the digest calculation if the target_file is used as a container + # for boot images. + boot_container = boot_images and len(boot_images.split()) >= 2 + if (OPTIONS.info_dict.get("avb_enable") == "true" and not boot_container and + OPTIONS.info_dict.get("avb_building_vbmeta_image") == "true"): + avbtool = OPTIONS.info_dict["avb_avbtool"] + digest = verity_utils.CalculateVbmetaDigest(OPTIONS.input_tmp, avbtool) + vbmeta_digest_txt = os.path.join(OPTIONS.input_tmp, "META", + "vbmeta_digest.txt") + with open(vbmeta_digest_txt, 'w') as f: + f.write(digest) + # writes to the output zipfile + if output_zip: + arc_name = "META/vbmeta_digest.txt" + if arc_name in output_zip.namelist(): + OPTIONS.replace_updated_files_list.append(arc_name) + else: + common.ZipWriteStr(output_zip, arc_name, digest) + + def AddImagesToTargetFiles(filename): """Creates and adds images (boot/recovery/system/...) to a target_files.zip. @@ -957,19 +982,7 @@ def AddImagesToTargetFiles(filename): with open(pack_radioimages_txt) as f: AddPackRadioImages(output_zip, f.readlines()) - # Calculate the vbmeta digest and put the result in to META/ - boot_images = OPTIONS.info_dict.get("boot_images") - # Disable the digest calculation if the target_file is used as a container - # for boot images. - boot_container = boot_images and len(boot_images.split()) >= 2 - if (OPTIONS.info_dict.get("avb_enable") == "true" and not boot_container and - OPTIONS.info_dict.get("avb_building_vbmeta_image") == "true"): - avbtool = OPTIONS.info_dict["avb_avbtool"] - digest = verity_utils.CalculateVbmetaDigest(OPTIONS.input_tmp, avbtool) - vbmeta_digest_txt = os.path.join(OPTIONS.input_tmp, "META", - "vbmeta_digest.txt") - with open(vbmeta_digest_txt, 'w') as f: - f.write(digest) + AddVbmetaDigest(output_zip) if output_zip: common.ZipClose(output_zip) diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py index 893266f95a..ef4c69cb2e 100644 --- a/tools/releasetools/apex_utils.py +++ b/tools/releasetools/apex_utils.py @@ -340,6 +340,8 @@ def SignUncompressedApex(avbtool, apex_file, payload_key, container_key, zip_items = apex_fd.namelist() payload_info = ParseApexPayloadInfo(avbtool, payload_file) + if no_hashtree is None: + no_hashtree = payload_info.get("Tree Size", 0) == 0 SignApexPayload( avbtool, payload_file, @@ -385,8 +387,8 @@ def SignUncompressedApex(avbtool, apex_file, payload_key, container_key, def SignCompressedApex(avbtool, apex_file, payload_key, container_key, - container_pw, apk_keys, codename_to_api_level_map, - no_hashtree, signing_args=None): + container_pw, apk_keys, codename_to_api_level_map, + no_hashtree, signing_args=None): """Signs the current compressed APEX with the given payload/container keys. Args: @@ -516,6 +518,7 @@ def SignApex(avbtool, apex_data, payload_key, container_key, container_pw, raise ApexInfoError( 'Failed to get type for {}:\n{}'.format(apex_file, e)) + def GetApexInfoFromTargetFiles(input_file, partition, compressed_only=True): """ Get information about system APEX stored in the input_file zip @@ -558,7 +561,7 @@ def GetApexInfoFromTargetFiles(input_file, partition, compressed_only=True): for apex_filename in os.listdir(target_dir): apex_filepath = os.path.join(target_dir, apex_filename) if not os.path.isfile(apex_filepath) or \ - not zipfile.is_zipfile(apex_filepath): + not zipfile.is_zipfile(apex_filepath): logger.info("Skipping %s because it's not a zipfile", apex_filepath) continue apex_info = ota_metadata_pb2.ApexInfo() diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index 2859948d1a..0842af9018 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -428,7 +428,7 @@ def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map, if is_compressed: uncompressed = tempfile.NamedTemporaryFile() with gzip.open(unsigned.name, "rb") as in_file, \ - open(uncompressed.name, "wb") as out_file: + open(uncompressed.name, "wb") as out_file: shutil.copyfileobj(in_file, out_file) # Finally, close the "unsigned" file (which is gzip compressed), and then @@ -468,7 +468,7 @@ def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map, # Recompress the file after it has been signed. compressed = tempfile.NamedTemporaryFile() with open(signed.name, "rb") as in_file, \ - gzip.open(compressed.name, "wb") as out_file: + gzip.open(compressed.name, "wb") as out_file: shutil.copyfileobj(in_file, out_file) data = compressed.read() @@ -484,21 +484,21 @@ def SignApk(data, keyname, pw, platform_api_level, codename_to_api_level_map, def IsBuildPropFile(filename): return filename in ( - "SYSTEM/etc/prop.default", - "BOOT/RAMDISK/prop.default", - "RECOVERY/RAMDISK/prop.default", + "SYSTEM/etc/prop.default", + "BOOT/RAMDISK/prop.default", + "RECOVERY/RAMDISK/prop.default", - "VENDOR_BOOT/RAMDISK/default.prop", - "VENDOR_BOOT/RAMDISK/prop.default", + "VENDOR_BOOT/RAMDISK/default.prop", + "VENDOR_BOOT/RAMDISK/prop.default", - # ROOT/default.prop is a legacy path, but may still exist for upgrading - # devices that don't support `property_overrides_split_enabled`. - "ROOT/default.prop", + # ROOT/default.prop is a legacy path, but may still exist for upgrading + # devices that don't support `property_overrides_split_enabled`. + "ROOT/default.prop", - # RECOVERY/RAMDISK/default.prop is a legacy path, but will always exist - # as a symlink in the current code. So it's a no-op here. Keeping the - # path here for clarity. - "RECOVERY/RAMDISK/default.prop") or filename.endswith("build.prop") + # RECOVERY/RAMDISK/default.prop is a legacy path, but will always exist + # as a symlink in the current code. So it's a no-op here. Keeping the + # path here for clarity. + "RECOVERY/RAMDISK/default.prop") or filename.endswith("build.prop") def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, @@ -561,7 +561,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, # We've asserted not having a case with only one of them PRESIGNED. if (payload_key not in common.SPECIAL_CERT_STRINGS and - container_key not in common.SPECIAL_CERT_STRINGS): + container_key not in common.SPECIAL_CERT_STRINGS): print(" signing: %-*s container (%s)" % ( maxsize, name, container_key)) print(" : %-*s payload (%s)" % ( @@ -575,7 +575,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, key_passwords, apk_keys, codename_to_api_level_map, - no_hashtree=True, + no_hashtree=None, # Let apex_util determine if hash tree is needed signing_args=OPTIONS.avb_extra_args.get('apex')) common.ZipWrite(output_tf_zip, signed_apex, filename) @@ -658,7 +658,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, # Updates system_other.avbpubkey in /product/etc/. elif filename in ( "PRODUCT/etc/security/avb/system_other.avbpubkey", - "SYSTEM/product/etc/security/avb/system_other.avbpubkey"): + "SYSTEM/product/etc/security/avb/system_other.avbpubkey"): # Only update system_other's public key, if the corresponding signing # key is specified via --avb_system_other_key. signing_key = OPTIONS.avb_keys.get("system_other") @@ -671,7 +671,7 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, # Should NOT sign boot-debug.img. elif filename in ( "BOOT/RAMDISK/force_debuggable", - "BOOT/RAMDISK/first_stage_ramdisk/force_debuggable"): + "BOOT/RAMDISK/first_stage_ramdisk/force_debuggable"): raise common.ExternalError("debuggable boot.img cannot be signed") # A non-APK file; copy it verbatim. @@ -762,7 +762,8 @@ def ReplaceCerts(data): # it's only checking entries with global seinfo at the moment (i.e. ignoring # the ones with inner packages). (Bug: 69479366) root = ElementTree.fromstring(data) - signatures = [signer.attrib['signature'] for signer in root.findall('signer')] + signatures = [signer.attrib['signature'] + for signer in root.findall('signer')] assert len(signatures) == len(set(signatures)), \ "Found duplicate entries after cert replacement: {}".format(data) @@ -807,7 +808,7 @@ def RewriteProps(data): if line and line[0] != '#' and "=" in line: key, value = line.split("=", 1) if (key.startswith("ro.") and - key.endswith((".build.fingerprint", ".build.thumbprint"))): + key.endswith((".build.fingerprint", ".build.thumbprint"))): pieces = value.split("/") pieces[-1] = EditTags(pieces[-1]) value = "/".join(pieces) @@ -1000,7 +1001,7 @@ def ReplaceAvbSigningKeys(misc_info): ReplaceAvbPartitionSigningKey(partition) for custom_partition in misc_info.get( - "avb_custom_images_partition_list", "").strip().split(): + "avb_custom_images_partition_list", "").strip().split(): ReplaceAvbPartitionSigningKey(custom_partition) @@ -1065,7 +1066,7 @@ def BuildKeyMap(misc_info, key_mapping_options): devkeydir + "/shared": d + "/shared", devkeydir + "/platform": d + "/platform", devkeydir + "/networkstack": d + "/networkstack", - }) + }) else: OPTIONS.key_map[s] = d @@ -1168,8 +1169,8 @@ def ReadApexKeysInfo(tf_zip): if container_cert == 'PRESIGNED' and container_private_key == 'PRESIGNED': container_key = 'PRESIGNED' elif CompareKeys( - container_cert, OPTIONS.public_key_suffix, - container_private_key, OPTIONS.private_key_suffix): + container_cert, OPTIONS.public_key_suffix, + container_private_key, OPTIONS.private_key_suffix): container_key = container_cert[:-len(OPTIONS.public_key_suffix)] else: raise ValueError("Failed to parse container keys: \n{}".format(line)) |