Merge "Use libucrt instead of libmsvcr110"
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 7d42fc9..a4b7c26 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -517,6 +517,8 @@
$(call add-clean-step, rm -f $(HOST_OUT)/*ts/host-libprotobuf-java-*.jar)
+$(call add-clean-step, find $(OUT_DIR)/target/product/mainline_arm64/system -type f -name "*.*dex" -print0 | xargs -0 rm -f)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index 2b602b8..6ba2be9 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -148,6 +148,11 @@
FINAL_VENDOR_DEFAULT_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
+FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT)
+FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
+FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT)
+
# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
# mode (via libminui).
ifdef TARGET_RECOVERY_DEFAULT_ROTATION
@@ -220,7 +225,7 @@
echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
- echo "$(line)" >> $@;)
+ echo "$(line)" >> $@;)
$(hide) echo "#" >> $@; \
echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
echo "#" >> $@;
@@ -245,7 +250,7 @@
echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
- echo "$(line)" >> $@;)
+ echo "$(line)" >> $@;)
$(hide) build/make/tools/post_process_props.py $@
endif # property_overrides_split_enabled
@@ -372,57 +377,59 @@
echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach prop,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES), \
- echo "import /oem/oem.prop $(prop)" >> $@;)
+ echo "import /oem/oem.prop $(prop)" >> $@;)
endif
$(hide) $(call generate-common-build-props,system,$@)
$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
- TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
- TARGET_DEVICE="$(TARGET_DEVICE)" \
- PRODUCT_NAME="$(TARGET_PRODUCT)" \
- PRODUCT_BRAND="$(PRODUCT_BRAND)" \
- PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
- PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
- PRODUCT_MODEL="$(PRODUCT_MODEL)" \
- PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
- PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
- BUILD_ID="$(BUILD_ID)" \
- BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
- DATE="$(DATE_FROM_FILE)" \
- BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
- BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
- AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
- PLATFORM_VERSION="$(PLATFORM_VERSION)" \
- PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
- PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
- PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
- PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
- PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
- PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
- PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
- BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
- BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
- $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
- TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
- TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
- TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
- TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
- TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
+ TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
+ TARGET_DEVICE="$(TARGET_DEVICE)" \
+ PRODUCT_NAME="$(TARGET_PRODUCT)" \
+ PRODUCT_BRAND="$(PRODUCT_BRAND)" \
+ PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
+ PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
+ PRODUCT_MODEL="$(PRODUCT_MODEL)" \
+ PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
+ PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
+ BUILD_ID="$(BUILD_ID)" \
+ BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
+ DATE="$(DATE_FROM_FILE)" \
+ BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
+ BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
+ AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
+ PLATFORM_VERSION="$(PLATFORM_VERSION)" \
+ PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
+ PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
+ PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
+ PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
+ PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
+ PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
+ PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
+ BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
+ BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
+ $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
+ TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
+ TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
+ TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
+ TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
+ TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
bash $(BUILDINFO_SH) >> $@
$(hide) $(foreach file,$(system_prop_file), \
- if [ -f "$(file)" ]; then \
- echo "#" >> $@; \
- echo Target buildinfo from: "$(file)"; \
- echo "# from $(file)" >> $@; \
- echo "#" >> $@; \
- cat $(file) >> $@; \
- fi;)
+ if [ -f "$(file)" ]; then \
+ echo Target buildinfo from: "$(file)"; \
+ echo "" >> $@; \
+ echo "#" >> $@; \
+ echo "# from $(file)" >> $@; \
+ echo "#" >> $@; \
+ cat $(file) >> $@; \
+ echo "# end of $(file)" >> $@; \
+ fi;)
$(if $(FINAL_BUILD_PROPERTIES), \
- $(hide) echo >> $@; \
- echo "#" >> $@; \
- echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
- echo "#" >> $@; )
+ $(hide) echo >> $@; \
+ echo "#" >> $@; \
+ echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
+ echo "#" >> $@; )
$(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
- echo "$(line)" >> $@;)
+ echo "$(line)" >> $@;)
$(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
$(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
@@ -472,7 +479,7 @@
echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
- echo "$(line)" >> $@;)
+ echo "$(line)" >> $@;)
endif # property_overrides_split_enabled
$(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_PROPERTY_BLACKLIST)
@@ -481,24 +488,40 @@
INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
+ifdef TARGET_PRODUCT_PROP
+product_prop_files := $(TARGET_PRODUCT_PROP)
+else
+product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
+endif
+
FINAL_PRODUCT_PROPERTIES += \
$(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_PRODUCT_PROPERTIES),=)
-$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
+$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
@echo Target product buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
ifdef BOARD_USES_PRODUCTIMAGE
$(hide) $(call generate-common-build-props,product,$@)
endif # BOARD_USES_PRODUCTIMAGE
+ $(hide) $(foreach file,$(product_prop_files), \
+ if [ -f "$(file)" ]; then \
+ echo Target product properties from: "$(file)"; \
+ echo "" >> $@; \
+ echo "#" >> $@; \
+ echo "# from $(file)" >> $@; \
+ echo "#" >> $@; \
+ cat $(file) >> $@; \
+ echo "# end of $(file)" >> $@; \
+ fi;)
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
echo "#" >> $@; \
- echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
+ echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
$(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
- echo "$(line)" >> $@;)
+ echo "$(line)" >> $@;)
$(hide) build/make/tools/post_process_props.py $@
# ----------------------------------------------------------------
@@ -523,7 +546,7 @@
echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
- echo "$(line)" >> $@;)
+ echo "$(line)" >> $@;)
$(hide) build/make/tools/post_process_props.py $@
# -----------------------------------------------------------------
@@ -547,7 +570,7 @@
echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
- echo "$(line)" >> $@;)
+ echo "$(line)" >> $@;)
$(hide) build/make/tools/post_process_props.py $@
# ----------------------------------------------------------------
@@ -573,9 +596,9 @@
@echo SDK buildinfo: $@
@mkdir -p $(dir $@)
$(hide) grep -v "$(subst $(space),\|,$(strip \
- $(sdk_build_prop_remove)))" $< > $@.tmp
+ $(sdk_build_prop_remove)))" $< > $@.tmp
$(hide) for x in $(sdk_build_prop_remove); do \
- echo "$$x"generic >> $@.tmp; done
+ echo "$$x"generic >> $@.tmp; done
$(hide) mv $@.tmp $@
# -----------------------------------------------------------------
@@ -977,30 +1000,46 @@
$(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_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, \
- --html-output)))) $(3) \
- -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
+ $(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, \
+ --html-output)))) $(3) \
+ -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
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,106 +1056,82 @@
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), \
- "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_txt), \
+ $(target_notice_file_xml), \
+ "Notices for files contained in the filesystem images in this directory:", \
+ $(TARGET_OUT_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
+ $(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), \
+ $(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
+ $(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), \
+ $(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)))
-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
+ $(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), \
+ $(license_modules_product_services)))
-$(eval $(call combine-notice-files, html, \
- $(tools_notice_file_txt), \
- $(tools_notice_file_html), \
- "Notices for files contained in the tools directory:", \
- $(HOST_OUT_NOTICE_FILES), \
- $(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)
+$(target_notice_file_xml_gz): $(target_notice_file_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_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)
-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
+ 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
+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, \
+ $(tools_notice_file_txt), \
+ $(tools_notice_file_html), \
+ "Notices for files contained in the tools directory:", \
+ $(HOST_OUT_NOTICE_FILES), \
+ $(ALL_DEFAULT_INSTALLED_MODULES) \
+ $(winpthreads_notice_file)))
+
endif # TARGET_BUILD_APPS
# The kernel isn't really a module, so to get its module file in there, we
@@ -1164,7 +1179,7 @@
ALL_DEFAULT_INSTALLED_MODULES += \
$(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem
$(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem: \
- $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
+ $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
$(hide) cp -f $< $@
endif
endif
@@ -1241,7 +1256,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 +1265,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"
@@ -1592,13 +1607,13 @@
endef
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
- $(INSTALLED_DEFAULT_PROP_TARGET) \
- $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
- $(intermediate_system_build_prop) \
- $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
- $(INSTALLED_ODM_BUILD_PROP_TARGET) \
- $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
- $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
+ $(INSTALLED_DEFAULT_PROP_TARGET) \
+ $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
+ $(intermediate_system_build_prop) \
+ $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
+ $(INSTALLED_ODM_BUILD_PROP_TARGET) \
+ $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
+ $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
@echo "Target recovery buildinfo: $@"
$(hide) mkdir -p $(dir $@)
$(hide) rm -f $@
@@ -1656,9 +1671,9 @@
# Copying baseline ramdisk...
# Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
$(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
- $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
- $(hide) rsync -a $(TARGET_RAMDISK_OUT)/* $(TARGET_RECOVERY_ROOT_OUT)/)
# Modifying ramdisk contents...
+ $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
+ $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
$(if $(BOARD_RECOVERY_KERNEL_MODULES), \
$(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
# Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
@@ -1715,17 +1730,17 @@
endif
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
- $(INTERNAL_ROOT_FILES) \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INTERNAL_RECOVERYIMAGE_FILES) \
- $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
- $(INSTALLED_2NDBOOTLOADER_TARGET) \
- $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
- $(recovery_resource_deps) \
- $(recovery_fstab) \
- $(RECOVERY_INSTALL_OTA_KEYS) \
- $(BOARD_RECOVERY_KERNEL_MODULES) \
- $(DEPMOD)
+ $(INTERNAL_ROOT_FILES) \
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INTERNAL_RECOVERYIMAGE_FILES) \
+ $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
+ $(INSTALLED_2NDBOOTLOADER_TARGET) \
+ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
+ $(recovery_resource_deps) \
+ $(recovery_fstab) \
+ $(RECOVERY_INSTALL_OTA_KEYS) \
+ $(BOARD_RECOVERY_KERNEL_MODULES) \
+ $(DEPMOD)
$(call pretty,"Target boot image from recovery: $@")
$(call build-recoveryimage-target, $@)
endif # BOARD_USES_RECOVERY_AS_BOOT
@@ -1735,18 +1750,18 @@
endif
$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
- $(INTERNAL_ROOT_FILES) \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INTERNAL_RECOVERYIMAGE_FILES) \
- $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
- $(INSTALLED_2NDBOOTLOADER_TARGET) \
- $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
- $(recovery_resource_deps) \
- $(recovery_fstab) \
- $(RECOVERY_INSTALL_OTA_KEYS) \
- $(BOARD_RECOVERY_KERNEL_MODULES) \
- $(DEPMOD)
+ $(INTERNAL_ROOT_FILES) \
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INTERNAL_RECOVERYIMAGE_FILES) \
+ $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
+ $(INSTALLED_2NDBOOTLOADER_TARGET) \
+ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
+ $(recovery_resource_deps) \
+ $(recovery_fstab) \
+ $(RECOVERY_INSTALL_OTA_KEYS) \
+ $(BOARD_RECOVERY_KERNEL_MODULES) \
+ $(DEPMOD)
$(call build-recoveryimage-target, $@)
ifdef RECOVERY_RESOURCE_ZIP
@@ -1816,11 +1831,11 @@
@echo "Verifying system VINTF manifest."
PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
$(HOST_OUT_EXECUTABLES)/assemble_vintf \
- -c $(BUILT_VENDOR_MATRIX) \
- -i $(BUILT_SYSTEM_MANIFEST) \
- $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
- find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
- sed "s/^/-i /" | tr '\n' ' ') -o $@
+ -c $(BUILT_VENDOR_MATRIX) \
+ -i $(BUILT_SYSTEM_MANIFEST) \
+ $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
+ find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
+ sed "s/^/-i /" | tr '\n' ' ') -o $@
# -----------------------------------------------------------------
# installed file list
@@ -1952,9 +1967,9 @@
RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
$(RECOVERY_FROM_BOOT_PATCH): \
- $(INSTALLED_RECOVERYIMAGE_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(diff_tool)
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(diff_tool)
@echo "Construct recovery from boot"
mkdir -p $(dir $@)
$(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
@@ -1968,8 +1983,8 @@
@echo "Install system fs image: $@"
$(copy-file-to-target)
$(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
- $(call read-image-prop-dictionary,\
- $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
+ $(call read-image-prop-dictionary,\
+ $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
@@ -1979,8 +1994,8 @@
@echo "make $@: ignoring dependencies"
$(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
$(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),\
- $(call read-image-prop-dictionary,\
- $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
+ $(call read-image-prop-dictionary,\
+ $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
ifeq (true,$(WITH_DEXPREOPT))
@@ -1988,8 +2003,8 @@
endif
endif
-.PHONY: sync
-sync: $(INTERNAL_SYSTEMIMAGE_FILES)
+.PHONY: sync syncsys
+sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
#######
## system tarball
@@ -2213,8 +2228,8 @@
$(call pretty,"Target userdata fs tarball: " \
"$(INSTALLED_USERDATATARBALL_TARGET)")
$(MKTARBALL) $(FS_GET_STATS) \
- $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
- $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
+ $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
+ $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
endef
userdata_tar := $(PRODUCT_OUT)/userdata.tar
@@ -2390,11 +2405,11 @@
PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
$(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
$(HOST_OUT_EXECUTABLES)/assemble_vintf \
- -c $(BUILT_SYSTEM_MATRIX) \
- -i $(BUILT_VENDOR_MANIFEST) \
- $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
- find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
- sed "s/^/-i /" | tr '\n' ' ') -o $@
+ -c $(BUILT_SYSTEM_MATRIX) \
+ -i $(BUILT_VENDOR_MANIFEST) \
+ $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
+ find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
+ sed "s/^/-i /" | tr '\n' ' ') -o $@
endif # BUILT_VENDOR_MANIFEST
# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
@@ -2624,10 +2639,10 @@
$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
cp $(BOARD_PREBUILT_DTBOIMAGE) $@
$(AVBTOOL) add_hash_footer \
- --image $@ \
- --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
- --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
- $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
+ --image $@ \
+ --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
+ --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
+ $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
else
$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
cp $(BOARD_PREBUILT_DTBOIMAGE) $@
@@ -2851,18 +2866,18 @@
ifdef BOARD_AVB_VBMETA_SYSTEM
INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img
$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \
- $(AVBTOOL) \
- $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
- $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
+ $(AVBTOOL) \
+ $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
+ $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
$(call build-chained-vbmeta-image,vbmeta_system)
endif
ifdef BOARD_AVB_VBMETA_VENDOR
INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img
$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \
- $(AVBTOOL) \
- $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
- $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
+ $(AVBTOOL) \
+ $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
+ $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
$(call build-chained-vbmeta-image,vbmeta_vendor)
endif
@@ -2883,20 +2898,20 @@
--algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
$(INSTALLED_VBMETAIMAGE_TARGET): \
- $(AVBTOOL) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INSTALLED_SYSTEMIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
- $(INSTALLED_ODMIMAGE_TARGET) \
- $(INSTALLED_DTBOIMAGE_TARGET) \
- $(INSTALLED_RECOVERYIMAGE_TARGET) \
- $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
- $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
- $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
- $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
- $(BOARD_AVB_KEY_PATH)
+ $(AVBTOOL) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_SYSTEMIMAGE_TARGET) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_ODMIMAGE_TARGET) \
+ $(INSTALLED_DTBOIMAGE_TARGET) \
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
+ $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
+ $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
+ $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
+ $(BOARD_AVB_KEY_PATH)
$(build-vbmetaimage-target)
.PHONY: vbmetaimage-nodeps
@@ -2919,27 +2934,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 +2967,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 +3005,24 @@
# 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
+# 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_expr="$(BOARD_SUPER_PARTITION_SIZE)"; \
+ 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:"; \
+ 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:"; \
+ 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
@@ -3006,21 +3040,21 @@
endef
define check-all-partition-sizes-target
- # Check sum(all partitions) <= super partition (/ 2 for A/B)
+ # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
$(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
- $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(filter true,$(AB_OTA_UPDATER)), / 2), \
- $(BOARD_SUPER_PARTITION_SIZE)$(if $(filter true,$(AB_OTA_UPDATER)), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
+ $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
+ $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
# For each group, check sum(partitions in group) <= group size
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
$(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
$(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
- # Check sum(all group sizes) <= super partition (/ 2 for A/B)
+ # Check sum(all group sizes) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
- max_size_tail=$(if $(filter true,$(AB_OTA_UPDATER))," / 2"); \
+ max_size_tail=$(if $(call super-slot-suffix)," / 2"); \
max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
@@ -3035,6 +3069,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 +3093,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)
@@ -3229,7 +3264,7 @@
BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
$(BUILT_TARGET_FILES_PACKAGE): \
- zip_root := $(intermediates)/$(name)
+ zip_root := $(intermediates)/$(name)
# $(1): Directory to copy
# $(2): Location to copy it to
@@ -3244,7 +3279,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
@@ -3297,43 +3332,43 @@
# Depending on the various images guarantees that the underlying
# directories are up-to-date.
$(BUILT_TARGET_FILES_PACKAGE): \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INSTALLED_RADIOIMAGE_TARGET) \
- $(INSTALLED_RECOVERYIMAGE_TARGET) \
- $(FULL_SYSTEMIMAGE_DEPS) \
- $(INSTALLED_USERDATAIMAGE_TARGET) \
- $(INSTALLED_CACHEIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
- $(INSTALLED_VBMETAIMAGE_TARGET) \
- $(INSTALLED_ODMIMAGE_TARGET) \
- $(INSTALLED_DTBOIMAGE_TARGET) \
- $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
- $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
- $(INSTALLED_KERNEL_TARGET) \
- $(INSTALLED_2NDBOOTLOADER_TARGET) \
- $(BOARD_PREBUILT_DTBOIMAGE) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
- $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
- $(LPMAKE) \
- $(SELINUX_FC) \
- $(APKCERTS_FILE) \
- $(SOONG_ZIP) \
- $(HOST_OUT_EXECUTABLES)/fs_config \
- $(HOST_OUT_EXECUTABLES)/imgdiff \
- $(HOST_OUT_EXECUTABLES)/bsdiff \
- $(HOST_OUT_EXECUTABLES)/care_map_generator \
- $(BUILD_IMAGE_SRCS) \
- $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
- $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
- $(BUILT_SYSTEM_MATRIX) \
- $(BUILT_VENDOR_MATRIX) \
- | $(ACP)
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_RADIOIMAGE_TARGET) \
+ $(INSTALLED_RECOVERYIMAGE_TARGET) \
+ $(FULL_SYSTEMIMAGE_DEPS) \
+ $(INSTALLED_USERDATAIMAGE_TARGET) \
+ $(INSTALLED_CACHEIMAGE_TARGET) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_VBMETAIMAGE_TARGET) \
+ $(INSTALLED_ODMIMAGE_TARGET) \
+ $(INSTALLED_DTBOIMAGE_TARGET) \
+ $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
+ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
+ $(INSTALLED_KERNEL_TARGET) \
+ $(INSTALLED_2NDBOOTLOADER_TARGET) \
+ $(BOARD_PREBUILT_DTBOIMAGE) \
+ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
+ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
+ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
+ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
+ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
+ $(LPMAKE) \
+ $(SELINUX_FC) \
+ $(APKCERTS_FILE) \
+ $(SOONG_ZIP) \
+ $(HOST_OUT_EXECUTABLES)/fs_config \
+ $(HOST_OUT_EXECUTABLES)/imgdiff \
+ $(HOST_OUT_EXECUTABLES)/bsdiff \
+ $(HOST_OUT_EXECUTABLES)/care_map_generator \
+ $(BUILD_IMAGE_SRCS) \
+ $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
+ $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
+ $(BUILT_SYSTEM_MATRIX) \
+ $(BUILT_VENDOR_MATRIX) \
+ | $(ACP)
@echo "Package target files: $@"
$(call create-system-vendor-symlink)
$(call create-system-product-symlink)
@@ -3345,7 +3380,7 @@
@# Components of the recovery image
$(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
$(hide) $(call package_files-copy-root, \
- $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
+ $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
ifdef INSTALLED_KERNEL_TARGET
$(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
endif
@@ -3369,13 +3404,13 @@
$(hide) mkdir -p $(zip_root)/BOOT
$(hide) mkdir -p $(zip_root)/ROOT
$(hide) $(call package_files-copy-root, \
- $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
-ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
- $(hide) $(call package_files-copy-root, \
- $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
-endif
+ $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
@# If we are using recovery as boot, this is already done when processing recovery.
ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
+ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ $(hide) $(call package_files-copy-root, \
+ $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
+endif
ifdef INSTALLED_KERNEL_TARGET
$(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
endif
@@ -3397,34 +3432,34 @@
cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
@# Contents of the system image
$(hide) $(call package_files-copy-root, \
- $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
+ $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
@# Contents of the data image
$(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_DATA),$(zip_root)/DATA)
+ $(TARGET_OUT_DATA),$(zip_root)/DATA)
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
@# Contents of the vendor image
$(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
+ $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
endif
ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
@# Contents of the product image
$(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
+ $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
endif
ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
@# Contents of the product_services image
$(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
+ $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
endif
ifdef BOARD_ODMIMAGE_FILE_SYSTEM_TYPE
@# Contents of the odm image
$(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_ODM),$(zip_root)/ODM)
+ $(TARGET_OUT_ODM),$(zip_root)/ODM)
endif
ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
@# Contents of the system_other image
$(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
+ $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
endif
@# Extra contents of the OTA package
$(hide) mkdir -p $(zip_root)/OTA
@@ -3654,13 +3689,24 @@
ifdef BUILT_VENDOR_MATRIX
$(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
endif
+ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
+ $(hide) echo "use_dynamic_partitions=true" >> $(zip_root)/META/misc_info.txt
+endif
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+ $(hide) echo "dynamic_partition_retrofit=true" >> $(zip_root)/META/misc_info.txt
+endif
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
- $(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_BLOCK_DEVICES),)
+ $(hide) echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(zip_root)/META/misc_info.txt
+endif
+ifneq ($(BOARD_SUPER_PARTITION_PARTITION_LIST),)
+ $(hide) echo "dynamic_partition_list=$(BOARD_SUPER_PARTITION_PARTITION_LIST)" >> $(zip_root)/META/misc_info.txt
+endif
ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
$(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
$(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
@@ -3697,6 +3743,19 @@
# -----------------------------------------------------------------
# OTA update package
+# $(1): output file
+# $(2): additional args
+define build-ota-package-target
+PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
+ build/make/tools/releasetools/ota_from_target_files -v \
+ --block \
+ --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
+ -p $(HOST_OUT) \
+ $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
+ $(2) \
+ $(BUILT_TARGET_FILES_PACKAGE) $(1)
+endef
+
name := $(TARGET_PRODUCT)
ifeq ($(TARGET_BUILD_TYPE),debug)
name := $(name)_debug
@@ -3714,20 +3773,41 @@
endif
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
- build/make/tools/releasetools/ota_from_target_files
+ build/make/tools/releasetools/ota_from_target_files
@echo "Package OTA: $@"
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- build/make/tools/releasetools/ota_from_target_files -v \
- --block \
- --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
- -p $(HOST_OUT) \
- -k $(KEY_CERT_PAIR) \
- $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
- $(BUILT_TARGET_FILES_PACKAGE) $@
+ $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR))
.PHONY: otapackage
otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+name := $(TARGET_PRODUCT)
+ifeq ($(TARGET_BUILD_TYPE),debug)
+ name := $(name)_debug
+endif
+name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
+
+INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
+
+$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
+
+ifeq ($(AB_OTA_UPDATER),true)
+$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
+else
+$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BROTLI)
+endif
+
+$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
+ build/make/tools/releasetools/ota_from_target_files
+ @echo "Package OTA (retrofit dynamic partitions): $@"
+ $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
+
+.PHONY: otardppackage
+
+otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
+
+endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
+
endif # build_ota_package
# -----------------------------------------------------------------
@@ -3755,12 +3835,12 @@
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
ifndef TARGET_BUILD_APPS
$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INSTALLED_USERDATAIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_USERDATAIMAGE_TARGET) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
endif
$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
$(APPCOMPAT_ZIP): $(SOONG_ZIP)
@@ -3785,14 +3865,14 @@
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
ifndef TARGET_BUILD_APPS
$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INSTALLED_USERDATAIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
- $(INSTALLED_ODMIMAGE_TARGET) \
- $(updater_dep)
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_USERDATAIMAGE_TARGET) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_ODMIMAGE_TARGET) \
+ $(updater_dep)
endif
$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
$(SYMBOLS_ZIP): $(SOONG_ZIP)
@@ -3812,13 +3892,13 @@
COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
ifndef TARGET_BUILD_APPS
$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
- $(INSTALLED_RAMDISK_TARGET) \
- $(INSTALLED_BOOTIMAGE_TARGET) \
- $(INSTALLED_USERDATAIMAGE_TARGET) \
- $(INSTALLED_VENDORIMAGE_TARGET) \
- $(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
- $(INSTALLED_ODMIMAGE_TARGET)
+ $(INSTALLED_RAMDISK_TARGET) \
+ $(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_USERDATAIMAGE_TARGET) \
+ $(INSTALLED_VENDORIMAGE_TARGET) \
+ $(INSTALLED_PRODUCTIMAGE_TARGET) \
+ $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_ODMIMAGE_TARGET)
endif
$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
$(COVERAGE_ZIP): $(SOONG_ZIP)
@@ -3845,10 +3925,10 @@
$(hide) mkdir -p $(dir $@)
$(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
if [ -z "$$apps_to_zip" ]; then \
- echo "No apps to zip up. Generating empty apps archive." ; \
- a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
+ echo "No apps to zip up. Generating empty apps archive." ; \
+ a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
else \
- zip -qjX $@ $$apps_to_zip; \
+ zip -qjX $@ $$apps_to_zip; \
fi
ifeq (true,$(EMMA_INSTRUMENT))
@@ -3862,7 +3942,7 @@
$(JACOCO_REPORT_CLASSES_ALL) :
@echo "Collecting uninstrumented classes"
$(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
- zip -@ -0 -q -X $@
+ zip -@ -0 -q -X $@
# Meaning of these options:
# -@ scan stdin for file paths to add to the zip
# -0 don't do any compression
@@ -3882,15 +3962,15 @@
$(PROGUARD_DICT_ZIP) :
@echo "Packaging Proguard obfuscation dictionary files."
$(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
- if [ -n "$$dict_files" ]; then \
- unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
- zip -qX $@ $$dict_files $$unobfuscated_jars; \
- else \
- touch $(dir $@)/zipdummy; \
- (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
- zip -qd $@ zipdummy; \
- rm $(dir $@)/zipdummy; \
- fi
+ if [ -n "$$dict_files" ]; then \
+ unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
+ zip -qX $@ $$dict_files $$unobfuscated_jars; \
+ else \
+ touch $(dir $@)/zipdummy; \
+ (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
+ zip -qd $@ zipdummy; \
+ rm $(dir $@)/zipdummy; \
+ fi
endif # TARGET_BUILD_APPS
@@ -4091,29 +4171,29 @@
if [ $$FAIL ]; then exit 1; fi
$(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
$(hide) ( \
- ATREE_STRIP="$(HOST_STRIP) -x" \
- $(HOST_OUT_EXECUTABLES)/atree \
- $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
- -m $(PRIVATE_DEP_FILE) \
- -I . \
- -I $(PRODUCT_OUT) \
- -I $(HOST_OUT) \
- -I $(TARGET_COMMON_OUT_ROOT) \
- -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
- -v "OUT_DIR=$(OUT_DIR)" \
- -v "HOST_OUT=$(HOST_OUT)" \
- -v "TARGET_ARCH=$(TARGET_ARCH)" \
- -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
- -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
- -v "FONT_OUT=$(SDK_FONT_TEMP)" \
- -o $(PRIVATE_DIR) && \
- cp -f $(target_notice_file_txt) \
- $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
- cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
- HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
- development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
- chmod -R ug+rwX $(PRIVATE_DIR) && \
- cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
+ ATREE_STRIP="$(HOST_STRIP) -x" \
+ $(HOST_OUT_EXECUTABLES)/atree \
+ $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
+ -m $(PRIVATE_DEP_FILE) \
+ -I . \
+ -I $(PRODUCT_OUT) \
+ -I $(HOST_OUT) \
+ -I $(TARGET_COMMON_OUT_ROOT) \
+ -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
+ -v "OUT_DIR=$(OUT_DIR)" \
+ -v "HOST_OUT=$(HOST_OUT)" \
+ -v "TARGET_ARCH=$(TARGET_ARCH)" \
+ -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
+ -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
+ -v "FONT_OUT=$(SDK_FONT_TEMP)" \
+ -o $(PRIVATE_DIR) && \
+ cp -f $(target_notice_file_txt) \
+ $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
+ cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
+ HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
+ development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
+ chmod -R ug+rwX $(PRIVATE_DIR) && \
+ cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
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/base_rules.mk b/core/base_rules.mk
index 9c5c69d..cb9c35a 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -277,14 +277,16 @@
generated_sources_dir := $(call local-generated-sources-dir)
ifneq ($(LOCAL_OVERRIDES_MODULES),)
- ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
- ifndef LOCAL_IS_HOST_MODULE
+ ifndef LOCAL_IS_HOST_MODULE
+ ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
EXECUTABLES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_MODULES))
+ else ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
+ SHARED_LIBRARIES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_MODULES))
else
- $(call pretty-error,host modules cannot use LOCAL_OVERRIDES_MODULES)
+ $(call pretty-error,LOCAL_MODULE_CLASS := $(LOCAL_MODULE_CLASS) cannot use LOCAL_OVERRIDES_MODULES)
endif
else
- $(call pretty-error,LOCAL_MODULE_CLASS := $(LOCAL_MODULE_CLASS) cannot use LOCAL_OVERRIDES_MODULES)
+ $(call pretty-error,host modules cannot use LOCAL_OVERRIDES_MODULES)
endif
endif
diff --git a/core/binary.mk b/core/binary.mk
index 07fb48a..427f689 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -73,6 +73,32 @@
my_native_coverage := false
endif
+ifeq ($(strip $(ENABLE_XOM)),true)
+ ifndef LOCAL_IS_HOST_MODULE
+ my_xom := true
+ # Disable XOM in excluded paths.
+ combined_xom_exclude_paths := $(XOM_EXCLUDE_PATHS) \
+ $(PRODUCT_XOM_EXCLUDE_PATHS)
+ ifneq ($(strip $(foreach dir,$(subst $(comma),$(space),$(combined_xom_exclude_paths)),\
+ $(filter $(dir)%,$(LOCAL_PATH)))),)
+ my_xom := false
+ endif
+
+ # Allow LOCAL_XOM to override the above
+ ifdef LOCAL_XOM
+ my_xom := $(LOCAL_XOM)
+ endif
+
+ ifeq ($(strip $(my_xom)),true)
+ ifeq (arm64,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+ ifeq ($(my_use_clang_lld),true)
+ my_ldflags += -Wl,-execute-only
+ endif
+ endif
+ endif
+ endif
+endif
+
my_allow_undefined_symbols := $(strip $(LOCAL_ALLOW_UNDEFINED_SYMBOLS))
ifdef SANITIZE_HOST
ifdef LOCAL_IS_HOST_MODULE
@@ -201,7 +227,6 @@
$(my_ndk_source_root)/cxx-stl/llvm-libc++/include
my_ndk_stl_include_path += \
$(my_ndk_source_root)/cxx-stl/llvm-libc++abi/include
- my_ndk_stl_include_path += $(my_ndk_source_root)/android/support/include
my_libcxx_libdir := \
$(my_ndk_source_root)/cxx-stl/llvm-libc++/libs/$(my_cpu_variant)
@@ -214,7 +239,13 @@
my_ndk_stl_shared_lib_fullpath := $(my_libcxx_libdir)/libc++_shared.so
endif
- my_ndk_stl_static_lib += $(my_libcxx_libdir)/libandroid_support.a
+ ifneq ($(my_ndk_api),current)
+ ifeq ($(call math_lt,$(my_ndk_api),21),true)
+ my_ndk_stl_include_path += $(my_ndk_source_root)/android/support/include
+ my_ndk_stl_static_lib += $(my_libcxx_libdir)/libandroid_support.a
+ endif
+ endif
+
ifneq (,$(filter armeabi armeabi-v7a,$(my_cpu_variant)))
my_ndk_stl_static_lib += $(my_libcxx_libdir)/libunwind.a
endif
@@ -396,13 +427,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 +1563,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..0417e13 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:=
@@ -302,6 +302,7 @@
LOCAL_VTS_MODE:=
LOCAL_WARNINGS_ENABLE:=
LOCAL_WHOLE_STATIC_LIBRARIES:=
+LOCAL_XOM:=
LOCAL_YACCFLAGS:=
# TODO: deprecate, it does nothing
OVERRIDE_BUILT_MODULE_PATH:=
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..c1d8182
--- /dev/null
+++ b/core/combo/arch/arm/armv8-2a.mk
@@ -0,0 +1,9 @@
+# Configuration for Linux on ARM.
+# Generating binaries for the ARMv8-2a architecture
+#
+# Many libraries are not aware of armv8-2a, and AArch32 is (almost) a superset
+# of armv7-a-neon. So just let them think we are just like v7.
+ARCH_ARM_HAVE_ARMV7A := true
+ARCH_ARM_HAVE_VFP := true
+ARCH_ARM_HAVE_VFP_D32 := true
+ARCH_ARM_HAVE_NEON := true
diff --git a/core/config.mk b/core/config.mk
index c1ea5a8..99feeb2 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -923,12 +923,7 @@
PLATFORM_SEPOLICY_VERSION \
TOT_SEPOLICY_VERSION \
-# If true, kernel configuration requirements are present in OTA package (and will be enforced
-# during OTA). Otherwise, kernel configuration requirements are enforced in VTS.
-# Devices that checks the running kernel (instead of the kernel in OTA package) should not
-# set this variable to prevent OTA failures.
-ifndef PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
- PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS :=
+ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),)
ifdef PRODUCT_SHIPPING_API_LEVEL
ifeq (true,$(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),29))
PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := true
@@ -937,17 +932,28 @@
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 :=
-
- BOARD_KERNEL_CMDLINE += androidboot.logical_partitions=1
endif
ifeq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true)
@@ -1000,6 +1006,7 @@
# - BOARD_{GROUP}_PARTITION_PARTITION_LIST: the list of partitions that belongs to this group.
# If empty, no partitions belong to this group, and the sum of sizes is effectively 0.
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
+ $(eval BOARD_$(group)_SIZE := $(strip $(BOARD_$(group)_SIZE))) \
$(if $(BOARD_$(group)_SIZE),,$(error BOARD_$(group)_SIZE must not be empty)) \
$(eval .KATI_READONLY := BOARD_$(group)_SIZE) \
$(eval BOARD_$(group)_PARTITION_LIST ?=) \
@@ -1007,7 +1014,7 @@
)
# BOARD_*_PARTITION_LIST: a list of the following tokens
-valid_super_partition_list := system vendor product product_services
+valid_super_partition_list := system vendor product product_services odm
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
$(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \
$(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \
@@ -1026,6 +1033,54 @@
$(BOARD_$(group)_PARTITION_LIST))
.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST
+ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+
+# The metadata device must be specified manually for retrofitting.
+ifeq ($(BOARD_SUPER_PARTITION_METADATA_DEVICE),)
+$(error Must specify BOARD_SUPER_PARTITION_METADATA_DEVICE if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS=true.)
+endif
+
+# The super partition block device list must be specified manually for retrofitting.
+ifeq ($(BOARD_SUPER_PARTITION_BLOCK_DEVICES),)
+$(error Must specify BOARD_SUPER_PARTITION_BLOCK_DEVICES if PRODUCT_RETROFIT_DYNAMIC_PARTITIONS=true.)
+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)), \
+ $(eval BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE := $(strip $(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))) \
+ $(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
# ###############################################################
@@ -1147,10 +1202,7 @@
INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-public-list.txt
INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-private-list.txt
-INTERNAL_PLATFORM_HIDDENAPI_WHITELIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-whitelist.txt
-INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-light-greylist.txt
-INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-dark-greylist.txt
-INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-blacklist.txt
+INTERNAL_PLATFORM_HIDDENAPI_FLAGS := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-flags.csv
INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/hiddenapi-greylist.csv
# Missing optional uses-libraries so that the platform doesn't create build rules that depend on
diff --git a/core/definitions.mk b/core/definitions.mk
index 0e959d6..50c26d3 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)
@@ -2371,10 +2374,7 @@
endef
appcompat-files = \
art/tools/veridex/appcompat.sh \
- $(INTERNAL_PLATFORM_HIDDENAPI_WHITELIST) \
- $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
- $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) \
- $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST) \
+ $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) \
$(HOST_OUT_EXECUTABLES)/veridex \
$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex \
$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/oahl_dex_intermediates/classes.dex
@@ -2668,17 +2668,13 @@
# Java semantics of the result dex bytecode. Use at own risk.
ifneq ($(UNSAFE_DISABLE_HIDDENAPI_FLAGS),true)
define hiddenapi-copy-dex-files
-$(2): $(1) $(HIDDENAPI) $(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
- $(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
+$(2): $(1) $(HIDDENAPI) $(INTERNAL_PLATFORM_HIDDENAPI_FLAGS)
@rm -rf $(dir $(2))
@mkdir -p $(dir $(2))
for INPUT_DEX in `find $(dir $(1)) -maxdepth 1 -name "classes*.dex" | sort`; do \
echo "--input-dex=$$$${INPUT_DEX}"; \
echo "--output-dex=$(dir $(2))/`basename $$$${INPUT_DEX}`"; \
- done | xargs $(HIDDENAPI) encode \
- --light-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_LIGHT_GREYLIST) \
- --dark-greylist=$(INTERNAL_PLATFORM_HIDDENAPI_DARK_GREYLIST) \
- --blacklist=$(INTERNAL_PLATFORM_HIDDENAPI_BLACKLIST)
+ done | xargs $(HIDDENAPI) encode --api-flags=$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS)
$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): $(1)
$(INTERNAL_PLATFORM_HIDDENAPI_PRIVATE_LIST): PRIVATE_DEX_INPUTS := $$(PRIVATE_DEX_INPUTS) $(1)
@@ -2694,27 +2690,20 @@
endif # UNSAFE_DISABLE_HIDDENAPI_FLAGS
# Generate a greylist.txt from a classes.jar
-define hiddenapi-generate-greylist-txt
+define hiddenapi-generate-csv
ifneq (,$(wildcard frameworks/base))
# Only generate this target if we're in a tree with frameworks/base present.
-$(3): .KATI_IMPLICIT_OUTPUTS := $(2) $(4)
-# For now, write P & Q blacklist to single file until runtime support is finished
+$(2): $(1) $(CLASS2GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
+ $(CLASS2GREYLIST) --public-api-list $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) $(1) \
+ --write-flags-csv $(2)
+
$(3): $(1) $(CLASS2GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
$(CLASS2GREYLIST) --public-api-list $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) $(1) \
- --write-whitelist $(2) \
- --write-greylist none,28:$(3) \
- --write-greylist 26:$(4)
+ --write-metadata-csv $(3)
-$(5): $(1) $(CLASS2GREYLIST) $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST)
- $(CLASS2GREYLIST) --public-api-list $(INTERNAL_PLATFORM_HIDDENAPI_PUBLIC_LIST) $(1) \
- --write-metadata-csv $(5)
+$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): $(2)
+$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS): PRIVATE_FLAGS_INPUTS := $$(PRIVATE_FLAGS_INPUTS) $(2)
-$(INTERNAL_PLATFORM_HIDDENAPI_WHITELIST): $(2) $(3) $(4)
-$(INTERNAL_PLATFORM_HIDDENAPI_WHITELIST): \
- PRIVATE_WHITELIST_INPUTS := $$(PRIVATE_WHITELIST_INPUTS) $(2)
-$(INTERNAL_PLATFORM_HIDDENAPI_WHITELIST): \
- PRIVATE_GREYLIST_INPUTS := $$(PRIVATE_GREYLIST_INPUTS) $(3)
- PRIVATE_DARKGREYLIST_INPUTS := $$(PRIVATE_DARKGREYLIST_INPUTS) $(4)
$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): $(5)
$(INTERNAL_PLATFORM_HIDDENAPI_GREYLIST_METADATA): \
PRIVATE_METADATA_INPUTS := $$(PRIVATE_METADATA_INPUTS) $(5)
@@ -2749,6 +2738,14 @@
###########################################################
## Commands to call R8
###########################################################
+
+# Use --debug flag for eng builds by default
+ifeq (eng,$(TARGET_BUILD_VARIANT))
+R8_DEBUG_MODE := --debug
+else
+R8_DEBUG_MODE :=
+endif
+
define transform-jar-to-dex-r8
@echo R8: $@
$(hide) rm -f $(PRIVATE_PROGUARD_DICTIONARY)
@@ -2756,6 +2753,7 @@
--min-api $(PRIVATE_MIN_SDK_VERSION) \
--no-data-resources \
--force-proguard-compatibility --output $(subst classes.dex,,$@) \
+ $(R8_DEBUG_MODE) \
$(PRIVATE_PROGUARD_FLAGS) \
$(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR)) \
$(PRIVATE_DX_FLAGS)
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 698034c..1c9ef64 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -173,6 +173,9 @@
# In the case where LOCAL_ENFORCE_USES_LIBRARIES is true, PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT
# contains the normalized path list of the libraries. This makes it easier to conditionally prepend
# org.apache.http.legacy.impl based on the SDK level if required.
+#
+# Pass --avoid-storing-invocation to make the output deterministics between
+# different products that may have different paths on the command line.
define dex2oat-one-file
$(hide) rm -f $(2)
$(hide) mkdir -p $(dir $(2))
@@ -188,6 +191,7 @@
source build/make/core/construct_context.sh "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST)" "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET)" && \
,) \
ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
+ --avoid-storing-invocation \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
$${class_loader_context_arg} \
$${stored_class_loader_context_arg} \
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 14955f0..70a934c 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -86,6 +86,8 @@
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_BOOT_IMAGE_FLAGS := $(my_boot_image_flags)
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME): PRIVATE_2ND_ARCH_VAR_PREFIX := $(my_2nd_arch_prefix)
# Use dex2oat debug version for better error reporting
+# Pass --avoid-storing-invocation to make the output deterministics between
+# different products that may have different paths on the command line.
$($(my_2nd_arch_prefix)DEFAULT_DEX_PREOPT_BUILT_IMAGE_FILENAME) : $(LIBART_TARGET_BOOT_DEX_FILES) $(PRELOADED_CLASSES) $(DIRTY_IMAGE_OBJECTS) $(DEX2OAT_DEPENDENCY) $(my_out_boot_image_profile_location)
@echo "target dex2oat: $@"
@mkdir -p $(dir $@)
@@ -94,6 +96,7 @@
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.art
@rm -f $(dir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)LIBART_TARGET_BOOT_OAT_UNSTRIPPED))/*.oat
$(hide) $(DEX2OAT_BOOT_IMAGE_LOG_TAGS) $(DEX2OAT) --runtime-arg -Xms$(DEX2OAT_IMAGE_XMS) \
+ --avoid-storing-invocation \
--runtime-arg -Xmx$(DEX2OAT_IMAGE_XMX) \
$(PRIVATE_BOOT_IMAGE_FLAGS) \
$(addprefix --dex-file=,$(LIBART_TARGET_BOOT_DEX_FILES)) \
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/generate_enforce_rro.mk b/core/generate_enforce_rro.mk
index 62a8c8d..c88c779 100644
--- a/core/generate_enforce_rro.mk
+++ b/core/generate_enforce_rro.mk
@@ -27,4 +27,10 @@
LOCAL_AAPT_FLAGS += --auto-add-overlay
LOCAL_RESOURCE_DIR := $(enforce_rro_source_overlays)
+ifeq (framework-res__auto_generated_rro,$(enforce_rro_module))
+LOCAL_PRIVATE_PLATFORM_APIS := true
+else
+LOCAL_SDK_VERSION := current
+endif
+
include $(BUILD_RRO_PACKAGE)
diff --git a/core/java.mk b/core/java.mk
index 30571b7..932a421 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -74,10 +74,8 @@
built_dex_hiddenapi := $(intermediates.COMMON)/dex-hiddenapi/classes.dex
full_classes_stubs_jar := $(intermediates.COMMON)/stubs.jar
java_source_list_file := $(intermediates.COMMON)/java-source-list
-hiddenapi_whitelist_txt := $(intermediates.COMMON)/hiddenapi/whitelist.txt
-hiddenapi_greylist_txt := $(intermediates.COMMON)/hiddenapi/greylist.txt
-hiddenapi_darkgreylist_txt := $(intermediates.COMMON)/hiddenapi/darkgreylist.txt
-hiddenapi_greylist_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
+hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv
+hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
ifeq ($(LOCAL_MODULE_CLASS)$(LOCAL_SRC_FILES)$(LOCAL_STATIC_JAVA_LIBRARIES)$(LOCAL_SOURCE_FILES_ALL_GENERATED),APPS)
# If this is an apk without any Java code (e.g. framework-res), we should skip compiling Java.
@@ -508,8 +506,8 @@
# dex later on. The difference is academic currently, as we don't proguard any
# bootclasspath code at the moment. If we were to do that, we should add keep
# rules for all members with the @UnsupportedAppUsage annotation.
- $(eval $(call hiddenapi-generate-greylist-txt, $(full_classes_pre_proguard_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt),$(hiddenapi_darkgreylist_txt),$(hiddenapi_greylist_metadata_csv)))
- LOCAL_INTERMEDIATE_TARGETS += $(hiddenapi_whitelist_txt) $(hiddenapi_greylist_txt) $(hiddenapi_darkgreylist_txt) $(hiddenapi_greylist_metadata_csv)
+ $(eval $(call hiddenapi-generate-csv, $(full_classes_pre_proguard_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
+ LOCAL_INTERMEDIATE_TARGETS += $(hiddenapi_flags_csv) $(hiddenapi_metadata_csv)
$(eval $(call hiddenapi-copy-dex-files,$(built_dex_intermediate),$(built_dex_hiddenapi)))
built_dex_copy_from := $(built_dex_hiddenapi)
else # !is_boot_jar
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/local_systemsdk.mk b/core/local_systemsdk.mk
index 49085fd..7acb57a 100644
--- a/core/local_systemsdk.mk
+++ b/core/local_systemsdk.mk
@@ -25,7 +25,7 @@
ifneq (,$(filter JAVA_LIBRARIES APPS,$(LOCAL_MODULE_CLASS)))
ifndef LOCAL_SDK_VERSION
ifeq ($(_is_vendor_app),true)
- ifeq (,$(findstring __auto_generated_rro,$(LOCAL_MODULE)))
+ ifeq (,$(filter framework-res__auto_generated_rro,$(LOCAL_MODULE)))
# Runtime resource overlay for framework-res is exempted from building
# against System SDK.
# TODO(b/35859726): remove this exception
diff --git a/core/main.mk b/core/main.mk
index fdf14de..9fd1c35 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -244,7 +244,13 @@
ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
endif
-ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.logical_partitions=$(PRODUCT_USE_LOGICAL_PARTITIONS)
+ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
+ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.dynamic_partitions=true
+endif
+
+ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
+ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.dynamic_partitions_retrofit=true
+endif
# -----------------------------------------------------------------
###
@@ -404,7 +410,9 @@
# Typical build; include any Android.mk files we can find.
#
-
+# Before we go and include all of the module makefiles, strip values for easier
+# processing.
+$(call strip-product-vars)
# Before we go and include all of the module makefiles, mark the PRODUCT_*
# and ADDITIONAL*PROPERTIES values readonly so that they won't be modified.
$(call readonly-product-vars)
@@ -965,7 +973,7 @@
# Expand a list of modules to the modules that they override (if any)
# $(1): The list of modules.
define module-overrides
-$(foreach m,$(1),$(PACKAGES.$(m).OVERRIDES) $(EXECUTABLES.$(m).OVERRIDES))
+$(foreach m,$(1),$(PACKAGES.$(m).OVERRIDES) $(EXECUTABLES.$(m).OVERRIDES) $(SHARED_LIBRARIES.$(m).OVERRIDES))
endef
###########################################################
@@ -1075,7 +1083,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 +1128,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 +1208,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))
@@ -1382,6 +1395,7 @@
$(call dist-for-goals, droidcore, \
$(INTERNAL_UPDATE_PACKAGE_TARGET) \
$(INTERNAL_OTA_PACKAGE_TARGET) \
+ $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) \
$(BUILT_OTATOOLS_PACKAGE) \
$(SYMBOLS_ZIP) \
$(COVERAGE_ZIP) \
@@ -1522,7 +1536,7 @@
.PHONY: dump-files
dump-files:
$(info product_FILES for $(TARGET_DEVICE) ($(INTERNAL_PRODUCT)):)
- $(foreach p,$(product_FILES),$(info : $(p)))
+ $(foreach p,$(sort $(product_FILES)),$(info : $(p)))
@echo Successfully dumped product file list
.PHONY: nothing
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..8497b28 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -203,13 +203,16 @@
PRODUCT_CFI_EXCLUDE_PATHS \
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \
- PRODUCT_USE_LOGICAL_PARTITIONS \
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS \
PRODUCT_ARTIFACT_PATH_REQUIREMENT_HINT \
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST \
PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
PRODUCT_BUILD_SUPER_PARTITION \
PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION \
+ PRODUCT_USE_DYNAMIC_PARTITIONS \
+ PRODUCT_RETROFIT_DYNAMIC_PARTITIONS \
+ PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
+ PRODUCT_XOM_EXCLUDE_PATHS \
define dump-product
$(info ==== $(1) ====)\
@@ -401,7 +404,7 @@
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY
# Logical partitions related variables.
-_product_stash_var_list += \
+_dynamic_partitions_var_list += \
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \
BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \
BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \
@@ -410,6 +413,9 @@
BOARD_SUPER_PARTITION_SIZE \
BOARD_SUPER_PARTITION_GROUPS \
+_product_stash_var_list += $(_dynamic_partitions_var_list)
+_product_strip_var_list := $(_dynamic_partitions_var_list)
+
#
# Mark the variables in _product_stash_var_list as readonly
#
@@ -420,6 +426,13 @@
)
endef
+#
+# Strip the variables in _product_strip_var_list
+#
+define strip-product-vars
+$(foreach v,$(_product_strip_var_list),$(eval $(v) := $(strip $($(v)))))
+endef
+
define add-to-product-copy-files-if-exists
$(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
endef
diff --git a/core/product_config.mk b/core/product_config.mk
index 577bafe..ac7fe91 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -501,6 +501,10 @@
PRODUCT_CFI_INCLUDE_PATHS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_CFI_INCLUDE_PATHS))
+# Whether any paths are excluded from being set XOM when ENABLE_XOM=true
+PRODUCT_XOM_EXCLUDE_PATHS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_XOM_EXCLUDE_PATHS))
+
# which Soong namespaces to export to Make
PRODUCT_SOONG_NAMESPACES := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SOONG_NAMESPACES))
@@ -513,20 +517,30 @@
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
+
+PRODUCT_USE_DYNAMIC_PARTITIONS := $(or \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_DYNAMIC_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
@@ -534,3 +548,10 @@
PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION))
.KATI_READONLY := PRODUCT_FORCE_PRODUCT_MODULES_TO_SYSTEM_PARTITION
+
+# If set, kernel configuration requirements are present in OTA package (and will be enforced
+# during OTA). Otherwise, kernel configuration requirements are enforced in VTS.
+# Devices that checks the running kernel (instead of the kernel in OTA package) should not
+# set this variable to prevent OTA failures.
+PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS))
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..279a612 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))
@@ -100,6 +82,8 @@
$(call add_json_bool, EnableCFI, $(call invert_bool,$(filter false,$(ENABLE_CFI))))
$(call add_json_list, CFIExcludePaths, $(CFI_EXCLUDE_PATHS) $(PRODUCT_CFI_EXCLUDE_PATHS))
$(call add_json_list, CFIIncludePaths, $(CFI_INCLUDE_PATHS) $(PRODUCT_CFI_INCLUDE_PATHS))
+$(call add_json_bool, EnableXOM, $(filter true,$(ENABLE_XOM)))
+$(call add_json_list, XOMExcludePaths, $(XOM_EXCLUDE_PATHS) $(PRODUCT_XOM_EXCLUDE_PATHS))
$(call add_json_list, IntegerOverflowExcludePaths, $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))
@@ -112,7 +96,6 @@
$(call add_json_bool, ArtUseReadBarrier, $(call invert_bool,$(filter false,$(PRODUCT_ART_USE_READ_BARRIER))))
$(call add_json_bool, Binder32bit, $(BINDER32BIT))
$(call add_json_str, BtConfigIncludeDir, $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR))
-$(call add_json_bool, Device_uses_hwc2, $(filter true,$(TARGET_USES_HWC2)))
$(call add_json_list, DeviceKernelHeaders, $(TARGET_PROJECT_SYSTEM_INCLUDES))
$(call add_json_bool, DevicePrefer32BitApps, $(filter true,$(TARGET_PREFER_32_BIT_APPS)))
$(call add_json_bool, DevicePrefer32BitExecutables, $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)))
@@ -154,17 +137,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 +157,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/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 3e6b261..1642ba7 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -19,10 +19,8 @@
full_classes_pre_proguard_jar := $(intermediates.COMMON)/classes-pre-proguard.jar
full_classes_header_jar := $(intermediates.COMMON)/classes-header.jar
common_javalib.jar := $(intermediates.COMMON)/javalib.jar
-hiddenapi_whitelist_txt := $(intermediates.COMMON)/hiddenapi/whitelist.txt
-hiddenapi_greylist_txt := $(intermediates.COMMON)/hiddenapi/greylist.txt
-hiddenapi_darkgreylist_txt := $(intermediates.COMMON)/hiddenapi/darkgreylist.txt
-hiddenapi_greylist_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
+hiddenapi_flags_csv := $(intermediates.COMMON)/hiddenapi/flags.csv
+hiddenapi_metadata_csv := $(intermediates.COMMON)/hiddenapi/greylist.csv
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_jar)))
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_MODULE_FILE),$(full_classes_pre_proguard_jar)))
@@ -80,7 +78,7 @@
# We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
# have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
# java.mk.
- $(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt),$(hiddenapi_darkgreylist_txt),$(hiddenapi_greylist_metadata_csv)))
+ $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
$(eval $(call hiddenapi-copy-soong-jar,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
else # !is_boot_jar
$(eval $(call copy-one-file,$(LOCAL_SOONG_DEX_JAR),$(common_javalib.jar)))
@@ -126,7 +124,7 @@
# We use full_classes_jar here, which is the post-proguard jar (on the basis that we also
# have a full_classes_pre_proguard_jar). This is consistent with the equivalent code in
# java.mk.
- $(eval $(call hiddenapi-generate-greylist-txt,$(full_classes_jar),$(hiddenapi_whitelist_txt),$(hiddenapi_greylist_txt),$(hiddenapi_darkgreylist_txt),$(hiddenapi_greylist_metadata_csv)))
+ $(eval $(call hiddenapi-generate-csv,$(full_classes_jar),$(hiddenapi_flags_csv),$(hiddenapi_metadata_csv)))
endif
$(eval $(call copy-one-file,$(full_classes_jar),$(LOCAL_BUILT_MODULE)))
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/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
index 69ae6f0..38f79fd 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -10,7 +10,6 @@
# no hardware camera
USE_CAMERA_STUB := true
-TARGET_USES_HWC2 := true
NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
# Build OpenGLES emulation guest and host libraries
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index dfa103a..a52bb80 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -1,14 +1,14 @@
# BoardConfigGsiCommon.mk
#
# Common compile-time definitions for GSI
+# Builds upon the mainline config.
#
-# The generic product target doesn't have any hardware-specific pieces.
-TARGET_NO_BOOTLOADER := true
-TARGET_NO_KERNEL := true
+include build/make/target/board/BoardConfigMainlineCommon.mk
-# GSIs always use ext4.
-TARGET_USERIMAGES_USE_EXT4 := true
+# This flag is set by mainline but isn't desired for GSI.
+BOARD_USES_SYSTEM_OTHER_ODEX :=
+
# GSIs are historically released in sparse format.
# Some vendors' bootloaders don't work properly with raw format images. So
# we explicit specify this need below (even though it's the current default).
@@ -40,14 +40,6 @@
# over those set by the vendor.
TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
endif
-BOARD_VNDK_VERSION := current
-
-# system-as-root is mandatory from Android P
-TARGET_NO_RECOVERY := true
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
-
-# 64 bits binder interface is mandatory from Android P
-TARGET_USES_64_BIT_BINDER := true
# Android generic system image always create metadata partition
BOARD_USES_METADATA_PARTITION := true
@@ -56,6 +48,3 @@
# The partition size doesn't matter, just to make build pass.
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
-
-# Audio: must using XML format for Treblized devices
-USE_XML_AUDIO_POLICY_CONF := 1
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
new file mode 100644
index 0000000..1cbe2e0
--- /dev/null
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -0,0 +1,25 @@
+# BoardConfigMainlineCommon.mk
+#
+# Common compile-time definitions for mainline images.
+
+# The generic product target doesn't have any hardware-specific pieces.
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
+
+TARGET_USERIMAGES_USE_EXT4 := true
+
+# system-as-root is mandatory from Android P
+TARGET_NO_RECOVERY := true
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+
+BOARD_VNDK_VERSION := current
+
+# Required flag for non-64 bit devices from P.
+TARGET_USES_64_BIT_BINDER := true
+
+# Puts odex files on system_other, as well as causing dex files not to get
+# stripped from APKs.
+BOARD_USES_SYSTEM_OTHER_ODEX := true
+
+# Audio: must using XML format for Treblized devices
+USE_XML_AUDIO_POLICY_CONF := 1
diff --git a/target/board/mainline_arm64/BoardConfig.mk b/target/board/mainline_arm64/BoardConfig.mk
index 906a566..521d976 100644
--- a/target/board/mainline_arm64/BoardConfig.mk
+++ b/target/board/mainline_arm64/BoardConfig.mk
@@ -24,4 +24,4 @@
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := generic
-include build/make/target/board/BoardConfigGsiCommon.mk
+include build/make/target/board/BoardConfigMainlineCommon.mk
diff --git a/target/board/treble_common.mk b/target/board/treble_common.mk
index 9413a75..eda5b37 100644
--- a/target/board/treble_common.mk
+++ b/target/board/treble_common.mk
@@ -44,8 +44,6 @@
# Android generic system image always create metadata partition
BOARD_USES_METADATA_PARTITION := true
-# Generic AOSP image does NOT support HWC1
-TARGET_USES_HWC2 := true
# Set emulator framebuffer display device buffer count to 3
NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
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..2c53a6e 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -52,6 +52,8 @@
charger \
cmd \
com.android.location.provider \
+ com.android.resolv \
+ com.android.tzdata \
ContactsProvider \
content \
crash_dump \
@@ -78,6 +80,7 @@
heapprofd \
heapprofd_client \
gatekeeperd \
+ gpuservice \
healthd \
hid \
hwservicemanager \
@@ -310,13 +313,20 @@
PRODUCT_PACKAGES_DEBUG := \
adb_keys \
apex.test.key \
+ arping \
iotop \
+ iw \
logpersist.start \
perfprofd \
procrank \
showmap \
sqlite3 \
+ ss \
strace \
+ sanitizer-status \
+ tracepath \
+ tracepath6 \
+ traceroute6 \
unwind_info \
unwind_reg_info \
unwind_symbols \
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index b0edb56..c41e1d7 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -31,6 +31,10 @@
RcsService \
SafetyRegulatoryInfo \
Stk \
+ TimeZoneUpdater \
+
+# Binaries
+PRODUCT_PACKAGES += llkd
# OTA support
PRODUCT_PACKAGES += \
@@ -38,12 +42,10 @@
update_verifier \
# Wrapped net utils for /vendor access.
-PRODUCT_PACKAGES += \
- netutils-wrapper-1.0 \
+PRODUCT_PACKAGES += netutils-wrapper-1.0
# Charger images
-PRODUCT_PACKAGES += \
- charger_res_images \
+PRODUCT_PACKAGES += charger_res_images
# system_other support
PRODUCT_PACKAGES += \
@@ -55,6 +57,29 @@
audio.a2dp.default \
audio.hearing_aid.default \
+# For ringtones that rely on forward lock encryption
+PRODUCT_PACKAGES += libfwdlockengine
+
+# System libraries commonly depended on by things on the product partition.
+# This list will be pruned periodically.
+PRODUCT_PACKAGES += \
+ android.hardware.biometrics.fingerprint@2.1 \
+ android.hardware.radio@1.0 \
+ android.hardware.radio@1.1 \
+ android.hardware.radio@1.2 \
+ android.hardware.radio.config@1.0 \
+ android.hardware.radio.deprecated@1.0 \
+ android.hardware.secure_element@1.0 \
+ android.hardware.tests.libhwbinder@1.0-impl \
+ android.hidl.base@1.0 \
+ libaudio-resampler \
+ liblogwrap \
+ liblz4 \
+ libminui \
+ libnl \
+ libprotobuf-cpp-full \
+ libprotobuf-cpp-full-rtti \
+
PRODUCT_PACKAGES_DEBUG += \
avbctl \
bootctl \
@@ -64,6 +89,11 @@
tinypcminfo \
update_engine_client \
+# Enable stats logging in LMKD
+TARGET_LMKD_STATS_LOG := true
+PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
+ ro.lmk.log_stats=true
+
# Enable dynamic partition size
PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
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..47c2d41 100644
--- a/target/product/vndk/current.txt
+++ b/target/product/vndk/current.txt
@@ -23,6 +23,7 @@
VNDK-SP: android.hidl.memory.token@1.0.so
VNDK-SP: android.hidl.memory@1.0.so
VNDK-SP: android.hidl.memory@1.0-impl.so
+VNDK-SP: android.hidl.safe_union@1.0.so
VNDK-SP: libRSCpuRef.so
VNDK-SP: libRSDriver.so
VNDK-SP: libRS_internal.so
@@ -121,11 +122,14 @@
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.config@1.2.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
VNDK-core: android.hardware.radio@1.2.so
VNDK-core: android.hardware.radio@1.3.so
+VNDK-core: android.hardware.radio@1.4.so
VNDK-core: android.hardware.secure_element@1.0.so
VNDK-core: android.hardware.sensors@1.0.so
VNDK-core: android.hardware.soundtrigger@2.0.so
@@ -154,7 +158,6 @@
VNDK-core: android.hardware.wifi@1.2.so
VNDK-core: android.hidl.allocator@1.0.so
VNDK-core: android.hidl.memory.block@1.0.so
-VNDK-core: android.hidl.safe_union@1.0.so
VNDK-core: android.hidl.token@1.0.so
VNDK-core: android.hidl.token@1.0-utils.so
VNDK-core: android.system.net.netd@1.0.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/fs_config/Android.mk b/tools/fs_config/Android.mk
index cb32b9e..bf5e171 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -163,10 +163,11 @@
LOCAL_MODULE_CLASS := ETC
LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): PRIVATE_PARTITION_LIST := $(fs_config_generate_extra_partition_list)
$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
@mkdir -p $(dir $@)
- $< -D $(if $(fs_config_generate_extra_partition_list), \
- -P '$(subst $(space),$(comma),$(addprefix -,$(fs_config_generate_extra_partition_list)))') \
+ $< -D $(if $(PRIVATE_PARTITION_LIST), \
+ -P '$(subst $(space),$(comma),$(addprefix -,$(PRIVATE_PARTITION_LIST)))') \
-o $@
##################################
@@ -179,10 +180,11 @@
LOCAL_MODULE_CLASS := ETC
LOCAL_INSTALLED_MODULE_STEM := fs_config_files
include $(BUILD_SYSTEM)/base_rules.mk
+$(LOCAL_BUILT_MODULE): PRIVATE_PARTITION_LIST := $(fs_config_generate_extra_partition_list)
$(LOCAL_BUILT_MODULE): $(fs_config_generate_bin)
@mkdir -p $(dir $@)
- $< -F $(if $(fs_config_generate_extra_partition_list), \
- -P '$(subst $(space),$(comma),$(addprefix -,$(fs_config_generate_extra_partition_list)))') \
+ $< -F $(if $(PRIVATE_PARTITION_LIST), \
+ -P '$(subst $(space),$(comma),$(addprefix -,$(PRIVATE_PARTITION_LIST)))') \
-o $@
ifneq ($(filter vendor,$(fs_config_generate_extra_partition_list)),)
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index ddc50be..139d257 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -260,11 +260,7 @@
args = OPTIONS.info_dict.get("avb_dtbo_add_hash_footer_args")
if args and args.strip():
cmd.extend(shlex.split(args))
- proc = common.Run(cmd)
- output, _ = proc.communicate()
- assert proc.returncode == 0, \
- "Failed to call 'avbtool add_hash_footer' for {}:\n{}".format(
- img.name, output)
+ common.RunAndCheckOutput(cmd)
img.Write()
return img.name
@@ -330,6 +326,12 @@
image_blocks_key = what + "_image_blocks"
info_dict[image_blocks_key] = int(image_size) / 4096 - 1
+ use_dynamic_size = (
+ info_dict.get("use_dynamic_partition_size") == "true" and
+ what in shlex.split(info_dict.get("dynamic_partition_list", "").strip()))
+ if use_dynamic_size:
+ info_dict.update(build_image.GlobalDictFromImageProp(image_props, what))
+
def AddUserdata(output_zip):
"""Create a userdata image and store it in output_zip.
@@ -457,10 +459,7 @@
assert found, 'Failed to find {}'.format(image_path)
cmd.extend(split_args)
- proc = common.Run(cmd)
- stdoutdata, _ = proc.communicate()
- assert proc.returncode == 0, \
- "avbtool make_vbmeta_image failed:\n{}".format(stdoutdata)
+ common.RunAndCheckOutput(cmd)
img.Write()
return img.name
@@ -487,11 +486,7 @@
args = OPTIONS.info_dict.get("board_bpt_make_table_args")
if args:
cmd.extend(shlex.split(args))
-
- proc = common.Run(cmd)
- stdoutdata, _ = proc.communicate()
- assert proc.returncode == 0, \
- "bpttool make_table failed:\n{}".format(stdoutdata)
+ common.RunAndCheckOutput(cmd)
img.Write()
bpt.Write()
@@ -606,10 +601,7 @@
temp_care_map = common.MakeTempFile(prefix="caremap-", suffix=".pb")
care_map_gen_cmd = ["care_map_generator", temp_care_map_text, temp_care_map]
- proc = common.Run(care_map_gen_cmd)
- output, _ = proc.communicate()
- assert proc.returncode == 0, \
- "Failed to generate the care_map proto message:\n{}".format(output)
+ common.RunAndCheckOutput(care_map_gen_cmd)
care_map_path = "META/care_map.pb"
if output_zip and care_map_path not in output_zip.namelist():
@@ -656,18 +648,71 @@
"""Create a super_empty.img and store it in output_zip."""
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "super_empty.img")
- cmd = [OPTIONS.info_dict.get('lpmake')]
- cmd += shlex.split(OPTIONS.info_dict.get('lpmake_args').strip())
+ cmd = [OPTIONS.info_dict['lpmake']]
+ cmd += shlex.split(OPTIONS.info_dict['lpmake_args'].strip())
cmd += ['--output', img.name]
-
- proc = common.Run(cmd)
- stdoutdata, _ = proc.communicate()
- assert proc.returncode == 0, \
- "lpmake tool failed:\n{}".format(stdoutdata)
+ common.RunAndCheckOutput(cmd)
img.Write()
+def AddSuperSplit(output_zip):
+ """Create split super_*.img and store it in output_zip."""
+
+ def GetPartitionSizeFromImage(img):
+ try:
+ simg = sparse_img.SparseImage(img)
+ return simg.blocksize * simg.total_blocks
+ except ValueError:
+ return os.path.getsize(img)
+
+ def TransformPartitionArg(arg):
+ lst = arg.split(':')
+ # Because --auto-slot-suffixing for A/B, there is no need to remove suffix.
+ name = lst[0]
+ if name + '_size' in OPTIONS.info_dict:
+ size = str(OPTIONS.info_dict[name + '_size'])
+ logger.info("Using %s_size = %s", name, size)
+ else:
+ size = str(GetPartitionSizeFromImage(
+ os.path.join(OPTIONS.input_tmp, "IMAGES", '{}.img'.format(name))))
+ logger.info("Using size of prebuilt %s = %s", name, size)
+ lst[2] = size
+ return ':'.join(lst)
+
+ def GetLpmakeArgsWithSizes():
+ lpmake_args = shlex.split(OPTIONS.info_dict['lpmake_args'].strip())
+
+ for i, arg in enumerate(lpmake_args):
+ if arg == '--partition':
+ assert i + 1 < len(lpmake_args), \
+ 'lpmake_args has --partition without value'
+ lpmake_args[i + 1] = TransformPartitionArg(lpmake_args[i + 1])
+
+ return lpmake_args
+
+ outdir = OutputFile(output_zip, OPTIONS.input_tmp, "OTA", "")
+ cmd = [OPTIONS.info_dict['lpmake']]
+ cmd += GetLpmakeArgsWithSizes()
+
+ source = OPTIONS.info_dict.get('dynamic_partition_list', '').strip()
+ if source:
+ cmd.append('--sparse')
+ for name in shlex.split(source):
+ img = os.path.join(OPTIONS.input_tmp, "IMAGES", '{}.img'.format(name))
+ # Because --auto-slot-suffixing for A/B, there is no need to add suffix.
+ cmd += ['--image', '{}={}'.format(name, img)]
+
+ cmd += ['--output', outdir.name]
+
+ common.RunAndCheckOutput(cmd)
+
+ for dev in OPTIONS.info_dict['super_block_devices'].strip().split():
+ img = OutputFile(output_zip, OPTIONS.input_tmp, "OTA",
+ "super_" + dev + ".img")
+ img.Write()
+
+
def ReplaceUpdatedFiles(zip_filename, files_list):
"""Updates all the ZIP entries listed in files_list.
@@ -861,10 +906,15 @@
banner("vbmeta")
AddVBMeta(output_zip, partitions, "vbmeta", vbmeta_partitions)
- if OPTIONS.info_dict.get("super_size"):
+ if OPTIONS.info_dict.get("lpmake_args"):
banner("super_empty")
AddSuperEmpty(output_zip)
+ if OPTIONS.info_dict.get("dynamic_partition_retrofit") == "true":
+ banner("super split images")
+ AddSuperSplit(output_zip)
+ # TODO(b/119322123): Add super.img to target_files for non-retrofit
+
banner("radio")
ab_partitions_txt = os.path.join(OPTIONS.input_tmp, "META",
"ab_partitions.txt")
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 6d22694..9612499 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,114 @@
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
+ # Use a minimum size, otherwise we will fail to calculate an AVB footer
+ # or fail to construct an ext4 image.
+ size = max(size, 256 * 1024)
+ 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 +467,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/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 2264655..7ec8ad8 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -64,6 +64,13 @@
Generate an OTA package that will wipe the user data partition when
installed.
+ --retrofit_dynamic_partitions
+ Generates an OTA package that updates a device to support dynamic
+ partitions (default False). This flag is implied when generating
+ an incremental OTA where the base build does not support dynamic
+ partitions but the target build does. For A/B, when this flag is set,
+ --skip_postinstall is implied.
+
Non-A/B OTA specific options
-b (--binary) <file>
@@ -213,11 +220,14 @@
OPTIONS.extracted_input = None
OPTIONS.key_passwords = []
OPTIONS.skip_postinstall = False
+OPTIONS.retrofit_dynamic_partitions = False
METADATA_NAME = 'META-INF/com/android/metadata'
POSTINSTALL_CONFIG = 'META/postinstall_config.txt'
+DYNAMIC_PARTITION_INFO = 'META/dynamic_partitions_info.txt'
UNZIP_PATTERN = ['IMAGES/*', 'META/*']
+SUPER_SPLIT_PATTERN = ['OTA/super_*.img']
class BuildInfo(object):
@@ -1717,6 +1727,60 @@
return target_file
+def GetTargetFilesZipForRetrofitDynamicPartitions(input_file,
+ super_block_devices):
+ """Returns a target-files.zip for retrofitting dynamic partitions.
+
+ This allows brillo_update_payload to generate an OTA based on the exact
+ bits on the block devices. Postinstall is disabled.
+
+ Args:
+ input_file: The input target-files.zip filename.
+ super_block_devices: The list of super block devices
+
+ Returns:
+ The filename of target-files.zip with *.img replaced with super_*.img for
+ each block device in super_block_devices.
+ """
+ assert super_block_devices, "No super_block_devices are specified."
+
+ replace = {'OTA/super_{}.img'.format(dev): 'IMAGES/{}.img'.format(dev)
+ for dev in super_block_devices}
+
+ target_file = common.MakeTempFile(prefix="targetfiles-", suffix=".zip")
+ shutil.copyfile(input_file, target_file)
+
+ with zipfile.ZipFile(input_file, 'r') as input_zip:
+ namelist = input_zip.namelist()
+
+ # Always skip postinstall for a retrofit update.
+ to_delete = [POSTINSTALL_CONFIG]
+
+ # Delete dynamic_partitions_info.txt so that brillo_update_payload thinks this
+ # is a regular update on devices without dynamic partitions support.
+ to_delete += [DYNAMIC_PARTITION_INFO]
+
+ # Remove the existing partition images as well as the map files.
+ to_delete += replace.values()
+ to_delete += ['IMAGES/{}.map'.format(dev) for dev in super_block_devices]
+
+ common.ZipDelete(target_file, to_delete)
+
+ input_tmp = common.UnzipTemp(input_file, SUPER_SPLIT_PATTERN)
+ target_zip = zipfile.ZipFile(target_file, 'a', allowZip64=True)
+
+ # Write super_{foo}.img as {foo}.img.
+ for src, dst in replace.items():
+ assert src in namelist, \
+ 'Missing {} in {}; {} cannot be written'.format(src, input_file, dst)
+ unzipped_file = os.path.join(input_tmp, *src.split('/'))
+ common.ZipWrite(target_zip, unzipped_file, arcname=dst)
+
+ common.ZipClose(target_zip)
+
+ return target_file
+
+
def WriteABOTAPackageWithBrilloScript(target_file, output_file,
source_file=None):
"""Generates an Android OTA package that has A/B update payload."""
@@ -1738,7 +1802,10 @@
# Metadata to comply with Android OTA package format.
metadata = GetPackageMetadata(target_info, source_info)
- if OPTIONS.skip_postinstall:
+ if OPTIONS.retrofit_dynamic_partitions:
+ target_file = GetTargetFilesZipForRetrofitDynamicPartitions(
+ target_file, target_info.get("super_block_devices").strip().split())
+ elif OPTIONS.skip_postinstall:
target_file = GetTargetFilesZipWithoutPostinstallConfig(target_file)
# Generate payload.
@@ -1870,6 +1937,8 @@
OPTIONS.extracted_input = a
elif o == "--skip_postinstall":
OPTIONS.skip_postinstall = True
+ elif o == "--retrofit_dynamic_partitions":
+ OPTIONS.retrofit_dynamic_partitions = True
else:
return False
return True
@@ -1900,6 +1969,7 @@
"payload_signer_args=",
"extracted_input_target_files=",
"skip_postinstall",
+ "retrofit_dynamic_partitions",
], extra_option_handler=option_handler)
if len(args) != 2:
@@ -1943,6 +2013,23 @@
# Load OEM dicts if provided.
OPTIONS.oem_dicts = _LoadOemDicts(OPTIONS.oem_source)
+ # Assume retrofitting dynamic partitions when base build does not set
+ # use_dynamic_partitions but target build does.
+ if (OPTIONS.source_info_dict and
+ OPTIONS.source_info_dict.get("use_dynamic_partitions") != "true" and
+ OPTIONS.target_info_dict.get("use_dynamic_partitions") == "true"):
+ if OPTIONS.target_info_dict.get("dynamic_partition_retrofit") != "true":
+ raise common.ExternalError(
+ "Expect to generate incremental OTA for retrofitting dynamic "
+ "partitions, but dynamic_partition_retrofit is not set in target "
+ "build.")
+ logger.info("Implicitly generating retrofit incremental OTA.")
+ OPTIONS.retrofit_dynamic_partitions = True
+
+ # Skip postinstall for retrofitting dynamic partitions.
+ if OPTIONS.retrofit_dynamic_partitions:
+ OPTIONS.skip_postinstall = True
+
ab_update = OPTIONS.info_dict.get("ab_update") == "true"
# Use the default key to sign the package if not specified with package_key.
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index ad22b72..d2a274d 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -40,11 +40,7 @@
# Calls an external binary to convert the proto message.
cmd = ["care_map_generator", "--parse_proto", file_name, text_file]
- proc = common.Run(cmd)
- output, _ = proc.communicate()
- self.assertEqual(
- 0, proc.returncode,
- "Failed to run care_map_generator:\n{}".format(output))
+ common.RunAndCheckOutput(cmd)
with open(text_file, 'r') as verify_fp:
plain_text = verify_fp.read()
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.