From 45a7c8cf921d94b3c3ca3bc510477aaed37c549e Mon Sep 17 00:00:00 2001 From: Inseob Kim Date: Thu, 8 Aug 2024 17:48:43 +0900 Subject: [PATCH] Build product/odm build.prop with Soong Bug: 322090587 Test: compare build.prop before and after, boot Change-Id: Iab157cf313d62c1c95ef66dd0a2b9563ee60ab46 --- core/config.mk | 6 ++- core/soong_config.mk | 1 + core/soong_extra_config.mk | 4 ++ core/sysprop.mk | 75 +++------------------------------- core/sysprop_config.mk | 39 +----------------- target/product/base_product.mk | 1 + target/product/base_vendor.mk | 1 + 7 files changed, 19 insertions(+), 108 deletions(-) diff --git a/core/config.mk b/core/config.mk index 6edb5b2f52..d4a2ea6a40 100644 --- a/core/config.mk +++ b/core/config.mk @@ -1268,7 +1268,11 @@ ifeq ($(TARGET_SYSTEM_EXT_PROP),) TARGET_SYSTEM_EXT_PROP := $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop) endif -.KATI_READONLY += TARGET_SYSTEM_PROP TARGET_SYSTEM_EXT_PROP +ifeq ($(TARGET_PRODUCT_PROP),) +TARGET_PRODUCT_PROP := $(wildcard $(TARGET_DEVICE_DIR)/product.prop) +endif + +.KATI_READONLY := TARGET_SYSTEM_PROP TARGET_SYSTEM_EXT_PROP TARGET_PRODUCT_PROP include $(BUILD_SYSTEM)/sysprop_config.mk diff --git a/core/soong_config.mk b/core/soong_config.mk index 070344e7ee..606a225776 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -365,6 +365,7 @@ $(call add_json_list, OemProperties, $(PRODUCT_OEM_PROPERTIES)) $(call add_json_list, SystemPropFiles, $(TARGET_SYSTEM_PROP)) $(call add_json_list, SystemExtPropFiles, $(TARGET_SYSTEM_EXT_PROP)) +$(call add_json_list, ProductPropFiles, $(TARGET_PRODUCT_PROP)) # Do not set ArtTargetIncludeDebugBuild into any value if PRODUCT_ART_TARGET_INCLUDE_DEBUG_BUILD is not set, # to have the same behavior from runtime_libart.mk. diff --git a/core/soong_extra_config.mk b/core/soong_extra_config.mk index 76da0d702b..00b5c0fd63 100644 --- a/core/soong_extra_config.mk +++ b/core/soong_extra_config.mk @@ -90,6 +90,10 @@ $(call add_json_list, BuildVersionTags, $(BUILD_VERSION_TAGS)) $(call add_json_bool, ProductNotDebuggableInUserdebug, $(PRODUCT_NOT_DEBUGGABLE_IN_USERDEBUG)) +$(call add_json_bool, UsesProductImage, $(filter true,$(BOARD_USES_PRODUCTIMAGE))) + +$(call add_json_bool, TargetBoots16K, $(filter true,$(TARGET_BOOTS_16K))) + $(call json_end) $(shell mkdir -p $(dir $(SOONG_EXTRA_VARIABLES))) diff --git a/core/sysprop.mk b/core/sysprop.mk index 6d65e19efa..dc6f2c4ac6 100644 --- a/core/sysprop.mk +++ b/core/sysprop.mk @@ -266,83 +266,18 @@ $(eval $(call declare-1p-target,$(INSTALLED_VENDOR_BUILD_PROP_TARGET))) # ----------------------------------------------------------------- # product/etc/build.prop # - -_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\ - $(TARGET_PRODUCT_PROP),\ - $(wildcard $(TARGET_DEVICE_DIR)/product.prop)) - -# Order matters here. When there are duplicates, the last one wins. -# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter -_prop_vars_ := \ - ADDITIONAL_PRODUCT_PROPERTIES \ - PRODUCT_PRODUCT_PROPERTIES +# product/etc/build.prop is built by Soong. See product-build.prop module in +# build/soong/Android.bp. INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/etc/build.prop -ifdef PRODUCT_OEM_PROPERTIES -import_oem_prop := $(call intermediates-dir-for,ETC,import_oem_prop)/oem.prop - -$(import_oem_prop): - $(hide) echo "####################################" >> $@; \ - echo "# PRODUCT_OEM_PROPERTIES" >> $@; \ - echo "####################################" >> $@; - $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \ - echo "import /oem/oem.prop $(prop)" >> $@;) - -_footers_ := $(import_oem_prop) -else -_footers_ := -endif - -# Skip common /product properties generation if device released before R and -# has no product partition. This is the first part of the check. -ifeq ($(call math_lt,$(if $(PRODUCT_SHIPPING_API_LEVEL),$(PRODUCT_SHIPPING_API_LEVEL),30),30), true) - _skip_common_properties := true -endif - -# The second part of the check - always generate common properties for the -# devices with product partition regardless of shipping level. -ifneq ($(BOARD_USES_PRODUCTIMAGE),) - _skip_common_properties := -endif - -$(eval $(call build-properties,\ - product,\ - $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\ - $(_prop_files_),\ - $(_prop_vars_),\ - $(empty),\ - $(_footers_),\ - $(_skip_common_properties))) - -$(eval $(call declare-1p-target,$(INSTALLED_PRODUCT_BUILD_PROP_TARGET))) - -_skip_common_properties := - # ---------------------------------------------------------------- # odm/etc/build.prop # -_prop_files_ := $(if $(TARGET_ODM_PROP),\ - $(TARGET_ODM_PROP),\ - $(wildcard $(TARGET_DEVICE_DIR)/odm.prop)) - -# Order matters here. When there are duplicates, the last one wins. -# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter -_prop_vars_ := \ - ADDITIONAL_ODM_PROPERTIES \ - PRODUCT_ODM_PROPERTIES +# odm/etc/build.prop is built by Soong. See odm-build.prop module in +# build/soong/Android.bp. INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop -$(eval $(call build-properties,\ - odm,\ - $(INSTALLED_ODM_BUILD_PROP_TARGET),\ - $(_prop_files_),\ - $(_prop_vars_),\ - $(empty),\ - $(empty),\ - $(empty))) - -$(eval $(call declare-1p-target,$(INSTALLED_ODM_BUILD_PROP_TARGET))) # ---------------------------------------------------------------- # vendor_dlkm/etc/build.prop @@ -395,7 +330,7 @@ $(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET))) # ----------------------------------------------------------------- # system_ext/etc/build.prop # -# system_ext/build.prop is built by Soong. See system-build.prop module in +# system_ext/etc/build.prop is built by Soong. See system-build.prop module in # build/soong/Android.bp. INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/etc/build.prop diff --git a/core/sysprop_config.mk b/core/sysprop_config.mk index 543b86b0e0..69066117a3 100644 --- a/core/sysprop_config.mk +++ b/core/sysprop_config.mk @@ -16,24 +16,8 @@ $(foreach name, $(_additional_prop_var_names),\ _additional_prop_var_names := $(KATI_obsolete_var ADDITIONAL_SYSTEM_PROPERTIES,Use build/soong/scripts/gen_build_prop.py instead) - -# Add the system server compiler filter if they are specified for the product. -ifneq (,$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER)) -ADDITIONAL_PRODUCT_PROPERTIES += dalvik.vm.systemservercompilerfilter=$(PRODUCT_SYSTEM_SERVER_COMPILER_FILTER) -endif - -# Add the 16K developer option if it is defined for the product. -ifeq ($(PRODUCT_16K_DEVELOPER_OPTION),true) -ADDITIONAL_PRODUCT_PROPERTIES += ro.product.build.16k_page.enabled=true -else -ADDITIONAL_PRODUCT_PROPERTIES += ro.product.build.16k_page.enabled=false -endif - -ifeq ($(TARGET_BOOTS_16K),true) -ADDITIONAL_PRODUCT_PROPERTIES += ro.product.page_size=16384 -else -ADDITIONAL_PRODUCT_PROPERTIES += ro.product.page_size=4096 -endif +$(KATI_obsolete_var ADDITIONAL_ODM_PROPERTIES,Use build/soong/scripts/gen_build_prop.py instead) +$(KATI_obsolete_var ADDITIONAL_PRODUCT_PROPERTIES,Use build/soong/scripts/gen_build_prop.py instead) # Add cpu properties for bionic and ART. ADDITIONAL_VENDOR_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH) @@ -146,35 +130,16 @@ ADDITIONAL_VENDOR_PROPERTIES += \ ro.build.ab_update=$(AB_OTA_UPDATER) endif -ADDITIONAL_PRODUCT_PROPERTIES += ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS) - ifeq ($(AB_OTA_UPDATER),true) -ADDITIONAL_PRODUCT_PROPERTIES += ro.product.ab_ota_partitions=$(subst $(space),$(comma),$(sort $(AB_OTA_PARTITIONS))) ADDITIONAL_VENDOR_PROPERTIES += ro.vendor.build.ab_ota_partitions=$(subst $(space),$(comma),$(sort $(AB_OTA_PARTITIONS))) endif -# Set this property for VTS to skip large page size tests on unsupported devices. -ADDITIONAL_PRODUCT_PROPERTIES += \ - ro.product.cpu.pagesize.max=$(TARGET_MAX_PAGE_SIZE_SUPPORTED) - -ifeq ($(PRODUCT_NO_BIONIC_PAGE_SIZE_MACRO),true) -ADDITIONAL_PRODUCT_PROPERTIES += ro.product.build.no_bionic_page_size_macro=true -endif - user_variant := $(filter user userdebug,$(TARGET_BUILD_VARIANT)) config_enable_uffd_gc := \ $(firstword $(OVERRIDE_ENABLE_UFFD_GC) $(PRODUCT_ENABLE_UFFD_GC) default) -# This is a temporary system property that controls the ART module. The plan is -# to remove it by Aug 2025, at which time Mainline updates of the ART module -# will ignore it as well. -# If the value is "default", it will be mangled by post_process_props.py. -ADDITIONAL_PRODUCT_PROPERTIES += ro.dalvik.vm.enable_uffd_gc=$(config_enable_uffd_gc) - -ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES)) ADDITIONAL_VENDOR_PROPERTIES := $(strip $(ADDITIONAL_VENDOR_PROPERTIES)) .KATI_READONLY += \ - ADDITIONAL_PRODUCT_PROPERTIES \ ADDITIONAL_VENDOR_PROPERTIES diff --git a/target/product/base_product.mk b/target/product/base_product.mk index 0ac220bb16..92fc420a13 100644 --- a/target/product/base_product.mk +++ b/target/product/base_product.mk @@ -25,3 +25,4 @@ PRODUCT_PACKAGES += \ product_compatibility_matrix.xml \ product_manifest.xml \ selinux_policy_product \ + product-build.prop \ diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk index 9892639824..c060c2ac19 100644 --- a/target/product/base_vendor.mk +++ b/target/product/base_vendor.mk @@ -72,6 +72,7 @@ PRODUCT_PACKAGES += \ passwd_vendor \ selinux_policy_nonsystem \ shell_and_utilities_vendor \ + odm-build.prop \ # Base modules when shipping api level is less than or equal to 34 PRODUCT_PACKAGES_SHIPPING_API_LEVEL_34 += \