Standardize parition build props.
This adds a set of standard build properties that are shared
between the system, vendor, odm, product, product_services and
bootimage partitions. The following properties are added:
ro.X.build.date
ro.X.build.date.utc
ro.X.build.fingerprint
ro.X.build.id
ro.X.build.tags
ro.X.build.type
ro.X.build.version.incremental
ro.X.build.version.release
ro.X.build.version.sdk
ro.product.X.brand
ro.product.X.device
ro.product.X.manufacturer
ro.product.X.model
ro.product.X.name
vendor and odm already had all of these, but bootimage, product
and product_services only had a subset and system didn't have
any.
Bug: 78359442
Bug: 111491184
Test: m out/target/product/hikey64/system/build.prop and inspect
Change-Id: Ia346d61aec331ed1b9fea12e6a50f1b79147473d
diff --git a/core/Makefile b/core/Makefile
index 7a6c9fc..ac2ef77 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -149,6 +149,29 @@
# -----------------------------------------------------------------
# prop.default
+
+BUILDINFO_SH := build/make/tools/buildinfo.sh
+BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
+# Generates a set of common build system properties to a file.
+# $(1): Partition name
+# $(2): Output file name
+define generate-common-build-props
+ BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
+ BUILD_ID="$(BUILD_ID)" \
+ BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
+ BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
+ DATE="$(DATE_FROM_FILE)" \
+ PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
+ PLATFORM_VERSION="$(PLATFORM_VERSION)" \
+ PRODUCT_BRAND="$(PRODUCT_BRAND)" \
+ PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
+ PRODUCT_MODEL="$(PRODUCT_MODEL)" \
+ PRODUCT_NAME="$(TARGET_PRODUCT)" \
+ TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
+ TARGET_DEVICE="$(TARGET_DEVICE)" \
+ bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
+endef
+
ifdef property_overrides_split_enabled
INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
@@ -171,7 +194,7 @@
intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
-$(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
+$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
@rm -f $@
@@ -183,9 +206,7 @@
$(hide) echo "#" >> $@; \
echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
echo "#" >> $@;
- $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
- $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
- $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
+ $(hide) $(call generate-common-build-props,bootimage,$@)
$(hide) build/make/tools/post_process_props.py $@
ifdef property_overrides_split_enabled
$(hide) mkdir -p $(TARGET_ROOT_OUT)
@@ -308,9 +329,6 @@
$(strip $(subst _,-, $(firstword $(1))))
endef
-BUILDINFO_SH := build/make/tools/buildinfo.sh
-DEVICE_BUILDINFO_SH := build/make/tools/device_buildinfo.sh
-
# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
# harness to distinguish builds. Only add _asan for a sanitized build
# if it isn't already a part of the flavor (via a dedicated lunch
@@ -327,7 +345,7 @@
else
system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
endif
-$(intermediate_system_build_prop): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
+$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -338,6 +356,7 @@
$(hide) $(foreach prop,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES), \
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)" \
@@ -419,32 +438,18 @@
$(FINAL_VENDOR_BUILD_PROPERTIES),=)
endif # property_overrides_split_enabled
-$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(DEVICE_BUILDINFO_SH) $(intermediate_system_build_prop)
+$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
@echo Target vendor buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
$(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
- $(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@
- $(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
- $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
$(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
$(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
$(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
$(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
- $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
- BUILD_ID="$(BUILD_ID)" \
- BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
- PLATFORM_VERSION="$(PLATFORM_VERSION)" \
- PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
- BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
- TARGET_DEVICE="$(TARGET_DEVICE)" \
- PRODUCT_NAME="$(TARGET_PRODUCT)" \
- PRODUCT_BRAND="$(PRODUCT_BRAND)" \
- PRODUCT_MODEL="$(PRODUCT_MODEL)" \
- PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
- TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
- TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
- bash $(DEVICE_BUILDINFO_SH) "vendor" >> $@
+ $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
+ $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
+ $(hide) $(call generate-common-build-props,vendor,$@)
ifdef property_overrides_split_enabled
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
@@ -464,14 +469,12 @@
FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_PRODUCT_PROPERTIES),=)
-$(INSTALLED_PRODUCT_BUILD_PROP_TARGET):
+$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
@echo Target product buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
ifdef BOARD_USES_PRODUCTIMAGE
- $(hide) echo ro.product.build.date=`$(DATE_FROM_FILE)`>>$@
- $(hide) echo ro.product.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
- $(hide) echo ro.product.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
+ $(hide) $(call generate-common-build-props,product,$@)
endif # BOARD_USES_PRODUCTIMAGE
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
@@ -490,24 +493,14 @@
FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_ODM_BUILD_PROPERTIES),=)
-$(INSTALLED_ODM_BUILD_PROP_TARGET): $(DEVICE_BUILDINFO_SH)
+$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
@echo Target odm buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
- $(hide) echo ro.odm.build.date=`$(DATE_FROM_FILE)`>>$@
- $(hide) echo ro.odm.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
- $(hide) echo ro.odm.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
$(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
$(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
$(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
- $(hide) TARGET_DEVICE="$(TARGET_DEVICE)" \
- PRODUCT_NAME="$(TARGET_PRODUCT)" \
- PRODUCT_BRAND="$(PRODUCT_BRAND)" \
- PRODUCT_MODEL="$(PRODUCT_MODEL)" \
- PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
- TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
- TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
- bash $(DEVICE_BUILDINFO_SH) "odm" >> $@
+ $(hide) $(call generate-common-build-props,odm,$@)
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
@@ -525,14 +518,12 @@
FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
-$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET):
+$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
@echo Target product_services buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
- $(hide) echo ro.product_services.build.date=`$(DATE_FROM_FILE)`>>$@
- $(hide) echo ro.product_services.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
- $(hide) echo ro.product_services.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
+ $(hide) $(call generate-common-build-props,product_services,$@)
endif # BOARD_USES_PRODUCT_SERVICESIMAGE
$(hide) echo "#" >> $@; \
echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \