blob: 4536e5f88633e0008342d3251c40c64f1ceafd6a [file] [log] [blame]
Jiyong Parke1346862020-05-18 14:31:30 +09001#
2# Copyright (C) 2020 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
Jiyong Parkc0bd8c72020-06-29 10:46:22 +090017# sysprop.mk defines rules for generating <partition>/[etc/]build.prop files
Jiyong Parke1346862020-05-18 14:31:30 +090018
19# -----------------------------------------------------------------
20# property_overrides_split_enabled
21property_overrides_split_enabled :=
22ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
23 property_overrides_split_enabled := true
24endif
25
Jiyong Parke1346862020-05-18 14:31:30 +090026BUILDINFO_SH := build/make/tools/buildinfo.sh
Jiyong Parkae556382020-05-20 18:33:43 +090027POST_PROCESS_PROPS := $(HOST_OUT_EXECUTABLES)/post_process_props$(HOST_EXECUTABLE_SUFFIX)
Jiyong Parke1346862020-05-18 14:31:30 +090028
Jiyong Park35a83d12020-05-26 02:01:05 +090029# Emits a set of sysprops common to all partitions to a file.
Jiyong Parke1346862020-05-18 14:31:30 +090030# $(1): Partition name
31# $(2): Output file name
32define generate-common-build-props
Jiyong Park35a83d12020-05-26 02:01:05 +090033 echo "####################################" >> $(2);\
34 echo "# from generate-common-build-props" >> $(2);\
35 echo "# These properties identify this partition image." >> $(2);\
36 echo "####################################" >> $(2);\
37 $(if $(filter system,$(1)),\
38 echo "ro.product.$(1).brand=$(PRODUCT_SYSTEM_BRAND)" >> $(2);\
39 echo "ro.product.$(1).device=$(PRODUCT_SYSTEM_DEVICE)" >> $(2);\
40 echo "ro.product.$(1).manufacturer=$(PRODUCT_SYSTEM_MANUFACTURER)" >> $(2);\
41 echo "ro.product.$(1).model=$(PRODUCT_SYSTEM_MODEL)" >> $(2);\
42 echo "ro.product.$(1).name=$(PRODUCT_SYSTEM_NAME)" >> $(2);\
43 ,\
44 echo "ro.product.$(1).brand=$(PRODUCT_BRAND)" >> $(2);\
45 echo "ro.product.$(1).device=$(TARGET_DEVICE)" >> $(2);\
46 echo "ro.product.$(1).manufacturer=$(PRODUCT_MANUFACTURER)" >> $(2);\
47 echo "ro.product.$(1).model=$(PRODUCT_MODEL)" >> $(2);\
48 echo "ro.product.$(1).name=$(TARGET_PRODUCT)" >> $(2);\
Prashant Patil7d9cda12022-09-28 15:52:08 +010049 # Attestation specific properties for AOSP/GSI build running on device.
wufei399fafae2023-08-09 14:00:58 +080050 if [ -n "$(strip $(PRODUCT_MODEL_FOR_ATTESTATION))" ]; then \
51 echo "ro.product.model_for_attestation=$(PRODUCT_MODEL_FOR_ATTESTATION)" >> $(2);\
52 fi; \
53 if [ -n "$(strip $(PRODUCT_BRAND_FOR_ATTESTATION))" ]; then \
54 echo "ro.product.brand_for_attestation=$(PRODUCT_BRAND_FOR_ATTESTATION)" >> $(2);\
55 fi; \
56 if [ -n "$(strip $(PRODUCT_NAME_FOR_ATTESTATION))" ]; then \
57 echo "ro.product.name_for_attestation=$(PRODUCT_NAME_FOR_ATTESTATION)" >> $(2);\
58 fi; \
59 if [ -n "$(strip $(PRODUCT_DEVICE_FOR_ATTESTATION))" ]; then \
60 echo "ro.product.device_for_attestation=$(PRODUCT_DEVICE_FOR_ATTESTATION)" >> $(2);\
61 fi; \
62 if [ -n "$(strip $(PRODUCT_MANUFACTURER_FOR_ATTESTATION))" ]; then \
63 echo "ro.product.manufacturer_for_attestation=$(PRODUCT_MANUFACTURER_FOR_ATTESTATION)" >> $(2);\
64 fi; \
Jiyong Park35a83d12020-05-26 02:01:05 +090065 )\
Christopher Ferris66b6fd62022-04-08 15:20:23 -070066 $(if $(filter true,$(ZYGOTE_FORCE_64)),\
67 $(if $(filter vendor,$(1)),\
68 echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
69 echo "ro.$(1).product.cpu.abilist32=" >> $(2);\
70 echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
71 )\
72 ,\
73 $(if $(filter system vendor odm,$(1)),\
74 echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST)" >> $(2);\
75 echo "ro.$(1).product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT)" >> $(2);\
76 echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
77 )\
SzuWei Linbaf5c812020-12-31 16:59:27 +080078 )\
Jiyong Park35a83d12020-05-26 02:01:05 +090079 echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\
80 echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\
Tiffany Yang19450e32023-05-23 17:36:54 -070081 # Allow optional assignments for ARC forward-declarations (b/249168657)
82 # TODO: Remove any tag-related inconsistencies once the goals from
83 # go/arc-android-sigprop-changes have been achieved.
84 echo "ro.$(1).build.fingerprint?=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\
85 echo "ro.$(1).build.id?=$(BUILD_ID)" >> $(2);\
86 echo "ro.$(1).build.tags?=$(BUILD_VERSION_TAGS)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090087 echo "ro.$(1).build.type=$(TARGET_BUILD_VARIANT)" >> $(2);\
88 echo "ro.$(1).build.version.incremental=$(BUILD_NUMBER_FROM_FILE)" >> $(2);\
Tianjiee88ac672020-10-15 17:22:48 -070089 echo "ro.$(1).build.version.release=$(PLATFORM_VERSION_LAST_STABLE)" >> $(2);\
90 echo "ro.$(1).build.version.release_or_codename=$(PLATFORM_VERSION)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090091 echo "ro.$(1).build.version.sdk=$(PLATFORM_SDK_VERSION)" >> $(2);\
Jiyong Parke1346862020-05-18 14:31:30 +090092
Jiyong Parke1346862020-05-18 14:31:30 +090093endef
94
Jiyong Parkc0bd8c72020-06-29 10:46:22 +090095# Rule for generating <partition>/[etc/]build.prop file
Jiyong Parke28fa802020-05-26 00:21:20 +090096#
97# $(1): partition name
98# $(2): path to the output
99# $(3): path to the input *.prop files. The contents of the files are directly
100# emitted to the output
101# $(4): list of variable names each of which contains name=value pairs
102# $(5): optional list of prop names to force remove from the output. Properties from both
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100103# $(3) and (4) are affected
104# $(6): optional list of files to append at the end. The content of each file is emitted
105# to the output
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100106# $(7): optional flag to skip common properties generation
Jiyong Parke28fa802020-05-26 00:21:20 +0900107define build-properties
108ALL_DEFAULT_INSTALLED_MODULES += $(2)
109
Jiyong Parkd721e872020-06-22 17:30:57 +0900110$(eval # Properties can be assigned using `prop ?= value` or `prop = value` syntax.)
111$(eval # Eliminate spaces around the ?= and = separators.)
Jiyong Parke28fa802020-05-26 00:21:20 +0900112$(foreach name,$(strip $(4)),\
Jiyong Parkd721e872020-06-22 17:30:57 +0900113 $(eval _temp := $$(call collapse-pairs,$$($(name)),?=))\
114 $(eval _resolved_$(name) := $$(call collapse-pairs,$$(_temp),=))\
Jiyong Parke28fa802020-05-26 00:21:20 +0900115)
116
Jiyong Park0b4fccb2020-06-26 17:38:00 +0900117$(eval # Implement the legacy behavior when BUILD_BROKEN_DUP_SYSPROP is on.)
118$(eval # Optional assignments are all converted to normal assignments and)
119$(eval # when their duplicates the first one wins)
120$(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\
121 $(foreach name,$(strip $(4)),\
122 $(eval _temp := $$(subst ?=,=,$$(_resolved_$(name))))\
123 $(eval _resolved_$(name) := $$(call uniq-pairs-by-first-component,$$(_resolved_$(name)),=))\
124 )\
125 $(eval _option := --allow-dup)\
Jiyong Parke28fa802020-05-26 00:21:20 +0900126)
127
Inseob Kim2a70ea02021-06-09 17:36:08 +0900128$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6)
Jiyong Parke28fa802020-05-26 00:21:20 +0900129 $(hide) echo Building $$@
130 $(hide) mkdir -p $$(dir $$@)
131 $(hide) rm -f $$@ && touch $$@
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100132ifneq ($(strip $(7)), true)
Jiyong Parke28fa802020-05-26 00:21:20 +0900133 $(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100134endif
Jiyong Parke28fa802020-05-26 00:21:20 +0900135 $(hide) $(foreach file,$(strip $(3)),\
136 if [ -f "$(file)" ]; then\
137 echo "" >> $$@;\
138 echo "####################################" >> $$@;\
139 echo "# from $(file)" >> $$@;\
140 echo "####################################" >> $$@;\
141 cat $(file) >> $$@;\
142 fi;)
143 $(hide) $(foreach name,$(strip $(4)),\
144 echo "" >> $$@;\
145 echo "####################################" >> $$@;\
146 echo "# from variable $(name)" >> $$@;\
147 echo "####################################" >> $$@;\
148 $$(foreach line,$$(_resolved_$(name)),\
149 echo "$$(line)" >> $$@;\
150 )\
151 )
Justin Yun07ceaa72021-04-02 16:29:06 +0900152 $(hide) $(POST_PROCESS_PROPS) $$(_option) --sdk-version $(PLATFORM_SDK_VERSION) $$@ $(5)
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100153 $(hide) $(foreach file,$(strip $(6)),\
154 if [ -f "$(file)" ]; then\
155 cat $(file) >> $$@;\
156 fi;)
Jiyong Parke28fa802020-05-26 00:21:20 +0900157 $(hide) echo "# end of file" >> $$@
Bob Badoure9bdbc52022-03-10 11:31:07 -0800158
Bob Badour1d31e2d2023-03-01 10:31:25 -0800159$(call declare-1p-target,$(2))
Jiyong Parke28fa802020-05-26 00:21:20 +0900160endef
161
Jiyong Parke1346862020-05-18 14:31:30 +0900162# -----------------------------------------------------------------
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900163# Define fingerprint, thumbprint, and version tags for the current build
Jiyong Parke28fa802020-05-26 00:21:20 +0900164#
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900165# BUILD_VERSION_TAGS is a comma-separated list of tags chosen by the device
166# implementer that further distinguishes the build. It's basically defined
167# by the device implementer. Here, we are adding a mandatory tag that
168# identifies the signing config of the build.
Jiyong Parke1346862020-05-18 14:31:30 +0900169BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
170ifeq ($(TARGET_BUILD_TYPE),debug)
171 BUILD_VERSION_TAGS += debug
172endif
173# The "test-keys" tag marks builds signed with the old test keys,
174# which are available in the SDK. "dev-keys" marks builds signed with
175# non-default dev keys (usually private keys from a vendor directory).
176# Both of these tags will be removed and replaced with "release-keys"
177# when the target-files is signed in a post-build step.
178ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
179BUILD_KEYS := test-keys
180else
181BUILD_KEYS := dev-keys
182endif
183BUILD_VERSION_TAGS += $(BUILD_KEYS)
184BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
185
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900186# BUILD_FINGERPRINT is used used to uniquely identify the combined build and
187# product; used by the OTA server.
Jiyong Parke1346862020-05-18 14:31:30 +0900188ifeq (,$(strip $(BUILD_FINGERPRINT)))
189 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
190 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
191 else
Jeongik Cha8a64fb12023-06-09 11:51:18 +0900192 BF_BUILD_NUMBER := $(BUILD_NUMBER_FROM_FILE)
Jiyong Parke1346862020-05-18 14:31:30 +0900193 endif
194 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
195endif
196# unset it for safety.
197BF_BUILD_NUMBER :=
198
199BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
200ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
201 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
202endif
203BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
204# unset it for safety.
205BUILD_FINGERPRINT :=
206
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900207# BUILD_THUMBPRINT is used to uniquely identify the system build; used by the
208# OTA server. This purposefully excludes any product-specific variables.
Jiyong Parke1346862020-05-18 14:31:30 +0900209ifeq (,$(strip $(BUILD_THUMBPRINT)))
210 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
211endif
212
213BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
Jeongik Cha05210f92023-04-27 11:05:22 +0900214ifeq ($(strip $(HAS_BUILD_NUMBER)),true)
215$(BUILD_THUMBPRINT_FILE): $(BUILD_NUMBER_FILE)
216endif
Jiyong Parke1346862020-05-18 14:31:30 +0900217ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
218 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
219endif
220BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
221# unset it for safety.
222BUILD_THUMBPRINT :=
223
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900224# -----------------------------------------------------------------
225# Define human readable strings that describe this build
226#
Jiyong Parke1346862020-05-18 14:31:30 +0900227
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900228# BUILD_ID: detail info; has the same info as the build fingerprint
229BUILD_DESC := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
230
231# BUILD_DISPLAY_ID is shown under Settings -> About Phone
Jiyong Parke1346862020-05-18 14:31:30 +0900232ifeq ($(TARGET_BUILD_VARIANT),user)
233 # User builds should show:
234 # release build number or branch.buld_number non-release builds
235
236 # Dev. branches should have DISPLAY_BUILD_NUMBER set
237 ifeq (true,$(DISPLAY_BUILD_NUMBER))
238 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
239 else
240 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
241 endif
242else
243 # Non-user builds should show detailed build information
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900244 BUILD_DISPLAY_ID := $(BUILD_DESC)
Jiyong Parke1346862020-05-18 14:31:30 +0900245endif
246
Jiyong Parke1346862020-05-18 14:31:30 +0900247# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
248# harness to distinguish builds. Only add _asan for a sanitized build
249# if it isn't already a part of the flavor (via a dedicated lunch
250# config for example).
251TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
252ifneq (, $(filter address, $(SANITIZE_TARGET)))
253ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
254TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
255endif
256endif
257
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900258KNOWN_OEM_THUMBPRINT_PROPERTIES := \
259 ro.product.brand \
260 ro.product.name \
261 ro.product.device
262OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
263 $(PRODUCT_OEM_PROPERTIES))
264KNOWN_OEM_THUMBPRINT_PROPERTIES:=
265
266# -----------------------------------------------------------------
267# system/build.prop
268#
269# Note: parts of this file that can't be generated by the build-properties
270# macro are manually created as separate files and then fed into the macro
271
272# Accepts a whitespace separated list of product locales such as
273# (en_US en_AU en_GB...) and returns the first locale in the list with
274# underscores replaced with hyphens. In the example above, this will
275# return "en-US".
276define get-default-product-locale
277$(strip $(subst _,-, $(firstword $(1))))
278endef
279
Jiyong Parkc60c5142020-07-14 15:15:50 +0900280gen_from_buildinfo_sh := $(call intermediates-dir-for,PACKAGING,system_build_prop)/buildinfo.prop
Jeongik Cha05210f92023-04-27 11:05:22 +0900281
282ifeq ($(strip $(HAS_BUILD_NUMBER)),true)
283$(gen_from_buildinfo_sh): $(BUILD_NUMBER_FILE)
284endif
285$(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(BUILD_HOSTNAME_FILE) | $(BUILD_DATETIME_FILE)
Jiyong Parke1346862020-05-18 14:31:30 +0900286 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
287 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
288 TARGET_DEVICE="$(TARGET_DEVICE)" \
289 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
290 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900291 PRIVATE_BUILD_DESC="$(BUILD_DESC)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900292 BUILD_ID="$(BUILD_ID)" \
293 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
294 DATE="$(DATE_FROM_FILE)" \
295 BUILD_USERNAME="$(BUILD_USERNAME)" \
Jeongik Cha05210f92023-04-27 11:05:22 +0900296 BUILD_HOSTNAME="$(BUILD_HOSTNAME_FROM_FILE)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900297 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
Tianjie97976232021-05-05 12:07:33 -0700298 BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT="$(BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900299 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
Colin Crossa4925442022-02-28 18:01:35 -0800300 PLATFORM_DISPLAY_VERSION="$(PLATFORM_DISPLAY_VERSION)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900301 PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
302 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
303 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
304 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
305 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
306 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
307 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
308 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
satayev2d945862022-02-09 21:59:28 +0000309 PLATFORM_VERSION_KNOWN_CODENAMES="$(PLATFORM_VERSION_KNOWN_CODENAMES)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900310 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
311 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
312 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
313 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
314 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
315 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
316 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
317 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Christopher Ferris66b6fd62022-04-08 15:20:23 -0700318 ZYGOTE_FORCE_64_BIT="$(ZYGOTE_FORCE_64_BIT)" \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900319 bash $(BUILDINFO_SH) > $@
Jiyong Parke1346862020-05-18 14:31:30 +0900320
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900321ifdef TARGET_SYSTEM_PROP
322system_prop_file := $(TARGET_SYSTEM_PROP)
323else
324system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
325endif
326
327_prop_files_ := \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900328 $(gen_from_buildinfo_sh) \
329 $(system_prop_file)
330
331# Order matters here. When there are duplicates, the last one wins.
332# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
333_prop_vars_ := \
334 ADDITIONAL_SYSTEM_PROPERTIES \
Jiyong Parkeb49b342020-05-29 17:50:03 +0900335 PRODUCT_SYSTEM_PROPERTIES
336
337# TODO(b/117892318): deprecate this
338_prop_vars_ += \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900339 PRODUCT_SYSTEM_DEFAULT_PROPERTIES
340
341ifndef property_overrides_split_enabled
342_prop_vars_ += \
Garfield Tan04714da2020-08-13 15:21:32 -0700343 ADDITIONAL_VENDOR_PROPERTIES \
344 PRODUCT_VENDOR_PROPERTIES
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900345endif
346
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900347INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
348
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100349$(eval $(call build-properties,\
350 system,\
351 $(INSTALLED_BUILD_PROP_TARGET),\
352 $(_prop_files_),\
353 $(_prop_vars_),\
Peter Collingbourne0e3b0952022-02-18 19:17:04 -0800354 $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100355 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100356 $(empty)))
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900357
Bob Badour70c07dd2022-02-12 15:39:22 -0800358$(eval $(call declare-1p-target,$(INSTALLED_BUILD_PROP_TARGET)))
359
Jiyong Parke1346862020-05-18 14:31:30 +0900360# -----------------------------------------------------------------
Jiyong Parke28fa802020-05-26 00:21:20 +0900361# vendor/build.prop
Jiyong Parke1346862020-05-18 14:31:30 +0900362#
Jiyong Parke28fa802020-05-26 00:21:20 +0900363_prop_files_ := $(if $(TARGET_VENDOR_PROP),\
364 $(TARGET_VENDOR_PROP),\
365 $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900366
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900367android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
368$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
369 cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
370
Donghyun Jo8c65ef62021-03-02 08:51:03 +0900371_prop_files_ += $(android_info_prop)
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900372
Jiyong Parke1346862020-05-18 14:31:30 +0900373ifdef property_overrides_split_enabled
Jiyong Parke28fa802020-05-26 00:21:20 +0900374# Order matters here. When there are duplicates, the last one wins.
375# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
376_prop_vars_ := \
377 ADDITIONAL_VENDOR_PROPERTIES \
Jiyong Parkeb49b342020-05-29 17:50:03 +0900378 PRODUCT_VENDOR_PROPERTIES
379
380# TODO(b/117892318): deprecate this
381_prop_vars_ += \
382 PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
Jiyong Parke28fa802020-05-26 00:21:20 +0900383 PRODUCT_PROPERTY_OVERRIDES
Jiyong Parke1346862020-05-18 14:31:30 +0900384else
Jiyong Parke28fa802020-05-26 00:21:20 +0900385_prop_vars_ :=
Jiyong Parke1346862020-05-18 14:31:30 +0900386endif
387
Jiyong Parke28fa802020-05-26 00:21:20 +0900388INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
389$(eval $(call build-properties,\
390 vendor,\
391 $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
392 $(_prop_files_),\
393 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100394 $(PRODUCT_VENDOR_PROPERTY_BLACKLIST),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100395 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100396 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900397
Bob Badour70c07dd2022-02-12 15:39:22 -0800398$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_BUILD_PROP_TARGET)))
399
Jiyong Parke28fa802020-05-26 00:21:20 +0900400# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900401# product/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900402#
403
404_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\
405 $(TARGET_PRODUCT_PROP),\
406 $(wildcard $(TARGET_DEVICE_DIR)/product.prop))
407
408# Order matters here. When there are duplicates, the last one wins.
409# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
410_prop_vars_ := \
411 ADDITIONAL_PRODUCT_PROPERTIES \
412 PRODUCT_PRODUCT_PROPERTIES
413
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900414INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/etc/build.prop
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100415
416ifdef PRODUCT_OEM_PROPERTIES
417import_oem_prop := $(call intermediates-dir-for,ETC,import_oem_prop)/oem.prop
418
419$(import_oem_prop):
420 $(hide) echo "####################################" >> $@; \
421 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
422 echo "####################################" >> $@;
423 $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
424 echo "import /oem/oem.prop $(prop)" >> $@;)
425
426_footers_ := $(import_oem_prop)
427else
428_footers_ :=
429endif
430
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100431# Skip common /product properties generation if device released before R and
432# has no product partition. This is the first part of the check.
433ifeq ($(call math_lt,$(if $(PRODUCT_SHIPPING_API_LEVEL),$(PRODUCT_SHIPPING_API_LEVEL),30),30), true)
434 _skip_common_properties := true
435endif
436
437# The second part of the check - always generate common properties for the
438# devices with product partition regardless of shipping level.
439ifneq ($(BOARD_USES_PRODUCTIMAGE),)
440 _skip_common_properties :=
441endif
442
Jiyong Parke28fa802020-05-26 00:21:20 +0900443$(eval $(call build-properties,\
444 product,\
445 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
446 $(_prop_files_),\
447 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100448 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100449 $(_footers_),\
450 $(_skip_common_properties)))
451
Bob Badour70c07dd2022-02-12 15:39:22 -0800452$(eval $(call declare-1p-target,$(INSTALLED_PRODUCT_BUILD_PROP_TARGET)))
453
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100454_skip_common_properties :=
Jiyong Parke1346862020-05-18 14:31:30 +0900455
456# ----------------------------------------------------------------
Jiyong Park62117c82020-06-26 09:56:31 +0900457# odm/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900458#
459_prop_files_ := $(if $(TARGET_ODM_PROP),\
460 $(TARGET_ODM_PROP),\
461 $(wildcard $(TARGET_DEVICE_DIR)/odm.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900462
Jiyong Parke28fa802020-05-26 00:21:20 +0900463# Order matters here. When there are duplicates, the last one wins.
464# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
465_prop_vars_ := \
466 ADDITIONAL_ODM_PROPERTIES \
467 PRODUCT_ODM_PROPERTIES
Jiyong Parke1346862020-05-18 14:31:30 +0900468
Jiyong Park62117c82020-06-26 09:56:31 +0900469INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900470$(eval $(call build-properties,\
471 odm,\
472 $(INSTALLED_ODM_BUILD_PROP_TARGET),\
Hidefumi Kanekob09a36c2021-07-30 17:38:36 +0900473 $(_prop_files_),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900474 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100475 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100476 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900477 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900478
Bob Badour70c07dd2022-02-12 15:39:22 -0800479$(eval $(call declare-1p-target,$(INSTALLED_ODM_BUILD_PROP_TARGET)))
480
Yifan Hong51a971b2020-06-25 17:00:27 -0700481# ----------------------------------------------------------------
482# vendor_dlkm/etc/build.prop
483#
484
485INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR_DLKM)/etc/build.prop
486$(eval $(call build-properties,\
487 vendor_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100488 $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET),\
489 $(empty),\
490 $(empty),\
491 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100492 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100493 $(empty)))
Yifan Hong51a971b2020-06-25 17:00:27 -0700494
Bob Badour70c07dd2022-02-12 15:39:22 -0800495$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET)))
496
Yifan Hong81a092f2020-07-15 17:02:07 -0700497# ----------------------------------------------------------------
498# odm_dlkm/etc/build.prop
499#
500
501INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
502$(eval $(call build-properties,\
503 odm_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100504 $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET),\
505 $(empty),\
506 $(empty),\
507 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100508 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100509 $(empty)))
Yifan Hong81a092f2020-07-15 17:02:07 -0700510
Bob Badour70c07dd2022-02-12 15:39:22 -0800511$(eval $(call declare-1p-target,$(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET)))
512
Ramji Jiyani13a41372022-01-27 07:05:08 +0000513# ----------------------------------------------------------------
514# system_dlkm/build.prop
515#
516
517INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_DLKM)/etc/build.prop
518$(eval $(call build-properties,\
519 system_dlkm,\
520 $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET),\
521 $(empty),\
522 $(empty),\
523 $(empty),\
524 $(empty),\
525 $(empty)))
526
Bob Badour70c07dd2022-02-12 15:39:22 -0800527$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET)))
528
Jiyong Parke1346862020-05-18 14:31:30 +0900529# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900530# system_ext/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900531#
532_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\
533 $(TARGET_SYSTEM_EXT_PROP),\
534 $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop))
535
536# Order matters here. When there are duplicates, the last one wins.
537# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
538_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES
539
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900540INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900541$(eval $(call build-properties,\
542 system_ext,\
543 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
544 $(_prop_files_),\
545 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100546 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100547 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900548 $(empty)))
Yifan Hong33fd5d42020-09-24 18:18:26 -0700549
Bob Badour70c07dd2022-02-12 15:39:22 -0800550$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)))
551
Yifan Hong33fd5d42020-09-24 18:18:26 -0700552# ----------------------------------------------------------------
553# ramdisk/boot/etc/build.prop
554#
555
556RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop
557INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH)
558$(eval $(call build-properties,\
Kelvin Zhang8250d2c2022-03-23 19:46:09 +0000559 bootimage,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100560 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET),\
561 $(empty),\
562 $(empty),\
563 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100564 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100565 $(empty)))
Bob Badour70c07dd2022-02-12 15:39:22 -0800566
567$(eval $(call declare-1p-target,$(INSTALLED_RAMDISK_BUILD_PROP_TARGET)))
Wei Li49933362023-01-04 17:13:47 -0800568
569ALL_INSTALLED_BUILD_PROP_FILES := \
570 $(INSTALLED_BUILD_PROP_TARGET) \
571 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
572 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
573 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
574 $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET) \
575 $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET) \
576 $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET) \
577 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) \
578 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET)
579
580# $1 installed file path, e.g. out/target/product/vsoc_x86_64/system/build.prop
581define is-build-prop
582$(if $(findstring $1,$(ALL_INSTALLED_BUILD_PROP_FILES)),Y)
Tiffany Yang19450e32023-05-23 17:36:54 -0700583endef