blob: 154073689c14e333eb6d52283e3cd0141da9471c [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);\
49 )\
50 echo "ro.$(1).build.date=`$(DATE_FROM_FILE)`" >> $(2);\
51 echo "ro.$(1).build.date.utc=`$(DATE_FROM_FILE) +%s`" >> $(2);\
52 echo "ro.$(1).build.fingerprint=$(BUILD_FINGERPRINT_FROM_FILE)" >> $(2);\
53 echo "ro.$(1).build.id=$(BUILD_ID)" >> $(2);\
54 echo "ro.$(1).build.tags=$(BUILD_VERSION_TAGS)" >> $(2);\
55 echo "ro.$(1).build.type=$(TARGET_BUILD_VARIANT)" >> $(2);\
56 echo "ro.$(1).build.version.incremental=$(BUILD_NUMBER_FROM_FILE)" >> $(2);\
Tianjiee88ac672020-10-15 17:22:48 -070057 echo "ro.$(1).build.version.release=$(PLATFORM_VERSION_LAST_STABLE)" >> $(2);\
58 echo "ro.$(1).build.version.release_or_codename=$(PLATFORM_VERSION)" >> $(2);\
Jiyong Park35a83d12020-05-26 02:01:05 +090059 echo "ro.$(1).build.version.sdk=$(PLATFORM_SDK_VERSION)" >> $(2);\
Jiyong Parke1346862020-05-18 14:31:30 +090060
Jiyong Parke1346862020-05-18 14:31:30 +090061endef
62
Jiyong Parkc0bd8c72020-06-29 10:46:22 +090063# Rule for generating <partition>/[etc/]build.prop file
Jiyong Parke28fa802020-05-26 00:21:20 +090064#
65# $(1): partition name
66# $(2): path to the output
67# $(3): path to the input *.prop files. The contents of the files are directly
68# emitted to the output
69# $(4): list of variable names each of which contains name=value pairs
70# $(5): optional list of prop names to force remove from the output. Properties from both
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +010071# $(3) and (4) are affected
72# $(6): optional list of files to append at the end. The content of each file is emitted
73# to the output
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +010074# $(7): optional flag to skip common properties generation
Jiyong Parke28fa802020-05-26 00:21:20 +090075define build-properties
76ALL_DEFAULT_INSTALLED_MODULES += $(2)
77
Jiyong Parkd721e872020-06-22 17:30:57 +090078$(eval # Properties can be assigned using `prop ?= value` or `prop = value` syntax.)
79$(eval # Eliminate spaces around the ?= and = separators.)
Jiyong Parke28fa802020-05-26 00:21:20 +090080$(foreach name,$(strip $(4)),\
Jiyong Parkd721e872020-06-22 17:30:57 +090081 $(eval _temp := $$(call collapse-pairs,$$($(name)),?=))\
82 $(eval _resolved_$(name) := $$(call collapse-pairs,$$(_temp),=))\
Jiyong Parke28fa802020-05-26 00:21:20 +090083)
84
Jiyong Park0b4fccb2020-06-26 17:38:00 +090085$(eval # Implement the legacy behavior when BUILD_BROKEN_DUP_SYSPROP is on.)
86$(eval # Optional assignments are all converted to normal assignments and)
87$(eval # when their duplicates the first one wins)
88$(if $(filter true,$(BUILD_BROKEN_DUP_SYSPROP)),\
89 $(foreach name,$(strip $(4)),\
90 $(eval _temp := $$(subst ?=,=,$$(_resolved_$(name))))\
91 $(eval _resolved_$(name) := $$(call uniq-pairs-by-first-component,$$(_resolved_$(name)),=))\
92 )\
93 $(eval _option := --allow-dup)\
Jiyong Parke28fa802020-05-26 00:21:20 +090094)
95
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +010096$(2): $(POST_PROCESS_PROPS) $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) $(3) $(6)
Jiyong Parke28fa802020-05-26 00:21:20 +090097 $(hide) echo Building $$@
98 $(hide) mkdir -p $$(dir $$@)
99 $(hide) rm -f $$@ && touch $$@
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100100ifneq ($(strip $(7)), true)
Jiyong Parke28fa802020-05-26 00:21:20 +0900101 $(hide) $$(call generate-common-build-props,$(call to-lower,$(strip $(1))),$$@)
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100102endif
Jiyong Parke28fa802020-05-26 00:21:20 +0900103 $(hide) $(foreach file,$(strip $(3)),\
104 if [ -f "$(file)" ]; then\
105 echo "" >> $$@;\
106 echo "####################################" >> $$@;\
107 echo "# from $(file)" >> $$@;\
108 echo "####################################" >> $$@;\
109 cat $(file) >> $$@;\
110 fi;)
111 $(hide) $(foreach name,$(strip $(4)),\
112 echo "" >> $$@;\
113 echo "####################################" >> $$@;\
114 echo "# from variable $(name)" >> $$@;\
115 echo "####################################" >> $$@;\
116 $$(foreach line,$$(_resolved_$(name)),\
117 echo "$$(line)" >> $$@;\
118 )\
119 )
Jiyong Park0b4fccb2020-06-26 17:38:00 +0900120 $(hide) $(POST_PROCESS_PROPS) $$(_option) $$@ $(5)
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100121 $(hide) $(foreach file,$(strip $(6)),\
122 if [ -f "$(file)" ]; then\
123 cat $(file) >> $$@;\
124 fi;)
Jiyong Parke28fa802020-05-26 00:21:20 +0900125 $(hide) echo "# end of file" >> $$@
126endef
127
Jiyong Parke1346862020-05-18 14:31:30 +0900128# -----------------------------------------------------------------
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900129# Define fingerprint, thumbprint, and version tags for the current build
Jiyong Parke28fa802020-05-26 00:21:20 +0900130#
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900131# BUILD_VERSION_TAGS is a comma-separated list of tags chosen by the device
132# implementer that further distinguishes the build. It's basically defined
133# by the device implementer. Here, we are adding a mandatory tag that
134# identifies the signing config of the build.
Jiyong Parke1346862020-05-18 14:31:30 +0900135BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
136ifeq ($(TARGET_BUILD_TYPE),debug)
137 BUILD_VERSION_TAGS += debug
138endif
139# The "test-keys" tag marks builds signed with the old test keys,
140# which are available in the SDK. "dev-keys" marks builds signed with
141# non-default dev keys (usually private keys from a vendor directory).
142# Both of these tags will be removed and replaced with "release-keys"
143# when the target-files is signed in a post-build step.
144ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
145BUILD_KEYS := test-keys
146else
147BUILD_KEYS := dev-keys
148endif
149BUILD_VERSION_TAGS += $(BUILD_KEYS)
150BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
151
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900152# BUILD_FINGERPRINT is used used to uniquely identify the combined build and
153# product; used by the OTA server.
Jiyong Parke1346862020-05-18 14:31:30 +0900154ifeq (,$(strip $(BUILD_FINGERPRINT)))
155 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
156 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
157 else
158 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
159 endif
160 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
161endif
162# unset it for safety.
163BF_BUILD_NUMBER :=
164
165BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
166ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
167 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
168endif
169BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
170# unset it for safety.
171BUILD_FINGERPRINT :=
172
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900173# BUILD_THUMBPRINT is used to uniquely identify the system build; used by the
174# OTA server. This purposefully excludes any product-specific variables.
Jiyong Parke1346862020-05-18 14:31:30 +0900175ifeq (,$(strip $(BUILD_THUMBPRINT)))
176 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
177endif
178
179BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
180ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
181 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
182endif
183BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
184# unset it for safety.
185BUILD_THUMBPRINT :=
186
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900187# -----------------------------------------------------------------
188# Define human readable strings that describe this build
189#
Jiyong Parke1346862020-05-18 14:31:30 +0900190
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900191# BUILD_ID: detail info; has the same info as the build fingerprint
192BUILD_DESC := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
193
194# BUILD_DISPLAY_ID is shown under Settings -> About Phone
Jiyong Parke1346862020-05-18 14:31:30 +0900195ifeq ($(TARGET_BUILD_VARIANT),user)
196 # User builds should show:
197 # release build number or branch.buld_number non-release builds
198
199 # Dev. branches should have DISPLAY_BUILD_NUMBER set
200 ifeq (true,$(DISPLAY_BUILD_NUMBER))
201 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
202 else
203 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
204 endif
205else
206 # Non-user builds should show detailed build information
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900207 BUILD_DISPLAY_ID := $(BUILD_DESC)
Jiyong Parke1346862020-05-18 14:31:30 +0900208endif
209
Jiyong Parke1346862020-05-18 14:31:30 +0900210# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
211# harness to distinguish builds. Only add _asan for a sanitized build
212# if it isn't already a part of the flavor (via a dedicated lunch
213# config for example).
214TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
215ifneq (, $(filter address, $(SANITIZE_TARGET)))
216ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
217TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
218endif
219endif
220
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900221KNOWN_OEM_THUMBPRINT_PROPERTIES := \
222 ro.product.brand \
223 ro.product.name \
224 ro.product.device
225OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
226 $(PRODUCT_OEM_PROPERTIES))
227KNOWN_OEM_THUMBPRINT_PROPERTIES:=
228
229# -----------------------------------------------------------------
230# system/build.prop
231#
232# Note: parts of this file that can't be generated by the build-properties
233# macro are manually created as separate files and then fed into the macro
234
235# Accepts a whitespace separated list of product locales such as
236# (en_US en_AU en_GB...) and returns the first locale in the list with
237# underscores replaced with hyphens. In the example above, this will
238# return "en-US".
239define get-default-product-locale
240$(strip $(subst _,-, $(firstword $(1))))
241endef
242
Jiyong Parkc60c5142020-07-14 15:15:50 +0900243gen_from_buildinfo_sh := $(call intermediates-dir-for,PACKAGING,system_build_prop)/buildinfo.prop
Rupert Shuttleworth3b37bc82020-12-08 09:46:55 +0000244$(gen_from_buildinfo_sh): $(INTERNAL_BUILD_ID_MAKEFILE) $(API_FINGERPRINT) | $(BUILD_DATETIME_FILE) $(BUILD_NUMBER_FILE)
Jiyong Parke1346862020-05-18 14:31:30 +0900245 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
246 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
247 TARGET_DEVICE="$(TARGET_DEVICE)" \
248 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
249 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900250 PRIVATE_BUILD_DESC="$(BUILD_DESC)" \
Jiyong Parke1346862020-05-18 14:31:30 +0900251 BUILD_ID="$(BUILD_ID)" \
252 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
253 DATE="$(DATE_FROM_FILE)" \
254 BUILD_USERNAME="$(BUILD_USERNAME)" \
255 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
256 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
257 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
258 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
259 PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \
260 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
261 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
262 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
263 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
264 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
265 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
266 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
267 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
268 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
269 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
270 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
271 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
272 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
273 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
274 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900275 bash $(BUILDINFO_SH) > $@
Jiyong Parke1346862020-05-18 14:31:30 +0900276
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900277ifdef TARGET_SYSTEM_PROP
278system_prop_file := $(TARGET_SYSTEM_PROP)
279else
280system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
281endif
282
283_prop_files_ := \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900284 $(gen_from_buildinfo_sh) \
285 $(system_prop_file)
286
287# Order matters here. When there are duplicates, the last one wins.
288# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
289_prop_vars_ := \
290 ADDITIONAL_SYSTEM_PROPERTIES \
Jiyong Parkeb49b342020-05-29 17:50:03 +0900291 PRODUCT_SYSTEM_PROPERTIES
292
293# TODO(b/117892318): deprecate this
294_prop_vars_ += \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900295 PRODUCT_SYSTEM_DEFAULT_PROPERTIES
296
297ifndef property_overrides_split_enabled
298_prop_vars_ += \
Garfield Tan04714da2020-08-13 15:21:32 -0700299 ADDITIONAL_VENDOR_PROPERTIES \
300 PRODUCT_VENDOR_PROPERTIES
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900301endif
302
303_blacklist_names_ := \
304 $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST) \
305 ro.product.first_api_level
306
307INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
308
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100309$(eval $(call build-properties,\
310 system,\
311 $(INSTALLED_BUILD_PROP_TARGET),\
312 $(_prop_files_),\
313 $(_prop_vars_),\
314 $(_blacklist_names_),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100315 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100316 $(empty)))
Jiyong Parkbb26c6f2020-05-26 03:18:36 +0900317
Jiyong Parke1346862020-05-18 14:31:30 +0900318# -----------------------------------------------------------------
Jiyong Parke28fa802020-05-26 00:21:20 +0900319# vendor/build.prop
Jiyong Parke1346862020-05-18 14:31:30 +0900320#
Jiyong Parke28fa802020-05-26 00:21:20 +0900321_prop_files_ := $(if $(TARGET_VENDOR_PROP),\
322 $(TARGET_VENDOR_PROP),\
323 $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900324
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900325android_info_prop := $(call intermediates-dir-for,ETC,android_info_prop)/android_info.prop
326$(android_info_prop): $(INSTALLED_ANDROID_INFO_TXT_TARGET)
327 cat $< | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' > $@
328
Jiyong Parke28fa802020-05-26 00:21:20 +0900329_prop_files_ += $(android_info_pro)
Jiyong Park3a2e95a2020-05-25 17:56:09 +0900330
Jiyong Parke1346862020-05-18 14:31:30 +0900331ifdef property_overrides_split_enabled
Jiyong Parke28fa802020-05-26 00:21:20 +0900332# Order matters here. When there are duplicates, the last one wins.
333# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
334_prop_vars_ := \
335 ADDITIONAL_VENDOR_PROPERTIES \
Jiyong Parkeb49b342020-05-29 17:50:03 +0900336 PRODUCT_VENDOR_PROPERTIES
337
338# TODO(b/117892318): deprecate this
339_prop_vars_ += \
340 PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
Jiyong Parke28fa802020-05-26 00:21:20 +0900341 PRODUCT_PROPERTY_OVERRIDES
Jiyong Parke1346862020-05-18 14:31:30 +0900342else
Jiyong Parke28fa802020-05-26 00:21:20 +0900343_prop_vars_ :=
Jiyong Parke1346862020-05-18 14:31:30 +0900344endif
345
Jiyong Parke28fa802020-05-26 00:21:20 +0900346INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
347$(eval $(call build-properties,\
348 vendor,\
349 $(INSTALLED_VENDOR_BUILD_PROP_TARGET),\
350 $(_prop_files_),\
351 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100352 $(PRODUCT_VENDOR_PROPERTY_BLACKLIST),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100353 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100354 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900355
Jiyong Parke28fa802020-05-26 00:21:20 +0900356# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900357# product/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900358#
359
360_prop_files_ := $(if $(TARGET_PRODUCT_PROP),\
361 $(TARGET_PRODUCT_PROP),\
362 $(wildcard $(TARGET_DEVICE_DIR)/product.prop))
363
364# Order matters here. When there are duplicates, the last one wins.
365# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
366_prop_vars_ := \
367 ADDITIONAL_PRODUCT_PROPERTIES \
368 PRODUCT_PRODUCT_PROPERTIES
369
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900370INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/etc/build.prop
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100371
372ifdef PRODUCT_OEM_PROPERTIES
373import_oem_prop := $(call intermediates-dir-for,ETC,import_oem_prop)/oem.prop
374
375$(import_oem_prop):
376 $(hide) echo "####################################" >> $@; \
377 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
378 echo "####################################" >> $@;
379 $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
380 echo "import /oem/oem.prop $(prop)" >> $@;)
381
382_footers_ := $(import_oem_prop)
383else
384_footers_ :=
385endif
386
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100387# Skip common /product properties generation if device released before R and
388# has no product partition. This is the first part of the check.
389ifeq ($(call math_lt,$(if $(PRODUCT_SHIPPING_API_LEVEL),$(PRODUCT_SHIPPING_API_LEVEL),30),30), true)
390 _skip_common_properties := true
391endif
392
393# The second part of the check - always generate common properties for the
394# devices with product partition regardless of shipping level.
395ifneq ($(BOARD_USES_PRODUCTIMAGE),)
396 _skip_common_properties :=
397endif
398
Jiyong Parke28fa802020-05-26 00:21:20 +0900399$(eval $(call build-properties,\
400 product,\
401 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET),\
402 $(_prop_files_),\
403 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100404 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100405 $(_footers_),\
406 $(_skip_common_properties)))
407
408_skip_common_properties :=
Jiyong Parke1346862020-05-18 14:31:30 +0900409
410# ----------------------------------------------------------------
Jiyong Park62117c82020-06-26 09:56:31 +0900411# odm/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900412#
413_prop_files_ := $(if $(TARGET_ODM_PROP),\
414 $(TARGET_ODM_PROP),\
415 $(wildcard $(TARGET_DEVICE_DIR)/odm.prop))
Jiyong Parke1346862020-05-18 14:31:30 +0900416
Jiyong Parke28fa802020-05-26 00:21:20 +0900417# Order matters here. When there are duplicates, the last one wins.
418# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
419_prop_vars_ := \
420 ADDITIONAL_ODM_PROPERTIES \
421 PRODUCT_ODM_PROPERTIES
Jiyong Parke1346862020-05-18 14:31:30 +0900422
Jiyong Park62117c82020-06-26 09:56:31 +0900423INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900424$(eval $(call build-properties,\
425 odm,\
426 $(INSTALLED_ODM_BUILD_PROP_TARGET),\
427 $(_prop_files),\
428 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100429 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100430 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900431 $(empty)))
Jiyong Parke1346862020-05-18 14:31:30 +0900432
Yifan Hong51a971b2020-06-25 17:00:27 -0700433# ----------------------------------------------------------------
434# vendor_dlkm/etc/build.prop
435#
436
437INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR_DLKM)/etc/build.prop
438$(eval $(call build-properties,\
439 vendor_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100440 $(INSTALLED_VENDOR_DLKM_BUILD_PROP_TARGET),\
441 $(empty),\
442 $(empty),\
443 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100444 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100445 $(empty)))
Yifan Hong51a971b2020-06-25 17:00:27 -0700446
Yifan Hong81a092f2020-07-15 17:02:07 -0700447# ----------------------------------------------------------------
448# odm_dlkm/etc/build.prop
449#
450
451INSTALLED_ODM_DLKM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM_DLKM)/etc/build.prop
452$(eval $(call build-properties,\
453 odm_dlkm,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100454 $(INSTALLED_ODM_DLKM_BUILD_PROP_TARGET),\
455 $(empty),\
456 $(empty),\
457 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100458 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100459 $(empty)))
Yifan Hong81a092f2020-07-15 17:02:07 -0700460
Jiyong Parke1346862020-05-18 14:31:30 +0900461# -----------------------------------------------------------------
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900462# system_ext/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900463#
464_prop_files_ := $(if $(TARGET_SYSTEM_EXT_PROP),\
465 $(TARGET_SYSTEM_EXT_PROP),\
466 $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop))
467
468# Order matters here. When there are duplicates, the last one wins.
469# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
470_prop_vars_ := PRODUCT_SYSTEM_EXT_PROPERTIES
471
Jiyong Parkc0bd8c72020-06-29 10:46:22 +0900472INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/etc/build.prop
Jiyong Parke28fa802020-05-26 00:21:20 +0900473$(eval $(call build-properties,\
474 system_ext,\
475 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET),\
476 $(_prop_files_),\
477 $(_prop_vars_),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100478 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100479 $(empty),\
Jiyong Parke28fa802020-05-26 00:21:20 +0900480 $(empty)))
Yifan Hong33fd5d42020-09-24 18:18:26 -0700481
482# ----------------------------------------------------------------
483# ramdisk/boot/etc/build.prop
484#
485
486RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop
487INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH)
488$(eval $(call build-properties,\
489 bootimage,\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100490 $(INSTALLED_RAMDISK_BUILD_PROP_TARGET),\
491 $(empty),\
492 $(empty),\
493 $(empty),\
Oleksiy Avramchenkod3d0f7d2020-12-15 14:38:32 +0100494 $(empty),\
Alexander Mishkovets5a6bc222020-11-11 15:25:37 +0100495 $(empty)))