diff options
author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2020-04-17 21:40:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2020-04-17 21:40:04 +0000 |
commit | 49e2f606a84625cf0152b4d7887288a0c6ef9fb9 (patch) | |
tree | b51f778c16fcbe61a8c0f46fe8b6bb12395a5d7f | |
parent | 39215281d8c284f582c196deedfa1ccc55816ab0 (diff) | |
parent | df4084ab48caf0f1395cbfd100ce7ec535c43d63 (diff) | |
download | build-platform-tools-30.0.0.tar.gz |
Merge "Snap for 6405781 from 2cbcf3bda242cf1ce911e8470b2b379f48b8d695 to sdk-release" into sdk-releaseplatform-tools-30.0.0
42 files changed, 339 insertions, 105 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index 673856c469..97dc31f71e 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -713,6 +713,15 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/apex/com.android.apex.cts.sh $(call add-clean-step, find $(SOONG_OUT_DIR)/.intermediates -type d -name "android_*_recovery*" -print0 | xargs -0 rm -rf) $(call add-clean-step, find $(SOONG_OUT_DIR)/.intermediates -type d -name "android_*_vendor*" -print0 | xargs -0 rm -rf) +# Clean up VTS-Core and VTS10 related artifacts. +$(call add-clean-step, rm -rf $(HOST_OUT)/vts-core/*) +$(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts-core-tradefed.jar) +$(call add-clean-step, rm -rf $(HOST_OUT)/vts10/*) +$(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts10-tradefed.jar) +# Clean up VTS again as VTS-Core will be renamed to VTS +$(call add-clean-step, rm -rf $(HOST_OUT)/vts/*) +$(call add-clean-step, rm -rf $(HOST_OUT)/framework/vts-tradefed.jar) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/common/strings.mk b/common/strings.mk index ce6d6fbe9f..ba20e272c0 100644 --- a/common/strings.mk +++ b/common/strings.mk @@ -88,7 +88,7 @@ $(word $(1),$(subst :,$(space),$(2))) endef ########################################################### -## Convert "a=b c= d e = f" into "a=b c=d e=f" +## Convert "a=b c= d e = f = g h=" into "a=b c=d e= f=g h=" ## ## $(1): list to collapse ## $(2): if set, separator word; usually "=", ":", or ":=" @@ -96,11 +96,29 @@ endef ########################################################### define collapse-pairs +$(strip \ $(eval _cpSEP := $(strip $(if $(2),$(2),=)))\ -$(strip $(subst $(space)$(_cpSEP)$(space),$(_cpSEP),$(strip \ - $(subst $(_cpSEP), $(_cpSEP) ,$(1)))$(space))) +$(eval _cpLHS :=)\ +$(eval _cpRET :=)\ +$(foreach w,$(subst $(space)$(_cpSEP),$(_cpSEP),$(strip \ + $(subst $(_cpSEP),$(space)$(_cpSEP)$(space),$(1)))),\ + $(if $(findstring $(_cpSEP),$(w)),\ + $(eval _cpRET += $(_cpLHS))$(eval _cpLHS := $(w)),\ + $(eval _cpRET += $(_cpLHS)$(w))$(eval _cpLHS :=)))\ +$(if $(_cpLHS),$(_cpRET)$(space)$(_cpLHS),$(_cpRET))\ +$(eval _cpSEP :=)\ +$(eval _cpLHS :=)\ +$(eval _cpRET :=)) endef +# Sanity check for collapse-pairs. +ifneq (a=b c=d e= f=g h=,$(call collapse-pairs,a=b c= d e = f = g h=)) + $(error collapse-pairs sanity check failure) +endif +ifneq (a:=b c:=d e:=f g:=h,$(call collapse-pairs,a:=b c:= d e :=f g := h,:=)) + $(error collapse-pairs sanity check failure) +endif + ########################################################### ## Given a list of pairs, if multiple pairs have the same ## first components, keep only the first pair. diff --git a/core/Makefile b/core/Makefile index bda0b231fa..83683a0a11 100644 --- a/core/Makefile +++ b/core/Makefile @@ -39,6 +39,16 @@ $(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \ use ODM_MANIFEST_FILES / vintf_fragments instead!)) \ ) endef + +# TODO(b/140560012): Flip BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES to default +# false after all problematic devices are tagged. +check_elf_prebuilt_product_copy_files := +ifneq (,$(filter false,$(BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES))) +check_elf_prebuilt_product_copy_files := true +endif +check_elf_prebuilt_product_copy_files_hint := \ + found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead. + # filter out the duplicate <source file>:<dest file> pairs. unique_product_copy_files_pairs := $(foreach cf,$(PRODUCT_COPY_FILES), \ @@ -59,7 +69,10 @@ $(foreach cf,$(unique_product_copy_files_pairs), \ $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \ $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\ $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\ - $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \ + $(if $(and $(filter true,$(check_elf_prebuilt_product_copy_files)), \ + $(filter bin lib lib64,$(subst /,$(space),$(_dest)))), \ + $(eval $(call copy-non-elf-file-checked,$(_src),$(_fulldest),$(check_elf_prebuilt_product_copy_files_hint))), \ + $(eval $(call copy-one-file,$(_src),$(_fulldest))))))) \ $(eval unique_product_copy_files_destinations += $(_dest)))) # Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries) @@ -418,7 +431,7 @@ endif $(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT) $(POST_PROCESS_PROPS) @echo Target buildinfo: $@ @mkdir -p $(dir $@) - $(hide) echo > $@ + $(hide) rm -f $@ && touch $@ ifneq ($(PRODUCT_OEM_PROPERTIES),) $(hide) echo "#" >> $@; \ echo "# PRODUCT_OEM_PROPERTIES" >> $@; \ @@ -517,7 +530,7 @@ endif # property_overrides_split_enabled $(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop) $(vendor_prop_files) @echo Target vendor buildinfo: $@ @mkdir -p $(dir $@) - $(hide) echo > $@ + $(hide) rm -f $@ && touch $@ ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) $(hide) echo ro.boot.dynamic_partitions=true >> $@ endif @@ -584,7 +597,7 @@ FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \ $(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(product_prop_files) @echo Target product buildinfo: $@ @mkdir -p $(dir $@) - $(hide) echo > $@ + $(hide) rm -f $@ && touch $@ ifdef BOARD_USES_PRODUCTIMAGE $(hide) $(call generate-common-build-props,product,$@) endif # BOARD_USES_PRODUCTIMAGE @@ -625,7 +638,7 @@ FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ $(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(odm_prop_files) @echo Target odm buildinfo: $@ @mkdir -p $(dir $@) - $(hide) echo > $@ + $(hide) rm -f $@ && touch $@ $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@ $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@ $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@ @@ -666,7 +679,7 @@ FINAL_SYSTEM_EXT_PROPERTIES := $(call uniq-pairs-by-first-component, \ $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(system_ext_prop_files) @echo Target system_ext buildinfo: $@ @mkdir -p $(dir $@) - $(hide) echo > $@ + $(hide) rm -f $@ && touch $@ $(hide) $(call generate-common-build-props,system_ext,$@) $(hide) $(foreach file,$(system_ext_prop_files), \ if [ -f "$(file)" ]; then \ @@ -2121,13 +2134,12 @@ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \ $(hide) cat $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) >> $@ $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@) -ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET - INTERNAL_RECOVERYIMAGE_ARGS := \ - --kernel $(recovery_kernel) --ramdisk $(recovery_ramdisk) +ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER))) + INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk) ifdef GENERIC_KERNEL_CMDLINE INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)" endif -else # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined +else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER) INTERNAL_RECOVERYIMAGE_ARGS := \ $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ --ramdisk $(recovery_ramdisk) @@ -2155,6 +2167,9 @@ ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET) endif endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined +ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS + BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS) +endif $(recovery_ramdisk): $(MKBOOTFS) $(MINIGZIP) \ $(INTERNAL_ROOT_FILES) \ @@ -2197,11 +2212,11 @@ $(recovery_ramdisk): $(MKBOOTFS) $(MINIGZIP) \ # $(2): kernel file define build-recoveryimage-target $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \ - $(MKBOOTIMG) --kernel $(2) $(MKBOOTIMG_KERNEL_ARG) $(INTERNAL_RECOVERYIMAGE_ARGS) \ - $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) \ + $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \ + $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \ --output $(1).unsigned, \ - $(MKBOOTIMG) --kernel $(2) $(MKBOOTIMG_KERNEL_ARG) $(INTERNAL_RECOVERYIMAGE_ARGS) \ - $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) \ + $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \ + $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \ --output $(1)) $(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\ $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\ @@ -2557,7 +2572,12 @@ endif # BUILDING_RAMDISK_IMAGE # can only be used if the device is unlocked with verification error. ifneq ($(strip $(TARGET_NO_KERNEL)),true) -INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-test-harness.img +ifneq ($(strip $(BOARD_KERNEL_BINARIES)),) + INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-test-harness,$(BOARD_KERNEL_BINARIES)), \ + $(PRODUCT_OUT)/$(k).img) +else + INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-test-harness.img +endif # Replace ramdisk-debug.img in $(MKBOOTIMG) ARGS with ramdisk-test-harness.img to build boot-test-harness.img INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS := $(subst $(INSTALLED_DEBUG_RAMDISK_TARGET),$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET),$(INTERNAL_DEBUG_BOOTIMAGE_ARGS)) @@ -2570,17 +2590,22 @@ ifneq ($(BOARD_AVB_BOOT_KEY_PATH),) $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH) endif +# $(1): output file +define build-boot-test-harness-target + $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-test-harness,kernel,$(notdir $(1)))) \ + $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ + $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@)) +endef + # Build the new boot-test-harness.img, based on boot-debug.img and ramdisk-test-harness.img. $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) $(call pretty,"Target boot test harness image: $@") - $(MKBOOTIMG) $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ - $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@)) + $(call build-boot-test-harness-target,$@) .PHONY: bootimage_test_harness-nodeps bootimage_test_harness-nodeps: $(MKBOOTIMG) echo "make $@: ignoring dependencies" - $(MKBOOTIMG) $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET) - $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET))) + $(foreach b,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET),$(call build-boot-test-harness-target,$b)) endif # TARGET_NO_KERNEL endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true @@ -4184,6 +4209,7 @@ ifdef PRODUCT_EXTRA_RECOVERY_KEYS $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $@ endif $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $@ + $(hide) echo 'recovery_mkbootimg_args=$(BOARD_RECOVERY_MKBOOTIMG_ARGS)' >> $@ $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $@ $(hide) echo "multistage_support=1" >> $@ $(hide) echo "blockimgdiff_versions=3,4" >> $@ @@ -4494,9 +4520,9 @@ ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_ ifdef INSTALLED_KERNEL_TARGET cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/ endif -ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET +ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER))) echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline -else # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined +else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER) ifdef INSTALLED_2NDBOOTLOADER_TARGET cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second endif @@ -5176,6 +5202,20 @@ $(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_S vendorimage: $(INSTALLED_QEMU_VENDORIMAGE) droidcore: $(INSTALLED_QEMU_VENDORIMAGE) endif + +ifdef INSTALLED_RAMDISK_TARGET +ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET +ifdef INTERNAL_VENDOR_RAMDISK_TARGET +INSTALLED_QEMU_RAMDISKIMAGE := $(PRODUCT_OUT)/ramdisk-qemu.img +$(INSTALLED_QEMU_RAMDISKIMAGE): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_RAMDISK_TARGET) + @echo Create ramdisk-qemu.img + (cat $(INSTALLED_RAMDISK_TARGET) $(INTERNAL_VENDOR_RAMDISK_TARGET) > $(INSTALLED_QEMU_RAMDISKIMAGE)) + +droidcore: $(INSTALLED_QEMU_RAMDISKIMAGE) +endif +endif +endif + ifdef INSTALLED_PRODUCTIMAGE_TARGET INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img $(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) @@ -5313,6 +5353,7 @@ deps := \ $(APPCOMPAT_ZIP) \ $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_QEMU_SYSTEMIMAGE) \ + $(INSTALLED_QEMU_RAMDISKIMAGE) \ $(INSTALLED_QEMU_VENDORIMAGE) \ $(QEMU_VERIFIED_BOOT_PARAMS) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ diff --git a/core/app_prebuilt_internal.mk b/core/app_prebuilt_internal.mk index 05d900160d..61e13e9ff3 100644 --- a/core/app_prebuilt_internal.mk +++ b/core/app_prebuilt_internal.mk @@ -163,6 +163,13 @@ else $(built_module) : $(LOCAL_CERTIFICATE).pk8 $(LOCAL_CERTIFICATE).x509.pem $(built_module) : PRIVATE_PRIVATE_KEY := $(LOCAL_CERTIFICATE).pk8 $(built_module) : PRIVATE_CERTIFICATE := $(LOCAL_CERTIFICATE).x509.pem + + additional_certificates := $(foreach c,$(LOCAL_ADDITIONAL_CERTIFICATES), $(c).x509.pem $(c).pk8) + $(built_module): $(additional_certificates) + $(built_module): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates) + + $(built_module): $(LOCAL_CERTIFICATE_LINEAGE) + $(built_module): PRIVATE_CERTIFICATE_LINEAGE := $(LOCAL_CERTIFICATE_LINEAGE) endif include $(BUILD_SYSTEM)/app_certificate_validate.mk diff --git a/core/base_rules.mk b/core/base_rules.mk index f78e5099a2..1d1c114e92 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -597,6 +597,7 @@ endif ## Compatibility suite files. ########################################################### ifdef LOCAL_COMPATIBILITY_SUITE +ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE)) # If we are building a native test or benchmark and its stem variants are not defined, # separate the multiple architectures into subdirectories of the testcase folder. @@ -757,6 +758,7 @@ $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \ $(eval my_compat_dist_config_$(suite) := ) \ $(eval my_compat_dist_test_data_$(suite) := )) +endif # LOCAL_UNINSTALLABLE_MODULE endif # LOCAL_COMPATIBILITY_SUITE ########################################################### diff --git a/core/binary.mk b/core/binary.mk index e021b7dc76..0582920c14 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -1136,6 +1136,18 @@ ifeq ($(LOCAL_USE_VNDK),) $(if $(filter $(l),$(VENDOR_PUBLIC_LIBRARIES)),$(l).vendorpublic,$(l))) endif +########################################################### +## When compiling against the NDK, use SDK variants of Soong libraries +########################################################### + +ifneq ($(LOCAL_SDK_VERSION),) + my_whole_static_libraries := $(call use_soong_sdk_libraries,$(my_whole_static_libraries)) + my_static_libraries := $(call use_soong_sdk_libraries,$(my_static_libraries)) + my_shared_libraries := $(call use_soong_sdk_libraries,$(my_shared_libraries)) + my_system_shared_libraries := $(call use_soong_sdk_libraries,$(my_system_shared_libraries)) + my_header_libraries := $(call use_soong_sdk_libraries,$(my_header_libraries)) +endif + ########################################################## ## Set up installed module dependency ## We cannot compute the full path of the LOCAL_SHARED_LIBRARIES for diff --git a/core/board_config.mk b/core/board_config.mk index 8ff16e2592..2279c3f10e 100644 --- a/core/board_config.mk +++ b/core/board_config.mk @@ -87,6 +87,7 @@ _board_strip_readonly_list += $(_dynamic_partitions_var_list) _build_broken_var_list := \ BUILD_BROKEN_DUP_RULES \ + BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES \ BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS \ BUILD_BROKEN_PREBUILT_ELF_FILES \ BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW \ @@ -365,11 +366,6 @@ ifdef BOARD_BOOT_HEADER_VERSION ifneq ($(TARGET_NO_VENDOR_BOOT),true) BUILDING_VENDOR_BOOT_IMAGE := true endif - ifdef BUILDING_RECOVERY_IMAGE - ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true) - $(error Boot header version >=3 requires recovery as boot) - endif - endif endif endif .KATI_READONLY := BUILDING_VENDOR_BOOT_IMAGE diff --git a/core/clear_vars.mk b/core/clear_vars.mk index e27d91c27e..3d481df558 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -152,6 +152,7 @@ LOCAL_JAVA_RESOURCE_FILES:= LOCAL_JETIFIER_ENABLED:= LOCAL_JNI_SHARED_LIBRARIES:= LOCAL_JNI_SHARED_LIBRARIES_ABI:= +LOCAL_CERTIFICATE_LINEAGE:= LOCAL_LDFLAGS:= LOCAL_LDLIBS:= LOCAL_LOGTAGS_FILES:= diff --git a/core/definitions.mk b/core/definitions.mk index 3499da9329..cd92848e01 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -2285,6 +2285,7 @@ endef define sign-package-arg $(hide) mv $(1) $(1).unsigned $(hide) $(JAVA) -Djava.library.path=$$(dirname $(SIGNAPK_JNI_LIBRARY_PATH)) -jar $(SIGNAPK_JAR) \ + $(if $(strip $(PRIVATE_CERTIFICATE_LINEAGE)), --lineage $(PRIVATE_CERTIFICATE_LINEAGE)) \ $(PRIVATE_CERTIFICATE) $(PRIVATE_PRIVATE_KEY) \ $(PRIVATE_ADDITIONAL_CERTIFICATES) $(1).unsigned $(1).signed $(hide) mv $(1).signed $(1) @@ -2551,6 +2552,22 @@ $(foreach f, $(1), $(strip \ $(_cmf_dest))) endef +# Copy the file only if it's not an ELF file. For use via $(eval). +# $(1): source file +# $(2): destination file +# $(3): message to print on error +define copy-non-elf-file-checked +$(2): $(1) $(LLVM_READOBJ) + @echo "Copy non-ELF: $$@" + $(hide) \ + if $(LLVM_READOBJ) -h $$< >/dev/null 2>&1; then \ + $(call echo-error,$$@,$(3)); \ + $(call echo-error,$$@,found ELF file: $$<); \ + false; \ + fi + $$(copy-file-to-target) +endef + # The -t option to acp and the -p option to cp is # required for OSX. OSX has a ridiculous restriction # where it's an error for a .a file's modification time @@ -3321,3 +3338,9 @@ $(hide) CLANG_BIN="$(LLVM_PREBUILTS_PATH)" \ XZ="$(XZ)" \ $(LIBRARY_IDENTITY_CHECK_SCRIPT) $(SOONG_STRIP_PATH) $(1) $(2) endef + +# Convert Soong libraries that have SDK variant +define use_soong_sdk_libraries + $(foreach l,$(1),$(if $(filter $(l),$(SOONG_SDK_VARIANT_MODULES)),\ + $(l).sdk,$(l))) +endef diff --git a/core/install_jni_libs_internal.mk b/core/install_jni_libs_internal.mk index d87513bd0e..b482eb59ba 100644 --- a/core/install_jni_libs_internal.mk +++ b/core/install_jni_libs_internal.mk @@ -12,9 +12,18 @@ # my_embedded_prebuilt_jni_libs, prebuilt jni libs embedded in prebuilt apk. # +my_sdk_variant = $(1) +ifneq (,$(and $(my_embed_jni),$(LOCAL_SDK_VERSION))) + # Soong produces $(lib).so in $(lib).sdk_intermediates so that the library + # has the correct name for embedding in an APK. Append .sdk to the name + # of the intermediates directory, but not the .so name. + my_sdk_variant = $(call use_soong_sdk_libraries,$(1)) +endif + my_jni_shared_libraries := $(strip \ - $(foreach lib,$(LOCAL_JNI_SHARED_LIBRARIES), \ - $(call intermediates-dir-for,SHARED_LIBRARIES,$(lib),,,$(my_2nd_arch_prefix))/$(lib).so)) + $(foreach lib,$(LOCAL_JNI_SHARED_LIBRARIES), \ + $(call intermediates-dir-for,SHARED_LIBRARIES,$(call my_sdk_variant,$(lib)),,,$(my_2nd_arch_prefix))/$(lib).so)) + # App-specific lib path. my_app_lib_path := $(dir $(LOCAL_INSTALLED_MODULE))lib/$(TARGET_$(my_2nd_arch_prefix)ARCH) @@ -115,7 +124,18 @@ ifneq ($(strip $(LOCAL_JNI_SHARED_LIBRARIES)),) my_allowed_types := $(my_allowed_ndk_types) native:platform native:product native:vendor native:vndk native:vndk_private native:platform_vndk endif - my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES)) + ifneq (,$(LOCAL_SDK_VERSION)) + ifeq ($(SOONG_ANDROID_MK),$(LOCAL_MODULE_MAKEFILE)) + # SOONG_SDK_VARIANT_MODULES isn't complete yet while parsing Soong modules, and Soong has + # already ensured that apps link against the correct SDK variants, rewrite all JNI libraries + # to the SDK variant. + my_link_deps := $(addprefix SHARED_LIBRARIES:,$(addsuffix .sdk,$(LOCAL_JNI_SHARED_LIBRARIES))) + else + my_link_deps := $(addprefix SHARED_LIBRARIES:,$(call use_soong_sdk_libraries,$(LOCAL_JNI_SHARED_LIBRARIES))) + endif + else + my_link_deps := $(addprefix SHARED_LIBRARIES:,$(LOCAL_JNI_SHARED_LIBRARIES)) + endif my_common := include $(BUILD_SYSTEM)/link_type.mk diff --git a/core/main.mk b/core/main.mk index 5fb3810abc..8b85170362 100644 --- a/core/main.mk +++ b/core/main.mk @@ -740,15 +740,18 @@ $(if $(_all_deps_for_$(1)_set_),$(_all_deps_for_$(1)_),\ $(_all_deps_for_$(1)_)) endef -# Scan all modules in general-tests and device-tests suite and flatten the -# shared library dependencies. +# Scan all modules in general-tests, device-tests and other selected suites and +# flatten the shared library dependencies. define update-host-shared-libs-deps-for-suites -$(foreach suite,general-tests device-tests,\ +$(foreach suite,general-tests device-tests vts,\ $(foreach m,$(COMPATIBILITY.$(suite).MODULES),\ $(eval my_deps := $(call get-all-shared-libs-deps,$(m)))\ $(foreach dep,$(my_deps),\ $(foreach f,$(ALL_MODULES.$(dep).HOST_SHARED_LIBRARY_FILES),\ - $(eval target := $(HOST_OUT_TESTCASES)/$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\ + $(if $(filter $(suite),device-tests general-tests),\ + $(eval my_testcases := $(HOST_OUT_TESTCASES)),\ + $(eval my_testcases := $$(COMPATIBILITY_TESTCASES_OUT_$(suite))))\ + $(eval target := $(my_testcases)/$(lastword $(subst /, ,$(dir $(f))))/$(notdir $(f)))\ $(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \ $$(COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES) $(f):$(target))\ $(eval COMPATIBILITY.$(suite).HOST_SHARED_LIBRARY.FILES := \ diff --git a/core/notice_files.mk b/core/notice_files.mk index 77fb8d461b..721a03411f 100644 --- a/core/notice_files.mk +++ b/core/notice_files.mk @@ -82,6 +82,10 @@ else else ifeq ($(LOCAL_MODULE_CLASS),ETC) # ETC modules may be uninstallable, yet still have a NOTICE file. e.g. apex components module_installed_filename := + else ifneq (,$(and $(filter %.sdk,$(LOCAL_MODULE)),$(filter $(patsubst %.sdk,%,$(LOCAL_MODULE)),$(SOONG_SDK_VARIANT_MODULES)))) + # Soong produces uninstallable *.sdk shared libraries for embedding in APKs. + module_installed_filename := \ + $(patsubst $(PRODUCT_OUT)/%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE)) else $(error Cannot determine where to install NOTICE file for $(LOCAL_MODULE)) endif # JAVA_LIBRARIES diff --git a/core/package_internal.mk b/core/package_internal.mk index c6c2cf55ce..59e0701e45 100644 --- a/core/package_internal.mk +++ b/core/package_internal.mk @@ -471,6 +471,9 @@ PACKAGES.$(LOCAL_PACKAGE_NAME).CERTIFICATE := $(certificate) $(LOCAL_BUILT_MODULE): $(additional_certificates) $(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates) +$(LOCAL_BUILT_MODULE): $(LOCAL_CERTIFICATE_LINEAGE) +$(LOCAL_BUILT_MODULE): PRIVATE_CERTIFICATE_LINEAGE := $(LOCAL_CERTIFICATE_LINEAGE) + # Set a actual_partition_tag (calculated in base_rules.mk) for the package. PACKAGES.$(LOCAL_PACKAGE_NAME).PARTITION := $(actual_partition_tag) diff --git a/core/rbe.mk b/core/rbe.mk index 7886e1ae4b..019ac04efd 100644 --- a/core/rbe.mk +++ b/core/rbe.mk @@ -46,8 +46,12 @@ ifneq ($(filter-out false,$(USE_RBE)),) d8_exec_strategy := "local" endif + platform := "container-image=docker://gcr.io/androidbuild-re-dockerimage/android-build-remoteexec-image@sha256:582efb38f0c229ea39952fff9e132ccbe183e14869b39888010dacf56b360d62" + cxx_platform := $(platform)",Pool=default" + java_r8_d8_platform := $(platform)",Pool=java16" + RBE_WRAPPER := $(rbe_dir)/rewrapper - RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) + RBE_CXX := --labels=type=compile,lang=cpp,compiler=clang --env_var_whitelist=PWD --exec_strategy=$(cxx_rbe_exec_strategy) --platform="$(cxx_platform)" # Append rewrapper to existing *_WRAPPER variables so it's possible to # use both ccache and rewrapper. @@ -55,16 +59,17 @@ ifneq ($(filter-out false,$(USE_RBE)),) CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER) $(RBE_CXX)) ifdef RBE_JAVAC - JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac,shallow=true --exec_strategy=$(javac_exec_strategy)) + JAVAC_WRAPPER := $(strip $(JAVAC_WRAPPER) $(RBE_WRAPPER) --labels=type=compile,lang=java,compiler=javac --exec_strategy=$(javac_exec_strategy) --platform="$(java_r8_d8_platform)") endif ifdef RBE_R8 - R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8,shallow=true --exec_strategy=$(r8_exec_strategy)) + R8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=r8 --exec_strategy=$(r8_exec_strategy) --platform="$(java_r8_d8_platform)" --inputs=out/soong/host/linux-x86/framework/r8-compat-proguard.jar,build/make/core/proguard_basic_keeps.flags --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java) endif ifdef RBE_D8 - D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8,shallow=true --exec_strategy=$(d8_exec_strategy)) + D8_WRAPPER := $(strip $(RBE_WRAPPER) --labels=type=compile,compiler=d8 --exec_strategy=$(d8_exec_strategy) --platform="$(java_r8_d8_platform)" --inputs=out/soong/host/linux-x86/framework/d8.jar --toolchain_inputs=prebuilts/jdk/jdk11/linux-x86/bin/java) endif rbe_dir := endif + diff --git a/core/soong_config.mk b/core/soong_config.mk index c91639c015..cbc2dd1f4d 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -32,7 +32,6 @@ $(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_csv, Platform_version_active_codenames, $(PLATFORM_VERSION_ALL_CODENAMES)) -$(call add_json_csv, Platform_version_future_codenames, $(PLATFORM_VERSION_FUTURE_CODENAMES)) $(call add_json_str, Platform_security_patch, $(PLATFORM_SECURITY_PATCH)) $(call add_json_str, Platform_preview_sdk_version, $(PLATFORM_PREVIEW_SDK_VERSION)) $(call add_json_str, Platform_base_os, $(PLATFORM_BASE_OS)) diff --git a/core/soong_droiddoc_prebuilt.mk b/core/soong_droiddoc_prebuilt.mk index c0467df2be..4e082bff73 100644 --- a/core/soong_droiddoc_prebuilt.mk +++ b/core/soong_droiddoc_prebuilt.mk @@ -12,6 +12,11 @@ ALL_DOCS += $(OUT_DOCS)/$(LOCAL_MODULE)-stubs.srcjar $(LOCAL_MODULE) : $(OUT_DOCS)/$(LOCAL_MODULE)-stubs.srcjar endif +ifdef INTERNAL_PLATFORM_API_FILE +.PHONY: $(LOCAL_MODULE) $(LOCAL_MODULE).txt +$(LOCAL_MODULE) $(LOCAL_MODULE).txt : $(INTERNAL_PLATFORM_API_FILE) $(INTERNAL_PLATFORM_REMOVED_API_FILE) +endif + ifdef LOCAL_DROIDDOC_DOC_ZIP $(eval $(call copy-one-file,$(LOCAL_DROIDDOC_DOC_ZIP),$(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip)) $(call dist-for-goals,docs,$(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip) diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk index 1cf7ef8cd2..cb84a5ca74 100644 --- a/core/tasks/general-tests.mk +++ b/core/tasks/general-tests.mk @@ -18,7 +18,7 @@ general_tests_tools := \ $(HOST_OUT_JAVA_LIBRARIES)/cts-tradefed.jar \ $(HOST_OUT_JAVA_LIBRARIES)/compatibility-host-util.jar \ - $(HOST_OUT_JAVA_LIBRARIES)/vts-core-tradefed.jar \ + $(HOST_OUT_JAVA_LIBRARIES)/vts-tradefed.jar \ $(HOST_OUT_JAVA_LIBRARIES)/vts10-tradefed.jar intermediates_dir := $(call intermediates-dir-for,PACKAGING,general-tests) diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk index 7f777a549f..5097f1266f 100644 --- a/core/tasks/sdk-addon.mk +++ b/core/tasks/sdk-addon.mk @@ -66,7 +66,7 @@ endif files_to_copy += \ $(addon_dir_img):$(INSTALLED_QEMU_SYSTEMIMAGE):images/$(TARGET_CPU_ABI)/system.img \ $(addon_dir_img):$(INSTALLED_QEMU_VENDORIMAGE):images/$(TARGET_CPU_ABI)/vendor.img \ - $(addon_dir_img):$(BUILT_RAMDISK_TARGET):images/$(TARGET_CPU_ABI)/ramdisk.img \ + $(addon_dir_img):$(INSTALLED_QEMU_RAMDISKIMAGE):images/$(TARGET_CPU_ABI)/ramdisk.img \ $(addon_dir_img):$(PRODUCT_OUT)/system/build.prop:images/$(TARGET_CPU_ABI)/build.prop \ $(addon_dir_img):device/generic/goldfish/data/etc/userdata.img:images/$(TARGET_CPU_ABI)/userdata.img \ $(addon_dir_img):$(target_notice_file_txt):images/$(TARGET_CPU_ABI)/NOTICE.txt \ diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk index b6dd39eb08..87582a55de 100644 --- a/core/tasks/tools/compatibility.mk +++ b/core/tasks/tools/compatibility.mk @@ -42,13 +42,16 @@ test_tools := $(HOST_OUT_JAVA_LIBRARIES)/hosttestlib.jar \ test_tools += $(test_suite_tools) +# Include host shared libraries +host_shared_libs := $(call copy-many-files, $(COMPATIBILITY.$(test_suite_name).HOST_SHARED_LIBRARY.FILES)) + compatibility_zip := $(out_dir).zip $(compatibility_zip): PRIVATE_NAME := android-$(test_suite_name) $(compatibility_zip): PRIVATE_OUT_DIR := $(out_dir) $(compatibility_zip): PRIVATE_TOOLS := $(test_tools) $(test_suite_prebuilt_tools) $(compatibility_zip): PRIVATE_SUITE_NAME := $(test_suite_name) $(compatibility_zip): PRIVATE_DYNAMIC_CONFIG := $(test_suite_dynamic_config) -$(compatibility_zip): $(test_artifacts) $(test_tools) $(test_suite_prebuilt_tools) $(test_suite_dynamic_config) $(SOONG_ZIP) | $(ADB) $(ACP) +$(compatibility_zip): $(test_artifacts) $(test_tools) $(test_suite_prebuilt_tools) $(test_suite_dynamic_config) $(SOONG_ZIP) $(host_shared_libs) | $(ADB) $(ACP) # Make dir structure $(hide) mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases $(hide) echo $(BUILD_NUMBER_FROM_FILE) > $(PRIVATE_OUT_DIR)/tools/version.txt @@ -65,3 +68,4 @@ test_suite_dynamic_config := test_suite_readme := test_suite_prebuilt_tools := test_suite_tools := +host_shared_libs := diff --git a/core/tasks/vts-core-tests.mk b/core/tasks/vts-core-tests.mk index f67d7224c8..08663c24cd 100644 --- a/core/tasks/vts-core-tests.mk +++ b/core/tasks/vts-core-tests.mk @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -test_suite_name := vts-core -test_suite_tradefed := vts-core-tradefed +test_suite_name := vts +test_suite_tradefed := vts-tradefed test_suite_readme := test/vts/tools/vts-core-tradefed/README # TODO(b/149249068): Clean up after all VTS tests are converted. @@ -23,9 +23,9 @@ vts_test_artifact_paths := include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk -.PHONY: vts-core +.PHONY: vts $(compatibility_zip): $(vts_test_artifact_paths) -vts-core: $(compatibility_zip) -$(call dist-for-goals, vts-core, $(compatibility_zip)) +vts: $(compatibility_zip) +$(call dist-for-goals, vts, $(compatibility_zip)) -tests: vts-core +tests: vts diff --git a/core/version_defaults.mk b/core/version_defaults.mk index ab7783ff94..fe71d7b4fd 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -123,8 +123,8 @@ ifndef PLATFORM_VERSION_CODENAME PLATFORM_VERSION_CODENAME := $(TARGET_PLATFORM_VERSION) endif - # This is all of the *active* development codenames. There are future - # codenames not included in this list. This confusing name is needed because + # This is all of the *active* development codenames. + # This confusing name is needed because # all_codenames has been baked into build.prop for ages. # # Should be either the same as PLATFORM_VERSION_CODENAME or a comma-separated @@ -141,29 +141,14 @@ ifndef PLATFORM_VERSION_CODENAME $(if $(filter $(_codename),$(PLATFORM_VERSION_ALL_CODENAMES)),,\ $(eval PLATFORM_VERSION_ALL_CODENAMES += $(_codename)))) - # This is all of the inactive development codenames. Available to be targeted - # in this branch but in the future relative to our current target. - PLATFORM_VERSION_FUTURE_CODENAMES := - - # Build a list of all untargeted code names. Avoid duplicates. - _versions_not_in_target := \ - $(filter-out $(PLATFORM_VERSION_ALL_CODENAMES),$(ALL_VERSIONS)) - $(foreach version,$(_versions_not_in_target),\ - $(eval _codename := $(PLATFORM_VERSION_CODENAME.$(version)))\ - $(if $(filter $(_codename),$(PLATFORM_VERSION_FUTURE_CODENAMES)),,\ - $(eval PLATFORM_VERSION_FUTURE_CODENAMES += $(_codename)))) - # And convert from space separated to comma separated. PLATFORM_VERSION_ALL_CODENAMES := \ $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_ALL_CODENAMES))) - PLATFORM_VERSION_FUTURE_CODENAMES := \ - $(subst $(space),$(comma),$(strip $(PLATFORM_VERSION_FUTURE_CODENAMES))) endif .KATI_READONLY := \ PLATFORM_VERSION_CODENAME \ - PLATFORM_VERSION_ALL_CODENAMES \ - PLATFORM_VERSION_FUTURE_CODENAMES + PLATFORM_VERSION_ALL_CODENAMES ifeq (REL,$(PLATFORM_VERSION_CODENAME)) PLATFORM_PREVIEW_SDK_VERSION := 0 @@ -250,7 +235,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 := 2020-03-05 + PLATFORM_SECURITY_PATCH := 2020-04-05 endif .KATI_READONLY := PLATFORM_SECURITY_PATCH diff --git a/envsetup.sh b/envsetup.sh index 791a43d78e..0ec7e6ffd2 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -33,7 +33,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y - allmod: List all modules. - gomod: Go to the directory containing a module. - pathmod: Get the directory containing a module. -- refreshmod: Refresh list of modules for allmod/gomod. +- refreshmod: Refresh list of modules for allmod/gomod/pathmod. Environment options: - SANITIZE_HOST: Set to 'address' to use ASAN for all host modules. @@ -119,13 +119,13 @@ function get_build_var() if [ "$BUILD_VAR_CACHE_READY" = "true" ] then eval "echo \"\${var_cache_$1}\"" - return + return 0 fi local T=$(gettop) if [ ! "$T" ]; then echo "Couldn't locate the top of the tree. Try setting TOP." >&2 - return + return 1 fi (\cd $T; build/soong/soong_ui.bash --dumpvar-mode $1) } @@ -576,10 +576,25 @@ function add_lunch_combo() function print_lunch_menu() { local uname=$(uname) - local choices=$(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES) + local choices + choices=$(TARGET_BUILD_APPS= get_build_var COMMON_LUNCH_CHOICES 2>/dev/null) + local ret=$? + echo echo "You're building on" $uname echo + + if [ $ret -ne 0 ] + then + echo "Warning: Cannot display lunch menu." + echo + echo "Note: You can invoke lunch with an explicit target:" + echo + echo " usage: lunch [target]" >&2 + echo + return + fi + echo "Lunch menu... pick a combo:" local i=1 diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk index d11f9d2ff1..a2e5518d37 100644 --- a/target/board/BoardConfigEmuCommon.mk +++ b/target/board/BoardConfigEmuCommon.mk @@ -74,6 +74,13 @@ else BOARD_VENDORIMAGE_PARTITION_SIZE := 146800640 endif +#vendor boot +TARGET_NO_VENDOR_BOOT := false +BOARD_INCLUDE_DTB_IN_BOOTIMG := false +BOARD_BOOT_HEADER_VERSION := 3 +BOARD_MKBOOTIMG_ARGS += --header_version $(BOARD_BOOT_HEADER_VERSION) +BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 0x06000000 + # Enable chain partition for system. BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048 diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk index 61aa67cd7d..c89e203edc 100644 --- a/target/board/BoardConfigGsiCommon.mk +++ b/target/board/BoardConfigGsiCommon.mk @@ -33,6 +33,13 @@ BOARD_USES_METADATA_PARTITION := true # updating the last seen rollback index in the tamper-evident storage. BOARD_AVB_ROLLBACK_INDEX := 0 +# Enable chain partition for system. +# GSI need to sign on system.img instead of vbmeta. +BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem +BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048 +BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP) +BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1 + # GSI specific System Properties ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT))) TARGET_SYSTEM_EXT_PROP := build/make/target/board/gsi_system_ext.prop diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk index a5264e43cf..8e28b5fc01 100644 --- a/target/board/generic_arm64/BoardConfig.mk +++ b/target/board/generic_arm64/BoardConfig.mk @@ -56,7 +56,7 @@ include build/make/target/board/BoardConfigGsiCommon.mk include build/make/target/board/BoardConfigEmuCommon.mk TARGET_NO_KERNEL := false -TARGET_NO_VENDOR_BOOT := true +TARGET_NO_VENDOR_BOOT := false BOARD_USES_RECOVERY_AS_BOOT := true BOARD_BOOTIMAGE_PARTITION_SIZE := 0x02000000 diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk index 491397f2d4..3f986d3961 100644 --- a/target/product/aosp_arm64.mk +++ b/target/product/aosp_arm64.mk @@ -51,8 +51,9 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk) # -# All components inherited here go to vendor image +# All components inherited here go to vendor or vendor_boot image # +$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk) diff --git a/target/product/base_system.mk b/target/product/base_system.mk index 434cbfcfd6..b017377a36 100644 --- a/target/product/base_system.mk +++ b/target/product/base_system.mk @@ -106,7 +106,6 @@ PRODUCT_PACKAGES += \ installd \ iorapd \ ip \ - ip6tables \ iptables \ ip-up-vpn \ javax.obex \ diff --git a/target/product/emulated_storage.mk b/target/product/emulated_storage.mk index 89de192dad..d7cc9ceadc 100644 --- a/target/product/emulated_storage.mk +++ b/target/product/emulated_storage.mk @@ -15,7 +15,7 @@ # PRODUCT_QUOTA_PROJID := 1 -PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.projid=1 +PRODUCT_PROPERTY_OVERRIDES += external_storage.projid.enabled=1 PRODUCT_FS_CASEFOLD := 1 -PRODUCT_PRODUCT_PROPERTIES += ro.emulated_storage.casefold=1 +PRODUCT_PROPERTY_OVERRIDES += external_storage.casefold.enabled=1 diff --git a/target/product/full.mk b/target/product/full.mk index b356f9d424..adb54ab662 100644 --- a/target/product/full.mk +++ b/target/product/full.mk @@ -19,6 +19,7 @@ # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. +$(call inherit-product-if-exists, device/generic/goldfish/arm32-vendor.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/emulator.mk) $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk) $(call inherit-product, $(SRC_TARGET_DIR)/board/generic/device.mk) diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt index 0c1f7888a1..d2aefdce5b 100644 --- a/target/product/gsi/current.txt +++ b/target/product/gsi/current.txt @@ -14,6 +14,7 @@ LLNDK: libm.so LLNDK: libmediandk.so LLNDK: libnativewindow.so LLNDK: libneuralnetworks.so +LLNDK: libselinux.so LLNDK: libsync.so LLNDK: libvndksupport.so LLNDK: libvulkan.so @@ -253,7 +254,6 @@ VNDK-core: libpng.so VNDK-core: libpower.so VNDK-core: libprocinfo.so VNDK-core: libradio_metadata.so -VNDK-core: libselinux.so VNDK-core: libspeexresampler.so VNDK-core: libsqlite.so VNDK-core: libssl.so diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk index 5184016462..84b1252d42 100644 --- a/target/product/runtime_libart.mk +++ b/target/product/runtime_libart.mk @@ -75,6 +75,10 @@ PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ pm.dexopt.inactive=verify \ pm.dexopt.shared=speed +# Pass file with the list of updatable boot class path packages to dex2oat. +PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ + dalvik.vm.dex2oat-updatable-bcp-packages-file=/system/etc/updatable-bcp-packages.txt + # Enable resolution of startup const strings. PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \ dalvik.vm.dex2oat-resolve-startup-strings=true diff --git a/target/product/sdk_phone_arm64.mk b/target/product/sdk_phone_arm64.mk index 9024890d2c..ad726333a7 100644 --- a/target/product/sdk_phone_arm64.mk +++ b/target/product/sdk_phone_arm64.mk @@ -16,7 +16,6 @@ QEMU_USE_SYSTEM_EXT_PARTITIONS := true $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_arm64.mk) -$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk) # Define the host tools and libs that are parts of the SDK. $(call inherit-product, sdk/build/product_sdk.mk) diff --git a/tools/fs_config/fs_config.c b/tools/fs_config/fs_config.c index 2952875f64..2a75add096 100644 --- a/tools/fs_config/fs_config.c +++ b/tools/fs_config/fs_config.c @@ -26,6 +26,7 @@ #include <selinux/label.h> #include "private/android_filesystem_config.h" +#include "private/fs_config.h" // This program takes a list of files and directories (indicated by a // trailing slash) on the stdin, and prints to stdout each input diff --git a/tools/fs_get_stats/fs_get_stats.c b/tools/fs_get_stats/fs_get_stats.c index 159e2aa912..64ef0e2312 100644 --- a/tools/fs_get_stats/fs_get_stats.c +++ b/tools/fs_get_stats/fs_get_stats.c @@ -4,6 +4,7 @@ #include <unistd.h> #include <private/android_filesystem_config.h> +#include <private/fs_config.h> #define DO_DEBUG 1 diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp index f29ec90cc0..d6f2116693 100644 --- a/tools/releasetools/Android.bp +++ b/tools/releasetools/Android.bp @@ -238,6 +238,16 @@ python_defaults { embedded_launcher: false, }, }, + // TODO (b/140144201) Build imgdiff from releasetools_common + required: [ + "aapt2", + "boot_signer", + "brotli", + "bsdiff", + "imgdiff", + "minigzip", + "mkbootfs", + ], } python_binary_host { diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 3bbf9d804f..ad69fef788 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -77,6 +77,7 @@ class Options(object): self.boot_signer_args = [] self.verity_signer_path = None self.verity_signer_args = [] + self.aftl_tool_path = None self.aftl_server = None self.aftl_key_path = None self.aftl_manufacturer_key_path = None @@ -935,6 +936,7 @@ def AddAftlInclusionProof(output_image): """Appends the aftl inclusion proof to the vbmeta image.""" # Ensure the other AFTL parameters are set as well. + assert OPTIONS.aftl_tool_path is not None, 'No aftl tool provided.' assert OPTIONS.aftl_key_path is not None, 'No AFTL key provided.' assert OPTIONS.aftl_manufacturer_key_path is not None, \ 'No AFTL manufacturer key provided.' @@ -943,7 +945,8 @@ def AddAftlInclusionProof(output_image): os.rename(output_image, vbmeta_image) build_info = BuildInfo(OPTIONS.info_dict) version_incremental = build_info.GetBuildProp("ro.build.version.incremental") - aftl_cmd = ["aftltool", "make_icp_from_vbmeta", + aftltool = OPTIONS.aftl_tool_path + aftl_cmd = [aftltool, "make_icp_from_vbmeta", "--vbmeta_image_path", vbmeta_image, "--output", output_image, "--version_incremental", version_incremental, @@ -1101,7 +1104,13 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None, cmd.append("--pagesize") cmd.append(open(fn).read().rstrip("\n")) - args = info_dict.get("mkbootimg_args") + # "boot" or "recovery", without extension. + partition_name = os.path.basename(sourcedir).lower() + + if partition_name == "recovery": + args = info_dict.get("recovery_mkbootimg_args") + else: + args = info_dict.get("mkbootimg_args") if args and args.strip(): cmd.extend(shlex.split(args)) @@ -1119,9 +1128,6 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None, else: cmd.extend(["--output", img.name]) - # "boot" or "recovery", without extension. - partition_name = os.path.basename(sourcedir).lower() - if partition_name == "recovery": if info_dict.get("include_recovery_dtbo") == "true": fn = os.path.join(sourcedir, "recovery_dtbo") @@ -1783,8 +1789,8 @@ def ReadApkCerts(tf_zip): continue m = re.match( r'^name="(?P<NAME>.*)"\s+certificate="(?P<CERT>.*)"\s+' - r'private_key="(?P<PRIVKEY>.*?)"(\s+compressed="(?P<COMPRESSED>.*)")?' - r'(\s+partition="(?P<PARTITION>.*)")?$', + r'private_key="(?P<PRIVKEY>.*?)"(\s+compressed="(?P<COMPRESSED>.*?)")?' + r'(\s+partition="(?P<PARTITION>.*?)")?$', line) if not m: continue @@ -1876,9 +1882,9 @@ def ParseOptions(argv, "java_path=", "java_args=", "android_jar_path=", "public_key_suffix=", "private_key_suffix=", "boot_signer_path=", "boot_signer_args=", "verity_signer_path=", "verity_signer_args=", "device_specific=", - "extra=", "logfile=", "aftl_server=", "aftl_key_path=", - "aftl_manufacturer_key_path=", "aftl_signer_helper="] + - list(extra_long_opts)) + "extra=", "logfile=", "aftl_tool_path=", "aftl_server=", + "aftl_key_path=", "aftl_manufacturer_key_path=", + "aftl_signer_helper="] + list(extra_long_opts)) except getopt.GetoptError as err: Usage(docstring) print("**", str(err), "**") @@ -1916,6 +1922,8 @@ def ParseOptions(argv, OPTIONS.verity_signer_path = a elif o in ("--verity_signer_args",): OPTIONS.verity_signer_args = shlex.split(a) + elif o in ("--aftl_tool_path",): + OPTIONS.aftl_tool_path = a elif o in ("--aftl_server",): OPTIONS.aftl_server = a elif o in ("--aftl_key_path",): diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py index 8e97509875..d9d3854056 100755 --- a/tools/releasetools/merge_target_files.py +++ b/tools/releasetools/merge_target_files.py @@ -95,6 +95,8 @@ import ota_from_target_files logger = logging.getLogger(__name__) OPTIONS = common.OPTIONS +# Always turn on verbose logging. +OPTIONS.verbose = True OPTIONS.framework_target_files = None OPTIONS.framework_item_list = None OPTIONS.framework_misc_info_keys = None @@ -117,14 +119,15 @@ OPTIONS.keep_tmp = False PARTITION_ITEM_PATTERN = re.compile(r'^([A-Z_]+)/\*$') -# In apexkeys.txt or apkcerts.txt, we may find partition tags on the various -# entries in the file. We use these partition tags to filter the entries in -# those files from the two different target files packages to produce a merged -# apexkeys.txt or apkcerts.txt file. A partition tag (e.g., for the product -# partition) looks like this: 'partition="_PRODUCT"' or 'partition="product". -# We use the group syntax grab the value of the tag. +# In apexkeys.txt or apkcerts.txt, we will find partition tags on each entry in +# the file. We use these partition tags to filter the entries in those files +# from the two different target files packages to produce a merged apexkeys.txt +# or apkcerts.txt file. A partition tag (e.g., for the product partition) looks +# like this: 'partition="product"'. We use the group syntax grab the value of +# the tag. We use non-greedy matching in case there are other fields on the +# same line. -PARTITION_TAG_PATTERN = re.compile(r'partition="(.*)"') +PARTITION_TAG_PATTERN = re.compile(r'partition="(.*?)"') # The sorting algorithm for apexkeys.txt and apkcerts.txt does not include the # ".apex" or ".apk" suffix, so we use the following pattern to extract a key. @@ -1108,9 +1111,6 @@ def main(): common.Usage(__doc__) sys.exit(1) - # Always turn on verbose logging. - OPTIONS.verbose = True - if OPTIONS.framework_item_list: framework_item_list = common.LoadListFromFile(OPTIONS.framework_item_list) else: diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index 783d63cb91..52cd9a850f 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -1082,8 +1082,8 @@ def ReadApexKeysInfo(tf_zip): r'public_key="(?P<PAYLOAD_PUBLIC_KEY>.*)"\s+' r'private_key="(?P<PAYLOAD_PRIVATE_KEY>.*)"\s+' r'container_certificate="(?P<CONTAINER_CERT>.*)"\s+' - r'container_private_key="(?P<CONTAINER_PRIVATE_KEY>.*)"\s+' - r'partition="(?P<PARTITION>.*)"$', + r'container_private_key="(?P<CONTAINER_PRIVATE_KEY>.*?)"' + r'(\s+partition="(?P<PARTITION>.*?)")?$', line) if not matches: continue diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py index 9621de86e5..7058da7444 100644 --- a/tools/releasetools/test_common.py +++ b/tools/releasetools/test_common.py @@ -710,6 +710,25 @@ class CommonApkUtilsTest(test_utils.ReleaseToolsTestCase): 'Compressed4.apk' : 'certs/compressed4', } + # Test parsing with no optional fields, both optional fields, and only the + # partition optional field. + APKCERTS_TXT4 = ( + 'name="RecoveryLocalizer.apk" certificate="certs/devkey.x509.pem"' + ' private_key="certs/devkey.pk8"\n' + 'name="Settings.apk"' + ' certificate="build/make/target/product/security/platform.x509.pem"' + ' private_key="build/make/target/product/security/platform.pk8"' + ' compressed="gz" partition="system"\n' + 'name="TV.apk" certificate="PRESIGNED" private_key=""' + ' partition="product"\n' + ) + + APKCERTS_CERTMAP4 = { + 'RecoveryLocalizer.apk' : 'certs/devkey', + 'Settings.apk' : 'build/make/target/product/security/platform', + 'TV.apk' : 'PRESIGNED', + } + def setUp(self): self.testdata_dir = test_utils.get_testdata_dir() @@ -786,6 +805,14 @@ class CommonApkUtilsTest(test_utils.ReleaseToolsTestCase): with zipfile.ZipFile(target_files, 'r') as input_zip: self.assertRaises(ValueError, common.ReadApkCerts, input_zip) + def test_ReadApkCerts_WithWithoutOptionalFields(self): + target_files = self._write_apkcerts_txt(self.APKCERTS_TXT4) + with zipfile.ZipFile(target_files, 'r') as input_zip: + certmap, ext = common.ReadApkCerts(input_zip) + + self.assertDictEqual(self.APKCERTS_CERTMAP4, certmap) + self.assertIsNone(ext) + def test_ExtractPublicKey(self): cert = os.path.join(self.testdata_dir, 'testkey.x509.pem') pubkey = os.path.join(self.testdata_dir, 'testkey.pubkey.pem') @@ -1417,6 +1444,7 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase): '6285659:userdebug/dev-keys' } } + common.OPTIONS.aftl_tool_path = "aftltool" common.OPTIONS.aftl_server = "log.endpoints.aftl-dev.cloud.goog:9000" common.OPTIONS.aftl_key_path = os.path.join(testdata_dir, 'test_transparency_key.pub') diff --git a/tools/releasetools/test_sign_target_files_apks.py b/tools/releasetools/test_sign_target_files_apks.py index 2dacd50375..308172f356 100644 --- a/tools/releasetools/test_sign_target_files_apks.py +++ b/tools/releasetools/test_sign_target_files_apks.py @@ -35,9 +35,13 @@ class SignTargetFilesApksTest(test_utils.ReleaseToolsTestCase): <signer signature="{}"><seinfo value="media"/></signer> </policy>""" + # Note that we test one apex with the partition tag, and another without to + # make sure that new OTA tools can process an older target files package that + # does not include the partition tag. + # pylint: disable=line-too-long APEX_KEYS_TXT = """name="apex.apexd_test.apex" public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package.avbpubkey" private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package.pem" container_certificate="build/make/target/product/security/testkey.x509.pem" container_private_key="build/make/target/product/security/testkey.pk8" partition="system" -name="apex.apexd_test_different_app.apex" public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.avbpubkey" private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem" container_certificate="build/make/target/product/security/testkey.x509.pem" container_private_key="build/make/target/product/security/testkey.pk8" partition="system" +name="apex.apexd_test_different_app.apex" public_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.avbpubkey" private_key="system/apex/apexd/apexd_testdata/com.android.apex.test_package_2.pem" container_certificate="build/make/target/product/security/testkey.x509.pem" container_private_key="build/make/target/product/security/testkey.pk8" """ def setUp(self): diff --git a/tools/signapk/src/com/android/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java index 9809ed406b..95ef05f4dd 100644 --- a/tools/signapk/src/com/android/signapk/SignApk.java +++ b/tools/signapk/src/com/android/signapk/SignApk.java @@ -36,6 +36,7 @@ import org.conscrypt.OpenSSLProvider; import com.android.apksig.ApkSignerEngine; import com.android.apksig.DefaultApkSignerEngine; +import com.android.apksig.SigningCertificateLineage; import com.android.apksig.Hints; import com.android.apksig.apk.ApkUtils; import com.android.apksig.apk.MinSdkVersionException; @@ -1042,6 +1043,7 @@ class SignApk { int alignment = 4; Integer minSdkVersionOverride = null; boolean signUsingApkSignatureSchemeV2 = true; + SigningCertificateLineage certLineage = null; int argstart = 0; while (argstart < args.length && args[argstart].startsWith("-")) { @@ -1069,6 +1071,15 @@ class SignApk { } else if ("--disable-v2".equals(args[argstart])) { signUsingApkSignatureSchemeV2 = false; ++argstart; + } else if ("--lineage".equals(args[argstart])) { + File lineageFile = new File(args[++argstart]); + try { + certLineage = SigningCertificateLineage.readFromFile(lineageFile); + } catch (Exception e) { + throw new IllegalArgumentException( + "Error reading lineage file: " + e.getMessage()); + } + ++argstart; } else { usage(); } @@ -1149,6 +1160,7 @@ class SignApk { .setV2SigningEnabled(signUsingApkSignatureSchemeV2) .setOtherSignersSignaturesPreserved(false) .setCreatedBy("1.0 (Android SignApk)") + .setSigningCertificateLineage(certLineage) .build()) { // We don't preserve the input APK's APK Signing Block (which contains v2 // signatures) diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp index 63fb962767..88505b7508 100644 --- a/tools/zipalign/ZipFile.cpp +++ b/tools/zipalign/ZipFile.cpp @@ -1221,7 +1221,7 @@ class FileReader : public zip_archive::Reader { FileReader(FILE* fp) : Reader(), fp_(fp), current_offset_(0) { } - bool ReadAtOffset(uint8_t* buf, size_t len, uint32_t offset) const { + bool ReadAtOffset(uint8_t* buf, size_t len, off64_t offset) const { // Data is usually requested sequentially, so this helps avoid pointless // fseeks every time we perform a read. There's an impedence mismatch // here because the original API was designed around pread and pwrite. @@ -1244,7 +1244,7 @@ class FileReader : public zip_archive::Reader { private: FILE* fp_; - mutable uint32_t current_offset_; + mutable off64_t current_offset_; }; // free the memory when you're done |