Merge "Enable overrides for shared libraries"
diff --git a/core/Makefile b/core/Makefile
index 2b602b8..97322c6 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -977,7 +977,7 @@
$(2) : $(3)
$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
build/make/tools/generate-notice-files.py --text-output $(2) \
- $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor$(comma)product$(comma)product_services --xml-output, \
+ $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e product_services --xml-output, \
$(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
$(if $(filter $(1),xml_product),-i product --xml-output, \
$(if $(filter $(1),xml_product_services),-i product_services --xml-output, \
@@ -986,21 +986,37 @@
notice_files: $(2) $(3)
endef
+# Notice file logic isn't relevant for TARGET_BUILD_APPS
+ifndef TARGET_BUILD_APPS
+
# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
# the src subdirectory.
-
target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
-target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
-target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
-installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
+kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
+winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
+pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
-ifeq ($(PRODUCT_NOTICE_SPLIT),true)
-target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
-target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
+ifneq ($(PRODUCT_NOTICE_SPLIT),true)
+target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
+target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
+installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
+$(eval $(call combine-notice-files, html, \
+ $(target_notice_file_txt), \
+ $(target_notice_file_html), \
+ "Notices for files contained in the filesystem images in this directory:", \
+ $(TARGET_OUT_NOTICE_FILES), \
+ $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
+$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
+ $(copy-file-to-target)
+else
+target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
+target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
@@ -1017,49 +1033,72 @@
target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml
target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz
installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz
-endif
-ifndef TARGET_BUILD_APPS
-kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
-winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
-pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
+# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
+# being built. A notice xml file must depend on all modules that could potentially
+# install a license file relevant to it.
+license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
+# Phonys/fakes don't have notice files (though their deps might)
+license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
+license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
+license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
+license_modules_product_services := $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(license_modules))
+license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_product_services)
+license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
-ifdef target_vendor_notice_file_xml_gz
$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
$(target_notice_file_txt), \
- $(target_notice_file_html_or_xml), \
+ $(target_notice_file_xml), \
"Notices for files contained in the filesystem images in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
+ $(license_modules_rest)))
$(eval $(call combine-notice-files, xml_vendor, \
$(target_vendor_notice_file_txt), \
$(target_vendor_notice_file_xml), \
"Notices for files contained in the vendor filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(target_notice_file_html_or_xml)))
-ifdef target_product_notice_file_txt
+ $(license_modules_vendor)))
$(eval $(call combine-notice-files, xml_product, \
$(target_product_notice_file_txt), \
$(target_product_notice_file_xml), \
"Notices for files contained in the product filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(target_notice_file_html_or_xml)))
-endif
-ifdef target_product_services_notice_file_txt
+ $(license_modules_product)))
$(eval $(call combine-notice-files, xml_product_services, \
$(target_product_services_notice_file_txt), \
$(target_product_services_notice_file_xml), \
"Notices for files contained in the product_services filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(target_notice_file_html_or_xml)))
+ $(license_modules_product_services)))
+
+$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
+ $(copy-file-to-target)
+$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
+ $(copy-file-to-target)
+$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
+ $(copy-file-to-target)
+$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
+ $(copy-file-to-target)
+
+# if we've been run my mm, mmm, etc, don't reinstall this every time
+ifeq ($(ONE_SHOT_MAKEFILE),)
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
endif
-else
-$(eval $(call combine-notice-files, html, \
- $(target_notice_file_txt), \
- $(target_notice_file_html_or_xml), \
- "Notices for files contained in the filesystem images in this directory:", \
- $(TARGET_OUT_NOTICE_FILES), \
- $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
+endif # PRODUCT_NOTICE_SPLIT
+
+ifeq ($(ONE_SHOT_MAKEFILE),)
+ ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
endif
$(eval $(call combine-notice-files, html, \
@@ -1070,53 +1109,6 @@
$(ALL_DEFAULT_INSTALLED_MODULES) \
$(winpthreads_notice_file)))
-# Install the html file at /system/etc/NOTICE.html.gz.
-# This is not ideal, but this is very late in the game, after a lot of
-# the module processing has already been done -- in fact, we used the
-# fact that all that has been done to get the list of modules that we
-# need notice files for.
-$(target_notice_file_html_or_xml_gz): $(target_notice_file_html_or_xml) | $(MINIGZIP)
- $(hide) $(MINIGZIP) -9 < $< > $@
-$(installed_notice_html_or_xml_gz): $(target_notice_file_html_or_xml_gz)
- $(copy-file-to-target)
-
-ifdef target_vendor_notice_file_xml_gz
-# Install the vendor html file at /vendor/etc/NOTICE.xml.gz.
-$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
- $(hide) $(MINIGZIP) -9 < $< > $@
-$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
- $(copy-file-to-target)
-endif
-
-ifdef target_product_notice_file_xml_gz
-# Install the product html file at /product/etc/NOTICE.xml.gz.
-$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
- $(hide) $(MINIGZIP) -9 < $< > $@
-$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
- $(copy-file-to-target)
-endif
-
-ifdef target_product_services_notice_file_xml_gz
-# Install the product html file at /product_services/etc/NOTICE.xml.gz.
-$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
- $(hide) $(MINIGZIP) -9 < $< > $@
-$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
- $(copy-file-to-target)
-endif
-
-# if we've been run my mm, mmm, etc, don't reinstall this every time
-ifeq ($(ONE_SHOT_MAKEFILE),)
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
- ifdef target_vendor_notice_file_xml_gz
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
- endif
- ifdef target_product_notice_file_xml_gz
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
- endif
- ifdef target_product_services_notice_file_xml_gz
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
- endif
-endif
endif # TARGET_BUILD_APPS
# The kernel isn't really a module, so to get its module file in there, we
@@ -1241,7 +1233,7 @@
INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
endif
-ifeq (true,$(PRODUCT_USE_LOGICAL_PARTITIONS))
+ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
$(error vboot 1.0 doesn't support logical partition)
@@ -1250,7 +1242,7 @@
# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
-endif # PRODUCT_USE_LOGICAL_PARTITIONS
+endif # PRODUCT_USE_DYNAMIC_PARTITIONS
# $(1): the path of the output dictionary file
# $(2): a subset of "system vendor cache userdata product product_services oem odm"
@@ -1988,8 +1980,8 @@
endif
endif
-.PHONY: sync
-sync: $(INTERNAL_SYSTEMIMAGE_FILES)
+.PHONY: sync syncsys
+sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
#######
## system tarball
@@ -2919,27 +2911,20 @@
# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
-INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
-INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
-
-$(INSTALLED_SUPERIMAGE_TARGET): $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
-
-# For A/B devices, super partition always contains sub-partitions in the _a slot, because this
-# image should only be used for bootstrapping / initializing the device. When flashing the image,
-# bootloader fastboot should always mark _a slot as bootable.
-ifeq ($(AB_OTA_UPDATER),true)
-$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): PRIVATE_PARTITION_SUFFIX=_a
-endif # AB_OTA_UPDATER
-
-$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE)
+define super-slot-suffix
+$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
+endef
# $(1): slot A suffix (_a or empty)
# $(2): include images or not (true or empty)
define build-superimage-target-args
$(if $(2), --sparse) \
--metadata-size 65536 \
- --metadata-slots $(if $(1),2,1) \
- --device-size $(BOARD_SUPER_PARTITION_SIZE) \
+ --metadata-slots $(if $(filter true,$(AB_OTA_UPDATER)),2,1) \
+ --super-name $(BOARD_SUPER_PARTITION_METADATA_DEVICE) \
+ $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), $(if $(filter true,$(AB_OTA_UPDATER)), --auto-slot-suffixing)) \
+ $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
+ --device $(device):$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)) \
$(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
--group $(group)$(1):$(BOARD_$(call to-upper,$(group))_SIZE) \
$(if $(1), --group $(group)_b:$(BOARD_$(call to-upper,$(group))_SIZE)) \
@@ -2959,15 +2944,23 @@
--output $(1)
endef
-$(INSTALLED_SUPERIMAGE_TARGET):
+# For A/B devices, super partition always contains sub-partitions in the _a slot, because this
+# image should only be used for bootstrapping / initializing the device. When flashing the image,
+# bootloader fastboot should always mark _a slot as bootable.
+
+ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
+INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
+$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
$(call pretty,"Target super fs image: $@")
- $(call build-superimage-target,$@,$(PRIVATE_PARTITION_SUFFIX),true)
+ $(call build-superimage-target,$@,$(call super-slot-suffix),true)
+endif
$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
-$(INSTALLED_SUPERIMAGE_EMPTY_TARGET):
+INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
+$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE)
$(call pretty,"Target empty super fs image: $@")
- $(call build-superimage-target,$@,$(PRIVATE_PARTITION_SUFFIX))
+ $(call build-superimage-target,$@,$(call super-slot-suffix))
$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
@@ -2989,6 +2982,25 @@
# Add image dependencies so that generated_*_image_info.txt are written before checking.
check-all-partition-sizes: $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+# Check sum(super partition block devices) == super partition (/ 2 for A/B)
+# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
+define check-super-partition-size
+ size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
+ sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
+ max_size_tail=$(if $(filter true,$(AB_OTA_UPDATER))," / 2"); \
+ max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
+ if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
+ echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
+ echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
+ exit 1; \
+ else \
+ echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
+ echo $${sum_sizes_expr} '==' $${max_size_expr}; \
+ fi
+endef
+endif
+
# $(1): human-readable max size string
# $(2): max size expression
# $(3): list of partition names
@@ -3035,6 +3047,7 @@
check-all-partition-sizes check-all-partition-sizes-nodeps:
$(call check-all-partition-sizes-target)
+ $(call check-super-partition-size)
endif # PRODUCT_BUILD_SUPER_PARTITION
@@ -3058,7 +3071,7 @@
ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
build_ota_package := false
endif
- ifneq ($(strip $(SANITIZE_TARGET)),)
+ ifneq (,$(filter address, $(SANITIZE_TARGET)))
build_ota_package := false
endif
ifeq ($(TARGET_PRODUCT),sdk)
@@ -3244,7 +3257,7 @@
built_ota_tools :=
# We can't build static executables when SANITIZE_TARGET=address
-ifeq ($(strip $(SANITIZE_TARGET)),)
+ifeq (,$(filter address, $(SANITIZE_TARGET)))
built_ota_tools += \
$(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
endif
@@ -3658,7 +3671,7 @@
$(hide) echo "super_size=$(BOARD_SUPER_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
$(hide) echo "lpmake=$(notdir $(LPMAKE))" >> $(zip_root)/META/misc_info.txt
$(hide) echo -n "lpmake_args=" >> $(zip_root)/META/misc_info.txt
- $(hide) echo $(call build-superimage-target-args,$(if $(filter true,$(AB_OTA_UPDATER)),_a,)) \
+ $(hide) echo $(call build-superimage-target-args,$(call super-slot-suffix)) \
>> $(zip_root)/META/misc_info.txt
endif
ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
diff --git a/core/aux_toolchain.mk b/core/aux_toolchain.mk
index de0b139..c710228 100644
--- a/core/aux_toolchain.mk
+++ b/core/aux_toolchain.mk
@@ -50,4 +50,3 @@
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_CXX_STL := none
LOCAL_NO_PIC := true
-LOCAL_NO_LIBCOMPILER_RT := true
diff --git a/core/binary.mk b/core/binary.mk
index 07fb48a..d7112b6 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -396,13 +396,6 @@
include $(BUILD_SYSTEM)/config_sanitizers.mk
-ifneq ($(LOCAL_NO_LIBCOMPILER_RT),true)
-# Add in libcompiler_rt for all regular device builds
-ifeq (,$(WITHOUT_LIBCOMPILER_RT))
- my_static_libraries += $(COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES)
-endif
-endif
-
# Statically link libwinpthread when cross compiling win32.
ifeq ($($(my_prefix)OS),windows)
my_static_libraries += libwinpthread
@@ -1539,7 +1532,7 @@
ifeq ($(ONE_SHOT_MAKEFILE),)
installed_static_library_notice_file_targets := \
$(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
- NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
+ NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-STATIC_LIBRARIES-$(lib))
else
installed_static_library_notice_file_targets :=
endif
diff --git a/core/clang/HOST_CROSS_x86.mk b/core/clang/HOST_CROSS_x86.mk
index ffd7811..7581353 100644
--- a/core/clang/HOST_CROSS_x86.mk
+++ b/core/clang/HOST_CROSS_x86.mk
@@ -1 +1,2 @@
$(clang_2nd_arch_prefix)HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i386.a
+$(clang_2nd_arch_prefix)HOST_CROSS_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.bulitins-i386.a
diff --git a/core/clang/HOST_CROSS_x86_64.mk b/core/clang/HOST_CROSS_x86_64.mk
index f921a1c..9a971c7 100644
--- a/core/clang/HOST_CROSS_x86_64.mk
+++ b/core/clang/HOST_CROSS_x86_64.mk
@@ -1 +1,2 @@
$(clang_2nd_arch_prefix)HOST_CROSS_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-x86_64.a
+$(clang_2nd_arch_prefix)HOST_CROSS_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.builtins-x86_64.a
diff --git a/core/clang/HOST_x86.mk b/core/clang/HOST_x86.mk
index 2803517..2e0865b 100644
--- a/core/clang/HOST_x86.mk
+++ b/core/clang/HOST_x86.mk
@@ -1 +1,2 @@
$(clang_2nd_arch_prefix)HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i386.a
+$(clang_2nd_arch_prefix)HOST_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.builtins-i386.a
diff --git a/core/clang/HOST_x86_64.mk b/core/clang/HOST_x86_64.mk
index 4fdffd8..3fd0541 100644
--- a/core/clang/HOST_x86_64.mk
+++ b/core/clang/HOST_x86_64.mk
@@ -1 +1,2 @@
HOST_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-x86_64.a
+HOST_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.builtins-x86_64.a
diff --git a/core/clang/TARGET_arm.mk b/core/clang/TARGET_arm.mk
index 9c1a836..6140d7c 100644
--- a/core/clang/TARGET_arm.mk
+++ b/core/clang/TARGET_arm.mk
@@ -3,6 +3,7 @@
$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := armv7-none-linux-gnueabi
$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-arm-android.a
+$(clang_2nd_arch_prefix)TARGET_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.builtins-arm-android.a
# Address sanitizer clang config
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
diff --git a/core/clang/TARGET_arm64.mk b/core/clang/TARGET_arm64.mk
index 9a67b6b..9fe5530 100644
--- a/core/clang/TARGET_arm64.mk
+++ b/core/clang/TARGET_arm64.mk
@@ -3,6 +3,7 @@
RS_COMPAT_TRIPLE := aarch64-linux-android
TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-aarch64-android.a
+TARGET_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.builtins-aarch64-android.a
# Address sanitizer clang config
ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
diff --git a/core/clang/TARGET_x86.mk b/core/clang/TARGET_x86.mk
index 1b9c78c..5e2d57e 100644
--- a/core/clang/TARGET_x86.mk
+++ b/core/clang/TARGET_x86.mk
@@ -3,6 +3,7 @@
$(clang_2nd_arch_prefix)RS_COMPAT_TRIPLE := i686-linux-android
$(clang_2nd_arch_prefix)TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-i686-android.a
+$(clang_2nd_arch_prefix)TARGET_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.builtins-i686-android.a
# Address sanitizer clang config
$(clang_2nd_arch_prefix)ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan
diff --git a/core/clang/TARGET_x86_64.mk b/core/clang/TARGET_x86_64.mk
index 3161f84..86b3798 100644
--- a/core/clang/TARGET_x86_64.mk
+++ b/core/clang/TARGET_x86_64.mk
@@ -3,6 +3,7 @@
RS_COMPAT_TRIPLE := x86_64-linux-android
TARGET_LIBPROFILE_RT := $(LLVM_RTLIB_PATH)/libclang_rt.profile-x86_64-android.a
+TARGET_LIBCRT_BUILTINS := $(LLVM_RTLIB_PATH)/libclang_rt.builtins-x86_64-android.a
# Address sanitizer clang config
ADDRESS_SANITIZER_LINKER := /system/bin/linker_asan64
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 63582c2..ca3a1fa 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -1,6 +1,6 @@
## Clang configurations.
-LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_PATH)/../lib64/clang/$(LLVM_RELEASE_VERSION)/lib/linux/
+LLVM_RTLIB_PATH := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/lib64/clang/$(LLVM_RELEASE_VERSION)/lib/linux/
define convert-to-clang-flags
$(strip $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(1)))
@@ -61,8 +61,4 @@
include $(BUILD_SYSTEM)/clang/TARGET_$(TARGET_2ND_ARCH).mk
endif
-# This allows us to use the superset of functionality that compiler-rt
-# provides to Clang (for supporting features like -ftrapv).
-COMPILER_RT_CONFIG_EXTRA_STATIC_LIBRARIES := libcompiler_rt-extras
-
include $(BUILD_SYSTEM)/clang/tidy.mk
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 34a1db8..64caa18 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -184,8 +184,8 @@
LOCAL_NO_CRT:=
LOCAL_NO_DEFAULT_COMPILER_FLAGS:=
LOCAL_NO_FPIE :=
-LOCAL_NO_LIBCOMPILER_RT:=
LOCAL_NO_LIBGCC:=
+LOCAL_NO_LIBCRT_BUILTINS:=
LOCAL_NO_NOTICE_FILE:=
LOCAL_NO_PIC:=
LOCAL_NOSANITIZE:=
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index ffb6021..4503062 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -36,9 +36,21 @@
KNOWN_ARMv8_CORES := cortex-a53 cortex-a53.a57 cortex-a55 cortex-a73 cortex-a75 cortex-a76
KNOWN_ARMv8_CORES += kryo denver64 exynos-m1 exynos-m2
+KNOWN_ARMv82a_CORES := cortex-a55 cortex-a75
+
+# Check for cores that implement armv8-2a ISAs.
+ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv82a_CORES)))
+ ifneq ($(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT),armv8-2a)
+ $(warning $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT) is armv8-2a.)
+ ifneq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
+ $(warning TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT, $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT), ignored! Use armv8-2a instead.)
+ endif
+ # Overwrite TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT
+ TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := armv8-2a
+ endif
# Many devices (incorrectly) use armv7-a-neon as the 2nd architecture variant
# for cores that implement armv8-a ISAs. The following sets it to armv8-a.
-ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv8_CORES)))
+else ifneq (,$(filter $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT), $(KNOWN_ARMv8_CORES)))
ifneq ($(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT),armv8-a)
$(warning $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT) is armv8-a.)
ifneq (,$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
diff --git a/core/combo/arch/arm/armv8-2a.mk b/core/combo/arch/arm/armv8-2a.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/core/combo/arch/arm/armv8-2a.mk
diff --git a/core/config.mk b/core/config.mk
index c1ea5a8..9eced54 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -937,13 +937,26 @@
endif
.KATI_READONLY := PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
-ifeq ($(PRODUCT_USE_LOGICAL_PARTITIONS),true)
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+ ifneq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
+ $(error PRODUCT_USE_DYNAMIC_PARTITIONS must be true when PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
+ is set)
+ endif
+ ifdef PRODUCT_SHIPPING_API_LEVEL
+ ifeq (true,$(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),29))
+ $(error Devices with shipping API level $(PRODUCT_SHIPPING_API_LEVEL) must not set \
+ PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)
+ endif
+ endif
+endif
+
+ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
requirements := \
PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
PRODUCT_BUILD_SUPER_PARTITION \
$(foreach req,$(requirements),$(if $(filter false,$($(req))),\
- $(error PRODUCT_USE_LOGICAL_PARTITIONS requires $(req) to be true)))
+ $(error PRODUCT_USE_DYNAMIC_PARTITIONS requires $(req) to be true)))
requirements :=
@@ -1026,6 +1039,48 @@
$(BOARD_$(group)_PARTITION_LIST))
.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST
+ifdef BOARD_SUPER_PARTITION_SIZE
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+
+# The metadata device must be specified manually for retrofitting.
+ifndef BOARD_SUPER_PARTITION_METADATA_DEVICE
+$(error Must specify BOARD_SUPER_PARTITION_METADATA_DEVICE if BOARD_SUPER_PARTITION_BLOCK_DEVICES is used.)
+endif
+
+# The metadata device must be included in the super partition block device list.
+ifeq (,$(filter $(BOARD_SUPER_PARTITION_METADATA_DEVICE),$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)))
+$(error BOARD_SUPER_PARTITION_METADATA_DEVICE is not listed in BOARD_SUPER_PARTITION_BLOCK_DEVICES.)
+endif
+
+# The metadata device must be supplied to init via the kernel command-line.
+BOARD_KERNEL_CMDLINE += androidboot.super_partition=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)
+
+else # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
+
+# These should not be specified on devices launching with dynamic partition support.
+ifdef BOARD_SUPER_PARTITION_BLOCK_DEVICES
+$(error BOARD_SUPER_PARTITION_BLOCK_DEVICES can only be used if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS is true.)
+endif
+ifdef BOARD_SUPER_PARTITION_METADATA_DEVICE
+$(error BOARD_SUPER_PARTITION_METADATA_DEVICE can only be used if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS is true.)
+endif
+
+# For normal devices, we populate BOARD_SUPER_PARTITION_BLOCK_DEVICES so the
+# build can handle both cases consistently.
+BOARD_SUPER_PARTITION_BLOCK_DEVICES := super
+BOARD_SUPER_PARTITION_METADATA_DEVICE := super
+BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE := $(BOARD_SUPER_PARTITION_SIZE)
+
+endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
+endif # BOARD_SUPER_PARTITION_SIZE
+.KATI_READONLY := BOARD_SUPER_PARTITION_BLOCK_DEVICES
+.KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE
+
+$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \
+ $(if $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE),, \
+ $(error $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE must not be empty))) \
+ $(eval .KATI_READONLY := BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))
+
endif # PRODUCT_BUILD_SUPER_PARTITION
# ###############################################################
diff --git a/core/definitions.mk b/core/definitions.mk
index 0e959d6..0d4b6c4 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -797,13 +797,13 @@
# $(1): path (and optionally line) information
# $(2): message to print
define echo-warning
-echo -e "$(ESC_BOLD)$(1): $(ESC_WARNING)warning:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2
+echo -e "$(ESC_BOLD)$(1): $(ESC_WARNING)warning:$(ESC_RESET)$(ESC_BOLD)" '$(subst ','\'',$(2))' "$(ESC_RESET)" >&2
endef
# $(1): path (and optionally line) information
# $(2): message to print
define echo-error
-echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2
+echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" '$(subst ','\'',$(2))' "$(ESC_RESET)" >&2
endef
###########################################################
@@ -1693,6 +1693,7 @@
$(PRIVATE_ALL_STATIC_LIBRARIES) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
+ $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -1728,6 +1729,7 @@
$(PRIVATE_ALL_STATIC_LIBRARIES) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
+ $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(PRIVATE_TARGET_LIBGCC) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -1775,6 +1777,7 @@
$(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(filter %libcompiler_rt.a %libcompiler_rt.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
$(PRIVATE_TARGET_LIBGCC) \
-Wl,--end-group \
$(PRIVATE_TARGET_CRTEND_O)
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 70b2ea8..c28c144 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -36,6 +36,11 @@
endif
# Define PRIVATE_ variables from global vars
+ifeq ($(LOCAL_NO_LIBCRT_BUILTINS),true)
+my_target_libcrt_builtins :=
+else
+my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
+endif
ifeq ($(LOCAL_NO_LIBGCC),true)
my_target_libgcc :=
else
@@ -60,6 +65,7 @@
my_target_crtbegin_static_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_static.o)
my_target_crtend_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_android.o)
endif
+$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
@@ -68,11 +74,11 @@
$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libgcc) $(my_target_libatomic)
+$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic)
$(transform-o-to-static-executable)
$(PRIVATE_POST_LINK_CMD)
else
-$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libgcc) $(my_target_libatomic)
+$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic)
$(transform-o-to-executable)
$(PRIVATE_POST_LINK_CMD)
endif
diff --git a/core/java_common.mk b/core/java_common.mk
index 860d73c..f4c47c8 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -499,7 +499,7 @@
ifeq ($(ONE_SHOT_MAKEFILE),)
installed_static_library_notice_file_targets := \
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
- NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-JAVA_LIBRARIES-$(lib))
+ NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-JAVA_LIBRARIES-$(lib))
else
installed_static_library_notice_file_targets :=
endif
diff --git a/core/json.mk b/core/json.mk
new file mode 100644
index 0000000..ba8ffa7
--- /dev/null
+++ b/core/json.mk
@@ -0,0 +1,35 @@
+4space :=$= $(space)$(space)$(space)$(space)
+invert_bool =$= $(if $(strip $(1)),,true)
+
+# Converts a list to a JSON list.
+# $1: List separator.
+# $2: List.
+_json_list =$= [$(if $(2),"$(subst $(1),"$(comma)",$(2))")]
+
+# Converts a space-separated list to a JSON list.
+json_list =$= $(call _json_list,$(space),$(1))
+
+# Converts a comma-separated list to a JSON list.
+csv_to_json_list =$= $(call _json_list,$(comma),$(1))
+
+# Adds or removes 4 spaces from _json_indent
+json_increase_indent =$= $(eval _json_indent := $$(_json_indent)$$(4space))
+json_decrease_indent =$= $(eval _json_indent := $$(subst _,$$(space),$$(patsubst %____,%,$$(subst $$(space),_,$$(_json_indent)))))
+
+# 1: Key name
+# 2: Value
+add_json_val =$= $(eval _json_contents := $$(_json_contents)$$(_json_indent)"$$(strip $$(1))": $$(strip $$(2))$$(comma)$$(newline))
+add_json_str =$= $(call add_json_val,$(1),"$(strip $(2))")
+add_json_list =$= $(call add_json_val,$(1),$(call json_list,$(patsubst %,%,$(2))))
+add_json_csv =$= $(call add_json_val,$(1),$(call csv_to_json_list,$(strip $(2))))
+add_json_bool =$= $(call add_json_val,$(1),$(if $(strip $(2)),true,false))
+add_json_map =$= $(eval _json_contents := $$(_json_contents)$$(_json_indent)"$$(strip $$(1))": {$$(newline))$(json_increase_indent)
+end_json_map =$= $(json_decrease_indent)$(eval _json_contents := $$(_json_contents)$$(if $$(filter %$$(comma),$$(lastword $$(_json_contents))),__SV_END)$$(_json_indent)},$$(newline))
+
+# Clears _json_contents to start a new json file
+json_start =$= $(eval _json_contents := {$$(newline))$(eval _json_indent := $$(4space))
+
+# Adds the trailing close brace to _json_contents, and removes any trailing commas if necessary
+json_end =$= $(eval _json_contents := $$(subst $$(comma)$$(newline)__SV_END,$$(newline),$$(_json_contents)__SV_END}$$(newline)))
+
+json_contents =$= $(_json_contents)
diff --git a/core/main.mk b/core/main.mk
index bd75736..a6e431f 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -244,7 +244,11 @@
ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
endif
-ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.logical_partitions=$(PRODUCT_USE_LOGICAL_PARTITIONS)
+# TODO(b/119286600): remove ro.logical_partitions
+ADDITIONAL_PRODUCT_PROPERTIES += \
+ ro.boot.logical_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS) \
+ ro.boot.dynamic_partitions=$(PRODUCT_USE_DYNAMIC_PARTITIONS) \
+ ro.boot.dynamic_partitions_retrofit=$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)
# -----------------------------------------------------------------
###
@@ -1075,7 +1079,8 @@
product_MODULES := $(_pif_modules)
# Verify the artifact path requirements made by included products.
-
+ is_asan := $(if $(filter address,$(SANITIZE_TARGET)),true)
+ ifneq (true,$(or $(is_asan),$(DISABLE_ARTIFACT_PATH_REQUIREMENTS)))
# Fakes don't get installed, and host files are irrelevant.
static_whitelist_patterns := $(TARGET_OUT_FAKE)/% $(HOST_OUT)/%
# RROs become REQUIRED by the source module, but are always placed on the vendor partition.
@@ -1119,6 +1124,7 @@
$(PRODUCT_OUT)/offending_artifacts.txt:
rm -f $@
$(foreach f,$(sort $(all_offending_files)),echo $(f) >> $@;)
+ endif
else
# We're not doing a full build, and are probably only including
# a subset of the module makefiles. Don't try to build any modules
@@ -1198,6 +1204,9 @@
modules_to_check += $(foreach m,$(ALL_MODULES),$(ALL_MODULES.$(m).BUILT))
endif
+# Build docs as part of checkbuild to catch more breakages.
+module_to_check += $(ALL_DOCS)
+
# for easier debugging
modules_to_check := $(sort $(modules_to_check))
#$(error modules_to_check $(modules_to_check))
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 08778c5..e687ab2 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -119,6 +119,6 @@
# Define it even if the notice file doesn't exist so that other
# modules can depend on it.
notice_target := NOTICE-$(if \
- $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
+ $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-$(LOCAL_MODULE_CLASS)-$(LOCAL_MODULE)
.PHONY: $(notice_target)
$(notice_target): $(installed_notice_file)
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 3e68c2f..9327587 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -743,7 +743,7 @@
ifdef LOCAL_DEX_PREOPT
$(built_odex): PRIVATE_DEX_FILE := $(built_dex)
ifeq (true, $(LOCAL_UNCOMPRESS_DEX))
-$(built_odex): $(ZIP2ZIP)
+$(built_odex): $(ZIP2ZIP) $(ZIPALIGN)
endif
# Use pattern rule - we may have multiple built odex files.
$(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(built_dex)
diff --git a/core/product.mk b/core/product.mk
index f9f8d60..661416c 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -210,6 +210,8 @@
PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
PRODUCT_BUILD_SUPER_PARTITION \
PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION \
+ PRODUCT_USE_DYNAMIC_PARTITIONS \
+ PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
define dump-product
$(info ==== $(1) ====)\
diff --git a/core/product_config.mk b/core/product_config.mk
index 577bafe..5a727c4 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -513,20 +513,32 @@
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE))
-# Logical and Resizable Partitions feature flag.
-PRODUCT_USE_LOGICAL_PARTITIONS := \
- $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_LOGICAL_PARTITIONS))
-.KATI_READONLY := PRODUCT_USE_LOGICAL_PARTITIONS
+# Dynamic partition feature flags.
-# All requirements of PRODUCT_USE_LOGICAL_PARTITIONS falls back to
-# PRODUCT_USE_LOGICAL_PARTITIONS if not defined.
+# When this is true, dynamic partitions is retrofitted on a device that has
+# already been launched without dynamic partitions. Otherwise, the device
+# is launched with dynamic partitions.
+# This flag implies PRODUCT_USE_DYNAMIC_PARTITIONS.
+PRODUCT_RETROFIT_DYNAMIC_PARTITIONS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
+.KATI_READONLY := PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
+
+# TODO(b/119286600): remove PRODUCT_USE_LOGICAL_PARTITIONS
+PRODUCT_USE_DYNAMIC_PARTITIONS := $(or \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_DYNAMIC_PARTITIONS)), \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_LOGICAL_PARTITIONS)), \
+ $(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
+.KATI_READONLY := PRODUCT_USE_DYNAMIC_PARTITIONS
+
+# All requirements of PRODUCT_USE_DYNAMIC_PARTITIONS falls back to
+# PRODUCT_USE_DYNAMIC_PARTITIONS if not defined.
PRODUCT_USE_DYNAMIC_PARTITION_SIZE := $(or \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_DYNAMIC_PARTITION_SIZE)),\
- $(PRODUCT_USE_LOGICAL_PARTITIONS))
+ $(PRODUCT_USE_DYNAMIC_PARTITIONS))
.KATI_READONLY := PRODUCT_USE_DYNAMIC_PARTITION_SIZE
PRODUCT_BUILD_SUPER_PARTITION := $(or \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BUILD_SUPER_PARTITION)),\
- $(PRODUCT_USE_LOGICAL_PARTITIONS))
+ $(PRODUCT_USE_DYNAMIC_PARTITIONS))
.KATI_READONLY := PRODUCT_BUILD_SUPER_PARTITION
# List of modules that should be forcefully unmarked from being LOCAL_PRODUCT_MODULE, and hence
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 41e6a95..44bb020 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -34,6 +34,11 @@
include $(BUILD_SYSTEM)/dynamic_binary.mk
# Define PRIVATE_ variables from global vars
+ifeq ($(LOCAL_NO_LIBCRT_BUILTINS),true)
+my_target_libcrt_builtins :=
+else
+my_target_libcrt_builtins := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)LIBCRT_BUILTINS)
+endif
ifeq ($(LOCAL_NO_LIBGCC),true)
my_target_libgcc :=
else
@@ -54,6 +59,7 @@
my_target_crtbegin_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtbegin_so.o)
my_target_crtend_so_o := $(wildcard $(my_ndk_sysroot_lib)/crtend_so.o)
endif
+$(linked_module): PRIVATE_TARGET_LIBCRT_BUILTINS := $(my_target_libcrt_builtins)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
@@ -64,6 +70,7 @@
$(all_libraries) \
$(my_target_crtbegin_so_o) \
$(my_target_crtend_so_o) \
+ $(my_target_libcrt_builtins) \
$(my_target_libgcc) \
$(my_target_libatomic) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index ae67fb8..088b076 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -188,7 +188,7 @@
$(LOCAL_STATIC_LIBRARIES))
installed_static_library_notice_file_targets := \
$(foreach lib,$(my_static_libraries) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
- NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST,TARGET)-STATIC_LIBRARIES-$(lib))
+ NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-STATIC_LIBRARIES-$(lib))
$(notice_target): | $(installed_static_library_notice_file_targets)
$(LOCAL_INSTALLED_MODULE): | $(notice_target)
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 7a884e0..4328453 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -14,31 +14,13 @@
endif
ifeq ($(WRITE_SOONG_VARIABLES),true)
-# Converts a list to a JSON list.
-# $1: List separator.
-# $2: List.
-_json_list = [$(if $(2),"$(subst $(1),"$(comma)",$(2))")]
-# Converts a space-separated list to a JSON list.
-json_list = $(call _json_list,$(space),$(1))
-
-# Converts a comma-separated list to a JSON list.
-csv_to_json_list = $(call _json_list,$(comma),$(1))
-
-# 1: Key name
-# 2: Value
-add_json_val = $(eval _contents := $$(_contents) "$$(strip $$(1))":$$(space)$$(strip $$(2))$$(comma)$$(newline))
-add_json_str = $(call add_json_val,$(1),"$(strip $(2))")
-add_json_list = $(call add_json_val,$(1),$(call json_list,$(patsubst %,%,$(2))))
-add_json_csv = $(call add_json_val,$(1),$(call csv_to_json_list,$(strip $(2))))
-add_json_bool = $(call add_json_val,$(1),$(if $(strip $(2)),true,false))
-
-invert_bool = $(if $(strip $(1)),,true)
+include $(BUILD_SYSTEM)/json.mk
# Create soong.variables with copies of makefile settings. Runs every build,
# but only updates soong.variables if it changes
$(shell mkdir -p $(dir $(SOONG_VARIABLES)))
-_contents := {$(newline)
+$(call json_start)
$(call add_json_str, Make_suffix, -$(TARGET_PRODUCT))
@@ -154,17 +136,19 @@
$(call add_json_list, BoardPlatPublicSepolicyDirs, $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR))
$(call add_json_list, BoardPlatPrivateSepolicyDirs, $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR))
-_contents := $(_contents) "VendorVars": {$(newline)
+$(call add_json_bool, FlattenApex, $(filter true,$(TARGET_FLATTEN_APEX)))
+
+$(call add_json_map, VendorVars)
$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
- $(eval _contents := $$(_contents) "$(namespace)": {$$(newline)) \
+ $(call add_json_map, $(namespace))\
$(foreach key,$(SOONG_CONFIG_$(namespace)),\
- $(eval _contents := $$(_contents) "$(key)": "$(SOONG_CONFIG_$(namespace)_$(key))",$$(newline)))\
- $(eval _contents := $$(_contents)$(if $(strip $(SOONG_CONFIG_$(namespace))),__SV_END) },$$(newline)))
-_contents := $(_contents)$(if $(strip $(SOONG_CONFIG_NAMESPACES)),__SV_END) },$(newline)
+ $(call add_json_str,$(key),$(SOONG_CONFIG_$(namespace)_$(key))))\
+ $(call end_json_map))
+$(call end_json_map)
-_contents := $(subst $(comma)$(newline)__SV_END,$(newline),$(_contents)__SV_END}$(newline))
+$(call json_end)
-$(file >$(SOONG_VARIABLES).tmp,$(_contents))
+$(file >$(SOONG_VARIABLES).tmp,$(json_contents))
$(shell if ! cmp -s $(SOONG_VARIABLES).tmp $(SOONG_VARIABLES); then \
mv $(SOONG_VARIABLES).tmp $(SOONG_VARIABLES); \
@@ -172,15 +156,4 @@
rm $(SOONG_VARIABLES).tmp; \
fi)
-_json_list :=
-json_list :=
-csv_to_json_list :=
-add_json_val :=
-add_json_str :=
-add_json_list :=
-add_json_csv :=
-add_json_bool :=
-invert_bool :=
-_contents :=
-
endif # CONFIGURE_SOONG
diff --git a/envsetup.sh b/envsetup.sh
index a4d950e..400e7f0 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -1095,7 +1095,7 @@
{
local PID="$1"
if [ "$PID" ] ; then
- if [[ "$(adb shell cat /proc/$PID/exe | xxd -l 1 -s 4 -ps)" -eq "02" ]] ; then
+ if [[ "$(adb shell cat /proc/$PID/exe | xxd -l 1 -s 4 -p)" -eq "02" ]] ; then
echo "64"
else
echo ""
@@ -1109,7 +1109,7 @@
Darwin)
function sgrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|S|java|xml|sh|mk|aidl|vts)' \
+ find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cc|cpp|hpp|S|java|xml|sh|mk|aidl|vts)' \
-exec grep --color -n "$@" {} +
}
@@ -1117,7 +1117,7 @@
*)
function sgrep()
{
- find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\)' \
+ find . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.\(c\|h\|cc\|cpp\|hpp\|S\|java\|xml\|sh\|mk\|aidl\|vts\)' \
-exec grep --color -n "$@" {} +
}
;;
@@ -1182,7 +1182,7 @@
function treegrep()
{
- find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|S|java|xml)' \
+ find -E . -name .repo -prune -o -name .git -prune -o -type f -iregex '.*\.(c|h|cpp|hpp|S|java|xml)' \
-exec grep --color -n -i "$@" {} +
}
@@ -1196,7 +1196,7 @@
function treegrep()
{
- find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|S|java|xml)' -type f \
+ find . -name .repo -prune -o -name .git -prune -o -regextype posix-egrep -iregex '.*\.(c|h|cpp|hpp|S|java|xml)' -type f \
-exec grep --color -n -i "$@" {} +
}
@@ -1567,10 +1567,19 @@
function atest()
{
- # TODO (sbasi): Replace this to be a destination in the build out when & if
- # atest is built by the build system. (This will be necessary if it ever
- # depends on external pip projects).
- "$(gettop)"/tools/tradefederation/core/atest/atest.py "$@"
+ # Let's use the built version over the prebuilt, then source code.
+ local os_arch=$(get_build_var HOST_PREBUILT_TAG)
+ local built_atest=${ANDROID_HOST_OUT}/bin/atest
+ local prebuilt_atest="$(gettop)"/prebuilts/asuite/atest/$os_arch/atest
+ if [[ -x $built_atest ]]; then
+ $built_atest "$@"
+ elif [[ -x $prebuilt_atest ]]; then
+ $prebuilt_atest "$@"
+ else
+ # TODO: once prebuilt atest released, remove the source code section
+ # and change the location of atest_completion.sh in addcompletions().
+ "$(gettop)"/tools/tradefederation/core/atest/atest.py "$@"
+ fi
}
# Zsh needs bashcompinit called to support bash-style completion.
diff --git a/target/product/OWNERS b/target/product/OWNERS
new file mode 100644
index 0000000..1c74859
--- /dev/null
+++ b/target/product/OWNERS
@@ -0,0 +1 @@
+per-file runtime_libart.mk = agampe@google.com, calin@google.com, mast@google.com, ngeoffray@google.com, oth@google.com, rpl@google.com, sehr@google.com, vmarko@google.com
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index 795f8aa..5a6a092 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -38,6 +38,10 @@
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+# GSI specific tasks on boot
+PRODUCT_COPY_FILES += \
+ build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc
+
# Support addtional P vendor interface
PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index f3f3c5a..90c159f 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -54,6 +54,10 @@
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+# GSI specific tasks on boot
+PRODUCT_COPY_FILES += \
+ build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc
+
# Support addtional P vendor interface
PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index e3167af..da31e24 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -38,6 +38,10 @@
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+# GSI specific tasks on boot
+PRODUCT_COPY_FILES += \
+ build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc
+
# Support addtional P vendor interface
PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index 222adaa..4ce40cc 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -54,6 +54,10 @@
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+# GSI specific tasks on boot
+PRODUCT_COPY_FILES += \
+ build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc
+
# Support addtional P vendor interface
PRODUCT_EXTRA_VNDK_VERSIONS := 28
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 7b70c86..1ac6332 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -52,6 +52,7 @@
charger \
cmd \
com.android.location.provider \
+ com.android.tzdata \
ContactsProvider \
content \
crash_dump \
@@ -78,6 +79,7 @@
heapprofd \
heapprofd_client \
gatekeeperd \
+ gpuservice \
healthd \
hid \
hwservicemanager \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index b0edb56..862a341 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -31,6 +31,7 @@
RcsService \
SafetyRegulatoryInfo \
Stk \
+ TimeZoneUpdater \
# OTA support
PRODUCT_PACKAGES += \
@@ -55,6 +56,9 @@
audio.a2dp.default \
audio.hearing_aid.default \
+# For ringtones that rely on forward lock encryption
+PRODUCT_PACKAGES += libfwdlockengine
+
PRODUCT_PACKAGES_DEBUG += \
avbctl \
bootctl \
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index bda4524..6d835fd 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -51,6 +51,10 @@
PRODUCT_PACKAGES += art-runtime
# ART/dex helpers.
PRODUCT_PACKAGES += art-tools
+# Android Runtime APEX module.
+ifneq ($(DONT_INCLUDE_RUNTIME_APEX), true)
+ PRODUCT_PACKAGES += com.android.runtime
+endif
# Certificates.
PRODUCT_PACKAGES += \
diff --git a/target/product/treble_common.mk b/target/product/treble_common.mk
index d3cce76..bbad484 100644
--- a/target/product/treble_common.mk
+++ b/target/product/treble_common.mk
@@ -46,9 +46,13 @@
PRODUCT_COPY_FILES += \
device/generic/common/nfc/libnfc-nci.conf:system/etc/libnfc-nci.conf
+# GSI specific tasks on boot
+PRODUCT_COPY_FILES += \
+ build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc
+
# Support for the O-MR1 devices
PRODUCT_COPY_FILES += \
- build/make/target/product/vndk/init.gsi.rc:system/etc/init/init.gsi.rc \
+ build/make/target/product/vndk/init.legacy-gsi.rc:system/etc/init/init.legacy-gsi.rc \
build/make/target/product/vndk/init.vndk-27.rc:system/etc/init/gsi/init.vndk-27.rc
# Name space configuration file for non-enforcing VNDK
diff --git a/target/product/vndk/current.txt b/target/product/vndk/current.txt
index 6120e9d..624102a 100644
--- a/target/product/vndk/current.txt
+++ b/target/product/vndk/current.txt
@@ -121,6 +121,7 @@
VNDK-core: android.hardware.power@1.2.so
VNDK-core: android.hardware.power@1.3.so
VNDK-core: android.hardware.radio.config@1.0.so
+VNDK-core: android.hardware.radio.config@1.1.so
VNDK-core: android.hardware.radio.deprecated@1.0.so
VNDK-core: android.hardware.radio@1.0.so
VNDK-core: android.hardware.radio@1.1.so
diff --git a/target/product/vndk/init.gsi.rc b/target/product/vndk/init.gsi.rc
index 0150b1a..695820e 100644
--- a/target/product/vndk/init.gsi.rc
+++ b/target/product/vndk/init.gsi.rc
@@ -1,2 +1,2 @@
-# If ro.vndk.version is not defined, import init.vndk-27.rc.
-import /system/etc/init/gsi/init.vndk-${ro.vndk.version:-27}.rc
+on early-init
+ umount /product # TODO(b/119391482): workaround for /system/product
diff --git a/target/product/vndk/init.legacy-gsi.rc b/target/product/vndk/init.legacy-gsi.rc
new file mode 100644
index 0000000..00dd576
--- /dev/null
+++ b/target/product/vndk/init.legacy-gsi.rc
@@ -0,0 +1,3 @@
+# If ro.vndk.version is not defined, import init.vndk-27.rc.
+import /system/etc/init/gsi/init.vndk-${ro.vndk.version:-27}.rc
+
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 6d22694..d32090a 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -221,8 +221,8 @@
adjusted_blocks))
-def BuildImage(in_dir, prop_dict, out_file, target_out=None):
- """Builds an image for the files under in_dir and writes it to out_file.
+def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
+ """Builds a pure image for the files under in_dir and writes it to out_file.
Args:
in_dir: Path to input directory.
@@ -233,77 +233,15 @@
points to the /system directory under PRODUCT_OUT. fs_config (the one
under system/core/libcutils) reads device specific FS config files from
there.
+ fs_config: The fs_config file that drives the prototype
Raises:
BuildImageError: On build image failures.
"""
- original_mount_point = prop_dict["mount_point"]
- in_dir, fs_config = SetUpInDirAndFsConfig(in_dir, prop_dict)
-
build_command = []
fs_type = prop_dict.get("fs_type", "")
run_e2fsck = False
- fs_spans_partition = True
- if fs_type.startswith("squash"):
- fs_spans_partition = False
-
- # Get a builder for creating an image that's to be verified by Verified Boot,
- # or None if not applicable.
- verity_image_builder = verity_utils.CreateVerityImageBuilder(prop_dict)
-
- if (prop_dict.get("use_dynamic_partition_size") == "true" and
- "partition_size" not in prop_dict):
- # If partition_size is not defined, use output of `du' + reserved_size.
- size = GetDiskUsage(in_dir)
- logger.info(
- "The tree size of %s is %d MB.", in_dir, size // BYTES_IN_MB)
- # If not specified, give us 16MB margin for GetDiskUsage error ...
- size += int(prop_dict.get("partition_reserved_size", BYTES_IN_MB * 16))
- # Round this up to a multiple of 4K so that avbtool works
- size = common.RoundUpTo4K(size)
- if verity_image_builder:
- size = verity_image_builder.CalculateDynamicPartitionSize(size)
- prop_dict["partition_size"] = str(size)
- if fs_type.startswith("ext"):
- if "extfs_inode_count" not in prop_dict:
- prop_dict["extfs_inode_count"] = str(GetInodeUsage(in_dir))
- logger.info(
- "First Pass based on estimates of %d MB and %s inodes.",
- size // BYTES_IN_MB, prop_dict["extfs_inode_count"])
- prop_dict["mount_point"] = original_mount_point
- BuildImage(in_dir, prop_dict, out_file, target_out)
- fs_dict = GetFilesystemCharacteristics(out_file)
- block_size = int(fs_dict.get("Block size", "4096"))
- free_size = int(fs_dict.get("Free blocks", "0")) * block_size
- reserved_size = int(prop_dict.get("partition_reserved_size", 0))
- if free_size <= reserved_size:
- logger.info(
- "Not worth reducing image %d <= %d.", free_size, reserved_size)
- else:
- size -= free_size + (free_size // 60)
- size += reserved_size
- if block_size <= 4096:
- size = common.RoundUpTo4K(size)
- else:
- size = ((size + block_size - 1) // block_size) * block_size
- extfs_inode_count = prop_dict["extfs_inode_count"]
- inodes = int(fs_dict.get("Inode count", extfs_inode_count))
- inodes -= int(fs_dict.get("Free inodes", "0"))
- prop_dict["extfs_inode_count"] = str(inodes)
- prop_dict["partition_size"] = str(size)
- logger.info(
- "Allocating %d Inodes for %s.", inodes, out_file)
- logger.info(
- "Allocating %d MB for %s.", size // BYTES_IN_MB, out_file)
-
- prop_dict["image_size"] = prop_dict["partition_size"]
-
- # Adjust the image size to make room for the hashes if this is to be verified.
- if verity_image_builder:
- max_image_size = verity_image_builder.CalculateMaxImageSize()
- prop_dict["image_size"] = str(max_image_size)
-
if fs_type.startswith("ext"):
build_command = [prop_dict["ext_mkuserimg"]]
if "extfs_sparse_flag" in prop_dict:
@@ -396,8 +334,8 @@
logger.exception("Failed to compute disk usage with du")
du_str = "unknown"
print(
- "Out of space? The tree size of {} is {}, with reserved space of {} "
- "bytes ({} MB).".format(
+ "Out of space? Out of inodes? The tree size of {} is {}, "
+ "with reserved space of {} bytes ({} MB).".format(
in_dir, du_str,
int(prop_dict.get("partition_reserved_size", 0)),
int(prop_dict.get("partition_reserved_size", 0)) // BYTES_IN_MB))
@@ -410,6 +348,111 @@
int(prop_dict["partition_size"]) // BYTES_IN_MB))
raise
+ if run_e2fsck and prop_dict.get("skip_fsck") != "true":
+ unsparse_image = UnsparseImage(out_file, replace=False)
+
+ # Run e2fsck on the inflated image file
+ e2fsck_command = ["e2fsck", "-f", "-n", unsparse_image]
+ try:
+ common.RunAndCheckOutput(e2fsck_command)
+ finally:
+ os.remove(unsparse_image)
+
+ return mkfs_output
+
+
+def BuildImage(in_dir, prop_dict, out_file, target_out=None):
+ """Builds an image for the files under in_dir and writes it to out_file.
+
+ Args:
+ in_dir: Path to input directory.
+ prop_dict: A property dict that contains info like partition size. Values
+ will be updated with computed values.
+ out_file: The output image file.
+ target_out: Path to the TARGET_OUT directory as in Makefile. It actually
+ points to the /system directory under PRODUCT_OUT. fs_config (the one
+ under system/core/libcutils) reads device specific FS config files from
+ there.
+
+ Raises:
+ BuildImageError: On build image failures.
+ """
+ in_dir, fs_config = SetUpInDirAndFsConfig(in_dir, prop_dict)
+
+ build_command = []
+ fs_type = prop_dict.get("fs_type", "")
+
+ fs_spans_partition = True
+ if fs_type.startswith("squash"):
+ fs_spans_partition = False
+
+ # Get a builder for creating an image that's to be verified by Verified Boot,
+ # or None if not applicable.
+ verity_image_builder = verity_utils.CreateVerityImageBuilder(prop_dict)
+
+ if (prop_dict.get("use_dynamic_partition_size") == "true" and
+ "partition_size" not in prop_dict):
+ # If partition_size is not defined, use output of `du' + reserved_size.
+ size = GetDiskUsage(in_dir)
+ logger.info(
+ "The tree size of %s is %d MB.", in_dir, size // BYTES_IN_MB)
+ # If not specified, give us 16MB margin for GetDiskUsage error ...
+ reserved_size = int(prop_dict.get("partition_reserved_size", BYTES_IN_MB * 16))
+ partition_headroom = int(prop_dict.get("partition_headroom", 0))
+ if fs_type.startswith("ext4") and partition_headroom > reserved_size:
+ reserved_size = partition_headroom
+ size += reserved_size
+ # Round this up to a multiple of 4K so that avbtool works
+ size = common.RoundUpTo4K(size)
+ if fs_type.startswith("ext"):
+ prop_dict["partition_size"] = str(size)
+ prop_dict["image_size"] = str(size)
+ if "extfs_inode_count" not in prop_dict:
+ prop_dict["extfs_inode_count"] = str(GetInodeUsage(in_dir))
+ logger.info(
+ "First Pass based on estimates of %d MB and %s inodes.",
+ size // BYTES_IN_MB, prop_dict["extfs_inode_count"])
+ BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
+ fs_dict = GetFilesystemCharacteristics(out_file)
+ os.remove(out_file)
+ block_size = int(fs_dict.get("Block size", "4096"))
+ free_size = int(fs_dict.get("Free blocks", "0")) * block_size
+ reserved_size = int(prop_dict.get("partition_reserved_size", 0))
+ partition_headroom = int(fs_dict.get("partition_headroom", 0))
+ if fs_type.startswith("ext4") and partition_headroom > reserved_size:
+ reserved_size = partition_headroom
+ if free_size <= reserved_size:
+ logger.info(
+ "Not worth reducing image %d <= %d.", free_size, reserved_size)
+ else:
+ size -= free_size
+ size += reserved_size
+ if block_size <= 4096:
+ size = common.RoundUpTo4K(size)
+ else:
+ size = ((size + block_size - 1) // block_size) * block_size
+ extfs_inode_count = prop_dict["extfs_inode_count"]
+ inodes = int(fs_dict.get("Inode count", extfs_inode_count))
+ inodes -= int(fs_dict.get("Free inodes", "0"))
+ prop_dict["extfs_inode_count"] = str(inodes)
+ prop_dict["partition_size"] = str(size)
+ logger.info(
+ "Allocating %d Inodes for %s.", inodes, out_file)
+ if verity_image_builder:
+ size = verity_image_builder.CalculateDynamicPartitionSize(size)
+ prop_dict["partition_size"] = str(size)
+ logger.info(
+ "Allocating %d MB for %s.", size // BYTES_IN_MB, out_file)
+
+ prop_dict["image_size"] = prop_dict["partition_size"]
+
+ # Adjust the image size to make room for the hashes if this is to be verified.
+ if verity_image_builder:
+ max_image_size = verity_image_builder.CalculateMaxImageSize()
+ prop_dict["image_size"] = str(max_image_size)
+
+ mkfs_output = BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config)
+
# Check if there's enough headroom space available for ext4 image.
if "partition_headroom" in prop_dict and fs_type.startswith("ext4"):
CheckHeadroom(mkfs_output, prop_dict)
@@ -421,16 +464,6 @@
if verity_image_builder:
verity_image_builder.Build(out_file)
- if run_e2fsck and prop_dict.get("skip_fsck") != "true":
- unsparse_image = UnsparseImage(out_file, replace=False)
-
- # Run e2fsck on the inflated image file
- e2fsck_command = ["e2fsck", "-f", "-n", unsparse_image]
- try:
- common.RunAndCheckOutput(e2fsck_command)
- finally:
- os.remove(unsparse_image)
-
def ImagePropFromGlobalDict(glob_dict, mount_point):
"""Build an image property dictionary from the global dictionary.
diff --git a/tools/releasetools/test_verity_utils.py b/tools/releasetools/test_verity_utils.py
index 41f234b..e0607c8 100644
--- a/tools/releasetools/test_verity_utils.py
+++ b/tools/releasetools/test_verity_utils.py
@@ -16,6 +16,7 @@
"""Unittests for verity_utils.py."""
+import copy
import math
import os.path
import random
@@ -165,14 +166,153 @@
self.assertEqual(self.expected_root_hash, info.root_hash)
+class VerifiedBootVersion1VerityImageBuilderTest(ReleaseToolsTestCase):
+
+ DEFAULT_PARTITION_SIZE = 4096 * 1024
+ DEFAULT_PROP_DICT = {
+ 'partition_size': str(DEFAULT_PARTITION_SIZE),
+ 'verity': 'true',
+ 'verity_block_device': '/dev/block/system',
+ 'verity_key': os.path.join(get_testdata_dir(), 'testkey'),
+ 'verity_fec': 'true',
+ 'verity_signer_cmd': 'verity_signer',
+ }
+
+ def test_init(self):
+ prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
+ verity_image_builder = CreateVerityImageBuilder(prop_dict)
+ self.assertIsNotNone(verity_image_builder)
+ self.assertEqual(1, verity_image_builder.version)
+
+ def test_init_MissingProps(self):
+ prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
+ del prop_dict['verity']
+ self.assertIsNone(CreateVerityImageBuilder(prop_dict))
+
+ prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
+ del prop_dict['verity_block_device']
+ self.assertIsNone(CreateVerityImageBuilder(prop_dict))
+
+ def test_CalculateMaxImageSize(self):
+ verity_image_builder = CreateVerityImageBuilder(self.DEFAULT_PROP_DICT)
+ size = verity_image_builder.CalculateMaxImageSize()
+ self.assertLess(size, self.DEFAULT_PARTITION_SIZE)
+
+ # Same result by explicitly passing the partition size.
+ self.assertEqual(
+ verity_image_builder.CalculateMaxImageSize(),
+ verity_image_builder.CalculateMaxImageSize(
+ self.DEFAULT_PARTITION_SIZE))
+
+ @staticmethod
+ def _BuildAndVerify(prop, verify_key):
+ verity_image_builder = CreateVerityImageBuilder(prop)
+ image_size = verity_image_builder.CalculateMaxImageSize()
+
+ # Build the sparse image with verity metadata.
+ input_dir = common.MakeTempDir()
+ image = common.MakeTempFile(suffix='.img')
+ cmd = ['mkuserimg_mke2fs', input_dir, image, 'ext4', '/system',
+ str(image_size), '-j', '0', '-s']
+ common.RunAndCheckOutput(cmd)
+ verity_image_builder.Build(image)
+
+ # Verify the verity metadata.
+ cmd = ['verity_verifier', image, '-mincrypt', verify_key]
+ common.RunAndCheckOutput(cmd)
+
+ def test_Build(self):
+ self._BuildAndVerify(
+ self.DEFAULT_PROP_DICT,
+ os.path.join(get_testdata_dir(), 'testkey_mincrypt'))
+
+ def test_Build_SanityCheck(self):
+ # A sanity check for the test itself: the image shouldn't be verifiable
+ # with wrong key.
+ self.assertRaises(
+ common.ExternalError,
+ self._BuildAndVerify,
+ self.DEFAULT_PROP_DICT,
+ os.path.join(get_testdata_dir(), 'verity_mincrypt'))
+
+ def test_Build_FecDisabled(self):
+ prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
+ del prop_dict['verity_fec']
+ self._BuildAndVerify(
+ prop_dict,
+ os.path.join(get_testdata_dir(), 'testkey_mincrypt'))
+
+ def test_Build_SquashFs(self):
+ verity_image_builder = CreateVerityImageBuilder(self.DEFAULT_PROP_DICT)
+ verity_image_builder.CalculateMaxImageSize()
+
+ # Build the sparse image with verity metadata.
+ input_dir = common.MakeTempDir()
+ image = common.MakeTempFile(suffix='.img')
+ cmd = ['mksquashfsimage.sh', input_dir, image, '-s']
+ common.RunAndCheckOutput(cmd)
+ verity_image_builder.PadSparseImage(image)
+ verity_image_builder.Build(image)
+
+ # Verify the verity metadata.
+ cmd = ["verity_verifier", image, '-mincrypt',
+ os.path.join(get_testdata_dir(), 'testkey_mincrypt')]
+ common.RunAndCheckOutput(cmd)
+
+
class VerifiedBootVersion2VerityImageBuilderTest(ReleaseToolsTestCase):
- def setUp(self):
+ DEFAULT_PROP_DICT = {
+ 'partition_size': str(4096 * 1024),
+ 'partition_name': 'system',
+ 'avb_avbtool': 'avbtool',
+ 'avb_hashtree_enable': 'true',
+ 'avb_add_hashtree_footer_args': '',
+ }
+
+ def test_init(self):
+ prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
+ verity_image_builder = CreateVerityImageBuilder(prop_dict)
+ self.assertIsNotNone(verity_image_builder)
+ self.assertEqual(2, verity_image_builder.version)
+
+ def test_init_MissingProps(self):
+ prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
+ del prop_dict['avb_hashtree_enable']
+ verity_image_builder = CreateVerityImageBuilder(prop_dict)
+ self.assertIsNone(verity_image_builder)
+
+ def test_Build(self):
+ prop_dict = copy.deepcopy(self.DEFAULT_PROP_DICT)
+ verity_image_builder = CreateVerityImageBuilder(prop_dict)
+ self.assertIsNotNone(verity_image_builder)
+ self.assertEqual(2, verity_image_builder.version)
+
+ input_dir = common.MakeTempDir()
+ image_dir = common.MakeTempDir()
+ system_image = os.path.join(image_dir, 'system.img')
+ system_image_size = verity_image_builder.CalculateMaxImageSize()
+ cmd = ['mkuserimg_mke2fs', input_dir, system_image, 'ext4', '/system',
+ str(system_image_size), '-j', '0', '-s']
+ common.RunAndCheckOutput(cmd)
+ verity_image_builder.Build(system_image)
+
+ # Additionally make vbmeta image so that we can verify with avbtool.
+ vbmeta_image = os.path.join(image_dir, 'vbmeta.img')
+ cmd = ['avbtool', 'make_vbmeta_image', '--include_descriptors_from_image',
+ system_image, '--output', vbmeta_image]
+ common.RunAndCheckOutput(cmd)
+
+ # Verify the verity metadata.
+ cmd = ['avbtool', 'verify_image', '--image', vbmeta_image]
+ common.RunAndCheckOutput(cmd)
+
+ def _test_CalculateMinPartitionSize_SetUp(self):
# To test CalculateMinPartitionSize(), by using 200MB to 2GB image size.
# - 51200 = 200MB * 1024 * 1024 / 4096
# - 524288 = 2GB * 1024 * 1024 * 1024 / 4096
- self._image_sizes = [BLOCK_SIZE * random.randint(51200, 524288) + offset
- for offset in range(BLOCK_SIZE)]
+ image_sizes = [BLOCK_SIZE * random.randint(51200, 524288) + offset
+ for offset in range(BLOCK_SIZE)]
prop_dict = {
'partition_size': None,
@@ -181,17 +321,19 @@
'avb_hashtree_enable': 'true',
'avb_add_hashtree_footer_args': None,
}
- self.builder = CreateVerityImageBuilder(prop_dict)
- self.assertEqual(2, self.builder.version)
+ builder = CreateVerityImageBuilder(prop_dict)
+ self.assertEqual(2, builder.version)
+ return image_sizes, builder
def test_CalculateMinPartitionSize_LinearFooterSize(self):
"""Tests with footer size which is linear to partition size."""
- for image_size in self._image_sizes:
+ image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
+ for image_size in image_sizes:
for ratio in 0.95, 0.56, 0.22:
expected_size = common.RoundUpTo4K(int(math.ceil(image_size / ratio)))
self.assertEqual(
expected_size,
- self.builder.CalculateMinPartitionSize(
+ builder.CalculateMinPartitionSize(
image_size, lambda x, ratio=ratio: int(x * ratio)))
def test_AVBCalcMinPartitionSize_SlowerGrowthFooterSize(self):
@@ -202,8 +344,9 @@
# Minus footer size to return max image size.
return partition_size - int(math.pow(partition_size, 0.95))
- for image_size in self._image_sizes:
- min_partition_size = self.builder.CalculateMinPartitionSize(
+ image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
+ for image_size in image_sizes:
+ min_partition_size = builder.CalculateMinPartitionSize(
image_size, _SizeCalculator)
# Checks min_partition_size can accommodate image_size.
self.assertGreaterEqual(
@@ -223,8 +366,9 @@
# footer size grows faster than partition size.
return int(math.pow(partition_size, 0.95))
- for image_size in self._image_sizes:
- min_partition_size = self.builder.CalculateMinPartitionSize(
+ image_sizes, builder = self._test_CalculateMinPartitionSize_SetUp()
+ for image_size in image_sizes:
+ min_partition_size = builder.CalculateMinPartitionSize(
image_size, _SizeCalculator)
# Checks min_partition_size can accommodate image_size.
self.assertGreaterEqual(
diff --git a/tools/releasetools/testdata/verity_mincrypt b/tools/releasetools/testdata/verity_mincrypt
new file mode 100644
index 0000000..31982d9
--- /dev/null
+++ b/tools/releasetools/testdata/verity_mincrypt
Binary files differ
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index 1cc4a60..ae8253d 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -311,31 +311,9 @@
if info_dict.get("avb_enable") == "true":
logging.info('Verifying Verified Boot 2.0 (AVB) images...')
- key = options['verity_key']
- if key is None:
- key = info_dict['avb_vbmeta_key_path']
-
- # avbtool verifies all the images that have descriptors listed in vbmeta.
- image = os.path.join(input_tmp, 'IMAGES', 'vbmeta.img')
- cmd = ['avbtool', 'verify_image', '--image', image, '--key', key]
-
- # Append the args for chained partitions if any.
- for partition in common.AVB_PARTITIONS:
- key_name = 'avb_' + partition + '_key_path'
- if info_dict.get(key_name) is not None:
- chained_partition_arg = common.GetAvbChainedPartitionArg(
- partition, info_dict, options[key_name])
- cmd.extend(["--expected_chain_partition", chained_partition_arg])
-
- proc = common.Run(cmd)
- stdoutdata, _ = proc.communicate()
- assert proc.returncode == 0, \
- 'Failed to verify {} with verity_verifier (key: {}):\n{}'.format(
- image, key, stdoutdata)
-
- logging.info(
- 'Verified %s with avbtool (key: %s):\n%s', image, key,
- stdoutdata.rstrip())
+ # Temporarily disable the verification for AVB-signed images, due to the
+ # dependency on PyCrypto in `avbtool verify_image` (Bug: 119624011).
+ logging.info('Temporarily disabled due to b/119624011')
def main():
diff --git a/tools/releasetools/verity_utils.py b/tools/releasetools/verity_utils.py
index 0a3dcec..3a58755 100644
--- a/tools/releasetools/verity_utils.py
+++ b/tools/releasetools/verity_utils.py
@@ -301,7 +301,7 @@
"""Creates an image that is verifiable using dm-verity.
Args:
- out_file: the location to write the verifiable image at
+ out_file: the output image.
Returns:
AssertionError: On invalid partition sizes.