blob: 615025de13b381a02ba8abfbce51a3e1828a74ad [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 Parkae556382020-05-20 18:33:43 +090026POST_PROCESS_PROPS := $(HOST_OUT_EXECUTABLES)/post_process_props$(HOST_EXECUTABLE_SUFFIX)
Jiyong Parke1346862020-05-18 14:31:30 +090027
Jiyong Park35a83d12020-05-26 02:01:05 +090028# Emits a set of sysprops common to all partitions to a file.
Jiyong Parke1346862020-05-18 14:31:30 +090029# $(1): Partition name
30# $(2): Output file name
31define generate-common-build-props
Jiyong Park35a83d12020-05-26 02:01:05 +090032 echo "####################################" >> $(2);\
33 echo "# from generate-common-build-props" >> $(2);\
34 echo "# These properties identify this partition image." >> $(2);\
35 echo "####################################" >> $(2);\
Liana Kazanova0b2f48f2024-07-30 19:14:30 +000036 $(if $(filter system,$(1)),\
37 echo "ro.product.$(1).brand=$(PRODUCT_SYSTEM_BRAND)" >> $(2);\
38 echo "ro.product.$(1).device=$(PRODUCT_SYSTEM_DEVICE)" >> $(2);\
39 echo "ro.product.$(1).manufacturer=$(PRODUCT_SYSTEM_MANUFACTURER)" >> $(2);\
40 echo "ro.product.$(1).model=$(PRODUCT_SYSTEM_MODEL)" >> $(2);\
41 echo "ro.product.$(1).name=$(PRODUCT_SYSTEM_NAME)" >> $(2);\
42 ,\
43 echo "ro.product.$(1).brand=$(PRODUCT_BRAND)" >> $(2);\
44 echo "ro.product.$(1).device=$(TARGET_DEVICE)" >> $(2);\
45 echo "ro.product.$(1).manufacturer=$(PRODUCT_MANUFACTURER)" >> $(2);\
46 echo "ro.product.$(1).model=$(PRODUCT_MODEL)" >> $(2);\
47 echo "ro.product.$(1).name=$(TARGET_PRODUCT)" >> $(2);\
48 if [ -n "$(strip $(PRODUCT_MODEL_FOR_ATTESTATION))" ]; then \
49 echo "ro.product.model_for_attestation=$(PRODUCT_MODEL_FOR_ATTESTATION)" >> $(2);\
50 fi; \
51 if [ -n "$(strip $(PRODUCT_BRAND_FOR_ATTESTATION))" ]; then \
52 echo "ro.product.brand_for_attestation=$(PRODUCT_BRAND_FOR_ATTESTATION)" >> $(2);\
53 fi; \
54 if [ -n "$(strip $(PRODUCT_NAME_FOR_ATTESTATION))" ]; then \
55 echo "ro.product.name_for_attestation=$(PRODUCT_NAME_FOR_ATTESTATION)" >> $(2);\
56 fi; \
57 if [ -n "$(strip $(PRODUCT_DEVICE_FOR_ATTESTATION))" ]; then \
58 echo "ro.product.device_for_attestation=$(PRODUCT_DEVICE_FOR_ATTESTATION)" >> $(2);\
59 fi; \
60 if [ -n "$(strip $(PRODUCT_MANUFACTURER_FOR_ATTESTATION))" ]; then \
61 echo "ro.product.manufacturer_for_attestation=$(PRODUCT_MANUFACTURER_FOR_ATTESTATION)" >> $(2);\
62 fi; \
63 )\
Christopher Ferris66b6fd62022-04-08 15:20:23 -070064 $(if $(filter true,$(ZYGOTE_FORCE_64)),\
65 $(if $(filter vendor,$(1)),\
66 echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
67 echo "ro.$(1).product.cpu.abilist32=" >> $(2);\
68 echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
69 )\
70 ,\
71 $(if $(filter system vendor odm,$(1)),\
72 echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST)" >> $(2);\
73 echo "ro.$(1).product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT)" >> $(2);\
74 echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
75 )\
SzuWei Linbaf5c812020-12-31 16:59:27 +080076 )\
Jiyong Park35a83d12020-05-26 02:01:05 +090077 echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\
78 echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\
Tiffany Yang19450e32023-05-23 17:36:54 -070079 # Allow optional assignments for ARC forward-declarations (b/249168657)
80 # TODO: Remove any tag-related inconsistencies once the goals from
81 # go/arc-android-sigprop-changes have been achieved.
82 echo "ro.$(1).build.fingerprint?=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\
83 echo "ro.$(1).build.id?=$(BUILD_ID)" >> $(2);\
84 echo "ro.$(1).build.tags?=$(BUILD_VERSION_TAGS)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090085 echo "ro.$(1).build.type=$(TARGET_BUILD_VARIANT)" >> $(2);\
86 echo "ro.$(1).build.version.incremental=$(BUILD_NUMBER_FROM_FILE)" >> $(2);\
Tianjiee88ac672020-10-15 17:22:48 -070087 echo "ro.$(1).build.version.release=$(PLATFORM_VERSION_LAST_STABLE)" >> $(2);\
88 echo "ro.$(1).build.version.release_or_codename=$(PLATFORM_VERSION)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090089 echo "ro.$(1).build.version.sdk=$(PLATFORM_SDK_VERSION)" >> $(2);\
Jiyong Parke1346862020-05-18 14:31:30 +090090
Jiyong Parke1346862020-05-18 14:31:30 +090091endef
92
Jiyong Parkc0bd8c72020-06-29 10:46:22 +090093# Rule for generating <partition>/[etc/]build.prop file
Jiyong Parke28fa802020-05-26 00:21:20 +090094#
95# $(1): partition name
96# $(2): path to the output
97# $(3): path to the input *.prop files. The contents of the files are directly
98# emitted to the output
99# $(4): list of variable names each of which contains name=value pairs
100# $(5): optional list of prop names to force remove from the output. Properties from both
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100101# $(3) and (4) are affected
102# $(6): optional list of files to append at the end. The content of each file is emitted
103# to the output
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100104# $(7): optional flag to skip common properties generation
Jiyong Parke28fa802020-05-26 00:21:20 +0900105define build-properties
106ALL_DEFAULT_INSTALLED_MODULES += $(2)
107
Jiyong Parkd721e872020-06-22 17:30:57 +0900108$(eval # Properties can be assigned using `prop ?= value` or `prop = value` syntax.)
109$(eval # Eliminate spaces around the ?= and = separators.)
Jiyong Parke28fa802020-05-26 00:21:20 +0900110$(foreach name,$(strip $(4)),\
Jiyong Parkd721e872020-06-22 17:30:57 +0900111 $(eval _temp := $$(call collapse-pairs,$$($(name)),?=))\
112 $(eval _resolved_$(name) := $$(call collapse-pairs,$$(_temp),=))\
Jiyong Parke28fa802020-05-26 00:21:20 +0900113)
114
Jiyong Park0b4fccb2020-06-26 17:38:00 +0900115$(eval # Implement the legacy behavior when BUILD_BROKEN_DUP_SYSPROP is on.)
116$(eval # Optional assignments are all converted to normal assignments and)
117$(eval # when their duplicates the first one wins)
118$(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\
119 $(foreach name,$(strip $(4)),\
120 $(eval _temp := $$(subst ?=,=,$$(_resolved_$(name))))\
121 $(eval _resolved_$(name) := $$(call uniq-pairs-by-first-component,$$(_resolved_$(name)),=))\
122 )\
123 $(eval _option := --allow-dup)\
Jiyong Parke28fa802020-05-26 00:21:20 +0900124)
125
Jiakai Zhang53dd8952024-01-18 17:22:13 +0000126$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6) $(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC)
Jiyong Parke28fa802020-05-26 00:21:20 +0900127 $(hide) echo Building $$@
128 $(hide) mkdir -p $$(dir $$@)
129 $(hide) rm -f $$@ && touch $$@
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100130ifneq ($(strip $(7)), true)
Jiyong Parke28fa802020-05-26 00:21:20 +0900131 $(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100132endif
Jiyong Parke28fa802020-05-26 00:21:20 +0900133 $(hide) $(foreach file,$(strip $(3)),\
134 if [ -f "$(file)" ]; then\
135 echo "" >> $$@;\
136 echo "####################################" >> $$@;\
137 echo "# from $(file)" >> $$@;\
138 echo "####################################" >> $$@;\
139 cat $(file) >> $$@;\
140 fi;)
141 $(hide) $(foreach name,$(strip $(4)),\
142 echo "" >> $$@;\
143 echo "####################################" >> $$@;\
144 echo "# from variable $(name)" >> $$@;\
145 echo "####################################" >> $$@;\
146 $$(foreach line,$$(_resolved_$(name)),\
147 echo "$$(line)" >> $$@;\
148 )\
149 )
Jiakai Zhang53dd8952024-01-18 17:22:13 +0000150 $(hide) $(POST_PROCESS_PROPS) $$(_option) \
151 --sdk-version $(PLATFORM_SDK_VERSION) \
152 --kernel-version-file-for-uffd-gc "$(BUILT_KERNEL_VERSION_FILE_FOR_UFFD_GC)" \
153 $$@ $(5)
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100154 $(hide) $(foreach file,$(strip $(6)),\
155 if [ -f "$(file)" ]; then\
156 cat $(file) >> $$@;\
157 fi;)
Jiyong Parke28fa802020-05-26 00:21:20 +0900158 $(hide) echo "# end of file" >> $$@
Bob Badoure9bdbc52022-03-10 11:31:07 -0800159
Bob Badour1d31e2d2023-03-01 10:31:25 -0800160$(call declare-1p-target,$(2))
Jiyong Parke28fa802020-05-26 00:21:20 +0900161endef
162
Jiyong Parke1346862020-05-18 14:31:30 +0900163# -----------------------------------------------------------------
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900164# Define fingerprint, thumbprint, and version tags for the current build
Jiyong Parke28fa802020-05-26 00:21:20 +0900165#
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900166# BUILD_VERSION_TAGS is a comma-separated list of tags chosen by the device
167# implementer that further distinguishes the build. It's basically defined
168# by the device implementer. Here, we are adding a mandatory tag that
169# identifies the signing config of the build.
Jiyong Parke1346862020-05-18 14:31:30 +0900170BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
171ifeq ($(TARGET_BUILD_TYPE),debug)
172 BUILD_VERSION_TAGS += debug
173endif
174# The "test-keys" tag marks builds signed with the old test keys,
175# which are available in the SDK. "dev-keys" marks builds signed with
176# non-default dev keys (usually private keys from a vendor directory).
177# Both of these tags will be removed and replaced with "release-keys"
178# when the target-files is signed in a post-build step.
179ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
180BUILD_KEYS := test-keys
181else
182BUILD_KEYS := dev-keys
183endif
184BUILD_VERSION_TAGS += $(BUILD_KEYS)
185BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
186
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900187# BUILD_FINGERPRINT is used used to uniquely identify the combined build and
188# product; used by the OTA server.
Jiyong Parke1346862020-05-18 14:31:30 +0900189ifeq (,$(strip $(BUILD_FINGERPRINT)))
Cole Faustc874c702023-09-27 13:44:56 -0700190 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jiyong Parke1346862020-05-18 14:31:30 +0900191endif
Jiyong Parke1346862020-05-18 14:31:30 +0900192
193BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
194ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
195 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
196endif
197BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
198# unset it for safety.
199BUILD_FINGERPRINT :=
200
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900201# BUILD_THUMBPRINT is used to uniquely identify the system build; used by the
202# OTA server. This purposefully excludes any product-specific variables.
Jiyong Parke1346862020-05-18 14:31:30 +0900203ifeq (,$(strip $(BUILD_THUMBPRINT)))
204 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
205endif
206
207BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
Jeongik Cha05210f92023-04-27 11:05:22 +0900208ifeq ($(strip $(HAS_BUILD_NUMBER)),true)
209$(BUILD_THUMBPRINT_FILE): $(BUILD_NUMBER_FILE)
210endif
Jiyong Parke1346862020-05-18 14:31:30 +0900211ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
212 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
213endif
Jiyong Parke1346862020-05-18 14:31:30 +0900214# unset it for safety.
Inseob Kim06d22312024-03-27 05:19:56 +0000215BUILD_THUMBPRINT_FILE :=
Jiyong Parke1346862020-05-18 14:31:30 +0900216BUILD_THUMBPRINT :=
217
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900218KNOWN_OEM_THUMBPRINT_PROPERTIES := \
219 ro.product.brand \
220 ro.product.name \
221 ro.product.device
222OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
223 $(PRODUCT_OEM_PROPERTIES))
224KNOWN_OEM_THUMBPRINT_PROPERTIES:=
225
226# -----------------------------------------------------------------
227# system/build.prop
228#
Liana Kazanova0b2f48f2024-07-30 19:14:30 +0000229# Note: parts of this file that can't be generated by the build-properties
230# macro are manually created as separate files and then fed into the macro
231
232buildinfo_prop := $(call intermediates-dir-for,ETC,buildinfo.prop)/buildinfo.prop
233
234system_prop_file := $(TARGET_SYSTEM_PROP)
235
236_prop_files_ := \
237 $(buildinfo_prop) \
238 $(system_prop_file)
239
240# Order matters here. When there are duplicates, the last one wins.
241# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
242_prop_vars_ := \
243 ADDITIONAL_SYSTEM_PROPERTIES \
244 PRODUCT_SYSTEM_PROPERTIES
245
246# TODO(b/117892318): deprecate this
247_prop_vars_ += \
248 PRODUCT_SYSTEM_DEFAULT_PROPERTIES
249
250ifndef property_overrides_split_enabled
251_prop_vars_ += \
252 ADDITIONAL_VENDOR_PROPERTIES \
253 PRODUCT_VENDOR_PROPERTIES
254endif
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900255
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900256INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
257
Liana Kazanova0b2f48f2024-07-30 19:14:30 +0000258$(eval $(call build-properties,\
259 system,\
260 $(INSTALLED_BUILD_PROP_TARGET),\
261 $(_prop_files_),\
262 $(_prop_vars_),\
263 $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST),\
264 $(empty),\
265 $(empty)))
266
267$(eval $(call declare-1p-target,$(INSTALLED_BUILD_PROP_TARGET)))
268
Jiyong Parke1346862020-05-18 14:31:30 +0900269# -----------------------------------------------------------------
Jiyong Parke28fa802020-05-26 00:21:20 +0900270# vendor/build.prop
Jiyong Parke1346862020-05-18 14:31:30 +0900271#
Jiyong Parke28fa802020-05-26 00:21:20 +0900272_prop_files_ := $(if $(TARGET_VENDOR_PROP),\
273 $(TARGET_VENDOR_PROP),\
274 $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900275
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900276android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
277$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
278 cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
279
Donghyun Jo8c65ef62021-03-02 08:51:03 +0900280_prop_files_ += $(android_info_prop)
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900281
Jiyong Parke1346862020-05-18 14:31:30 +0900282ifdef property_overrides_split_enabled
Jiyong Parke28fa802020-05-26 00:21:20 +0900283# Order matters here. When there are duplicates, the last one wins.
284# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
285_prop_vars_ := \
286 ADDITIONAL_VENDOR_PROPERTIES \
Jiyong Parkeb49b342020-05-29 17:50:03 +0900287 PRODUCT_VENDOR_PROPERTIES
288
289# TODO(b/117892318): deprecate this
290_prop_vars_ += \
291 PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
Jiyong Parke28fa802020-05-26 00:21:20 +0900292 PRODUCT_PROPERTY_OVERRIDES
Jiyong Parke1346862020-05-18 14:31:30 +0900293else
Jiyong Parke28fa802020-05-26 00:21:20 +0900294_prop_vars_ :=
Jiyong Parke1346862020-05-18 14:31:30 +0900295endif
296
Jiyong Parke28fa802020-05-26 00:21:20 +0900297INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
298$(eval $(call build-properties,\
299 vendor,\
300 $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
301 $(_prop_files_),\
302 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100303 $(PRODUCT_VENDOR_PROPERTY_BLACKLIST),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100304 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100305 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900306
Bob Badour70c07dd2022-02-12 15:39:22 -0800307$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_BUILD_PROP_TARGET)))
308
Jiyong Parke28fa802020-05-26 00:21:20 +0900309# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900310# product/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900311#
312
313_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\
314 $(TARGET_PRODUCT_PROP),\
315 $(wildcard $(TARGET_DEVICE_DIR)/product.prop))
316
317# Order matters here. When there are duplicates, the last one wins.
318# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
319_prop_vars_ := \
320 ADDITIONAL_PRODUCT_PROPERTIES \
321 PRODUCT_PRODUCT_PROPERTIES
322
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900323INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/etc/build.prop
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100324
325ifdef PRODUCT_OEM_PROPERTIES
326import_oem_prop := $(call intermediates-dir-for,ETC,import_oem_prop)/oem.prop
327
328$(import_oem_prop):
329 $(hide) echo "####################################" >> $@; \
330 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
331 echo "####################################" >> $@;
332 $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
333 echo "import /oem/oem.prop $(prop)" >> $@;)
334
335_footers_ := $(import_oem_prop)
336else
337_footers_ :=
338endif
339
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100340# Skip common /product properties generation if device released before R and
341# has no product partition. This is the first part of the check.
342ifeq ($(call math_lt,$(if $(PRODUCT_SHIPPING_API_LEVEL),$(PRODUCT_SHIPPING_API_LEVEL),30),30), true)
343 _skip_common_properties := true
344endif
345
346# The second part of the check - always generate common properties for the
347# devices with product partition regardless of shipping level.
348ifneq ($(BOARD_USES_PRODUCTIMAGE),)
349 _skip_common_properties :=
350endif
351
Jiyong Parke28fa802020-05-26 00:21:20 +0900352$(eval $(call build-properties,\
353 product,\
354 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
355 $(_prop_files_),\
356 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100357 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100358 $(_footers_),\
359 $(_skip_common_properties)))
360
Bob Badour70c07dd2022-02-12 15:39:22 -0800361$(eval $(call declare-1p-target,$(INSTALLED_PRODUCT_BUILD_PROP_TARGET)))
362
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100363_skip_common_properties :=
Jiyong Parke1346862020-05-18 14:31:30 +0900364
365# ----------------------------------------------------------------
Jiyong Park62117c82020-06-26 09:56:31 +0900366# odm/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900367#
368_prop_files_ := $(if $(TARGET_ODM_PROP),\
369 $(TARGET_ODM_PROP),\
370 $(wildcard $(TARGET_DEVICE_DIR)/odm.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900371
Jiyong Parke28fa802020-05-26 00:21:20 +0900372# Order matters here. When there are duplicates, the last one wins.
373# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
374_prop_vars_ := \
375 ADDITIONAL_ODM_PROPERTIES \
376 PRODUCT_ODM_PROPERTIES
Jiyong Parke1346862020-05-18 14:31:30 +0900377
Jiyong Park62117c82020-06-26 09:56:31 +0900378INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900379$(eval $(call build-properties,\
380 odm,\
381 $(INSTALLED_ODM_BUILD_PROP_TARGET),\
Hidefumi Kanekob09a36c2021-07-30 17:38:36 +0900382 $(_prop_files_),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900383 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100384 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100385 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900386 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900387
Bob Badour70c07dd2022-02-12 15:39:22 -0800388$(eval $(call declare-1p-target,$(INSTALLED_ODM_BUILD_PROP_TARGET)))
389
Yifan Hong51a971b2020-06-25 17:00:27 -0700390# ----------------------------------------------------------------
391# vendor_dlkm/etc/build.prop
392#
393
394INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR_DLKM)/etc/build.prop
395$(eval $(call build-properties,\
396 vendor_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100397 $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET),\
398 $(empty),\
399 $(empty),\
400 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100401 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100402 $(empty)))
Yifan Hong51a971b2020-06-25 17:00:27 -0700403
Bob Badour70c07dd2022-02-12 15:39:22 -0800404$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET)))
405
Yifan Hong81a092f2020-07-15 17:02:07 -0700406# ----------------------------------------------------------------
407# odm_dlkm/etc/build.prop
408#
409
410INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
411$(eval $(call build-properties,\
412 odm_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100413 $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET),\
414 $(empty),\
415 $(empty),\
416 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100417 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100418 $(empty)))
Yifan Hong81a092f2020-07-15 17:02:07 -0700419
Bob Badour70c07dd2022-02-12 15:39:22 -0800420$(eval $(call declare-1p-target,$(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET)))
421
Ramji Jiyani13a41372022-01-27 07:05:08 +0000422# ----------------------------------------------------------------
423# system_dlkm/build.prop
424#
425
426INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_DLKM)/etc/build.prop
427$(eval $(call build-properties,\
428 system_dlkm,\
429 $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET),\
430 $(empty),\
431 $(empty),\
432 $(empty),\
433 $(empty),\
434 $(empty)))
435
Bob Badour70c07dd2022-02-12 15:39:22 -0800436$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET)))
437
Jiyong Parke1346862020-05-18 14:31:30 +0900438# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900439# system_ext/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900440#
441_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\
442 $(TARGET_SYSTEM_EXT_PROP),\
443 $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop))
444
445# Order matters here. When there are duplicates, the last one wins.
446# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
447_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES
448
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900449INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900450$(eval $(call build-properties,\
451 system_ext,\
452 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
453 $(_prop_files_),\
454 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100455 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100456 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900457 $(empty)))
Yifan Hong33fd5d42020-09-24 18:18:26 -0700458
Bob Badour70c07dd2022-02-12 15:39:22 -0800459$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)))
460
Yifan Hong33fd5d42020-09-24 18:18:26 -0700461# ----------------------------------------------------------------
462# ramdisk/boot/etc/build.prop
463#
464
465RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop
466INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH)
467$(eval $(call build-properties,\
Kelvin Zhang8250d2c2022-03-23 19:46:09 +0000468 bootimage,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100469 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET),\
470 $(empty),\
471 $(empty),\
472 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100473 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100474 $(empty)))
Bob Badour70c07dd2022-02-12 15:39:22 -0800475
476$(eval $(call declare-1p-target,$(INSTALLED_RAMDISK_BUILD_PROP_TARGET)))
Wei Li49933362023-01-04 17:13:47 -0800477
478ALL_INSTALLED_BUILD_PROP_FILES := \
479 $(INSTALLED_BUILD_PROP_TARGET) \
480 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
481 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
482 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
483 $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET) \
484 $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET) \
485 $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET) \
486 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) \
487 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET)
488
489# $1 installed file path, e.g. out/target/product/vsoc_x86_64/system/build.prop
490define is-build-prop
491$(if $(findstring $1,$(ALL_INSTALLED_BUILD_PROP_FILES)),Y)
Tiffany Yang19450e32023-05-23 17:36:54 -0700492endef