blob: 451e88af8457f3713b3a760077a6399e4d3966b3 [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.
50 echo "ro.product.model_for_attestation=$(PRODUCT_MODEL_FOR_ATTESTATION)" >> $(2);\
51 echo "ro.product.brand_for_attestation=$(PRODUCT_BRAND_FOR_ATTESTATION)" >> $(2);\
52 echo "ro.product.name_for_attestation=$(PRODUCT_NAME_FOR_ATTESTATION)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090053 )\
Christopher Ferris66b6fd62022-04-08 15:20:23 -070054 $(if $(filter true,$(ZYGOTE_FORCE_64)),\
55 $(if $(filter vendor,$(1)),\
56 echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
57 echo "ro.$(1).product.cpu.abilist32=" >> $(2);\
58 echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
59 )\
60 ,\
61 $(if $(filter system vendor odm,$(1)),\
62 echo "ro.$(1).product.cpu.abilist=$(TARGET_CPU_ABI_LIST)" >> $(2);\
63 echo "ro.$(1).product.cpu.abilist32=$(TARGET_CPU_ABI_LIST_32_BIT)" >> $(2);\
64 echo "ro.$(1).product.cpu.abilist64=$(TARGET_CPU_ABI_LIST_64_BIT)" >> $(2);\
65 )\
SzuWei Linbaf5c812020-12-31 16:59:27 +080066 )\
Jiyong Park35a83d12020-05-26 02:01:05 +090067 echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\
68 echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\
Tiffany Yang19450e32023-05-23 17:36:54 -070069 # Allow optional assignments for ARC forward-declarations (b/249168657)
70 # TODO: Remove any tag-related inconsistencies once the goals from
71 # go/arc-android-sigprop-changes have been achieved.
72 echo "ro.$(1).build.fingerprint?=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\
73 echo "ro.$(1).build.id?=$(BUILD_ID)" >> $(2);\
74 echo "ro.$(1).build.tags?=$(BUILD_VERSION_TAGS)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090075 echo "ro.$(1).build.type=$(TARGET_BUILD_VARIANT)" >> $(2);\
76 echo "ro.$(1).build.version.incremental=$(BUILD_NUMBER_FROM_FILE)" >> $(2);\
Tianjiee88ac672020-10-15 17:22:48 -070077 echo "ro.$(1).build.version.release=$(PLATFORM_VERSION_LAST_STABLE)" >> $(2);\
78 echo "ro.$(1).build.version.release_or_codename=$(PLATFORM_VERSION)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090079 echo "ro.$(1).build.version.sdk=$(PLATFORM_SDK_VERSION)" >> $(2);\
Jiyong Parke1346862020-05-18 14:31:30 +090080
Jiyong Parke1346862020-05-18 14:31:30 +090081endef
82
Jiyong Parkc0bd8c72020-06-29 10:46:22 +090083# Rule for generating <partition>/[etc/]build.prop file
Jiyong Parke28fa802020-05-26 00:21:20 +090084#
85# $(1): partition name
86# $(2): path to the output
87# $(3): path to the input *.prop files. The contents of the files are directly
88# emitted to the output
89# $(4): list of variable names each of which contains name=value pairs
90# $(5): optional list of prop names to force remove from the output. Properties from both
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +010091# $(3) and (4) are affected
92# $(6): optional list of files to append at the end. The content of each file is emitted
93# to the output
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +010094# $(7): optional flag to skip common properties generation
Jiyong Parke28fa802020-05-26 00:21:20 +090095define build-properties
96ALL_DEFAULT_INSTALLED_MODULES += $(2)
97
Jiyong Parkd721e872020-06-22 17:30:57 +090098$(eval # Properties can be assigned using `prop ?= value` or `prop = value` syntax.)
99$(eval # Eliminate spaces around the ?= and = separators.)
Jiyong Parke28fa802020-05-26 00:21:20 +0900100$(foreach name,$(strip $(4)),\
Jiyong Parkd721e872020-06-22 17:30:57 +0900101 $(eval _temp := $$(call collapse-pairs,$$($(name)),?=))\
102 $(eval _resolved_$(name) := $$(call collapse-pairs,$$(_temp),=))\
Jiyong Parke28fa802020-05-26 00:21:20 +0900103)
104
Jiyong Park0b4fccb2020-06-26 17:38:00 +0900105$(eval # Implement the legacy behavior when BUILD_BROKEN_DUP_SYSPROP is on.)
106$(eval # Optional assignments are all converted to normal assignments and)
107$(eval # when their duplicates the first one wins)
108$(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\
109 $(foreach name,$(strip $(4)),\
110 $(eval _temp := $$(subst ?=,=,$$(_resolved_$(name))))\
111 $(eval _resolved_$(name) := $$(call uniq-pairs-by-first-component,$$(_resolved_$(name)),=))\
112 )\
113 $(eval _option := --allow-dup)\
Jiyong Parke28fa802020-05-26 00:21:20 +0900114)
115
Inseob Kim2a70ea02021-06-09 17:36:08 +0900116$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(3) $(6)
Jiyong Parke28fa802020-05-26 00:21:20 +0900117 $(hide) echo Building $$@
118 $(hide) mkdir -p $$(dir $$@)
119 $(hide) rm -f $$@ && touch $$@
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100120ifneq ($(strip $(7)), true)
Jiyong Parke28fa802020-05-26 00:21:20 +0900121 $(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100122endif
Jiyong Parke28fa802020-05-26 00:21:20 +0900123 $(hide) $(foreach file,$(strip $(3)),\
124 if [ -f "$(file)" ]; then\
125 echo "" >> $$@;\
126 echo "####################################" >> $$@;\
127 echo "# from $(file)" >> $$@;\
128 echo "####################################" >> $$@;\
129 cat $(file) >> $$@;\
130 fi;)
131 $(hide) $(foreach name,$(strip $(4)),\
132 echo "" >> $$@;\
133 echo "####################################" >> $$@;\
134 echo "# from variable $(name)" >> $$@;\
135 echo "####################################" >> $$@;\
136 $$(foreach line,$$(_resolved_$(name)),\
137 echo "$$(line)" >> $$@;\
138 )\
139 )
Justin Yun07ceaa72021-04-02 16:29:06 +0900140 $(hide) $(POST_PROCESS_PROPS) $$(_option) --sdk-version $(PLATFORM_SDK_VERSION) $$@ $(5)
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100141 $(hide) $(foreach file,$(strip $(6)),\
142 if [ -f "$(file)" ]; then\
143 cat $(file) >> $$@;\
144 fi;)
Jiyong Parke28fa802020-05-26 00:21:20 +0900145 $(hide) echo "# end of file" >> $$@
Bob Badoure9bdbc52022-03-10 11:31:07 -0800146
Bob Badour1d31e2d2023-03-01 10:31:25 -0800147$(call declare-1p-target,$(2))
Jiyong Parke28fa802020-05-26 00:21:20 +0900148endef
149
Jiyong Parke1346862020-05-18 14:31:30 +0900150# -----------------------------------------------------------------
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900151# Define fingerprint, thumbprint, and version tags for the current build
Jiyong Parke28fa802020-05-26 00:21:20 +0900152#
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900153# BUILD_VERSION_TAGS is a comma-separated list of tags chosen by the device
154# implementer that further distinguishes the build. It's basically defined
155# by the device implementer. Here, we are adding a mandatory tag that
156# identifies the signing config of the build.
Jiyong Parke1346862020-05-18 14:31:30 +0900157BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
158ifeq ($(TARGET_BUILD_TYPE),debug)
159 BUILD_VERSION_TAGS += debug
160endif
161# The "test-keys" tag marks builds signed with the old test keys,
162# which are available in the SDK. "dev-keys" marks builds signed with
163# non-default dev keys (usually private keys from a vendor directory).
164# Both of these tags will be removed and replaced with "release-keys"
165# when the target-files is signed in a post-build step.
166ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
167BUILD_KEYS := test-keys
168else
169BUILD_KEYS := dev-keys
170endif
171BUILD_VERSION_TAGS += $(BUILD_KEYS)
172BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
173
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900174# BUILD_FINGERPRINT is used used to uniquely identify the combined build and
175# product; used by the OTA server.
Jiyong Parke1346862020-05-18 14:31:30 +0900176ifeq (,$(strip $(BUILD_FINGERPRINT)))
177 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
178 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
179 else
Jeongik Cha8a64fb12023-06-09 11:51:18 +0900180 BF_BUILD_NUMBER := $(BUILD_NUMBER_FROM_FILE)
Jiyong Parke1346862020-05-18 14:31:30 +0900181 endif
182 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
183endif
184# unset it for safety.
185BF_BUILD_NUMBER :=
186
187BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
188ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
189 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
190endif
191BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
192# unset it for safety.
193BUILD_FINGERPRINT :=
194
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900195# BUILD_THUMBPRINT is used to uniquely identify the system build; used by the
196# OTA server. This purposefully excludes any product-specific variables.
Jiyong Parke1346862020-05-18 14:31:30 +0900197ifeq (,$(strip $(BUILD_THUMBPRINT)))
198 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
199endif
200
201BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
Jeongik Cha05210f92023-04-27 11:05:22 +0900202ifeq ($(strip $(HAS_BUILD_NUMBER)),true)
203$(BUILD_THUMBPRINT_FILE): $(BUILD_NUMBER_FILE)
204endif
Jiyong Parke1346862020-05-18 14:31:30 +0900205ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
206 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
207endif
208BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
209# unset it for safety.
210BUILD_THUMBPRINT :=
211
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900212# -----------------------------------------------------------------
213# Define human readable strings that describe this build
214#
Jiyong Parke1346862020-05-18 14:31:30 +0900215
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900216# BUILD_ID: detail info; has the same info as the build fingerprint
217BUILD_DESC := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
218
219# BUILD_DISPLAY_ID is shown under Settings -> About Phone
Jiyong Parke1346862020-05-18 14:31:30 +0900220ifeq ($(TARGET_BUILD_VARIANT),user)
221 # User builds should show:
222 # release build number or branch.buld_number non-release builds
223
224 # Dev. branches should have DISPLAY_BUILD_NUMBER set
225 ifeq (true,$(DISPLAY_BUILD_NUMBER))
226 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
227 else
228 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
229 endif
230else
231 # Non-user builds should show detailed build information
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900232 BUILD_DISPLAY_ID := $(BUILD_DESC)
Jiyong Parke1346862020-05-18 14:31:30 +0900233endif
234
Jiyong Parke1346862020-05-18 14:31:30 +0900235# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
236# harness to distinguish builds. Only add _asan for a sanitized build
237# if it isn't already a part of the flavor (via a dedicated lunch
238# config for example).
239TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
240ifneq (, $(filter address, $(SANITIZE_TARGET)))
241ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
242TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
243endif
244endif
245
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900246KNOWN_OEM_THUMBPRINT_PROPERTIES := \
247 ro.product.brand \
248 ro.product.name \
249 ro.product.device
250OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
251 $(PRODUCT_OEM_PROPERTIES))
252KNOWN_OEM_THUMBPRINT_PROPERTIES:=
253
254# -----------------------------------------------------------------
255# system/build.prop
256#
257# Note: parts of this file that can't be generated by the build-properties
258# macro are manually created as separate files and then fed into the macro
259
260# Accepts a whitespace separated list of product locales such as
261# (en_US en_AU en_GB...) and returns the first locale in the list with
262# underscores replaced with hyphens. In the example above, this will
263# return "en-US".
264define get-default-product-locale
265$(strip $(subst _,-, $(firstword $(1))))
266endef
267
Jiyong Parkc60c5142020-07-14 15:15:50 +0900268gen_from_buildinfo_sh := $(call intermediates-dir-for,PACKAGING,system_build_prop)/buildinfo.prop
Jeongik Cha05210f92023-04-27 11:05:22 +0900269
270ifeq ($(strip $(HAS_BUILD_NUMBER)),true)
271$(gen_from_buildinfo_sh): $(BUILD_NUMBER_FILE)
272endif
273$(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(BUILD_HOSTNAME_FILE) | $(BUILD_DATETIME_FILE)
Jiyong Parke1346862020-05-18 14:31:30 +0900274 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
275 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
276 TARGET_DEVICE="$(TARGET_DEVICE)" \
277 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
278 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900279 PRIVATE_BUILD_DESC="$(BUILD_DESC)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900280 BUILD_ID="$(BUILD_ID)" \
281 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
282 DATE="$(DATE_FROM_FILE)" \
283 BUILD_USERNAME="$(BUILD_USERNAME)" \
Jeongik Cha05210f92023-04-27 11:05:22 +0900284 BUILD_HOSTNAME="$(BUILD_HOSTNAME_FROM_FILE)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900285 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
Tianjie97976232021-05-05 12:07:33 -0700286 BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT="$(BOARD_USE_VBMETA_DIGTEST_IN_FINGERPRINT)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900287 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
Colin Crossa4925442022-02-28 18:01:35 -0800288 PLATFORM_DISPLAY_VERSION="$(PLATFORM_DISPLAY_VERSION)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900289 PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
290 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
291 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
292 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
293 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
294 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
295 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
296 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
satayev2d945862022-02-09 21:59:28 +0000297 PLATFORM_VERSION_KNOWN_CODENAMES="$(PLATFORM_VERSION_KNOWN_CODENAMES)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900298 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
299 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
300 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
301 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
302 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
303 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
304 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
305 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Christopher Ferris66b6fd62022-04-08 15:20:23 -0700306 ZYGOTE_FORCE_64_BIT="$(ZYGOTE_FORCE_64_BIT)" \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900307 bash $(BUILDINFO_SH) > $@
Jiyong Parke1346862020-05-18 14:31:30 +0900308
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900309ifdef TARGET_SYSTEM_PROP
310system_prop_file := $(TARGET_SYSTEM_PROP)
311else
312system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
313endif
314
315_prop_files_ := \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900316 $(gen_from_buildinfo_sh) \
317 $(system_prop_file)
318
319# Order matters here. When there are duplicates, the last one wins.
320# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
321_prop_vars_ := \
322 ADDITIONAL_SYSTEM_PROPERTIES \
Jiyong Parkeb49b342020-05-29 17:50:03 +0900323 PRODUCT_SYSTEM_PROPERTIES
324
325# TODO(b/117892318): deprecate this
326_prop_vars_ += \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900327 PRODUCT_SYSTEM_DEFAULT_PROPERTIES
328
329ifndef property_overrides_split_enabled
330_prop_vars_ += \
Garfield Tan04714da2020-08-13 15:21:32 -0700331 ADDITIONAL_VENDOR_PROPERTIES \
332 PRODUCT_VENDOR_PROPERTIES
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900333endif
334
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900335INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
336
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100337$(eval $(call build-properties,\
338 system,\
339 $(INSTALLED_BUILD_PROP_TARGET),\
340 $(_prop_files_),\
341 $(_prop_vars_),\
Peter Collingbourne0e3b0952022-02-18 19:17:04 -0800342 $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100343 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100344 $(empty)))
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900345
Bob Badour70c07dd2022-02-12 15:39:22 -0800346$(eval $(call declare-1p-target,$(INSTALLED_BUILD_PROP_TARGET)))
347
Jiyong Parke1346862020-05-18 14:31:30 +0900348# -----------------------------------------------------------------
Jiyong Parke28fa802020-05-26 00:21:20 +0900349# vendor/build.prop
Jiyong Parke1346862020-05-18 14:31:30 +0900350#
Jiyong Parke28fa802020-05-26 00:21:20 +0900351_prop_files_ := $(if $(TARGET_VENDOR_PROP),\
352 $(TARGET_VENDOR_PROP),\
353 $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900354
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900355android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
356$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
357 cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
358
Donghyun Jo8c65ef62021-03-02 08:51:03 +0900359_prop_files_ += $(android_info_prop)
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900360
Jiyong Parke1346862020-05-18 14:31:30 +0900361ifdef property_overrides_split_enabled
Jiyong Parke28fa802020-05-26 00:21:20 +0900362# Order matters here. When there are duplicates, the last one wins.
363# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
364_prop_vars_ := \
365 ADDITIONAL_VENDOR_PROPERTIES \
Jiyong Parkeb49b342020-05-29 17:50:03 +0900366 PRODUCT_VENDOR_PROPERTIES
367
368# TODO(b/117892318): deprecate this
369_prop_vars_ += \
370 PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
Jiyong Parke28fa802020-05-26 00:21:20 +0900371 PRODUCT_PROPERTY_OVERRIDES
Jiyong Parke1346862020-05-18 14:31:30 +0900372else
Jiyong Parke28fa802020-05-26 00:21:20 +0900373_prop_vars_ :=
Jiyong Parke1346862020-05-18 14:31:30 +0900374endif
375
Jiyong Parke28fa802020-05-26 00:21:20 +0900376INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
377$(eval $(call build-properties,\
378 vendor,\
379 $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
380 $(_prop_files_),\
381 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100382 $(PRODUCT_VENDOR_PROPERTY_BLACKLIST),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100383 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100384 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900385
Bob Badour70c07dd2022-02-12 15:39:22 -0800386$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_BUILD_PROP_TARGET)))
387
Jiyong Parke28fa802020-05-26 00:21:20 +0900388# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900389# product/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900390#
391
392_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\
393 $(TARGET_PRODUCT_PROP),\
394 $(wildcard $(TARGET_DEVICE_DIR)/product.prop))
395
396# Order matters here. When there are duplicates, the last one wins.
397# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
398_prop_vars_ := \
399 ADDITIONAL_PRODUCT_PROPERTIES \
400 PRODUCT_PRODUCT_PROPERTIES
401
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900402INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/etc/build.prop
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100403
404ifdef PRODUCT_OEM_PROPERTIES
405import_oem_prop := $(call intermediates-dir-for,ETC,import_oem_prop)/oem.prop
406
407$(import_oem_prop):
408 $(hide) echo "####################################" >> $@; \
409 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
410 echo "####################################" >> $@;
411 $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
412 echo "import /oem/oem.prop $(prop)" >> $@;)
413
414_footers_ := $(import_oem_prop)
415else
416_footers_ :=
417endif
418
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100419# Skip common /product properties generation if device released before R and
420# has no product partition. This is the first part of the check.
421ifeq ($(call math_lt,$(if $(PRODUCT_SHIPPING_API_LEVEL),$(PRODUCT_SHIPPING_API_LEVEL),30),30), true)
422 _skip_common_properties := true
423endif
424
425# The second part of the check - always generate common properties for the
426# devices with product partition regardless of shipping level.
427ifneq ($(BOARD_USES_PRODUCTIMAGE),)
428 _skip_common_properties :=
429endif
430
Jiyong Parke28fa802020-05-26 00:21:20 +0900431$(eval $(call build-properties,\
432 product,\
433 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
434 $(_prop_files_),\
435 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100436 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100437 $(_footers_),\
438 $(_skip_common_properties)))
439
Bob Badour70c07dd2022-02-12 15:39:22 -0800440$(eval $(call declare-1p-target,$(INSTALLED_PRODUCT_BUILD_PROP_TARGET)))
441
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100442_skip_common_properties :=
Jiyong Parke1346862020-05-18 14:31:30 +0900443
444# ----------------------------------------------------------------
Jiyong Park62117c82020-06-26 09:56:31 +0900445# odm/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900446#
447_prop_files_ := $(if $(TARGET_ODM_PROP),\
448 $(TARGET_ODM_PROP),\
449 $(wildcard $(TARGET_DEVICE_DIR)/odm.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900450
Jiyong Parke28fa802020-05-26 00:21:20 +0900451# Order matters here. When there are duplicates, the last one wins.
452# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
453_prop_vars_ := \
454 ADDITIONAL_ODM_PROPERTIES \
455 PRODUCT_ODM_PROPERTIES
Jiyong Parke1346862020-05-18 14:31:30 +0900456
Jiyong Park62117c82020-06-26 09:56:31 +0900457INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900458$(eval $(call build-properties,\
459 odm,\
460 $(INSTALLED_ODM_BUILD_PROP_TARGET),\
Hidefumi Kanekob09a36c2021-07-30 17:38:36 +0900461 $(_prop_files_),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900462 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100463 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100464 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900465 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900466
Bob Badour70c07dd2022-02-12 15:39:22 -0800467$(eval $(call declare-1p-target,$(INSTALLED_ODM_BUILD_PROP_TARGET)))
468
Yifan Hong51a971b2020-06-25 17:00:27 -0700469# ----------------------------------------------------------------
470# vendor_dlkm/etc/build.prop
471#
472
473INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR_DLKM)/etc/build.prop
474$(eval $(call build-properties,\
475 vendor_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100476 $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET),\
477 $(empty),\
478 $(empty),\
479 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100480 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100481 $(empty)))
Yifan Hong51a971b2020-06-25 17:00:27 -0700482
Bob Badour70c07dd2022-02-12 15:39:22 -0800483$(eval $(call declare-1p-target,$(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET)))
484
Yifan Hong81a092f2020-07-15 17:02:07 -0700485# ----------------------------------------------------------------
486# odm_dlkm/etc/build.prop
487#
488
489INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
490$(eval $(call build-properties,\
491 odm_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100492 $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET),\
493 $(empty),\
494 $(empty),\
495 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100496 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100497 $(empty)))
Yifan Hong81a092f2020-07-15 17:02:07 -0700498
Bob Badour70c07dd2022-02-12 15:39:22 -0800499$(eval $(call declare-1p-target,$(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET)))
500
Ramji Jiyani13a41372022-01-27 07:05:08 +0000501# ----------------------------------------------------------------
502# system_dlkm/build.prop
503#
504
505INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_DLKM)/etc/build.prop
506$(eval $(call build-properties,\
507 system_dlkm,\
508 $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET),\
509 $(empty),\
510 $(empty),\
511 $(empty),\
512 $(empty),\
513 $(empty)))
514
Bob Badour70c07dd2022-02-12 15:39:22 -0800515$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET)))
516
Jiyong Parke1346862020-05-18 14:31:30 +0900517# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900518# system_ext/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900519#
520_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\
521 $(TARGET_SYSTEM_EXT_PROP),\
522 $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop))
523
524# Order matters here. When there are duplicates, the last one wins.
525# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
526_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES
527
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900528INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900529$(eval $(call build-properties,\
530 system_ext,\
531 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
532 $(_prop_files_),\
533 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100534 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100535 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900536 $(empty)))
Yifan Hong33fd5d42020-09-24 18:18:26 -0700537
Bob Badour70c07dd2022-02-12 15:39:22 -0800538$(eval $(call declare-1p-target,$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)))
539
Yifan Hong33fd5d42020-09-24 18:18:26 -0700540# ----------------------------------------------------------------
541# ramdisk/boot/etc/build.prop
542#
543
544RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop
545INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH)
546$(eval $(call build-properties,\
Kelvin Zhang8250d2c2022-03-23 19:46:09 +0000547 bootimage,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100548 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET),\
549 $(empty),\
550 $(empty),\
551 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100552 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100553 $(empty)))
Bob Badour70c07dd2022-02-12 15:39:22 -0800554
555$(eval $(call declare-1p-target,$(INSTALLED_RAMDISK_BUILD_PROP_TARGET)))
Wei Li49933362023-01-04 17:13:47 -0800556
557ALL_INSTALLED_BUILD_PROP_FILES := \
558 $(INSTALLED_BUILD_PROP_TARGET) \
559 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
560 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
561 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
562 $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET) \
563 $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET) \
564 $(INSTALLED_SYSTEM_DLKM_BUILD_PROP_TARGET) \
565 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) \
566 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET)
567
568# $1 installed file path, e.g. out/target/product/vsoc_x86_64/system/build.prop
569define is-build-prop
570$(if $(findstring $1,$(ALL_INSTALLED_BUILD_PROP_FILES)),Y)
Tiffany Yang19450e32023-05-23 17:36:54 -0700571endef