blob: 5e9fb297269d39b712252257c6bf91adb75311a5 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Put some miscellaneous rules here
2
Ying Wang3bbfddd2014-03-01 15:32:04 -08003# HACK: clear LOCAL_PATH from including last build target before calling
4# intermedites-dir-for
5LOCAL_PATH := $(BUILD_SYSTEM)
6
The Android Open Source Project88b60792009-03-03 19:28:42 -08007# -----------------------------------------------------------------
8# Define rules to copy PRODUCT_COPY_FILES defined by the product.
Ying Wang4b0486b2012-09-20 16:35:36 -07009# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
The Android Open Source Project88b60792009-03-03 19:28:42 -080010# <dest file> is relative to $(PRODUCT_OUT), so it should look like,
11# e.g., "system/etc/file.xml".
Jean-Baptiste Queru518ce572010-03-01 16:18:59 -080012# The filter part means "only eval the copy-one-file rule if this
Ying Wang462d26b2010-11-02 21:31:47 -070013# src:dest pair is the first one to match the same dest"
Ying Wang68864102011-09-29 13:23:25 -070014#$(1): the src:dest pair
Dan Willemsen7d957c92018-04-30 16:01:33 -070015#$(2): the dest
Ying Wang68864102011-09-29 13:23:25 -070016define check-product-copy-files
Dan Willemsen7d957c92018-04-30 16:01:33 -070017$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
18 $(if $(filter %.apk, $(2)),$(error \
19 Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
Ying Wang68864102011-09-29 13:23:25 -070020endef
Ying Wang619fccf2012-09-05 18:08:29 -070021# filter out the duplicate <source file>:<dest file> pairs.
22unique_product_copy_files_pairs :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080023$(foreach cf,$(PRODUCT_COPY_FILES), \
Ying Wang619fccf2012-09-05 18:08:29 -070024 $(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\
25 $(eval unique_product_copy_files_pairs += $(cf))))
26unique_product_copy_files_destinations :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080027product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070028$(foreach cf,$(unique_product_copy_files_pairs), \
Ying Wang462d26b2010-11-02 21:31:47 -070029 $(eval _src := $(call word-colon,1,$(cf))) \
30 $(eval _dest := $(call word-colon,2,$(cf))) \
Dan Willemsen7d957c92018-04-30 16:01:33 -070031 $(call check-product-copy-files,$(cf),$(_dest)) \
Ying Wang193010c2011-12-16 11:54:25 -080032 $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
Dan Willemsen403b98a2017-11-15 11:13:23 -080033 $(eval product_copy_files_ignored += $(cf)), \
Ying Wang462d26b2010-11-02 21:31:47 -070034 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
Ying Wang3ceecfa2012-05-14 14:39:00 -070035 $(if $(filter %.xml,$(_dest)),\
36 $(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
Nicolas Geoffraya95fbd12017-09-19 13:10:31 +010037 $(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\
38 $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
Tom Cherryfc977642018-06-13 14:51:05 -070039 $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
40 $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
41 $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \
Ying Wang7e8d4422011-06-17 17:05:35 -070042 $(eval unique_product_copy_files_destinations += $(_dest))))
Dan Willemsen403b98a2017-11-15 11:13:23 -080043
44# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
Dan Willemsen7537fd02018-10-16 23:15:08 -070045pcf_ignored_file := $(PRODUCT_OUT)/product_copy_files_ignored.txt
46$(pcf_ignored_file): PRIVATE_IGNORED := $(sort $(product_copy_files_ignored))
47$(pcf_ignored_file):
48 echo "$(PRIVATE_IGNORED)" | tr " " "\n" >$@
Dan Willemsen403b98a2017-11-15 11:13:23 -080049
Dan Willemsen7537fd02018-10-16 23:15:08 -070050$(call dist-for-goals,droidcore,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file)))
51
52pcf_ignored_file :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080053product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070054unique_product_copy_files_pairs :=
Ying Wang7e8d4422011-06-17 17:05:35 -070055unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080056
57# -----------------------------------------------------------------
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +080058# Returns the max allowed size for an image suitable for hash verification
59# (e.g., boot.img, recovery.img, etc).
60# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL).
61# $(1): partition size to flash the image
62define get-hash-image-max-size
63$(if $(1), \
64 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
65 $(eval _hash_meta_size := 69632), \
66 $(eval _hash_meta_size := 0)) \
67 $(1)-$(_hash_meta_size))
68endef
69
70# -----------------------------------------------------------------
Dan Willemsen6f60f022016-02-23 13:40:07 -080071# Define rules to copy headers defined in copy_headers.mk
72# If more than one makefile declared a header, print a warning,
73# then copy the last one defined. This matches the previous make
74# behavior.
Dan Willemsen7f9bd562018-08-15 14:28:01 -070075has_dup_copy_headers :=
Dan Willemsen6f60f022016-02-23 13:40:07 -080076$(foreach dest,$(ALL_COPIED_HEADERS), \
77 $(eval _srcs := $(ALL_COPIED_HEADERS.$(dest).SRC)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -080078 $(eval _src := $(lastword $(_srcs))) \
Dan Willemsen6f60f022016-02-23 13:40:07 -080079 $(if $(call streq,$(_src),$(_srcs)),, \
80 $(warning Duplicate header copy: $(dest)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -080081 $(warning _ Using $(_src)) \
82 $(warning __ from $(lastword $(ALL_COPIED_HEADERS.$(dest).MAKEFILE))) \
83 $(eval _makefiles := $$(wordlist 1,$(call int_subtract,$(words $(ALL_COPIED_HEADERS.$(dest).MAKEFILE)),1),$$(ALL_COPIED_HEADERS.$$(dest).MAKEFILE))) \
84 $(foreach src,$(wordlist 1,$(call int_subtract,$(words $(_srcs)),1),$(_srcs)), \
85 $(warning _ Ignoring $(src)) \
86 $(warning __ from $(firstword $(_makefiles))) \
87 $(eval _makefiles := $$(wordlist 2,9999,$$(_makefiles)))) \
88 $(eval has_dup_copy_headers := true)) \
Dan Willemsen6f60f022016-02-23 13:40:07 -080089 $(eval $(call copy-one-header,$(_src),$(dest))))
90all_copied_headers: $(ALL_COPIED_HEADERS)
91
Dan Willemsen7f9bd562018-08-15 14:28:01 -070092ifdef has_dup_copy_headers
93 has_dup_copy_headers :=
94 ifneq ($(BUILD_BROKEN_DUP_COPY_HEADERS),true)
95 $(error duplicate header copies are no longer allowed. For more information about headers, see: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers)
96 endif
97endif
98
Dan Willemsen6f60f022016-02-23 13:40:07 -080099# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800100# docs/index.html
Ying Wang3f45b3c2012-04-02 18:21:36 -0700101ifeq (,$(TARGET_BUILD_APPS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800102gen := $(OUT_DOCS)/index.html
103ALL_DOCS += $(gen)
104$(gen): frameworks/base/docs/docs-redirect-index.html
105 @mkdir -p $(dir $@)
106 @cp -f $< $@
Ying Wang3f45b3c2012-04-02 18:21:36 -0700107endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800108
Dan Albert303e6032017-10-04 10:20:20 -0700109ndk_doxygen_out := $(OUT_NDK_DOCS)
110ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include
111ndk_docs_src_dir := frameworks/native/docs
112ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile
113ifneq ($(wildcard $(ndk_docs_src_dir)),)
114ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\
115 $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.))
116$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp
117 @mkdir -p $(ndk_doxygen_out)
118 @echo "Generating NDK docs to $(ndk_doxygen_out)"
119 @( cat $(ndk_doxyfile); \
120 echo "INPUT=$(ndk_headers)"; \
121 echo "HTML_OUTPUT=$(ndk_doxygen_out)" \
122 ) | doxygen -
123
124# Note: Not a part of the docs target because we don't have doxygen available.
125# You can run this target locally if you have doxygen installed.
126ndk-docs: $(ndk_doxygen_out)/index.html
127.PHONY: ndk-docs
128endif
129
The Android Open Source Project88b60792009-03-03 19:28:42 -0800130# -----------------------------------------------------------------
Dan Willemsenad6a1542018-12-14 01:04:19 -0800131# generate preview API fingerprint
132api_fingerprint := $(call intermediates-dir-for,PACKAGING,api_fingerprint)/api_fingerprint.txt
133.KATI_READONLY := api_fingerprint
134
135ifeq (REL,$(PLATFORM_VERSION_CODENAME))
136 $(api_fingerprint):
137 echo REL >$@
138else ifneq ($(TARGET_BUILD_APPS),)
139 # TODO: use a prebuilt api_fingerprint.txt from prebuilts/sdk/current.txt once we have one
140 #$(eval $(call copy-one-file,prebuilts/sdk/current/api_fingerprint.txt,$(api_fingerprint)))
141 $(api_fingerprint):
142 echo $(PLATFORM_PREVIEW_SDK_VERSION) >$@
143else ifneq ($(TARGET_BUILD_PDK),)
144 $(eval $(call copy-one-file,$(_pdk_fusion_intermediates)/api_fingerprint.txt,$(api_fingerprint)))
145else
146 ifeq ($(HOST_OS),darwin)
147 $(api_fingerprint): PRIVATE_HASH := md5
148 else
149 $(api_fingerprint): PRIVATE_HASH := md5sum
150 endif
151 $(api_fingerprint): $(sort $(wildcard frameworks/base/api/*current.txt))
152 cat $^ | $(PRIVATE_HASH) | cut -d' ' -f1 >$@
153
154 $(call dist-for-goals,sdk,$(api_fingerprint))
155endif
156
157# -----------------------------------------------------------------
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900158# property_overrides_split_enabled
159property_overrides_split_enabled :=
160ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
161 property_overrides_split_enabled := true
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900162endif
163
164# -----------------------------------------------------------------
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900165# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if
166# property_overrides_split_enabled is true. Otherwise it will be installed in
167# ROOT/default.prop.
168ifdef BOARD_VNDK_VERSION
169 ifeq ($(BOARD_VNDK_VERSION),current)
170 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
171 else
172 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
173 endif
Logan Chiend73b94c2018-05-04 19:33:17 +0800174 ifdef BOARD_VNDK_RUNTIME_DISABLE
175 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
176 endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900177else
Logan Chiend73b94c2018-05-04 19:33:17 +0800178 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
179 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900180endif
181FINAL_VENDOR_DEFAULT_PROPERTIES += \
182 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
Tao Bao5f999232018-09-04 11:42:53 -0700183
Anton Hansson30851f22019-02-21 11:51:26 +0000184# Add cpu properties for bionic and ART.
Haibo Huangee0531d2018-11-04 09:20:09 -0800185FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000186FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME)
Haibo Huangee0531d2018-11-04 09:20:09 -0800187FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000188FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME)
Haibo Huangee0531d2018-11-04 09:20:09 -0800189
Anton Hansson30851f22019-02-21 11:51:26 +0000190FINAL_VENDOR_DEFAULT_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000191FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
Anton Hansson30851f22019-02-21 11:51:26 +0000192ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
193 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
194endif
195
196ifdef TARGET_2ND_ARCH
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000197 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
Anton Hansson30851f22019-02-21 11:51:26 +0000198 ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
199 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
200 endif
201endif
202
Tao Bao5f999232018-09-04 11:42:53 -0700203# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
204# mode (via libminui).
205ifdef TARGET_RECOVERY_DEFAULT_ROTATION
206FINAL_VENDOR_DEFAULT_PROPERTIES += \
207 ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
208endif
209ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
210FINAL_VENDOR_DEFAULT_PROPERTIES += \
211 ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
212endif
213ifdef TARGET_RECOVERY_PIXEL_FORMAT
214FINAL_VENDOR_DEFAULT_PROPERTIES += \
215 ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
216endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900217FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
218 $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
219
220# -----------------------------------------------------------------
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800221# prop.default
Anton Hansson1f8729e2018-08-15 12:11:55 +0100222
223BUILDINFO_SH := build/make/tools/buildinfo.sh
224BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
Anton Hanssonee4c9702018-12-21 15:36:00 +0000225
226# Generates a set of sysprops common to all partitions to a file.
Anton Hansson1f8729e2018-08-15 12:11:55 +0100227# $(1): Partition name
228# $(2): Output file name
229define generate-common-build-props
Anton Hanssonee4c9702018-12-21 15:36:00 +0000230 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
231 PRODUCT_DEVICE="$(TARGET_DEVICE)" \
232 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
233 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
234 PRODUCT_NAME="$(TARGET_PRODUCT)" \
235 $(call generate-common-build-props-with-product-vars-set,$(1),$(2))
236endef
237
238# Like the above macro, but requiring the relevant PRODUCT_ environment
239# variables to be set when called.
240define generate-common-build-props-with-product-vars-set
Anton Hansson1f8729e2018-08-15 12:11:55 +0100241 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
242 BUILD_ID="$(BUILD_ID)" \
243 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
244 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
245 DATE="$(DATE_FROM_FILE)" \
246 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
247 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
Anton Hansson1f8729e2018-08-15 12:11:55 +0100248 TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson1f8729e2018-08-15 12:11:55 +0100249 bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
250endef
251
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800252ifdef property_overrides_split_enabled
253INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800254INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
255ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
256$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800257else
258# legacy path
The Android Open Source Project88b60792009-03-03 19:28:42 -0800259INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800260endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800261ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900262FINAL_DEFAULT_PROPERTIES := \
Jaekyun Seokb31b9ba2017-11-03 15:18:55 +0900263 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
264 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900265ifndef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900266 FINAL_DEFAULT_PROPERTIES += \
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900267 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900268endif
Jaekyun Seok294286d2017-01-20 13:17:12 +0900269FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
270 $(FINAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800271
Andres Moralesb8876e12015-05-06 20:44:22 -0700272intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
273
Anton Hansson1f8729e2018-08-15 12:11:55 +0100274$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800275 @echo Target buildinfo: $@
276 @mkdir -p $(dir $@)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800277 @rm -f $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800278 $(hide) echo "#" > $@; \
279 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
280 echo "#" >> $@;
Jaekyun Seok294286d2017-01-20 13:17:12 +0900281 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000282 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800283 $(hide) build/make/tools/post_process_props.py $@
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800284ifdef property_overrides_split_enabled
285 $(hide) mkdir -p $(TARGET_ROOT_OUT)
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800286 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800287endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800288
289# -----------------------------------------------------------------
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900290# vendor default.prop
291INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900292ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900293INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
294ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
295
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900296$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
297 @echo Target buildinfo: $@
298 @mkdir -p $(dir $@)
299 $(hide) echo "#" > $@; \
300 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
301 echo "#" >> $@;
302 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000303 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800304 $(hide) build/make/tools/post_process_props.py $@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900305
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900306endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900307
308# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800309# build.prop
310INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
311ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900312FINAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -0700313 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
Jaekyun Seok294286d2017-01-20 13:17:12 +0900314FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
315 $(FINAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800316
317# A list of arbitrary tags describing the build configuration.
318# Force ":=" so we can use +=
319BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
320ifeq ($(TARGET_BUILD_TYPE),debug)
321 BUILD_VERSION_TAGS += debug
322endif
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700323# The "test-keys" tag marks builds signed with the old test keys,
324# which are available in the SDK. "dev-keys" marks builds signed with
325# non-default dev keys (usually private keys from a vendor directory).
326# Both of these tags will be removed and replaced with "release-keys"
327# when the target-files is signed in a post-build step.
Dan Willemsen0ab1be62019-04-09 21:35:37 -0700328ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
Doug Zongkera8608a72013-07-23 11:51:04 -0700329BUILD_KEYS := test-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700330else
Doug Zongkera8608a72013-07-23 11:51:04 -0700331BUILD_KEYS := dev-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700332endif
Doug Zongkera8608a72013-07-23 11:51:04 -0700333BUILD_VERSION_TAGS += $(BUILD_KEYS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800334BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
335
336# A human-readable string that descibes this build in detail.
Colin Crossf37b4552015-07-16 17:15:19 -0700337build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
Andres Moralesb8876e12015-05-06 20:44:22 -0700338$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800339
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700340# The string used to uniquely identify the combined build and product; used by the OTA server.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800341ifeq (,$(strip $(BUILD_FINGERPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800342 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Dan Willemsen63e48db2019-01-02 12:27:43 -0800343 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
Ying Wang50367cc2014-06-12 18:42:53 -0700344 else
Nan Zhang0abdb582018-02-20 17:00:39 -0800345 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
Ying Wang50367cc2014-06-12 18:42:53 -0700346 endif
347 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800348endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800349# unset it for safety.
350BF_BUILD_NUMBER :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800351
Nan Zhang0abdb582018-02-20 17:00:39 -0800352BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
353ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
354 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
355endif
356BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
357# unset it for safety.
358BUILD_FINGERPRINT :=
Colin Crossf37b4552015-07-16 17:15:19 -0700359
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700360# The string used to uniquely identify the system build; used by the OTA server.
361# This purposefully excludes any product-specific variables.
362ifeq (,$(strip $(BUILD_THUMBPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800363 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700364endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800365
366BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
367ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
368 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700369endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800370BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
371# unset it for safety.
372BUILD_THUMBPRINT :=
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700373
Ying Wange24e17a2014-10-07 18:42:11 -0700374KNOWN_OEM_THUMBPRINT_PROPERTIES := \
375 ro.product.brand \
376 ro.product.name \
377 ro.product.device
378OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
Anton Hansson8dab0a62019-03-28 15:45:40 +0000379 $(PRODUCT_OEM_PROPERTIES))
Ying Wange24e17a2014-10-07 18:42:11 -0700380
Sriram Raman7b641242009-03-24 22:40:59 -0700381# Display parameters shown under Settings -> About Phone
382ifeq ($(TARGET_BUILD_VARIANT),user)
383 # User builds should show:
384 # release build number or branch.buld_number non-release builds
385
386 # Dev. branches should have DISPLAY_BUILD_NUMBER set
Colin Cross63fe36a2017-02-21 17:23:02 -0800387 ifeq (true,$(DISPLAY_BUILD_NUMBER))
Colin Crossf37b4552015-07-16 17:15:19 -0700388 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700389 else
Doug Zongkera8608a72013-07-23 11:51:04 -0700390 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700391 endif
392else
393 # Non-user builds should show detailed build information
394 BUILD_DISPLAY_ID := $(build_desc)
395endif
396
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000397# Accepts a whitespace separated list of product locales such as
398# (en_US en_AU en_GB...) and returns the first locale in the list with
399# underscores replaced with hyphens. In the example above, this will
400# return "en-US".
401define get-default-product-locale
402$(strip $(subst _,-, $(firstword $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800403endef
404
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700405# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
406# harness to distinguish builds. Only add _asan for a sanitized build
407# if it isn't already a part of the flavor (via a dedicated lunch
408# config for example).
Ying Wang21ec03d2015-10-28 18:45:03 -0700409TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
Ivan Lozano0f71db32017-08-14 07:57:37 -0700410ifneq (, $(filter address, $(SANITIZE_TARGET)))
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700411ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
Ying Wang21ec03d2015-10-28 18:45:03 -0700412TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
413endif
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700414endif
Ying Wang21ec03d2015-10-28 18:45:03 -0700415
Andrew Boiefa61ff02012-09-28 09:33:45 -0700416ifdef TARGET_SYSTEM_PROP
417system_prop_file := $(TARGET_SYSTEM_PROP)
418else
419system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
420endif
Dan Willemsenad6a1542018-12-14 01:04:19 -0800421$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(api_fingerprint)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800422 @echo Target buildinfo: $@
423 @mkdir -p $(dir $@)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700424 $(hide) echo > $@
Anton Hansson8dab0a62019-03-28 15:45:40 +0000425ifneq ($(PRODUCT_OEM_PROPERTIES),)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700426 $(hide) echo "#" >> $@; \
427 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700428 echo "#" >> $@;
Anton Hansson8dab0a62019-03-28 15:45:40 +0000429 $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000430 echo "import /oem/oem.prop $(prop)" >> $@;)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700431endif
Anton Hanssonee4c9702018-12-21 15:36:00 +0000432 $(hide) PRODUCT_BRAND="$(PRODUCT_SYSTEM_BRAND)" \
433 PRODUCT_MANUFACTURER="$(PRODUCT_SYSTEM_MANUFACTURER)" \
434 PRODUCT_MODEL="$(PRODUCT_SYSTEM_MODEL)" \
435 PRODUCT_NAME="$(PRODUCT_SYSTEM_NAME)" \
436 PRODUCT_DEVICE="$(PRODUCT_SYSTEM_DEVICE)" \
437 $(call generate-common-build-props-with-product-vars-set,system,$@)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800438 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000439 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
440 TARGET_DEVICE="$(TARGET_DEVICE)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000441 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
442 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000443 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
444 BUILD_ID="$(BUILD_ID)" \
445 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
446 DATE="$(DATE_FROM_FILE)" \
Dan Willemsen63e48db2019-01-02 12:27:43 -0800447 BUILD_USERNAME="$(BUILD_USERNAME)" \
448 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000449 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
450 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
451 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
452 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
453 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
454 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
455 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
456 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
Dan Willemsenad6a1542018-12-14 01:04:19 -0800457 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(api_fingerprint))" \
Anton Hansson6d814982018-11-26 18:12:05 +0000458 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
459 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
460 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
461 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000462 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
463 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
464 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
465 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
466 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
467 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700468 bash $(BUILDINFO_SH) >> $@
Johan Redestig674a27d2012-04-12 17:00:58 +0200469 $(hide) $(foreach file,$(system_prop_file), \
Anton Hansson6d814982018-11-26 18:12:05 +0000470 if [ -f "$(file)" ]; then \
471 echo Target buildinfo from: "$(file)"; \
472 echo "" >> $@; \
473 echo "#" >> $@; \
474 echo "# from $(file)" >> $@; \
475 echo "#" >> $@; \
476 cat $(file) >> $@; \
477 echo "# end of $(file)" >> $@; \
478 fi;)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900479 $(if $(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000480 $(hide) echo >> $@; \
481 echo "#" >> $@; \
482 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
483 echo "#" >> $@; )
Jaekyun Seok294286d2017-01-20 13:17:12 +0900484 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000485 echo "$(line)" >> $@;)
Anton Hansson8dab0a62019-03-28 15:45:40 +0000486 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800487
488build_desc :=
489
Andres Moralesb8876e12015-05-06 20:44:22 -0700490ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
491INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
492else
493INSTALLED_RECOVERYIMAGE_TARGET :=
494endif
495
496$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
497 @echo "Target build info: $@"
Steven Morelandec082652017-10-22 02:11:47 -0700498 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
Andres Moralesb8876e12015-05-06 20:44:22 -0700499
The Android Open Source Project88b60792009-03-03 19:28:42 -0800500# -----------------------------------------------------------------
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700501# vendor build.prop
502#
Alex Naidis47e24e92016-01-10 14:18:54 +0000503# For verifying that the vendor build is what we think it is
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700504INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
505ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900506
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900507ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900508FINAL_VENDOR_BUILD_PROPERTIES += \
509 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
510FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
511 $(FINAL_VENDOR_BUILD_PROPERTIES),=)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900512endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900513
Anton Hansson1f8729e2018-08-15 12:11:55 +0100514$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700515 @echo Target vendor buildinfo: $@
516 @mkdir -p $(dir $@)
517 $(hide) echo > $@
Sandeep Patil127f5012017-10-23 19:47:43 -0700518 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
Max Biresa1749982018-03-28 15:48:13 -0700519 $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
Isaac Chen8d11feb2018-01-31 14:27:37 +0800520 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
521 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
522 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100523 $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
524 $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
525 $(hide) $(call generate-common-build-props,vendor,$@)
Anton Hansson15794ca2019-04-08 17:47:35 +0100526 $(hide) echo "#" >> $@; \
527 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
528 echo "#" >> $@;
529 $(hide) $(call generate-common-build-props,bootimage,$@)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900530 $(hide) echo "#" >> $@; \
531 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
532 echo "#" >> $@;
Anton Hanssonc65ebaf2019-04-09 16:21:51 +0100533 $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
534ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900535 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000536 echo "$(line)" >> $@;)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900537endif # property_overrides_split_enabled
Anton Hansson8dab0a62019-03-28 15:45:40 +0000538 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700539
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900540# -----------------------------------------------------------------
541# product build.prop
542INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
543ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
544
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000545ifdef TARGET_PRODUCT_PROP
546product_prop_files := $(TARGET_PRODUCT_PROP)
547else
548product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
549endif
550
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900551FINAL_PRODUCT_PROPERTIES += \
Yifan Hongaf9e7f02018-07-27 13:11:50 -0700552 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900553FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
554 $(FINAL_PRODUCT_PROPERTIES),=)
555
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000556$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900557 @echo Target product buildinfo: $@
558 @mkdir -p $(dir $@)
559 $(hide) echo > $@
560ifdef BOARD_USES_PRODUCTIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100561 $(hide) $(call generate-common-build-props,product,$@)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900562endif # BOARD_USES_PRODUCTIMAGE
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000563 $(hide) $(foreach file,$(product_prop_files), \
Anton Hansson6d814982018-11-26 18:12:05 +0000564 if [ -f "$(file)" ]; then \
565 echo Target product properties from: "$(file)"; \
566 echo "" >> $@; \
567 echo "#" >> $@; \
568 echo "# from $(file)" >> $@; \
569 echo "#" >> $@; \
570 cat $(file) >> $@; \
571 echo "# end of $(file)" >> $@; \
572 fi;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900573 $(hide) echo "#" >> $@; \
574 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
Anton Hansson5ac408b2018-11-05 17:29:28 +0000575 echo "#" >> $@; \
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000576 echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900577 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000578 echo "$(line)" >> $@;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900579 $(hide) build/make/tools/post_process_props.py $@
580
Andres Morales9c820f82015-01-13 15:30:34 -0800581# ----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800582# odm build.prop
583INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop
584ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
585
586FINAL_ODM_BUILD_PROPERTIES += \
587 $(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES))
588FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
589 $(FINAL_ODM_BUILD_PROPERTIES),=)
590
Anton Hansson1f8729e2018-08-15 12:11:55 +0100591$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800592 @echo Target odm buildinfo: $@
593 @mkdir -p $(dir $@)
594 $(hide) echo > $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800595 $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
596 $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
597 $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100598 $(hide) $(call generate-common-build-props,odm,$@)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800599 $(hide) echo "#" >> $@; \
600 echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
601 echo "#" >> $@;
602 $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000603 echo "$(line)" >> $@;)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800604 $(hide) build/make/tools/post_process_props.py $@
Andres Morales9c820f82015-01-13 15:30:34 -0800605
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700606# -----------------------------------------------------------------
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000607# product_services build.prop (unless it's merged into /product)
608ifdef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
609 ifneq (,$(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
610 $(error PRODUCT_PRODUCT_SERVICES_PROPERTIES is not supported in this build.)
611 endif
612else
Dario Freni5f681e12018-05-29 13:09:01 +0100613INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
614ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
615
616FINAL_PRODUCT_SERVICES_PROPERTIES += \
617 $(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
618FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
619 $(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
Anton Hansson1f8729e2018-08-15 12:11:55 +0100620$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Dario Freni924af7d2018-08-17 00:56:14 +0100621 @echo Target product_services buildinfo: $@
Dario Freni5f681e12018-05-29 13:09:01 +0100622 @mkdir -p $(dir $@)
623 $(hide) echo > $@
624ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100625 $(hide) $(call generate-common-build-props,product_services,$@)
Dario Freni5f681e12018-05-29 13:09:01 +0100626endif # BOARD_USES_PRODUCT_SERVICESIMAGE
627 $(hide) echo "#" >> $@; \
628 echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
629 echo "#" >> $@;
630 $(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000631 echo "$(line)" >> $@;)
Dario Freni5f681e12018-05-29 13:09:01 +0100632 $(hide) build/make/tools/post_process_props.py $@
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000633endif # MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Dario Freni5f681e12018-05-29 13:09:01 +0100634
635# ----------------------------------------------------------------
636
637# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800638# sdk-build.prop
639#
640# There are certain things in build.prop that we don't want to
641# ship with the sdk; remove them.
642
643# This must be a list of entire property keys followed by
644# "=" characters, without any internal spaces.
645sdk_build_prop_remove := \
646 ro.build.user= \
647 ro.build.host= \
648 ro.product.brand= \
649 ro.product.manufacturer= \
650 ro.product.device=
651# TODO: Remove this soon-to-be obsolete property
652sdk_build_prop_remove += ro.build.product=
653INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
654$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
655 @echo SDK buildinfo: $@
656 @mkdir -p $(dir $@)
657 $(hide) grep -v "$(subst $(space),\|,$(strip \
Anton Hansson6d814982018-11-26 18:12:05 +0000658 $(sdk_build_prop_remove)))" $< > $@.tmp
The Android Open Source Project88b60792009-03-03 19:28:42 -0800659 $(hide) for x in $(sdk_build_prop_remove); do \
Anton Hansson6d814982018-11-26 18:12:05 +0000660 echo "$$x"generic >> $@.tmp; done
The Android Open Source Project88b60792009-03-03 19:28:42 -0800661 $(hide) mv $@.tmp $@
662
663# -----------------------------------------------------------------
664# package stats
Bill Peckhamd52fd9b2019-04-16 10:06:13 -0700665ifdef BUILDING_SYSTEM_IMAGE
666
The Android Open Source Project88b60792009-03-03 19:28:42 -0800667PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
668PACKAGES_TO_STAT := \
669 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
670 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
671$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
672 @echo Package stats: $@
673 @mkdir -p $(dir $@)
674 $(hide) rm -f $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700675ifeq ($(PACKAGES_TO_STAT),)
676# Create empty package stats file if target builds no jar(s) or apk(s).
677 $(hide) touch $@
678else
Colin Crossfdea8932017-12-06 14:38:40 -0800679 $(hide) build/make/tools/dump-package-stats $^ > $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700680endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800681
682.PHONY: package-stats
683package-stats: $(PACKAGE_STATS_FILE)
684
Bill Peckhamd52fd9b2019-04-16 10:06:13 -0700685endif # BUILDING_SYSTEM_IMAGE
686
The Android Open Source Project88b60792009-03-03 19:28:42 -0800687# -----------------------------------------------------------------
688# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700689# Use a macro to add newline to each echo command
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100690define _apkcerts_write_line
691$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
692$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
693$(hide) echo '' >> $5
Ying Wangd9a88d52012-10-26 09:21:28 -0700694
695endef
696
The Android Open Source Project88b60792009-03-03 19:28:42 -0800697name := $(TARGET_PRODUCT)
698ifeq ($(TARGET_BUILD_TYPE),debug)
699 name := $(name)_debug
700endif
701name := $(name)-apkcerts-$(FILE_NAME_TAG)
702intermediates := \
703 $(call intermediates-dir-for,PACKAGING,apkcerts)
704APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800705# We don't need to really build all the modules.
706# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700707$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800708 @echo APK certs list: $@
709 @mkdir -p $(dir $@)
710 @rm -f $@
Ying Wangd9a88d52012-10-26 09:21:28 -0700711 $(foreach p,$(PACKAGES),\
712 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100713 $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
714 $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
Ying Wangd9a88d52012-10-26 09:21:28 -0700715 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700716 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800717
718.PHONY: apkcerts-list
719apkcerts-list: $(APKCERTS_FILE)
720
Ying Wang15e487a2011-02-15 10:56:18 -0800721ifneq (,$(TARGET_BUILD_APPS))
722 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900723 $(call dist-for-goals, apps_only, $(SOONG_APEX_KEYS_FILE):apexkeys.txt)
Ying Wang15e487a2011-02-15 10:56:18 -0800724endif
Ying Wangefb21682010-07-23 16:42:13 -0700725
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900726
The Android Open Source Project88b60792009-03-03 19:28:42 -0800727# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700728# build system stats
729BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
730$(BUILD_SYSTEM_STATS):
731 @rm -f $@
732 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
733 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
734$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700735
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700736# -----------------------------------------------------------------
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800737# build /product/etc/security/avb/system_other.avbpubkey if needed
738ifdef BUILDING_SYSTEM_OTHER_IMAGE
Bowgo Tsai8802b712019-03-21 14:24:31 +0800739ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800740INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET := $(TARGET_OUT_PRODUCT_ETC)/security/avb/system_other.avbpubkey
741ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET)
Bowgo Tsai8802b712019-03-21 14:24:31 +0800742endif # BOARD_AVB_ENABLE
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800743endif # BUILDING_SYSTEM_OTHER_IMAGE
744
745# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700746# Modules ready to be converted to Soong, ordered by how many
747# modules depend on them.
748SOONG_CONV := $(sort $(SOONG_CONV))
749SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
750$(SOONG_CONV_DATA):
751 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800752 @$(foreach s,$(SOONG_CONV),echo "$(s),$(SOONG_CONV.$(s).TYPE),$(sort $(SOONG_CONV.$(s).PROBLEMS)),$(sort $(filter-out $(SOONG_ALREADY_CONV),$(SOONG_CONV.$(s).DEPS)))" >>$@;)
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700753
Colin Crossfdea8932017-12-06 14:38:40 -0800754SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700755SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
756$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
757 @rm -f $@
758 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
759$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
760
761# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800762# Modules use -Wno-error, or added default -Wall -Werror
763WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
764$(WALL_WERROR):
765 @rm -f $@
766 echo "# Modules using -Wno-error" >> $@
767 for m in $(sort $(SOONG_MODULES_USING_WNO_ERROR) $(MODULES_USING_WNO_ERROR)); do echo $$m >> $@; done
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800768 echo "# Modules added default -Wall" >> $@
769 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
770
771$(call dist-for-goals,droidcore,$(WALL_WERROR))
772
773# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800774# Modules missing profile files
775PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
776$(PGO_PROFILE_MISSING):
777 @rm -f $@
778 echo "# Modules missing PGO profile files" >> $@
779 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
780
781$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
782
783# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700784# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700785# for future OTA packages installed by this system. Actual product
786# deliverables will be re-signed by hand. We expect this file to
787# exist with the suffixes ".x509.pem" and ".pk8".
Colin Cross21122f92018-09-14 21:51:11 -0700788DEFAULT_KEY_CERT_PAIR := $(strip $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
Doug Zongker8678df42009-06-15 14:30:14 -0700789
790
Jeff Browne33ba4c2011-07-11 22:11:46 -0700791# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800792# if they don't do anything.
793.PHONY: systemimage
794systemimage:
795
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800796# -----------------------------------------------------------------
797
798.PHONY: event-log-tags
799
Joe Onoratob7510532010-07-14 10:22:54 -0700800# Produce an event logs tag file for everything we know about, in order
801# to properly allocate numbers. Then produce a file that's filtered
802# for what's going to be installed.
803
804all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
805
Colin Crossdc8f8e42012-04-12 13:25:54 -0700806event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
807
Joe Onoratob7510532010-07-14 10:22:54 -0700808# Include tags from all packages that we know about
809all_event_log_tags_src := \
810 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
811
Colin Crossdc8f8e42012-04-12 13:25:54 -0700812# PDK builds will already have a full list of tags that needs to get merged
813# in with the ones from source
814pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
815
816$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src) $(pdk_fusion_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800817$(all_event_log_tags_file): $(all_event_log_tags_src) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/make/tools/event_log_tags.py
Joe Onoratob7510532010-07-14 10:22:54 -0700818 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900819 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700820
Doug Zongkera34fa952011-02-23 12:17:29 -0800821# Include tags from all packages included in this product, plus all
822# tags that are part of the system (ie, not in a vendor/ or device/
823# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800824event_log_tags_src := \
825 $(sort $(foreach m,\
Anton Hansson8dab0a62019-03-28 15:45:40 +0000826 $(PRODUCT_PACKAGES) \
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800827 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800828 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
829 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800830
Colin Crossdc8f8e42012-04-12 13:25:54 -0700831$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700832$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800833$(event_log_tags_file): $(event_log_tags_src) $(all_event_log_tags_file) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/make/tools/event_log_tags.py
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800834 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900835 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800836
837event-log-tags: $(event_log_tags_file)
838
839ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
840
Joe Onoratob7510532010-07-14 10:22:54 -0700841
The Android Open Source Project88b60792009-03-03 19:28:42 -0800842# #################################################################
843# Targets for boot/OS images
844# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800845ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
846 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
847 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
848 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
849 else
850 INSTALLED_2NDBOOTLOADER_TARGET :=
851 endif
852else
853 INSTALLED_BOOTLOADER_MODULE :=
854 INSTALLED_2NDBOOTLOADER_TARGET :=
855endif # TARGET_NO_BOOTLOADER
856ifneq ($(strip $(TARGET_NO_KERNEL)),true)
857 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
858else
859 INSTALLED_KERNEL_TARGET :=
860endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800861
862# -----------------------------------------------------------------
Tom Cherryd14b8952018-08-09 14:26:00 -0700863# the root dir
864INTERNAL_ROOT_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800865 $(ALL_GENERATED_SOURCES) \
866 $(ALL_DEFAULT_INSTALLED_MODULES))
867
Luis Hector Chavezff489932018-07-03 15:41:40 -0700868INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
869INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
870$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700871$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700872 @echo Installed file list: $@
873 @mkdir -p $(dir $@)
874 @rm -f $@
875 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
876 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
877
878$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
879
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800880#------------------------------------------------------------------
881# dtb
882
883ifdef BOARD_PREBUILT_DTBIMAGE_DIR
884INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Hridya Valsarajuc63a7442019-02-07 11:38:18 -0800885$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb))
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800886 cat $^ > $@
887endif
888
Tom Cherryd14b8952018-08-09 14:26:00 -0700889# -----------------------------------------------------------------
890# the ramdisk
Dan Willemsen67495202019-01-16 12:42:05 -0800891ifdef BUILDING_RAMDISK_IMAGE
Tom Cherryd14b8952018-08-09 14:26:00 -0700892INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \
893 $(ALL_GENERATED_SOURCES) \
894 $(ALL_DEFAULT_INSTALLED_MODULES))
895
896INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt
897INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json)
898$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK)
899$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
900 @echo Installed file list: $@
SzuWei Lin29770fa2019-03-28 11:46:48 +0800901 @mkdir -p $(TARGET_RAMDISK_OUT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700902 @mkdir -p $(dir $@)
903 @rm -f $@
904 $(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json)
905 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
906
907$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
Joe Onorato64d85d02009-04-09 19:31:12 -0700908BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
909
910# We just build this directly to the install location.
911INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Tom Cherryd14b8952018-08-09 14:26:00 -0700912$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800913 $(call pretty,"Target ram disk: $@")
Tom Cherryd14b8952018-08-09 14:26:00 -0700914 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800915
Ying Wangad7fd292013-08-08 16:34:29 -0700916.PHONY: ramdisk-nodeps
917ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
918 @echo "make $@: ignoring dependencies"
Tom Cherryd14b8952018-08-09 14:26:00 -0700919 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800920
Dan Willemsen67495202019-01-16 12:42:05 -0800921endif # BUILDING_RAMDISK_IMAGE
922
923
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700924INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
925
The Android Open Source Project88b60792009-03-03 19:28:42 -0800926ifneq ($(strip $(TARGET_NO_KERNEL)),true)
927
928# -----------------------------------------------------------------
929# the boot image, which is a collection of other images.
930INTERNAL_BOOTIMAGE_ARGS := \
931 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700932 --kernel $(INSTALLED_KERNEL_TARGET)
933
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800934ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
935 INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
936endif
937
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700938ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
939INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
940endif
941
The Android Open Source Project88b60792009-03-03 19:28:42 -0800942INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
943
Dima Zavin1e0847c2009-05-07 19:43:08 -0700944ifdef BOARD_KERNEL_BASE
945 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
946endif
947
Ying Wangffff0022010-08-23 12:56:25 -0700948ifdef BOARD_KERNEL_PAGESIZE
949 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
950endif
951
Anton Hansson8dab0a62019-03-28 15:45:40 +0000952ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700953ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Anton Hansson8dab0a62019-03-28 15:45:40 +0000954VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700955 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
956endif
957endif
958
Anton Hansson72e36f02019-02-26 17:36:30 +0000959INTERNAL_KERNEL_CMDLINE := $(strip $(INTERNAL_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700960ifdef INTERNAL_KERNEL_CMDLINE
961INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700962endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700963
Sami Tolvanen3303d902016-03-15 16:49:30 +0000964INTERNAL_MKBOOTIMG_VERSION_ARGS := \
965 --os_version $(PLATFORM_VERSION) \
966 --os_patch_level $(PLATFORM_SECURITY_PATCH)
967
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800968# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
969ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800970ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800971$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400972
973else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
974
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800975$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400976 $(call pretty,"Target boot image: $@")
977 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800978 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400979 $(hide) $(AVBTOOL) add_hash_footer \
980 --image $@ \
981 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800982 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400983 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
984
985.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800986bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400987 @echo "make $@: ignoring dependencies"
988 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800989 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400990 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800991 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400992 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800993 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400994 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
995
Anton Hansson8dab0a62019-03-28 15:45:40 +0000996else ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700997
998$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
999 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001000 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Anton Hansson8dab0a62019-03-28 15:45:40 +00001001 $(BOOT_SIGNER) /boot $@ $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $@
Geremy Condra740b6632014-07-08 20:07:41 -07001002 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1003
1004.PHONY: bootimage-nodeps
1005bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
1006 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001007 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001008 $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET)
Geremy Condra740b6632014-07-08 20:07:41 -07001009 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1010
Anton Hansson8dab0a62019-03-28 15:45:40 +00001011else ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -08001012
Tao Bao4b577412017-02-22 22:54:39 -08001013$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -08001014 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001015 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Anton Hansson8dab0a62019-03-28 15:45:40 +00001016 $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
David Riley17be3d32015-03-03 08:54:11 -08001017 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1018
1019.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -08001020bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -08001021 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001022 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Anton Hansson8dab0a62019-03-28 15:45:40 +00001023 $(VBOOT_SIGNER) $(FUTILITY) $(INSTALLED_BOOTIMAGE_TARGET).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(INSTALLED_BOOTIMAGE_TARGET).keyblock $(INSTALLED_BOOTIMAGE_TARGET)
David Riley17be3d32015-03-03 08:54:11 -08001024 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1025
1026else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -08001027
1028$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
1029 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001030 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001031 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001032
1033.PHONY: bootimage-nodeps
1034bootimage-nodeps: $(MKBOOTIMG)
1035 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001036 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001037 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001038
The Android Open Source Project88b60792009-03-03 19:28:42 -08001039endif # TARGET_BOOTIMAGE_USE_EXT2
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001040endif # BOARD_USES_RECOVERY_AS_BOOT
The Android Open Source Project88b60792009-03-03 19:28:42 -08001041
Tao Baob1a2e352018-08-14 16:17:12 -07001042else # TARGET_NO_KERNEL == "true"
Michael Schwartz0dc6f212017-07-18 10:05:13 -07001043ifdef BOARD_PREBUILT_BOOTIMAGE
1044ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
1045# Remove when b/63676296 is resolved.
1046$(error Prebuilt bootimage is only supported for AB targets)
1047endif
1048$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
Tao Baob1a2e352018-08-14 16:17:12 -07001049else # BOARD_PREBUILT_BOOTIMAGE not defined
Tao Baob1a2e352018-08-14 16:17:12 -07001050INSTALLED_BOOTIMAGE_TARGET :=
1051endif # BOARD_PREBUILT_BOOTIMAGE
1052endif # TARGET_NO_KERNEL
The Android Open Source Project88b60792009-03-03 19:28:42 -08001053
1054# -----------------------------------------------------------------
1055# NOTICE files
1056#
Steve Blockd14d3b42012-03-01 11:34:41 +00001057# We are required to publish the licenses for all code under BSD, GPL and
1058# Apache licenses (and possibly other more exotic ones as well). We err on the
1059# side of caution, so the licenses for other third-party code are included here
1060# too.
1061#
The Android Open Source Project88b60792009-03-03 19:28:42 -08001062# This needs to be before the systemimage rules, because it adds to
1063# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
1064# go into the systemimage.
1065
Steve Block495e5852012-02-29 19:18:08 +00001066.PHONY: notice_files
1067
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001068# Create the rule to combine the files into text and html/xml forms
Dario Freniadc972d2018-07-09 18:38:38 +01001069# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001070# $(2) - Plain text output file
1071# $(3) - HTML/XML output file
1072# $(4) - File title
1073# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -08001074# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001075# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -08001076#
1077# The algorithm here is that we go collect a hash for each of the notice
1078# files and write the names of the files that match that hash. Then
1079# to generate the real files, we go print out all of the files and their
1080# hashes.
1081#
1082# These rules are fairly complex, so they depend on this makefile so if
1083# it changes, they'll run again.
1084#
1085# TODO: We could clean this up so that we just record the locations of the
1086# original notice files instead of making rules to copy them somwehere.
1087# Then we could traverse that without quite as much bash drama.
1088define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001089$(2) $(3): PRIVATE_MESSAGE := $(4)
1090$(2) $(3): PRIVATE_DIR := $(5)
1091$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -08001092$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
1093 build/make/tools/generate-notice-files.py --text-output $(2) \
Anton Hansson6d814982018-11-26 18:12:05 +00001094 $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e product_services --xml-output, \
1095 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
1096 $(if $(filter $(1),xml_product),-i product --xml-output, \
1097 $(if $(filter $(1),xml_product_services),-i product_services --xml-output, \
1098 --html-output)))) $(3) \
1099 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001100notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001101endef
1102
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001103# Notice file logic isn't relevant for TARGET_BUILD_APPS
1104ifndef TARGET_BUILD_APPS
1105
The Android Open Source Project88b60792009-03-03 19:28:42 -08001106# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
1107# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
1108# the src subdirectory.
Steve Block495e5852012-02-29 19:18:08 +00001109target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Steve Block495e5852012-02-29 19:18:08 +00001110tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08001111tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001112kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
1113winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
1114pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001115
Steven Morelandae69e572017-12-15 14:49:55 -08001116# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001117ifneq ($(PRODUCT_NOTICE_SPLIT),true)
1118target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
1119target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
1120installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
1121$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001122 $(target_notice_file_txt), \
1123 $(target_notice_file_html), \
1124 "Notices for files contained in the filesystem images in this directory:", \
1125 $(TARGET_OUT_NOTICE_FILES), \
1126 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001127$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
1128 $(hide) $(MINIGZIP) -9 < $< > $@
1129$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
1130 $(copy-file-to-target)
1131else
1132target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
1133target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001134installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
1135
1136target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
1137target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
1138target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
1139installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
Dario Freniadc972d2018-07-09 18:38:38 +01001140
1141target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
1142target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
1143target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
1144installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
Dario Frenicbca1132018-08-28 18:04:03 +01001145
1146target_product_services_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.txt
1147target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml
1148target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz
1149installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001150
Anton Hansson6ad6f6c2018-11-12 23:33:47 +00001151# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
1152# being built. A notice xml file must depend on all modules that could potentially
1153# install a license file relevant to it.
1154license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
1155# Phonys/fakes don't have notice files (though their deps might)
1156license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
1157license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
1158license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
1159license_modules_product_services := $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(license_modules))
1160license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_product_services)
1161license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001162
Dario Frenicbca1132018-08-28 18:04:03 +01001163$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
Anton Hansson6d814982018-11-26 18:12:05 +00001164 $(target_notice_file_txt), \
1165 $(target_notice_file_xml), \
1166 "Notices for files contained in the filesystem images in this directory:", \
1167 $(TARGET_OUT_NOTICE_FILES), \
1168 $(license_modules_rest)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001169$(eval $(call combine-notice-files, xml_vendor, \
Anton Hansson6d814982018-11-26 18:12:05 +00001170 $(target_vendor_notice_file_txt), \
1171 $(target_vendor_notice_file_xml), \
1172 "Notices for files contained in the vendor filesystem image in this directory:", \
1173 $(TARGET_OUT_NOTICE_FILES), \
1174 $(license_modules_vendor)))
Dario Freniadc972d2018-07-09 18:38:38 +01001175$(eval $(call combine-notice-files, xml_product, \
Anton Hansson6d814982018-11-26 18:12:05 +00001176 $(target_product_notice_file_txt), \
1177 $(target_product_notice_file_xml), \
1178 "Notices for files contained in the product filesystem image in this directory:", \
1179 $(TARGET_OUT_NOTICE_FILES), \
1180 $(license_modules_product)))
Dario Frenicbca1132018-08-28 18:04:03 +01001181$(eval $(call combine-notice-files, xml_product_services, \
Anton Hansson6d814982018-11-26 18:12:05 +00001182 $(target_product_services_notice_file_txt), \
1183 $(target_product_services_notice_file_xml), \
1184 "Notices for files contained in the product_services filesystem image in this directory:", \
1185 $(TARGET_OUT_NOTICE_FILES), \
1186 $(license_modules_product_services)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001187
1188$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
1189 $(hide) $(MINIGZIP) -9 < $< > $@
1190$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
1191 $(hide) $(MINIGZIP) -9 < $< > $@
1192$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
1193 $(hide) $(MINIGZIP) -9 < $< > $@
1194$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
1195 $(hide) $(MINIGZIP) -9 < $< > $@
1196$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
1197 $(copy-file-to-target)
1198$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
1199 $(copy-file-to-target)
1200$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
1201 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001202
1203# No notice file for product_services if its contents are merged into /product.
1204# The notices will be part of the /product notice file.
1205ifndef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001206$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
1207 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001208endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001209
1210# if we've been run my mm, mmm, etc, don't reinstall this every time
1211ifeq ($(ONE_SHOT_MAKEFILE),)
1212 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
1213 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
1214 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
1215 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
Dario Frenicbca1132018-08-28 18:04:03 +01001216endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001217endif # PRODUCT_NOTICE_SPLIT
1218
1219ifeq ($(ONE_SHOT_MAKEFILE),)
1220 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001221endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001222
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001223$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001224 $(tools_notice_file_txt), \
1225 $(tools_notice_file_html), \
1226 "Notices for files contained in the tools directory:", \
1227 $(HOST_OUT_NOTICE_FILES), \
1228 $(ALL_DEFAULT_INSTALLED_MODULES) \
1229 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001230
Ying Wang62c81f82013-08-22 20:02:03 -07001231endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -08001232
1233# The kernel isn't really a module, so to get its module file in there, we
1234# make the target NOTICE files depend on this particular file too, which will
1235# then be in the right directory for the find in combine-notice-files to work.
1236$(kernel_notice_file): \
Lee Campbellb463fcd2015-11-08 16:28:15 -08001237 $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001238 | $(ACP)
1239 @echo Copying: $@
1240 $(hide) mkdir -p $(dir $@)
1241 $(hide) $(ACP) $< $@
1242
Josh Gao4d9268e2017-02-23 13:17:46 -08001243$(winpthreads_notice_file): \
1244 $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
1245 | $(ACP)
1246 @echo Copying: $@
1247 $(hide) mkdir -p $(dir $@)
1248 $(hide) $(ACP) $< $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08001249
Doug Zongker8678df42009-06-15 14:30:14 -07001250# -----------------------------------------------------------------
1251# Build a keystore with the authorized keys in it, used to verify the
1252# authenticity of downloaded OTA packages.
1253#
1254# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
1255# before the rules that use that variable to build the image.
Dan Willemsenb589ae42015-10-29 21:26:18 +00001256ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
Colin Cross21122f92018-09-14 21:51:11 -07001257$(TARGET_OUT_ETC)/security/otacerts.zip: PRIVATE_CERT := $(DEFAULT_KEY_CERT_PAIR).x509.pem
1258$(TARGET_OUT_ETC)/security/otacerts.zip: $(SOONG_ZIP)
1259$(TARGET_OUT_ETC)/security/otacerts.zip: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Doug Zongker8678df42009-06-15 14:30:14 -07001260 $(hide) rm -f $@
1261 $(hide) mkdir -p $(dir $@)
Colin Cross21122f92018-09-14 21:51:11 -07001262 $(hide) $(SOONG_ZIP) -o $@ -C $(dir $(PRIVATE_CERT)) -f $(PRIVATE_CERT)
Doug Zongker8678df42009-06-15 14:30:14 -07001263
Alex Deymocec578c2017-03-28 20:48:18 -07001264# Carry the public key for update_engine if it's a non-IoT target that
Tao Bao38812d62016-01-20 20:58:20 -08001265# uses the AB updater. We use the same key as otacerts but in RSA public key
1266# format.
1267ifeq ($(AB_OTA_UPDATER),true)
Alex Deymocec578c2017-03-28 20:48:18 -07001268ifneq ($(PRODUCT_IOT),true)
Tao Bao23c3db92016-01-21 14:28:50 -08001269ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Colin Cross21122f92018-09-14 21:51:11 -07001270$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Tao Bao38812d62016-01-20 20:58:20 -08001271 $(hide) rm -f $@
1272 $(hide) mkdir -p $(dir $@)
1273 $(hide) openssl x509 -pubkey -noout -in $< > $@
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001274
Tao Bao696bb332018-08-17 16:27:01 -07001275ALL_DEFAULT_INSTALLED_MODULES += \
1276 $(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem
1277$(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem: \
Anton Hansson6d814982018-11-26 18:12:05 +00001278 $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001279 $(hide) cp -f $< $@
Tao Bao38812d62016-01-20 20:58:20 -08001280endif
1281endif
1282
Doug Zongker8678df42009-06-15 14:30:14 -07001283.PHONY: otacerts
1284otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
1285
1286
The Android Open Source Project88b60792009-03-03 19:28:42 -08001287# #################################################################
1288# Targets for user images
1289# #################################################################
1290
Ying Wang933abf12010-06-16 14:31:34 -07001291INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001292ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001293INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1294else
1295ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001296INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1297else
1298ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001299INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1300endif
1301endif
1302endif
1303
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001304# These options tell the recovery updater/installer how to mount the partitions writebale.
1305# <fstype>=<fstype_opts>[|<fstype_opts>]...
1306# fstype_opts := <opt>[,<opt>]...
1307# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001308# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1309DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS := ext4=max_batch_time=0,commit=1,data=ordered,barrier=1,errors=panic,nodelalloc
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001310
Ying Wang542903a2010-11-17 15:40:38 -08001311ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1312 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1313endif
1314
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001315INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
Mark Salyzyn780f5952018-10-19 13:44:36 -07001316INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK) $(TUNE2FS)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001317ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1318INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1319endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001320
Chris Friesdf0387d2017-06-21 15:51:46 -05001321ifeq ($(BOARD_AVB_ENABLE),true)
1322INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1323endif
1324
Todd Poynorb2a555e2015-12-15 18:00:14 -08001325ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1326 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1327endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001328ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE) $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
Mohamad Ayyash353265b2015-06-24 15:42:19 -07001329INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001330endif
1331
Ying Wang178ef922011-10-31 18:13:30 -07001332INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001333
Anton Hansson8dab0a62019-03-28 15:45:40 +00001334ifeq (true,$(PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001335INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001336ifeq (true,$(PRODUCT_SUPPORTS_VERITY_FEC))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001337INTERNAL_USERIMAGES_DEPS += $(FEC)
1338endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001339endif
1340
Alex Klyubin092c9022017-03-13 13:28:34 -07001341SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001342INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1343
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001344INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1345
Jin Qianabcec5e2017-03-10 16:53:45 -08001346INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
Jin Qianabcec5e2017-03-10 16:53:45 -08001347
Yifan Hongc5c01242018-11-09 10:27:23 -08001348ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001349
Anton Hansson8dab0a62019-03-28 15:45:40 +00001350ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001351 $(error vboot 1.0 doesn't support logical partition)
1352endif
1353
1354# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1355# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1356
Yifan Hongc5c01242018-11-09 10:27:23 -08001357endif # PRODUCT_USE_DYNAMIC_PARTITIONS
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001358
Ying Wangbd93d422011-10-28 17:02:30 -07001359# $(1): the path of the output dictionary file
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001360# $(2): a subset of "system vendor cache userdata product product_services oem odm"
Yifan Hong760d3c02018-05-30 11:16:46 -07001361# $(3): additional "key=value" pairs to append to the dictionary file.
1362define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001363$(if $(filter $(2),system),\
1364 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
Bowgo Tsai867ab662019-01-29 13:30:18 +08001365 $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001366 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1367 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1368 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1369 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1370 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1371 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1372 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1373 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001374 $(if $(PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1375 $(if $(PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCT_SYSTEM_HEADROOM)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001376 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001377)
Yifan Hong760d3c02018-05-30 11:16:46 -07001378$(if $(filter $(2),userdata),\
1379 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1380 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
1381)
Yifan Hong760d3c02018-05-30 11:16:46 -07001382$(if $(filter $(2),cache),\
1383 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1384 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
1385)
1386$(if $(filter $(2),vendor),\
1387 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1388 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1389 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1390 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1391 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1392 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1393 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1394 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1395 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001396 $(if $(PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
Yifan Hong749062d2018-06-19 16:23:16 -07001397 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001398)
1399$(if $(filter $(2),product),\
1400 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1401 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1402 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1403 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1404 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1405 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1406 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1407 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1408 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001409 $(if $(PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
Yifan Hong56a6c3b2018-07-20 15:19:34 -07001410 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001411)
Yifan Hongebc041a2018-07-26 16:02:52 -07001412$(if $(filter $(2),product_services),\
1413 $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_services_fs_type=$(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1414 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_services_extfs_inode_count=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1415 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_services_extfs_rsv_pct=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT)" >> $(1))
1416 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),$(hide) echo "product_services_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)" >> $(1))
1417 $(if $(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE),$(hide) echo "product_services_journal_size=$(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE)" >> $(1))
1418 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_services_squashfs_compressor=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1419 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_services_squashfs_compressor_opt=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1420 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_services_squashfs_block_size=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1421 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_services_squashfs_disable_4k_align=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1422 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_services_reserved_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001423)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001424$(if $(filter $(2),odm),\
1425 $(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1426 $(if $(BOARD_ODMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_extfs_inode_count=$(BOARD_ODMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1427 $(if $(BOARD_ODMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_extfs_rsv_pct=$(BOARD_ODMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1428 $(if $(BOARD_ODMIMAGE_PARTITION_SIZE),$(hide) echo "odm_size=$(BOARD_ODMIMAGE_PARTITION_SIZE)" >> $(1))
1429 $(if $(BOARD_ODMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_journal_size=$(BOARD_ODMIMAGE_JOURNAL_SIZE)" >> $(1))
1430 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_squashfs_compressor=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1431 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_squashfs_compressor_opt=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1432 $(if $(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_squashfs_block_size=$(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1433 $(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001434 $(if $(PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCT_ODM_BASE_FS_PATH)" >> $(1))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001435 $(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
1436)
Yifan Hong760d3c02018-05-30 11:16:46 -07001437$(if $(filter $(2),oem),\
1438 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1439 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1440 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1441 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1442)
Tao Bao3602eca2018-07-10 10:53:55 -07001443$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001444
Tao Bao3602eca2018-07-10 10:53:55 -07001445$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001446$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001447$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001448$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1449$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1450$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001451$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001452$(if $(PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
1453$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCT_SUPPORTS_VERITY)" >> $(1))
1454$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
1455$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
1456$(if $(PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1))
Bowgo Tsai6ceeb1a2017-10-11 16:21:48 +08001457$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001458$(if $(PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1459$(if $(PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
1460$(if $(PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
1461$(if $(PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION),$(hide) echo "product_services_verity_block_device=$(PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION)" >> $(1))
1462$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1463$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
1464$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
1465$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
1466$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001467$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001468$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1469$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1470$(if $(BOARD_AVB_ENABLE),\
1471 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1472 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1473 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1474 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08001475$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1476$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1477$(if $(BOARD_AVB_ENABLE),\
1478 $(if $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH),\
1479 $(hide) echo "avb_system_other_key_path=$(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)" >> $(1)
Bowgo Tsaie4544b12019-02-27 10:15:51 +08001480 $(hide) echo "avb_system_other_algorithm=$(BOARD_AVB_SYSTEM_OTHER_ALGORITHM)" >> $(1)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001481$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1482$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1483$(if $(BOARD_AVB_ENABLE),\
1484 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1485 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1486 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1487 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001488$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1489$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1490$(if $(BOARD_AVB_ENABLE),\
1491 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1492 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1493 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1494 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Tao Bao1ebda8d2018-08-01 17:21:14 -07001495$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_services_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1496$(if $(BOARD_AVB_ENABLE),\
1497 $(hide) echo "avb_product_services_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001498$(if $(BOARD_AVB_ENABLE),\
1499 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
Yifan Hongebc041a2018-07-26 16:02:52 -07001500 $(hide) echo "avb_product_services_key_path=$(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH)" >> $(1)
1501 $(hide) echo "avb_product_services_algorithm=$(BOARD_AVB_PRODUCT_SERVICES_ALGORITHM)" >> $(1)
1502 $(hide) echo "avb_product_services_rollback_index_location=$(BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001503$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1504$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1505$(if $(BOARD_AVB_ENABLE),\
1506 $(if $(BOARD_AVB_ODM_KEY_PATH),\
1507 $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1)
1508 $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1)
1509 $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001510$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1511 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001512$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Tom Cherryd14b8952018-08-09 14:26:00 -07001513 $(hide) echo "system_root_image=true" >> $(1))
1514$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
Yifan Hong2dae5722018-07-31 12:47:27 -07001515$(if $(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),$(hide) echo "use_dynamic_partition_size=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001516$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1517endef
1518
1519# $(1): the path of the output dictionary file
1520# $(2): additional "key=value" pairs to append to the dictionary file.
1521define generate-userimage-prop-dictionary
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001522$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product product_services oem odm,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001523endef
1524
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001525# $(1): the path of the input dictionary file, where each line has the format key=value
1526# $(2): the key to look up
1527define read-image-prop-dictionary
1528$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1529endef
1530
Xu Chao2b04bf42017-07-06 14:34:31 +08001531# $(1): modules list
1532# $(2): output dir
1533# $(3): mount point
1534# $(4): staging dir
1535# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1536define build-image-kernel-modules
1537 $(hide) rm -rf $(2)/lib/modules
1538 $(hide) mkdir -p $(2)/lib/modules
1539 $(hide) cp $(1) $(2)/lib/modules/
1540 $(hide) rm -rf $(4)
1541 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1542 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1543 $(hide) $(DEPMOD) -b $(4) 0.0
1544 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1545 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1546endef
1547
The Android Open Source Project88b60792009-03-03 19:28:42 -08001548# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001549# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001550
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001551# Recovery image exists if we are building recovery, or building recovery as boot.
1552ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001553
Ying Wang37526142015-03-10 12:02:57 -07001554INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1555 $(ALL_DEFAULT_INSTALLED_MODULES))
1556
Tao Bao10fc9492018-08-14 12:17:48 -07001557INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
1558INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
1559
1560# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other
1561# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in
1562# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with
1563# the call to FILELIST.
1564ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
1565$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET)
1566else
1567$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET)
1568endif
1569
1570$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY)
1571$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST)
1572 @echo Installed file list: $@
1573 @mkdir -p $(dir $@)
1574 @rm -f $@
1575 $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
1576 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
1577
Doug Zongker4647f122009-07-02 09:00:54 -07001578recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001579recovery_sepolicy := \
1580 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001581 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001582 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001583 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001584 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts \
Bowgo Tsai99671252017-11-30 22:15:17 +08001585 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001586 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts \
1587 $(TARGET_RECOVERY_ROOT_OUT)/product_file_contexts \
1588 $(TARGET_RECOVERY_ROOT_OUT)/product_property_contexts
Bowgo Tsai99671252017-11-30 22:15:17 +08001589
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001590# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1591# SELinux files
1592IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1593
Doug Zongker4647f122009-07-02 09:00:54 -07001594recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1595recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Doug Zongker4647f122009-07-02 09:00:54 -07001596recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001597
Tao Baoe1e829e2018-08-29 20:36:00 -07001598# Set recovery_density to a density bucket based on PRODUCT_AAPT_PREF_CONFIG if set. Otherwise use
1599# the default medium density.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001600ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001601# If PRODUCT_AAPT_PREF_CONFIG includes a non-numeric dpi bucket, always perfer that value.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001602recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001603ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density)))
1604recovery_density_value := $(patsubst %dpi,%,$(recovery_density))
1605# Map the numeric dpi value to a bucket. We roughly use the medium point between the primary
1606# densities to split buckets.
1607# ------160------240------320----------480------------640------
1608# mdpi hdpi xhdpi xxhdpi xxxhdpi
1609recovery_density := $(strip \
1610 $(or $(if $(filter $(shell echo $$(($(recovery_density_value) >= 560))),1),xxxhdpi),\
1611 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 400))),1),xxhdpi),\
1612 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
1613 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
Doug Zongker8eaeea92014-05-12 15:32:20 -07001614endif
Tao Baoe1e829e2018-08-29 20:36:00 -07001615else # PRODUCT_AAPT_PREF_CONFIG is empty
1616recovery_density := mdpi
1617endif # PRODUCT_AAPT_PREF_CONFIG
Doug Zongker8eaeea92014-05-12 15:32:20 -07001618
1619ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1620recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1621else
Doug Zongker25d55f82014-04-04 13:51:15 -07001622recovery_resources_common := $(recovery_resources_common)-xhdpi
1623endif
1624
Tao Baoe1e829e2018-08-29 20:36:00 -07001625# Select the 18x32 font on high-density devices (xhdpi and up); and the 12x22 font on other devices.
1626# Note that the font selected here can be overridden for a particular device by putting a font.png
1627# in its private recovery resources.
1628ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001629recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1630else
1631recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1632endif
1633
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001634
1635# We will only generate the recovery background text images if the variable
1636# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the
1637# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for
1638# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their
1639# BoardConfig in order to use this feature.
1640ifeq ($(recovery_density),xxxhdpi)
1641TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440
1642else ifeq ($(recovery_density),xxhdpi)
1643TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080
1644endif
1645
1646ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),)
1647# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative.
1648ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
1649 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10))
1650else
1651 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10))
1652endif
1653
1654
1655RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png
1656RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
1657RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
1658RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
1659RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
1660
xunchangcc57d312018-12-07 12:12:17 -08001661RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
1662RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
1663RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
1664RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
1665RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
1666
1667generated_recovery_text_files := \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001668 $(RECOVERY_INSTALLING_TEXT_FILE) \
1669 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
1670 $(RECOVERY_ERASING_TEXT_FILE) \
1671 $(RECOVERY_ERROR_TEXT_FILE) \
xunchangcc57d312018-12-07 12:12:17 -08001672 $(RECOVERY_NO_COMMAND_TEXT_FILE) \
1673 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
1674 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
1675 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
1676 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
1677 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001678
1679resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
1680image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
xunchangcc57d312018-12-07 12:12:17 -08001681zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001682$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
1683$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
1684$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
1685$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
xunchangcc57d312018-12-07 12:12:17 -08001686$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001687$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
xunchangdbe55e12018-12-19 17:15:14 -08001688$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001689 recovery_installing \
1690 recovery_installing_security \
1691 recovery_erasing \
1692 recovery_error \
xunchangdbe55e12018-12-19 17:15:14 -08001693 recovery_no_command
1694$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001695 recovery_cancel_wipe_data \
1696 recovery_factory_data_reset \
1697 recovery_try_again \
1698 recovery_wipe_data_menu_header \
1699 recovery_wipe_data_confirmation
1700$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
1701$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001702 # Prepares the font directory.
1703 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1704 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
xunchangcc57d312018-12-07 12:12:17 -08001705 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001706 @rm -rf $(dir $@)
1707 @mkdir -p $(dir $@)
xunchangdbe55e12018-12-19 17:15:14 -08001708 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
xunchangcc57d312018-12-07 12:12:17 -08001709 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
xunchangdbe55e12018-12-19 17:15:14 -08001710 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001711 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
1712 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
1713 --text_name $(text_name) \
1714 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
1715 --resource_dir $(PRIVATE_RESOURCE_DIR) \
xunchangdbe55e12018-12-19 17:15:14 -08001716 --output_file $(output_file) $(center_alignment) && \
xunchangcc57d312018-12-07 12:12:17 -08001717 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001718else
1719RECOVERY_INSTALLING_TEXT_FILE :=
1720RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
1721RECOVERY_ERASING_TEXT_FILE :=
1722RECOVERY_ERROR_TEXT_FILE :=
1723RECOVERY_NO_COMMAND_TEXT_FILE :=
xunchangcc57d312018-12-07 12:12:17 -08001724RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
1725RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
1726RECOVERY_TRY_AGAIN_TEXT_FILE :=
1727RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
1728RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001729endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
1730
Ying Wang9a175682015-08-06 11:47:47 -07001731ifndef TARGET_PRIVATE_RES_DIRS
1732TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1733endif
Doug Zongker4647f122009-07-02 09:00:54 -07001734recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001735 $(TARGET_PRIVATE_RES_DIRS) -type f)
xunchangcc57d312018-12-07 12:12:17 -08001736recovery_resource_deps += $(generated_recovery_text_files)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001737
1738
Andrew Boiefa61ff02012-09-28 09:33:45 -07001739ifdef TARGET_RECOVERY_FSTAB
1740recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1741else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001742recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001743endif
Tao Baoc3c17532016-06-10 10:11:54 -07001744ifdef TARGET_RECOVERY_WIPE
1745recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001746else
Tao Baoc3c17532016-06-10 10:11:54 -07001747recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001748endif
Tao Bao8beab692015-07-22 12:33:18 -07001749
Tao Bao6d5d6232018-03-09 17:04:42 -08001750# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001751# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001752# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1753# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001754#
1755# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001756# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001757# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001758# b) We build a single image that contains boot and recovery both - no recovery image to install
1759# (BOARD_USES_RECOVERY_AS_BOOT = true);
Tom Cherry2929cad2018-09-20 11:04:37 -07001760# c) We mount the system image as / and therefore do not have a ramdisk in boot.img
Tao Bao6d5d6232018-03-09 17:04:42 -08001761# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001762# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1763# do bsdiff because boot and recovery will contain different number of entries
1764# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001765# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
1766# do bsdiff because boot and recovery will contain different number of entries
1767# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001768
Tom Cherry2929cad2018-09-20 11:04:37 -07001769ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001770 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Doug Zongker56588872012-08-20 15:38:58 -07001771# Named '.dat' so we don't attempt to use imgdiff for patching it.
1772RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001773else
Tao Bao8beab692015-07-22 12:33:18 -07001774RECOVERY_RESOURCE_ZIP :=
1775endif
Doug Zongker4647f122009-07-02 09:00:54 -07001776
Tao Bao139c7272018-07-31 13:26:54 -07001777INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1778
1779$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \
Tao Bao139c7272018-07-31 13:26:54 -07001780 TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \
1781 TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \
1782 TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \
1783 TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \
1784 TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE:progress_bar_baseline \
1785 TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD:touch_low_threshold \
1786 TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD:touch_high_threshold \
1787 TARGET_RECOVERY_UI_VR_STEREO_OFFSET:vr_stereo_offset
1788
1789# Parses the given list of build variables and writes their values as build properties if defined.
1790# For example, if a target defines `TARGET_RECOVERY_UI_MARGIN_HEIGHT := 100`,
1791# `ro.recovery.ui.margin_height=100` will be appended to the given output file.
1792# $(1): Map from the build variable names to property names
1793# $(2): Output file
1794define append-recovery-ui-properties
1795echo "#" >> $(2)
1796echo "# RECOVERY UI BUILD PROPERTIES" >> $(2)
1797echo "#" >> $(2)
1798$(foreach prop,$(1), \
1799 $(eval _varname := $(call word-colon,1,$(prop))) \
1800 $(eval _propname := $(call word-colon,2,$(prop))) \
1801 $(eval _value := $($(_varname))) \
1802 $(if $(_value), \
1803 echo ro.recovery.ui.$(_propname)=$(_value) >> $(2) &&)) true
1804endef
1805
1806$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00001807 $(INSTALLED_DEFAULT_PROP_TARGET) \
1808 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1809 $(intermediate_system_build_prop) \
1810 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
1811 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
1812 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
1813 $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
Tao Bao1edaca12018-09-18 10:22:54 -07001814 @echo "Target recovery buildinfo: $@"
Tao Bao139c7272018-07-31 13:26:54 -07001815 $(hide) mkdir -p $(dir $@)
1816 $(hide) rm -f $@
1817 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@
1818 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@
Tao Bao6eb1a992018-08-06 07:33:45 -07001819 $(hide) cat $(intermediate_system_build_prop) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001820 $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001821 $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001822 $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
1823 $(hide) cat $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET) >> $@
1824 $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
1825
Doug Zongker4647f122009-07-02 09:00:54 -07001826INTERNAL_RECOVERYIMAGE_ARGS := \
1827 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1828 --kernel $(recovery_kernel) \
1829 --ramdisk $(recovery_ramdisk)
1830
1831# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001832ifdef INTERNAL_KERNEL_CMDLINE
1833 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001834endif
1835ifdef BOARD_KERNEL_BASE
1836 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1837endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001838ifdef BOARD_KERNEL_PAGESIZE
1839 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1840endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001841ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001842ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1843 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1844else
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001845 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1846endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001847endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001848ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1849 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
1850endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001851ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1852 INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
1853endif
Doug Zongker4647f122009-07-02 09:00:54 -07001854
1855# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001856# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001857# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001858OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001859
1860# Generate a file containing the keys that will be read by the
1861# recovery binary.
1862RECOVERY_INSTALL_OTA_KEYS := \
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001863 $(call intermediates-dir-for,PACKAGING,ota_keys)/otacerts.zip
Doug Zongker4647f122009-07-02 09:00:54 -07001864$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001865$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001866$(RECOVERY_INSTALL_OTA_KEYS): $(SOONG_ZIP) $(OTA_PUBLIC_KEYS) $(extra_keys)
1867 $(hide) rm -f $@
1868 $(hide) mkdir -p $(dir $@)
1869 $(hide) $(SOONG_ZIP) -o $@ $(foreach key_file, $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys), -C $(dir $(key_file)) -f $(key_file))
Doug Zongker4647f122009-07-02 09:00:54 -07001870
Andres Moralesb8876e12015-05-06 20:44:22 -07001871RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001872
Ying Wang747b9f12015-01-30 14:05:22 -08001873# $(1): output file
1874define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001875 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001876 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao696bb332018-08-17 16:27:01 -07001877 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001878 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001879 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
Tao Bao696bb332018-08-17 16:27:01 -07001880 $(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001881 # Modifying ramdisk contents...
Tom Cherry3871f0f2018-11-06 14:23:44 -08001882 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
1883 $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
Howard Chen1756f8d2017-02-22 17:27:10 +08001884 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1885 $(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
Bowgo Tsaib5b3bc62017-09-25 17:50:41 +08001886 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1887 $(hide) find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f
Ying Wang747b9f12015-01-30 14:05:22 -08001888 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Tao Baocf8853b2018-08-13 14:27:32 -07001889 $(hide) cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ 2> /dev/null || true # Ignore error when the src file doesn't exist.
Ying Wang747b9f12015-01-30 14:05:22 -08001890 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1891 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1892 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
xunchangcc57d312018-12-07 12:12:17 -08001893 $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
1894 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
Ying Wang747b9f12015-01-30 14:05:22 -08001895 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001896 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1897 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001898 $(hide) $(foreach item,$(recovery_fstab), \
Tao Bao696bb332018-08-17 16:27:01 -07001899 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001900 $(if $(strip $(recovery_wipe)), \
Tao Bao696bb332018-08-17 16:27:01 -07001901 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001902 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security
1903 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security/otacerts.zip
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001904 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001905 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001906 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001907 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001908 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1909 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1) --id > $(RECOVERYIMAGE_ID_FILE))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001910 $(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001911 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
Anton Hansson8dab0a62019-03-28 15:45:40 +00001912 $(BOOT_SIGNER) /boot $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1913 $(BOOT_SIGNER) /recovery $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001914 )\
1915 )
Anton Hansson8dab0a62019-03-28 15:45:40 +00001916 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
1917 $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001918 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1919 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1920 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001921 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1922 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1923 $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\
1924 $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) --partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) $(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)))
Ying Wang747b9f12015-01-30 14:05:22 -08001925endef
1926
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001927ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001928ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER))
Ying Wangbd07ad02016-03-10 12:57:33 -08001929$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1930endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00001931ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Ying Wangbd07ad02016-03-10 12:57:33 -08001932$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1933endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001934ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001935$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001936endif
Tao Baof4866c72018-08-22 14:35:09 -07001937ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001938ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1939$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1940else
Tao Baof4866c72018-08-22 14:35:09 -07001941$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
1942endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001943endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001944ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1945$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1946endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001947ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1948$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1949endif
Tao Baof4866c72018-08-22 14:35:09 -07001950
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001951$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001952 $(INTERNAL_ROOT_FILES) \
1953 $(INSTALLED_RAMDISK_TARGET) \
1954 $(INTERNAL_RECOVERYIMAGE_FILES) \
1955 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1956 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1957 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1958 $(recovery_resource_deps) \
1959 $(recovery_fstab) \
1960 $(RECOVERY_INSTALL_OTA_KEYS) \
1961 $(BOARD_RECOVERY_KERNEL_MODULES) \
1962 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001963 $(call pretty,"Target boot image from recovery: $@")
1964 $(call build-recoveryimage-target, $@)
1965endif # BOARD_USES_RECOVERY_AS_BOOT
1966
1967ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001968ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1969$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1970else
Tao Baof4866c72018-08-22 14:35:09 -07001971$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001972endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001973endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001974ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1975$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1976endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001977ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1978$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1979endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001980
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001981$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001982 $(INTERNAL_ROOT_FILES) \
1983 $(INSTALLED_RAMDISK_TARGET) \
1984 $(INSTALLED_BOOTIMAGE_TARGET) \
1985 $(INTERNAL_RECOVERYIMAGE_FILES) \
1986 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1987 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1988 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1989 $(recovery_resource_deps) \
1990 $(recovery_fstab) \
1991 $(RECOVERY_INSTALL_OTA_KEYS) \
1992 $(BOARD_RECOVERY_KERNEL_MODULES) \
1993 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001994 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001995
Tao Bao4594d0e2015-12-22 09:47:46 -08001996ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001997$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001998 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001999 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
2000 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07002001endif
Doug Zongker56588872012-08-20 15:38:58 -07002002
Ying Wang747b9f12015-01-30 14:05:22 -08002003.PHONY: recoveryimage-nodeps
2004recoveryimage-nodeps:
2005 @echo "make $@: ignoring dependencies"
2006 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
2007
Tao Bao8beab692015-07-22 12:33:18 -07002008else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07002009RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07002010endif
2011
2012.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07002013recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07002014
Jiyong Park03eb0612017-10-04 21:22:41 +09002015ifneq ($(BOARD_NAND_PAGE_SIZE),)
2016$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08002017endif
2018
Jiyong Park03eb0612017-10-04 21:22:41 +09002019ifneq ($(BOARD_NAND_SPARE_SIZE),)
2020$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07002021endif
2022
Doug Zongker4647f122009-07-02 09:00:54 -07002023# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07002024# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08002025#
Ying Wang9c649a72012-08-08 15:27:00 -07002026# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
2027PDK_FUSION_SYSIMG_FILES := \
2028 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
2029 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002030
Dan Willemsen37a19862018-10-31 16:31:46 -07002031INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07002032 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07002033 $(ALL_DEFAULT_INSTALLED_MODULES) \
2034 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08002035 $(RECOVERY_RESOURCE_ZIP)) \
Dan Willemsen37a19862018-10-31 16:31:46 -07002036 $(PDK_FUSION_SYMLINK_STAMP))
Ying Wang160b6702012-03-13 18:58:27 -07002037
Ying Wang82cceba2012-08-13 15:03:00 -07002038FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002039
2040# ASAN libraries in the system image - add dependency.
2041ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
Evgenii Stepanov8841a7f2018-07-27 11:54:32 -07002042ifneq (,$(filter address, $(SANITIZE_TARGET)))
Andreas Gampe039b5c72017-03-24 16:06:31 -07002043 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
2044 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
2045 endif
2046endif
2047
Tom Cherryd14b8952018-08-09 14:26:00 -07002048FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
Luis Hector Chavezff489932018-07-03 15:41:40 -07002049
Ying Wange5e8c5f2011-09-09 16:35:53 -07002050# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07002051# Final System VINTF manifest including fragments. This is not assembled
2052# on the device because it depends on everything in a given device
2053# image which defines a vintf_fragment.
2054
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07002055ifdef BUILDING_SYSTEM_IMAGE
2056
Steven Moreland627debe2018-05-01 09:54:21 -07002057BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
2058$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2059$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
2060$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
2061$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
2062 @echo "Verifying system VINTF manifest."
2063 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2064 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Anton Hansson6d814982018-11-26 18:12:05 +00002065 -c $(BUILT_VENDOR_MATRIX) \
2066 -i $(BUILT_SYSTEM_MANIFEST) \
2067 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
2068 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
2069 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002070
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07002071endif # BUILDING_SYSTEM_IMAGE
2072
Steven Moreland627debe2018-05-01 09:54:21 -07002073# -----------------------------------------------------------------
Dan Willemsen67495202019-01-16 12:42:05 -08002074ifdef BUILDING_SYSTEM_IMAGE
2075
Ying Wange5e8c5f2011-09-09 16:35:53 -07002076# installed file list
2077# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
2078# We put installed-files.txt ahead of image itself in the dependency graph
2079# so that we can get the size stat even if the build fails due to too large
2080# system image.
2081INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07002082INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
2083$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002084$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002085 @echo Installed file list: $@
2086 @mkdir -p $(dir $@)
2087 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002088 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002089 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07002090
2091.PHONY: installed-file-list
2092installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08002093
2094$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07002095
2096systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002097 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002098BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
2099
Ying Wang23898df2014-06-18 20:26:24 -07002100# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002101ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07002102define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07002103$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
2104 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
2105 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
2106 exit 1; \
2107fi
Ying Wang23898df2014-06-18 20:26:24 -07002108$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
2109endef
2110else
2111define create-system-vendor-symlink
2112endef
2113endif
2114
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002115# Create symlink /system/product to /product if necessary.
2116ifdef BOARD_USES_PRODUCTIMAGE
2117define create-system-product-symlink
2118$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
2119 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
2120 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
2121 exit 1; \
2122fi
2123$(hide) ln -sf /product $(TARGET_OUT)/product
2124endef
2125else
2126define create-system-product-symlink
2127endef
2128endif
2129
Dario Freni924af7d2018-08-17 00:56:14 +01002130# Create symlink /system/product_services to /product_services if necessary.
Dario Freni5f681e12018-05-29 13:09:01 +01002131ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002132define create-system-product_services-symlink
2133$(hide) if [ -d $(TARGET_OUT)/product_services ] && [ ! -h $(TARGET_OUT)/product_services ]; then \
2134 echo 'Non-symlink $(TARGET_OUT)/product_services detected!' 1>&2; \
2135 echo 'You cannot install files to $(TARGET_OUT)/product_services while building a separate product_services.img!' 1>&2; \
Dario Freni5f681e12018-05-29 13:09:01 +01002136 exit 1; \
2137fi
Dario Freni924af7d2018-08-17 00:56:14 +01002138$(hide) ln -sf /product_services $(TARGET_OUT)/product_services
Dario Freni5f681e12018-05-29 13:09:01 +01002139endef
2140else
Dario Freni924af7d2018-08-17 00:56:14 +01002141define create-system-product_services-symlink
Dario Freni5f681e12018-05-29 13:09:01 +01002142endef
2143endif
2144
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002145# Create symlink /vendor/odm to /odm if necessary.
2146ifdef BOARD_USES_ODMIMAGE
2147define create-vendor-odm-symlink
2148$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
2149 echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
2150 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
2151 exit 1; \
2152fi
2153$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
2154endef
2155else
2156define create-vendor-odm-symlink
2157endef
2158endif
2159
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002160# Check that libraries that should only be in APEXes don't end up in the system
2161# image. For the Runtime APEX this complements the checks in
2162# art/build/apex/art_apex_test.py.
2163# TODO(b/128708192): Implement this restriction in Soong instead.
2164
2165# TODO(b/124293228): Fix remaining bugs and add these libraries to the list:
2166# libart-compiler.so
2167# libart-dexlayout.so
2168# libart.so
2169# libartbase.so
2170# libartpalette.so
2171# libdexfile.so
Martin Stjernholmd185bb22019-03-22 14:24:08 +00002172# libdexfile_external.so - aosp_marlin-userdebug gets this in a vndk-sp-Q subdirectory.
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002173# libicui18n.so
2174# libicuuc.so
2175# libnativehelper.so - cf_x86_phone-userdebug builds get this in system/lib/arm
2176# libprofile.so
Martin Stjernholmf8b6fef2019-03-28 17:22:08 +00002177# libsigchain.so - cf_x86_phone-userdebug builds get this in system/lib/arm
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002178# libtombstoned_client.so
2179APEX_MODULE_LIBS= \
2180 libadbconnection.so \
2181 libandroidicu.so \
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002182 libdt_fd_forward.so \
2183 libdt_socket.so \
2184 libjavacore.so \
2185 libjdwp.so \
2186 libnativebridge.so \
2187 libnativeloader.so \
2188 libnpt.so \
2189 libopenjdk.so \
2190 libopenjdkjvm.so \
2191 libopenjdkjvmti.so \
2192 libpac.so \
2193
Martin Stjernholmc9d58582019-03-27 17:36:06 +00002194# An option to disable the check below, for local use since some build targets
2195# still may create these libraries in /system (b/129006418).
2196DISABLE_APEX_LIBS_ABSENCE_CHECK ?=
2197
Martin Stjernholm5c5d59b2019-04-16 15:29:15 +01002198# Exclude lib/arm and lib/arm64 which contain the native bridge proxy libs.
2199# They are compiled for the guest architecture and used with an entirely
2200# different linker config. The native libs are then linked to as usual via
2201# exported interfaces, so the proxy libs do not violate the interface boundaries
2202# on the native architecture.
2203# TODO(b/130630776): Introduce a make variable for the appropriate directory
2204# when native bridge is active.
2205APEX_LIBS_ABSENCE_CHECK_EXCLUDE=lib/arm lib/arm64
2206
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002207# If the check below fails, some library has ended up in system/lib or
2208# system/lib64 that is intended to only go into some APEX package. The likely
2209# cause is that a library or binary in /system has grown a dependency that
2210# directly or indirectly pulls in the prohibited library.
2211#
2212# To resolve this, look for the APEX package that the library belong to - search
2213# for it in 'native_shared_lib' properties in 'apex' build modules (see
2214# art/build/apex/Android.bp for an example). Then check if there is an exported
2215# library in that APEX package that should be used instead, i.e. one listed in
2216# its 'native_shared_lib' property for which the corresponding 'cc_library'
2217# module has a 'stubs' clause (like libdexfile_external in
2218# art/libdexfile/Android.bp).
2219#
2220# If you cannot find an APEX exported library that fits your needs, or you think
2221# that the library you want to depend on should be allowed in /system, then
2222# please contact the owners of the APEX package containing the library.
2223#
2224# If you get this error for a library that is exported in an APEX, then the APEX
2225# might be misconfigured or something is wrong in the build system. Please reach
2226# out to the APEX package owners and/or soong-team@, or
2227# android-building@googlegroups.com externally.
Martin Stjernholmc9d58582019-03-27 17:36:06 +00002228ifndef DISABLE_APEX_LIBS_ABSENCE_CHECK
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002229define check-apex-libs-absence
2230$(hide) ( \
Martin Stjernholm5c5d59b2019-04-16 15:29:15 +01002231 cd $(TARGET_OUT) && \
2232 findres=$$(find lib* \
2233 $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE),-path $(dir) -prune -o) \
2234 -type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \
2235 -print) && \
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002236 if [ -n "$$findres" ]; then \
Martin Stjernholmc9d58582019-03-27 17:36:06 +00002237 echo "APEX libraries found in system image (see comment in build/make/core/Makefile for details):" 1>&2; \
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002238 echo "$$findres" | sort 1>&2; \
2239 false; \
2240 fi; \
2241)
2242endef
Martin Stjernholmc9d58582019-03-27 17:36:06 +00002243else
2244define check-apex-libs-absence
2245endef
2246endif
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002247
The Android Open Source Project88b60792009-03-03 19:28:42 -08002248# $(1): output file
2249define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07002250 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07002251 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002252 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002253 $(call create-system-product_services-symlink)
Martin Stjernholmf1e7c712019-03-18 16:54:58 +00002254 $(call check-apex-libs-absence)
Ying Wangbd93d422011-10-28 17:02:30 -07002255 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002256 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07002257 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002258 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002259 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002260 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Dan Willemsen3e8eb372018-10-20 21:37:44 -07002261 || ( mkdir -p $${DIST_DIR}; cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07002262 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08002263endef
2264
Steven Moreland627debe2018-05-01 09:54:21 -07002265$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002266$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002267 $(call build-systemimage-target,$@)
2268
Tao Baoe9d61b02018-08-20 21:09:07 -07002269INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07002270SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002271
Tao Baoe9d61b02018-08-20 21:09:07 -07002272# INSTALLED_SYSTEMIMAGE_TARGET used to be named INSTALLED_SYSTEMIMAGE. Create an alias for backward
2273# compatibility, in case device-specific Makefiles still refer to the old name.
2274INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
2275
Doug Zongker73ef8252009-07-23 15:12:53 -07002276# The system partition needs room for the recovery image as well. We
2277# now store the recovery image as a binary patch using the boot image
2278# as the source (since they are very similar). Generate the patch so
2279# we can see how big it's going to be, and include that in the system
2280# image size check calculation.
Tao Baob1a2e352018-08-14 16:17:12 -07002281ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
Sriram Raman1e96ac82009-07-24 13:52:32 -07002282ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07002283ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Chen, ZhiminX752439b2018-09-23 22:10:47 +08002284ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08002285diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
2286else
2287diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
2288endif
Doug Zongker73ef8252009-07-23 15:12:53 -07002289intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
2290RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08002291$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
2292$(RECOVERY_FROM_BOOT_PATCH): \
Anton Hansson6d814982018-11-26 18:12:05 +00002293 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2294 $(INSTALLED_BOOTIMAGE_TARGET) \
2295 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07002296 @echo "Construct recovery from boot"
2297 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08002298 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07002299else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
2300RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
Tao Baob1a2e352018-08-14 16:17:12 -07002301endif # BOARD_USES_FULL_RECOVERY_IMAGE
2302endif # INSTALLED_RECOVERYIMAGE_TARGET
2303endif # INSTALLED_BOOTIMAGE_TARGET
Doug Zongker73ef8252009-07-23 15:12:53 -07002304
Tao Baoe9d61b02018-08-20 21:09:07 -07002305$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002306 @echo "Install system fs image: $@"
2307 $(copy-file-to-target)
Yifan Hong8c3dce02019-04-09 17:03:57 +00002308 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002309
Tao Baoe9d61b02018-08-20 21:09:07 -07002310systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002311
2312.PHONY: systemimage-nodeps snod
2313systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07002314 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002315 @echo "make $@: ignoring dependencies"
Tao Baoe9d61b02018-08-20 21:09:07 -07002316 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
Yifan Hong8c3dce02019-04-09 17:03:57 +00002317 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002318
Ying Wangacf01ec2012-02-24 11:05:48 -08002319ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
2320ifeq (true,$(WITH_DEXPREOPT))
2321$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
2322endif
2323endif
2324
Dan Willemsen67495202019-01-16 12:42:05 -08002325endif # BUILDING_SYSTEM_IMAGE
2326
Anton Hansson30e061b2018-11-12 13:36:46 +00002327.PHONY: sync syncsys
2328sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
Colin Cross91a52272017-06-20 16:57:52 -07002329
The Android Open Source Project88b60792009-03-03 19:28:42 -08002330#######
2331## system tarball
2332define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07002333 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
2334 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002335 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002336 $(call create-system-product_services-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07002337 $(MKTARBALL) $(FS_GET_STATS) \
2338 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002339 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002340endef
2341
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002342ifndef SYSTEM_TARBALL_FORMAT
2343 SYSTEM_TARBALL_FORMAT := bz2
2344endif
2345
The Android Open Source Project88b60792009-03-03 19:28:42 -08002346system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002347INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002348$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
2349$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
2350 $(build-systemtarball-target)
2351
2352.PHONY: systemtarball-nodeps
2353systemtarball-nodeps: $(FS_GET_STATS) \
2354 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
2355 $(build-systemtarball-target)
2356
2357.PHONY: stnod
2358stnod: systemtarball-nodeps
2359
Ying Wang3a61eeb2016-03-11 10:32:01 -08002360# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07002361## platform.zip: system, plus other files to be used in PDK fusion build,
2362## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07002363##
2364## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
2365## The variable will be typically set from BoardConfig.mk.
2366## Files under out dir will be rejected to prevent possible conflicts with other rules.
Colin Cross53c8f972018-09-28 16:19:42 -07002367ifneq (,$(BUILD_PLATFORM_ZIP))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002368pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002369 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002370pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002371 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002372pdk_classes_dex := $(strip \
2373 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
2374 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
2375
2376pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
2377$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
2378$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
2379$(pdk_odex_config_mk) :
2380 @echo "PDK odex config makefile: $@"
2381 $(hide) mkdir -p $(dir $@)
2382 $(hide) echo "# Auto-generated. Do not modify." > $@
2383 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
2384 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
2385 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
2386 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
2387 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2388 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2389 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2390 )
2391 $(foreach m,$(PRIVATE_APPS),\
2392 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
2393 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2394 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2395 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2396 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07002397 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08002398 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
2399 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
2400 )
2401
keunyoungc0178062013-07-22 14:54:58 -07002402PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07002403INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08002404
2405$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
2406$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
Colin Cross7363cde2018-09-14 21:51:11 -07002407$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP)
2408# dependencies for the other partitions are defined below after their file lists
2409# are known
Dan Willemsenad6a1542018-12-14 01:04:19 -08002410$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(api_fingerprint)
Keun young Park816b9fd2012-05-16 10:32:41 -07002411 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Colin Cross7363cde2018-09-14 21:51:11 -07002412 rm -f $@ $@.lst
2413 echo "-C $(PRODUCT_OUT)" >> $@.lst
2414 echo "-D $(TARGET_OUT)" >> $@.lst
2415 echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst
2416 echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst
Dan Willemsen67495202019-01-16 12:42:05 -08002417ifdef BUILDING_VENDOR_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002418 echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst
Ying Wangcff38622014-07-16 17:46:35 -07002419endif
Dan Willemsen67495202019-01-16 12:42:05 -08002420ifdef BUILDING_PRODUCT_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002421 echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002422endif
Dan Willemsen67495202019-01-16 12:42:05 -08002423ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002424 echo "-D $(TARGET_OUT_PRODUCT_SERVICES)" >> $@.lst
Dario Freni5f681e12018-05-29 13:09:01 +01002425endif
Dan Willemsen67495202019-01-16 12:42:05 -08002426ifdef BUILDING_ODM_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002427 echo "-D $(TARGET_OUT_ODM)" >> $@.lst
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002428endif
Colin Crossc451a372013-12-18 19:36:44 -08002429ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Colin Cross7363cde2018-09-14 21:51:11 -07002430 echo "-C $(OUT_DIR)" >> $@.lst
2431 for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \
2432 if [ -e $$f ]; then \
2433 echo "-f $$f"; \
2434 fi \
2435 done >> $@.lst
Keun young Park816b9fd2012-05-16 10:32:41 -07002436endif
keunyoungc0178062013-07-22 14:54:58 -07002437ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Colin Cross7363cde2018-09-14 21:51:11 -07002438 echo "-C . $(addprefix -f ,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))" >> $@.lst
keunyoungc0178062013-07-22 14:54:58 -07002439endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08002440 @# Add dex-preopt files and config.
Colin Cross7363cde2018-09-14 21:51:11 -07002441 $(if $(PRIVATE_DEX_FILES),\
2442 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst
Dan Willemsenad6a1542018-12-14 01:04:19 -08002443 echo "-C $(dir $(api_fingerprint)) -f $(api_fingerprint)" >> $@.lst
Colin Cross7363cde2018-09-14 21:51:11 -07002444 touch $(PRODUCT_OUT)/pdk.mk
2445 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst
2446 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst
Ying Wang4c289e52012-03-30 13:52:54 -07002447
2448.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07002449platform: $(INSTALLED_PLATFORM_ZIP)
2450
2451.PHONY: platform-java
2452platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07002453
2454# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07002455ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
2456$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07002457endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002458
Colin Cross53c8f972018-09-28 16:19:42 -07002459endif # BUILD_PLATFORM_ZIP
2460
Ying Wang3a61eeb2016-03-11 10:32:01 -08002461# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07002462## boot tarball
2463define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07002464 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07002465 $(hide) mkdir -p $(PRODUCT_OUT)/boot
2466 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002467 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07002468 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
2469 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002470 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07002471endef
2472
2473ifndef BOOT_TARBALL_FORMAT
2474 BOOT_TARBALL_FORMAT := bz2
2475endif
2476
2477boot_tar := $(PRODUCT_OUT)/boot.tar
2478INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
2479$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
2480$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
2481 $(build-boottarball-target)
2482
2483.PHONY: boottarball-nodeps btnod
2484boottarball-nodeps btnod: $(FS_GET_STATS) \
2485 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
2486 $(build-boottarball-target)
2487
2488
The Android Open Source Project88b60792009-03-03 19:28:42 -08002489# -----------------------------------------------------------------
2490# data partition image
2491INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002492 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002493
Dan Willemsen67495202019-01-16 12:42:05 -08002494ifdef BUILDING_USERDATA_IMAGE
Ying Wangbd93d422011-10-28 17:02:30 -07002495userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002496 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07002497BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
2498
Ying Wangbd93d422011-10-28 17:02:30 -07002499define build-userdataimage-target
2500 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
2501 @mkdir -p $(TARGET_OUT_DATA)
2502 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002503 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002504 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002505 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002506 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002507 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07002508endef
2509
Joe Onorato64d85d02009-04-09 19:31:12 -07002510# We just build this directly to the install location.
2511INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002512INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
2513 $(INTERNAL_USERIMAGES_DEPS) \
2514 $(INTERNAL_USERDATAIMAGE_FILES) \
2515 $(BUILD_IMAGE_SRCS)
2516$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002517 $(build-userdataimage-target)
2518
2519.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07002520userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002521 $(build-userdataimage-target)
2522
Dan Willemsen67495202019-01-16 12:42:05 -08002523endif # BUILDING_USERDATA_IMAGE
Ying Wange215ed52012-10-15 14:36:22 -07002524
Andreas Gampe039b5c72017-03-24 16:06:31 -07002525# ASAN libraries in the system image - build rule.
2526ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
2527 $(TARGET_OUT_SHARED_LIBRARIES) \
2528 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
2529 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
2530 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07002531# Extra options: Enforce the system user for the files to avoid having to change ownership.
2532ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07002533# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
2534# enough space.
2535$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07002536 tar cfj $(ASAN_IN_SYSTEM_INSTALLED) $(ASAN_SYSTEM_INSTALL_OPTIONS) -C $(TARGET_OUT_DATA)/.. $(ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL) >/dev/null
Andreas Gampe039b5c72017-03-24 16:06:31 -07002537
The Android Open Source Project88b60792009-03-03 19:28:42 -08002538#######
2539## data partition tarball
2540define build-userdatatarball-target
2541 $(call pretty,"Target userdata fs tarball: " \
2542 "$(INSTALLED_USERDATATARBALL_TARGET)")
2543 $(MKTARBALL) $(FS_GET_STATS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002544 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
2545 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002546endef
2547
2548userdata_tar := $(PRODUCT_OUT)/userdata.tar
2549INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
2550$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
2551$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
2552 $(build-userdatatarball-target)
2553
Dan Willemsen69af2e42016-08-16 16:36:05 -07002554$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
2555
The Android Open Source Project88b60792009-03-03 19:28:42 -08002556.PHONY: userdatatarball-nodeps
2557userdatatarball-nodeps: $(FS_GET_STATS)
2558 $(build-userdatatarball-target)
2559
2560
The Android Open Source Project88b60792009-03-03 19:28:42 -08002561# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04002562# partition table image
2563ifdef BOARD_BPT_INPUT_FILES
2564
2565BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002566BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04002567
2568INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
2569 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002570 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04002571 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
2572
2573ifdef BOARD_BPT_DISK_SIZE
2574INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
2575endif
2576
2577define build-bptimage-target
2578 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
2579 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
2580endef
2581
2582INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002583$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
2584 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
2585
David Zeuthen25328622016-04-08 15:08:03 -04002586$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
2587 $(build-bptimage-target)
2588
2589.PHONY: bptimage-nodeps
2590bptimage-nodeps:
2591 $(build-bptimage-target)
2592
2593endif # BOARD_BPT_INPUT_FILES
2594
2595# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07002596# cache partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002597ifdef BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002598INTERNAL_CACHEIMAGE_FILES := \
2599 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
2600
2601cacheimage_intermediates := \
2602 $(call intermediates-dir-for,PACKAGING,cache)
2603BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
2604
2605define build-cacheimage-target
2606 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
2607 @mkdir -p $(TARGET_OUT_CACHE)
2608 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002609 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002610 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002611 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002612 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002613 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07002614endef
2615
2616# We just build this directly to the install location.
2617INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002618$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002619 $(build-cacheimage-target)
2620
2621.PHONY: cacheimage-nodeps
2622cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2623 $(build-cacheimage-target)
2624
Dan Willemsen67495202019-01-16 12:42:05 -08002625else # BUILDING_CACHE_IMAGE
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07002626# we need to ignore the broken cache link when doing the rsync
2627IGNORE_CACHE_LINK := --exclude=cache
Dan Willemsen67495202019-01-16 12:42:05 -08002628endif # BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002629
David Zeuthen0eb10972016-09-28 17:55:27 -04002630# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07002631# system_other partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002632ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002633ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
Alex Light4e358ab2016-06-16 14:47:10 -07002634# Marker file to identify that odex files are installed
2635INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2636ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2637$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2638 $(hide) touch $@
2639endif
2640
Alex Light4e358ab2016-06-16 14:47:10 -07002641INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2642 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2643 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002644 $(ALL_PDK_FUSION_FILES)) \
2645 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002646
Colin Cross6db5b0e2018-11-16 21:26:33 -08002647# system_other dex files are installed as a side-effect of installing system image files
2648INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES)
2649
Alex Light4e358ab2016-06-16 14:47:10 -07002650INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002651INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2652$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002653$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07002654 @echo Installed file list: $@
2655 @mkdir -p $(dir $@)
2656 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002657 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002658 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002659
Bowgo Tsai867ab662019-01-29 13:30:18 +08002660# Determines partition size for system_other.img.
2661ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
2662ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
2663INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE)
2664endif
2665endif
2666
2667ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE
2668INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE)
2669endif
2670
Alex Light4e358ab2016-06-16 14:47:10 -07002671systemotherimage_intermediates := \
2672 $(call intermediates-dir-for,PACKAGING,system_other)
2673BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2674
2675# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2676define build-systemotherimage-target
2677 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2678 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2679 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002680 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002681 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002682 build/make/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002683 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)
2684 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
Alex Light4e358ab2016-06-16 14:47:10 -07002685endef
2686
2687# We just build this directly to the install location.
2688INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002689ifneq (true,$(SANITIZE_LITE))
2690# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002691$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2692 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002693endif
Alex Light4e358ab2016-06-16 14:47:10 -07002694
2695.PHONY: systemotherimage-nodeps
2696systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2697 $(build-systemotherimage-target)
2698
Dan Willemsen67495202019-01-16 12:42:05 -08002699endif # BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002700
2701
2702# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002703# vendor partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002704ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07002705INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002706 $(filter $(TARGET_OUT_VENDOR)/%,\
2707 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002708 $(ALL_PDK_FUSION_FILES)) \
2709 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002710
Steven Moreland627debe2018-05-01 09:54:21 -07002711# Final Vendor VINTF manifest including fragments. This is not assembled
2712# on the device because it depends on everything in a given device
2713# image which defines a vintf_fragment.
2714ifdef BUILT_VENDOR_MANIFEST
2715BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
Anton Hansson8dab0a62019-03-28 15:45:40 +00002716ifeq (true,$(PRODUCT_ENFORCE_VINTF_MANIFEST))
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002717ifneq ($(strip $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)),)
Steven Moreland627debe2018-05-01 09:54:21 -07002718$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002719endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
Steven Moreland627debe2018-05-01 09:54:21 -07002720endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2721$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2722$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2723$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2724$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
Yifan Hong770ab052018-11-02 13:43:30 -07002725
2726$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS :=
2727
2728# -- Kernel version and configurations.
2729ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
2730
2731# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
2732# from INSTALLED_KERNEL_TARGET.
2733ifdef BOARD_KERNEL_CONFIG_FILE
2734ifdef BOARD_KERNEL_VERSION
2735$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BOARD_KERNEL_CONFIG_FILE)
2736$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $(BOARD_KERNEL_VERSION):$(BOARD_KERNEL_CONFIG_FILE)
2737my_board_extracted_kernel := true
2738endif # BOARD_KERNEL_VERSION
2739endif # BOARD_KERNEL_CONFIG_FILE
2740
2741ifneq ($(my_board_extracted_kernel),true)
2742ifndef INSTALLED_KERNEL_TARGET
2743$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2744 is true. Information about the updated kernel cannot be built into OTA update package. \
2745 You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
2746 to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
2747 or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
2748 BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2749 manually.)
2750else
2751intermediates := $(call intermediates-dir-for,ETC,$(notdir $(BUILT_ASSEMBLED_VENDOR_MANIFEST)))
2752
2753# Tools for decompression that is not in PATH.
2754# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
2755# Algorithms that are in the script but not in this list will be found in PATH.
2756my_decompress_tools := \
2757 lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
2758
2759my_kernel_configs := $(intermediates)/kernel_configs.txt
2760my_kernel_version := $(intermediates)/kernel_version.txt
2761$(my_kernel_configs): .KATI_IMPLICIT_OUTPUTS := $(my_kernel_version)
2762$(my_kernel_configs): PRIVATE_KERNEL_VERSION_FILE := $(my_kernel_version)
2763$(my_kernel_configs): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
2764$(my_kernel_configs): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
2765$(my_kernel_configs): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
2766 $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
2767 --output-configs $@ \
2768 --output-version $(PRIVATE_KERNEL_VERSION_FILE)
2769
2770$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(my_kernel_configs) $(my_kernel_version)
2771$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $$(cat $(my_kernel_version)):$(my_kernel_configs)
2772
2773intermediates :=
2774my_kernel_configs :=
2775my_kernel_version :=
2776my_decompress_tools :=
2777
2778endif # my_board_extracted_kernel
2779my_board_extracted_kernel :=
2780
2781endif # INSTALLED_KERNEL_TARGET
2782endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
2783
2784$(BUILT_ASSEMBLED_VENDOR_MANIFEST):
Steven Moreland627debe2018-05-01 09:54:21 -07002785 @echo "Verifying vendor VINTF manifest."
2786 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2787 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2788 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Yifan Hong770ab052018-11-02 13:43:30 -07002789 $(PRIVATE_FLAGS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002790 -c $(BUILT_SYSTEM_MATRIX) \
2791 -i $(BUILT_VENDOR_MANIFEST) \
2792 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2793 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2794 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002795endif # BUILT_VENDOR_MANIFEST
2796
Ying Wangcff38622014-07-16 17:46:35 -07002797# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2798$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002799
Ying Wang8da19e32015-09-15 14:22:12 -07002800INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002801INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2802$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002803$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002804 @echo Installed file list: $@
2805 @mkdir -p $(dir $@)
2806 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002807 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002808 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002809
Ying Wanga0febe52013-03-20 11:02:05 -07002810vendorimage_intermediates := \
2811 $(call intermediates-dir-for,PACKAGING,vendor)
2812BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002813define build-vendorimage-target
2814 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2815 @mkdir -p $(TARGET_OUT_VENDOR)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002816 $(call create-vendor-odm-symlink)
Ying Wanga0febe52013-03-20 11:02:05 -07002817 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002818 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002819 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2820 $(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor/,$(call intermediates-dir-for,PACKAGING,depmod_vendor)))
Ying Wanga0febe52013-03-20 11:02:05 -07002821 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002822 build/make/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002823 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
2824 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
Ying Wanga0febe52013-03-20 11:02:05 -07002825endef
2826
2827# We just build this directly to the install location.
2828INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002829ifdef BUILT_VENDOR_MANIFEST
2830$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2831endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002832$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_VENDOR_KERNEL_MODULES)
Ying Wanga0febe52013-03-20 11:02:05 -07002833 $(build-vendorimage-target)
2834
Steven Morelanda2e734d2017-03-07 12:10:09 -08002835.PHONY: vendorimage-nodeps vnod
2836vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002837 $(build-vendorimage-target)
2838
Colin Cross91a52272017-06-20 16:57:52 -07002839sync: $(INTERNAL_VENDORIMAGE_FILES)
2840
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002841else ifdef BOARD_PREBUILT_VENDORIMAGE
2842INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2843$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2844endif
Ying Wanga0febe52013-03-20 11:02:05 -07002845
Ying Wang9f8e8db2011-11-04 11:37:01 -07002846# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002847# product partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002848ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002849INTERNAL_PRODUCTIMAGE_FILES := \
2850 $(filter $(TARGET_OUT_PRODUCT)/%,\
2851 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002852 $(ALL_PDK_FUSION_FILES)) \
2853 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002854
2855# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2856$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2857
2858INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002859INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2860$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002861$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2862 @echo Installed file list: $@
2863 @mkdir -p $(dir $@)
2864 @rm -f $@
2865 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2866 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2867
2868productimage_intermediates := \
2869 $(call intermediates-dir-for,PACKAGING,product)
2870BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2871define build-productimage-target
2872 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2873 @mkdir -p $(TARGET_OUT_PRODUCT)
2874 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002875 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002876 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2877 ./build/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002878 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
2879 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002880endef
2881
2882# We just build this directly to the install location.
2883INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2884$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2885 $(build-productimage-target)
2886
2887.PHONY: productimage-nodeps pnod
2888productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2889 $(build-productimage-target)
2890
2891sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2892
2893else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2894INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2895$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2896endif
2897
2898# -----------------------------------------------------------------
Dario Freni924af7d2018-08-17 00:56:14 +01002899# product_services partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002900ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni5f681e12018-05-29 13:09:01 +01002901INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
2902 $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
2903 $(ALL_DEFAULT_INSTALLED_MODULES)\
2904 $(ALL_PDK_FUSION_FILES)) \
2905 $(PDK_FUSION_SYMLINK_STAMP)
2906
2907# platform.zip depends on $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES).
2908$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2909
Dario Freni924af7d2018-08-17 00:56:14 +01002910INSTALLED_FILES_FILE_PRODUCT_SERVICES := $(PRODUCT_OUT)/installed-files-product_services.txt
Dario Freni5f681e12018-05-29 13:09:01 +01002911INSTALLED_FILES_JSON_PRODUCT_SERVICES := $(INSTALLED_FILES_FILE_PRODUCT_SERVICES:.txt=.json)
2912$(INSTALLED_FILES_FILE_PRODUCT_SERVICES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT_SERVICES)
2913$(INSTALLED_FILES_FILE_PRODUCT_SERVICES) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(FILESLIST)
2914 @echo Installed file list: $@
2915 @mkdir -p $(dir $@)
2916 @rm -f $@
2917 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT_SERVICES) > $(@:.txt=.json)
2918 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2919
Yifan Hongebc041a2018-07-26 16:02:52 -07002920product_servicesimage_intermediates := \
2921 $(call intermediates-dir-for,PACKAGING,product_services)
Dario Freni924af7d2018-08-17 00:56:14 +01002922BUILT_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
2923define build-product_servicesimage-target
2924 $(call pretty,"Target product_services fs image: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)")
Dario Freni5f681e12018-05-29 13:09:01 +01002925 @mkdir -p $(TARGET_OUT_PRODUCT_SERVICES)
Yifan Hongebc041a2018-07-26 16:02:52 -07002926 @mkdir -p $(product_servicesimage_intermediates) && rm -rf $(product_servicesimage_intermediates)/product_services_image_info.txt
2927 $(call generate-image-prop-dictionary, $(product_servicesimage_intermediates)/product_services_image_info.txt,product_services, skip_fsck=true)
Dario Freni5f681e12018-05-29 13:09:01 +01002928 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2929 ./build/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002930 $(TARGET_OUT_PRODUCT_SERVICES) $(product_servicesimage_intermediates)/product_services_image_info.txt $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(TARGET_OUT)
2931 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE))
Dario Freni5f681e12018-05-29 13:09:01 +01002932endef
2933
2934# We just build this directly to the install location.
2935INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(BUILT_PRODUCT_SERVICESIMAGE_TARGET)
2936$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT_SERVICES) $(BUILD_IMAGE_SRCS)
Dario Freni924af7d2018-08-17 00:56:14 +01002937 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002938
2939.PHONY: productservicesimage-nodeps psnod
2940productservicesimage-nodeps psnod: | $(INTERNAL_USERIMAGES_DEPS)
Dario Freni924af7d2018-08-17 00:56:14 +01002941 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002942
2943sync: $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2944
2945else ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002946INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
Dario Freni5f681e12018-05-29 13:09:01 +01002947$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCT_SERVICESIMAGE),$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)))
2948endif
2949
2950# -----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002951# odm partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002952ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002953INTERNAL_ODMIMAGE_FILES := \
2954 $(filter $(TARGET_OUT_ODM)/%,\
2955 $(ALL_DEFAULT_INSTALLED_MODULES)\
2956 $(ALL_PDK_FUSION_FILES)) \
2957 $(PDK_FUSION_SYMLINK_STAMP)
2958# platform.zip depends on $(INTERNAL_ODMIMAGE_FILES).
2959$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODMIMAGE_FILES)
2960
2961INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt
2962INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json)
2963$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM)
2964$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST)
2965 @echo Installed file list: $@
2966 @mkdir -p $(dir $@)
2967 @rm -f $@
2968 $(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json)
2969 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2970
2971odmimage_intermediates := \
2972 $(call intermediates-dir-for,PACKAGING,odm)
2973BUILT_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2974define build-odmimage-target
2975 $(call pretty,"Target odm fs image: $(INSTALLED_ODMIMAGE_TARGET)")
2976 @mkdir -p $(TARGET_OUT_ODM)
2977 @mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt
2978 $(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true)
2979 $(if $(BOARD_ODM_KERNEL_MODULES), \
2980 $(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm/,$(call intermediates-dir-for,PACKAGING,depmod_odm)))
2981 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2982 ./build/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002983 $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT)
2984 $(hide) $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),$(BOARD_ODMIMAGE_PARTITION_SIZE))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002985endef
2986
2987# We just build this directly to the install location.
2988INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET)
2989$(INSTALLED_ODMIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_ODMIMAGE_FILES) $(INSTALLED_FILES_FILE_ODM) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_ODM_KERNEL_MODULES)
2990 $(build-odmimage-target)
2991
2992.PHONY: odmimage-nodeps onod
2993odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
2994 $(build-odmimage-target)
2995
2996sync: $(INTERNAL_ODMIMAGE_FILES)
2997
2998else ifdef BOARD_PREBUILT_ODMIMAGE
2999INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
3000$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET)))
3001endif
3002
3003# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07003004# dtbo image
3005ifdef BOARD_PREBUILT_DTBOIMAGE
3006INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
3007
3008ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003009$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07003010 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
3011 $(AVBTOOL) add_hash_footer \
Anton Hansson6d814982018-11-26 18:12:05 +00003012 --image $@ \
3013 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
3014 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
3015 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
Yueyao Zhu211c9012017-04-27 00:34:50 -07003016else
3017$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
3018 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
3019endif
3020
Tao Bao0da43472018-08-22 22:53:41 -07003021endif # BOARD_PREBUILT_DTBOIMAGE
3022
3023# Returns a list of image targets corresponding to the given list of partitions. For example, it
3024# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET)
3025# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor".
3026# (1): list of partitions like "system", "vendor" or "system product product_services".
3027define images-for-partitions
3028$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))
3029endef
Yueyao Zhu211c9012017-04-27 00:34:50 -07003030
3031# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003032# vbmeta image
3033ifeq ($(BOARD_AVB_ENABLE),true)
3034
3035BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003036AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003037
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003038ifdef BOARD_AVB_KEY_PATH
3039$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
3040else
3041# If key path isn't specified, use the 4096-bit test key.
3042BOARD_AVB_ALGORITHM := SHA256_RSA4096
3043BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
3044endif
3045
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08003046# AVB signing for system_other.img.
3047ifdef BUILDING_SYSTEM_OTHER_IMAGE
3048ifdef BOARD_AVB_SYSTEM_OTHER_KEY_PATH
3049$(if $(BOARD_AVB_SYSTEM_OTHER_ALGORITHM),,$(error BOARD_AVB_SYSTEM_OTHER_ALGORITHM is not defined))
3050else
3051# If key path isn't specified, use the same key as BOARD_AVB_KEY_PATH.
3052BOARD_AVB_SYSTEM_OTHER_KEY_PATH := $(BOARD_AVB_KEY_PATH)
3053BOARD_AVB_SYSTEM_OTHER_ALGORITHM := $(BOARD_AVB_ALGORITHM)
3054endif
3055
Bowgo Tsaie4544b12019-02-27 10:15:51 +08003056$(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET): $(AVBTOOL) $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)
3057 @echo Extracting system_other avb key: $@
3058 @rm -f $@
3059 @mkdir -p $(dir $@)
3060 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH) --output $@
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08003061
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08003062ifndef BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX
3063BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
3064endif
3065
3066BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX)
3067endif # end of AVB for BUILDING_SYSTEM_OTHER_IMAGE
3068
Tao Bao744c4c72018-08-20 21:09:07 -07003069INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \
David Anderson7709ab22018-10-15 14:41:34 -07003070 $(BOARD_AVB_VBMETA_SYSTEM) \
Tao Bao744c4c72018-08-20 21:09:07 -07003071 $(BOARD_AVB_VBMETA_VENDOR)
3072
3073# Not allowing the same partition to appear in multiple groups.
3074ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
David Anderson7709ab22018-10-15 14:41:34 -07003075 $(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates)
Tao Bao744c4c72018-08-20 21:09:07 -07003076endif
3077
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003078# Appends security patch level as a AVB property descriptor
3079
3080BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
3081 --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
3082
3083BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
3084 --prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
3085
3086BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS += \
3087 --prop com.android.build.product_services.security_patch:$(PLATFORM_SECURITY_PATCH)
3088
3089# The following vendor- and odm-specific images needs explicitly set per board.
3090ifdef BOOT_SECURITY_PATCH
3091BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
3092 --prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH)
3093endif
3094
3095ifdef VENDOR_SECURITY_PATCH
3096BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
3097 --prop com.android.build.vendor.security_patch:$(VENDOR_SECURITY_PATCH)
3098endif
3099
3100ifdef ODM_SECURITY_PATCH
3101BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
3102 --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH)
3103endif
3104
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003105BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
3106DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
3107SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
3108VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05003109RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003110PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Dario Freni5f681e12018-05-29 13:09:01 +01003111PRODUCT_SERVICES_FOOTER_ARGS := BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003112ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003113
Tao Bao0da43472018-08-22 22:53:41 -07003114# Helper function that checks and sets required build variables for an AVB chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003115# $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system.
Tao Bao0da43472018-08-22 22:53:41 -07003116define _check-and-set-avb-chain-args
3117$(eval part := $(1))
3118$(eval PART=$(call to-upper,$(part)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003119
3120$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
3121$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
3122$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
3123$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
3124$(if $($(_key_path)),,$(error $(_key_path) is not defined))
3125$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
3126$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
3127$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
3128
3129# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
3130$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
3131$(eval $(_signing_args) := \
3132 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
3133
3134$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3135 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
3136
Tao Bao744c4c72018-08-20 21:09:07 -07003137# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up
David Anderson7709ab22018-10-15 14:41:34 -07003138# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX).
Tao Bao744c4c72018-08-20 21:09:07 -07003139$(if $(filter $(part),$(part:vbmeta_%=%)),\
3140 $(eval _footer_args := $(PART)_FOOTER_ARGS) \
3141 $(eval $($(_footer_args)) += --rollback_index $($(_rollback_index))))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003142endef
3143
Tao Bao0da43472018-08-22 22:53:41 -07003144# Checks and sets the required build variables for an AVB partition. The partition will be
3145# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the
Tao Bao744c4c72018-08-20 21:09:07 -07003146# image descriptor will be included into vbmeta.img, unless it has been already added to any chained
3147# VBMeta image.
Tao Bao0da43472018-08-22 22:53:41 -07003148# $(1): Partition name, e.g. boot or system.
3149define check-and-set-avb-args
Tao Bao744c4c72018-08-20 21:09:07 -07003150$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
Tao Bao0da43472018-08-22 22:53:41 -07003151$(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\
Tao Bao744c4c72018-08-20 21:09:07 -07003152 $(if $(_in_chained_vbmeta),\
3153 $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \
Tao Bao0da43472018-08-22 22:53:41 -07003154 $(call _check-and-set-avb-chain-args,$(1)),\
Tao Bao744c4c72018-08-20 21:09:07 -07003155 $(if $(_in_chained_vbmeta),,\
3156 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3157 --include_descriptors_from_image $(call images-for-partitions,$(1)))))
Tao Bao0da43472018-08-22 22:53:41 -07003158endef
3159
Tao Baob1a2e352018-08-14 16:17:12 -07003160ifdef INSTALLED_BOOTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003161$(eval $(call check-and-set-avb-args,boot))
Tao Baob1a2e352018-08-14 16:17:12 -07003162endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003163
Tao Bao0da43472018-08-22 22:53:41 -07003164$(eval $(call check-and-set-avb-args,system))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003165
3166ifdef INSTALLED_VENDORIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003167$(eval $(call check-and-set-avb-args,vendor))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003168endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003169
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003170ifdef INSTALLED_PRODUCTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003171$(eval $(call check-and-set-avb-args,product))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003172endif
3173
Tao Baocee6d042018-08-22 23:39:03 -07003174ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003175$(eval $(call check-and-set-avb-args,product_services))
Tao Baocee6d042018-08-22 23:39:03 -07003176endif
3177
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003178ifdef INSTALLED_ODMIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003179$(eval $(call check-and-set-avb-args,odm))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003180endif
3181
Yueyao Zhu211c9012017-04-27 00:34:50 -07003182ifdef INSTALLED_DTBOIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003183$(eval $(call check-and-set-avb-args,dtbo))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003184endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07003185
David Zeuthen8fecb282017-12-01 16:24:01 -05003186ifdef INSTALLED_RECOVERYIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003187$(eval $(call check-and-set-avb-args,recovery))
David Zeuthen8fecb282017-12-01 16:24:01 -05003188endif
Bowgo Tsai53cf9992017-06-13 11:27:06 +08003189
David Anderson7709ab22018-10-15 14:41:34 -07003190# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet.
3191ifdef BOARD_AVB_VBMETA_SYSTEM
3192$(eval $(call check-and-set-avb-args,vbmeta_system))
Tao Bao744c4c72018-08-20 21:09:07 -07003193endif
3194
3195ifdef BOARD_AVB_VBMETA_VENDOR
3196$(eval $(call check-and-set-avb-args,vbmeta_vendor))
3197endif
3198
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003199# Add kernel cmdline descriptor for kernel to mount system.img as root with
3200# dm-verity. This works when system.img is either chained or not-chained:
3201# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
3202# cmdline descriptor to system.img
3203# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
3204# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08003205ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
David Anderson8916a2a2018-09-18 15:46:59 -07003206ifeq ($(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003207BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08003208endif
David Anderson8916a2a2018-09-18 15:46:59 -07003209endif
Bowgo Tsai9b377602017-04-14 18:50:11 +08003210
Tao Bao0da43472018-08-22 22:53:41 -07003211BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
David Anderson7709ab22018-10-15 14:41:34 -07003212BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += --padding_size 4096
Tao Bao744c4c72018-08-20 21:09:07 -07003213BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += --padding_size 4096
3214
3215ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
Tao Bao240dcb82018-10-22 13:02:53 -07003216# We only need the flag in top-level vbmeta.img.
Tao Bao744c4c72018-08-20 21:09:07 -07003217BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
Tao Bao744c4c72018-08-20 21:09:07 -07003218endif
Tao Bao0da43472018-08-22 22:53:41 -07003219
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003220ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003221BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003222endif
3223
David Anderson7709ab22018-10-15 14:41:34 -07003224ifdef BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX
3225BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += \
3226 --rollback_index $(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX)
Tao Bao744c4c72018-08-20 21:09:07 -07003227endif
3228
3229ifdef BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX
3230BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += \
3231 --rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX)
John Reck0588b432018-05-03 13:20:01 -07003232endif
3233
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003234# $(1): the directory to extract public keys to
3235define extract-avb-chain-public-keys
3236 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
3237 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
3238 --output $(1)/boot.avbpubkey)
3239 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
3240 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
3241 --output $(1)/system.avbpubkey)
3242 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
3243 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
3244 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003245 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
3246 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
3247 --output $(1)/product.avbpubkey)
Dario Freni5f681e12018-05-29 13:09:01 +01003248 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
3249 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH) \
Dario Freni924af7d2018-08-17 00:56:14 +01003250 --output $(1)/product_services.avbpubkey)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003251 $(if $(BOARD_AVB_ODM_KEY_PATH),\
3252 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \
3253 --output $(1)/odm.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003254 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
3255 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
3256 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05003257 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
3258 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
3259 --output $(1)/recovery.avbpubkey)
David Anderson7709ab22018-10-15 14:41:34 -07003260 $(if $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH),\
3261 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3262 --output $(1)/vbmeta_system.avbpubkey)
Tao Bao744c4c72018-08-20 21:09:07 -07003263 $(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\
3264 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3265 --output $(1)/vbmeta_vendor.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003266endef
3267
Tao Bao744c4c72018-08-20 21:09:07 -07003268# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
3269# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level
David Anderson7709ab22018-10-15 14:41:34 -07003270# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM
3271# := system product_services`, `vbmeta_system.img` will be created that includes the descriptors
3272# for `system.img` and `product_services.img`. `vbmeta_system.img` itself will be included into
Tao Bao744c4c72018-08-20 21:09:07 -07003273# `vbmeta.img` as a chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003274# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
Tao Bao744c4c72018-08-20 21:09:07 -07003275# $(2): Output filename.
3276define build-chained-vbmeta-image
3277 $(call pretty,"Target chained vbmeta image: $@")
3278 $(hide) $(AVBTOOL) make_vbmeta_image \
3279 $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
3280 $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
3281 $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
3282 --include_descriptors_from_image $(call images-for-partitions,$(image))) \
3283 --output $@
3284endef
3285
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003286ifdef BUILDING_SYSTEM_IMAGE
David Anderson7709ab22018-10-15 14:41:34 -07003287ifdef BOARD_AVB_VBMETA_SYSTEM
3288INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img
3289$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003290 $(AVBTOOL) \
3291 $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
3292 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
David Anderson7709ab22018-10-15 14:41:34 -07003293 $(call build-chained-vbmeta-image,vbmeta_system)
Tao Bao744c4c72018-08-20 21:09:07 -07003294endif
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003295endif # BUILDING_SYSTEM_IMAGE
Tao Bao744c4c72018-08-20 21:09:07 -07003296
3297ifdef BOARD_AVB_VBMETA_VENDOR
3298INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img
3299$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003300 $(AVBTOOL) \
3301 $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
3302 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
Tao Bao744c4c72018-08-20 21:09:07 -07003303 $(call build-chained-vbmeta-image,vbmeta_vendor)
3304endif
3305
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003306define build-vbmetaimage-target
3307 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003308 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
3309 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003310 $(hide) $(AVBTOOL) make_vbmeta_image \
3311 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
Tao Bao0da43472018-08-22 22:53:41 -07003312 $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003313 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
3314 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003315 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003316endef
3317
3318INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
Tao Bao0da43472018-08-22 22:53:41 -07003319$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
3320 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
3321
David Zeuthen8fecb282017-12-01 16:24:01 -05003322$(INSTALLED_VBMETAIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003323 $(AVBTOOL) \
3324 $(INSTALLED_BOOTIMAGE_TARGET) \
3325 $(INSTALLED_SYSTEMIMAGE_TARGET) \
3326 $(INSTALLED_VENDORIMAGE_TARGET) \
3327 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3328 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3329 $(INSTALLED_ODMIMAGE_TARGET) \
3330 $(INSTALLED_DTBOIMAGE_TARGET) \
3331 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3332 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
3333 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
3334 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3335 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3336 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003337 $(build-vbmetaimage-target)
3338
3339.PHONY: vbmetaimage-nodeps
3340vbmetaimage-nodeps:
3341 $(build-vbmetaimage-target)
3342
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003343endif # BOARD_AVB_ENABLE
3344
3345# -----------------------------------------------------------------
Yifan Hong055e6cf2018-11-29 13:51:48 -08003346# Check image sizes <= size of super partition
3347
3348ifeq (,$(TARGET_BUILD_APPS))
3349# Do not check for apps-only build
3350
3351ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003352
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003353# (1): list of items like "system", "vendor", "product", "product_services"
3354# return: map each item into a command ( wrapped in $$() ) that reads the size
3355define read-size-of-partitions
Yifan Hong8c3dce02019-04-09 17:03:57 +00003356$(foreach image,$(call images-for-partitions,$(1)),$$( \
3357 build/make/tools/releasetools/sparse_img.py --get_partition_size $(image)))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003358endef
3359
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003360# round result to BOARD_SUPER_PARTITION_ALIGNMENT
3361#$(1): the calculated size
3362ifeq (,$(BOARD_SUPER_PARTITION_ALIGNMENT))
3363define round-partition-size
3364$(1)
3365endef
3366else
3367define round-partition-size
3368$$((($(1)+$(BOARD_SUPER_PARTITION_ALIGNMENT)-1)/$(BOARD_SUPER_PARTITION_ALIGNMENT)*$(BOARD_SUPER_PARTITION_ALIGNMENT)))
3369endef
3370endif
3371
David Anderson619fe2d2018-10-30 18:47:59 -07003372define super-slot-suffix
3373$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
3374endef
David Anderson1ef03e22018-08-30 13:11:47 -07003375
Yifan Hongb43012f2018-10-01 17:30:01 -07003376droid_targets: check-all-partition-sizes
Yifan Hong17dd45d2018-07-20 16:45:57 -07003377
Yifan Hongb43012f2018-10-01 17:30:01 -07003378.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
Yifan Hong17dd45d2018-07-20 16:45:57 -07003379
Yifan Hong17dd45d2018-07-20 16:45:57 -07003380# Add image dependencies so that generated_*_image_info.txt are written before checking.
Yifan Hong8c3dce02019-04-09 17:03:57 +00003381check-all-partition-sizes: \
3382 build/make/tools/releasetools/sparse_img.py \
3383 $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
Yifan Hong17dd45d2018-07-20 16:45:57 -07003384
David Anderson619fe2d2018-10-30 18:47:59 -07003385ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
Yifan Hongf39d8af2018-11-19 14:22:43 -08003386# Check sum(super partition block devices) == super partition
David Anderson619fe2d2018-10-30 18:47:59 -07003387# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
3388define check-super-partition-size
3389 size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
3390 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003391 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003392 if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003393 echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003394 echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
3395 exit 1; \
3396 else \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003397 echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003398 echo $${sum_sizes_expr} '==' $${max_size_expr}; \
3399 fi
3400endef
3401endif
3402
Yifan Hongb43012f2018-10-01 17:30:01 -07003403# $(1): human-readable max size string
3404# $(2): max size expression
3405# $(3): list of partition names
3406define check-sum-of-partition-sizes
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003407 partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
3408 echo $(call round-partition-size,$${i}); \
3409 done)"; \
3410 sum_sizes_expr=$$(tr '\n' '+' <<< "$${partition_size_list}" | sed 's/+$$//'); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003411 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \
3412 echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \
3413 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
3414 exit 1; \
3415 else \
3416 echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
3417 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
Yifan Hongd58e70b2019-01-11 13:20:52 -08003418 fi;
Yifan Hongb43012f2018-10-01 17:30:01 -07003419endef
Yifan Hong17dd45d2018-07-20 16:45:57 -07003420
Yifan Hongb43012f2018-10-01 17:30:01 -07003421define check-all-partition-sizes-target
Yifan Hongf39d8af2018-11-19 14:22:43 -08003422 # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003423 $(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003424 $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
3425 $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
Yifan Hongb43012f2018-10-01 17:30:01 -07003426
3427 # For each group, check sum(partitions in group) <= group size
3428 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
3429 $(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
3430 $(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
3431
Yifan Hongf39d8af2018-11-19 14:22:43 -08003432 # Check sum(all group sizes) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003433 if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
3434 group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
3435 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003436 max_size_tail=$(if $(call super-slot-suffix)," / 2"); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003437 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
3438 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
3439 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3440 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3441 exit 1; \
3442 else \
3443 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3444 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3445 fi \
3446 fi
3447endef
3448
3449check-all-partition-sizes check-all-partition-sizes-nodeps:
3450 $(call check-all-partition-sizes-target)
David Anderson619fe2d2018-10-30 18:47:59 -07003451 $(call check-super-partition-size)
Yifan Hongb43012f2018-10-01 17:30:01 -07003452
Yifan Hong2dae5722018-07-31 12:47:27 -07003453endif # PRODUCT_BUILD_SUPER_PARTITION
Yifan Hong17dd45d2018-07-20 16:45:57 -07003454
3455endif # TARGET_BUILD_APPS
3456
3457# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08003458# bring in the installer image generation defines if necessary
3459ifeq ($(TARGET_USE_DISKINSTALLER),true)
3460include bootable/diskinstaller/config.mk
3461endif
3462
3463# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07003464# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08003465
Ying Wangbd2d0242015-09-22 11:17:52 -07003466ifeq ($(BUILD_OS),darwin)
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003467 build_ota_package := false
3468 build_otatools_package := false
3469else
Tao Bao9be20c72019-04-08 21:11:59 -07003470 # Set build_ota_package, and allow opt-out below.
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003471 build_ota_package := true
3472 ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
3473 build_ota_package := false
3474 endif
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003475 ifneq (,$(filter address, $(SANITIZE_TARGET)))
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003476 build_ota_package := false
3477 endif
3478 ifeq ($(TARGET_PRODUCT),sdk)
3479 build_ota_package := false
3480 endif
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003481 ifeq ($(TARGET_BUILD_PDK),true)
3482 build_ota_package := false
3483 endif
Tao Bao9be20c72019-04-08 21:11:59 -07003484 ifneq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
3485 ifneq ($(filter generic%,$(TARGET_DEVICE)),)
3486 build_ota_package := false
3487 endif
3488 ifeq ($(TARGET_NO_KERNEL),true)
3489 build_ota_package := false
3490 endif
3491 ifeq ($(recovery_fstab),)
3492 build_ota_package := false
3493 endif
3494 endif # PRODUCT_BUILD_GENERIC_OTA_PACKAGE
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003495
Tao Bao9be20c72019-04-08 21:11:59 -07003496 # Set build_otatools_package, and allow opt-out below.
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003497 build_otatools_package := true
3498 ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
3499 build_otatools_package := false
3500 endif
Colin Cross481cc5a2016-02-04 15:09:23 -08003501endif
Ying Wangbd2d0242015-09-22 11:17:52 -07003502
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003503ifeq ($(build_otatools_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07003504OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
3505 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08003506 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07003507 $(HOST_OUT_EXECUTABLES)/mkbootfs \
3508 $(HOST_OUT_EXECUTABLES)/mkbootimg \
3509 $(HOST_OUT_EXECUTABLES)/fs_config \
3510 $(HOST_OUT_EXECUTABLES)/zipalign \
3511 $(HOST_OUT_EXECUTABLES)/bsdiff \
3512 $(HOST_OUT_EXECUTABLES)/imgdiff \
Ying Wangc45a47b2015-04-08 12:24:37 -07003513 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
3514 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003515 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08003516 $(HOST_OUT_EXECUTABLES)/mke2fs \
Tianjie Xu57332222018-08-15 16:16:21 -07003517 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs \
Tao Baobcc31092017-01-06 14:24:18 -08003518 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Mark Salyzyn780f5952018-10-19 13:44:36 -07003519 $(HOST_OUT_EXECUTABLES)/tune2fs \
Tao Baocffaf732016-04-14 12:11:36 -07003520 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
3521 $(HOST_OUT_EXECUTABLES)/mksquashfs \
3522 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
3523 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08003524 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07003525 $(HOST_OUT_EXECUTABLES)/simg2img \
3526 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003527 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07003528 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08003529 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07003530 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07003531 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01003532 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003533 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08003534 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
3535 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07003536 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tianjie Xuccbae482018-08-15 14:28:27 -07003537 $(HOST_OUT_EXECUTABLES)/care_map_generator \
Bill Peckhamf753e152019-02-19 18:02:46 -08003538 $(HOST_OUT_EXECUTABLES)/fc_sort \
3539 $(HOST_OUT_EXECUTABLES)/sefcontext_compile \
David Anderson1ef03e22018-08-30 13:11:47 -07003540 $(LPMAKE) \
Tao Bao3cba3742017-05-16 16:27:25 -07003541 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003542 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07003543 $(BROTLI) \
3544 $(BUILD_VERITY_METADATA) \
3545 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08003546
Anton Hansson8dab0a62019-03-28 15:45:40 +00003547ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Tao Bao5e04c382017-02-22 16:38:19 -08003548OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08003549 $(FUTILITY) \
3550 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08003551endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08003552
Ying Wangc45a47b2015-04-08 12:24:37 -07003553# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07003554OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07003555 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
3556 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
3557 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003558 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003559 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003560 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003561 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
3562 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
3563 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
3564 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08003565 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003566 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
3567 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08003568 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003569 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
3570 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
3571 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003572 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
3573 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00003574 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08003575 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003576 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01003577 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08003578 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01003579 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003580 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
David Anderson1ef03e22018-08-30 13:11:47 -07003581 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) \
3582 $(HOST_LIBRARY_PATH)/liblp$(HOST_SHLIB_SUFFIX) \
Tao Baoa19f8e92019-01-02 23:22:42 -08003583 $(HOST_LIBRARY_PATH)/libext4_utils$(HOST_SHLIB_SUFFIX) \
Tao Baobeea6c02019-01-03 12:18:24 -08003584 $(HOST_LIBRARY_PATH)/libfec$(HOST_SHLIB_SUFFIX) \
3585 $(HOST_LIBRARY_PATH)/libsquashfs_utils$(HOST_SHLIB_SUFFIX)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003586
The Android Open Source Project88b60792009-03-03 19:28:42 -08003587
Ying Wang06898662010-06-17 17:52:18 -07003588.PHONY: otatools
3589otatools: $(OTATOOLS)
3590
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003591BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07003592$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003593
Tao Baoe8ef8f702017-05-17 11:41:50 -07003594OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003595 system/extras/ext4_utils/mke2fs.conf \
Dan Willemsen0ab1be62019-04-09 21:35:37 -07003596 $(sort $(shell find build/make/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Tao Bao93ab8442018-10-12 11:03:04 -07003597 -name verity_key))
3598
3599ifneq (,$(wildcard device))
3600OTATOOLS_DEPS += \
Dan Willemsen60c66442018-05-01 19:07:27 -07003601 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
3602 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Bao93ab8442018-10-12 11:03:04 -07003603endif
3604ifneq (,$(wildcard external/avb))
3605OTATOOLS_DEPS += \
3606 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
3607 -name "atx_metadata.bin"))
3608endif
3609ifneq (,$(wildcard system/update_engine))
3610OTATOOLS_DEPS += \
3611 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print))
3612endif
Tao Baoe8ef8f702017-05-17 11:41:50 -07003613
3614OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07003615 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003616
Anton Hansson8dab0a62019-03-28 15:45:40 +00003617ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003618OTATOOLS_DEPS += \
Tao Bao5232f092018-02-10 04:03:32 +00003619 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003620endif
3621
Colin Cross21122f92018-09-14 21:51:11 -07003622$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) $(SOONG_ZIP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003623 @echo "Package OTA tools: $@"
3624 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07003625 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07003626 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Bill Peckhameabb7132019-02-15 11:25:34 -08003627 $(hide) cp $(SOONG_ZIP) $(zip_root)/bin/
Colin Cross21122f92018-09-14 21:51:11 -07003628 $(hide) cp -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003629 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Colin Cross21122f92018-09-14 21:51:11 -07003630 $(hide) $(SOONG_ZIP) -o $@ -C $(zip_root) -D $(zip_root) \
3631 -C . $(addprefix -f ,$(OTATOOLS_DEPS))
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003632
3633.PHONY: otatools-package
3634otatools-package: $(BUILT_OTATOOLS_PACKAGE)
3635
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003636endif # build_otatools_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003637
The Android Open Source Project88b60792009-03-03 19:28:42 -08003638# -----------------------------------------------------------------
3639# A zip of the directories that map to the target filesystem.
3640# This zip can be used to create an OTA package or filesystem image
3641# as a post-build step.
3642#
3643name := $(TARGET_PRODUCT)
3644ifeq ($(TARGET_BUILD_TYPE),debug)
3645 name := $(name)_debug
3646endif
3647name := $(name)-target_files-$(FILE_NAME_TAG)
3648
3649intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
3650BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
3651$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
3652$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003653 zip_root := $(intermediates)/$(name)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003654
3655# $(1): Directory to copy
3656# $(2): Location to copy it to
3657# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
3658define package_files-copy-root
3659 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
3660 mkdir -p $(2) && \
3661 $(ACP) -rd $(strip $(1))/* $(2); \
3662 fi
3663endef
3664
Tao Baoa04fca32015-11-30 12:22:24 -08003665built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07003666
3667# We can't build static executables when SANITIZE_TARGET=address
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003668ifeq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wange6e544e2015-06-22 18:35:35 -07003669built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07003670 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
3671endif
3672
The Android Open Source Project88b60792009-03-03 19:28:42 -08003673$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
3674
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003675$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003676$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003677
Doug Zongkerc18736b2009-09-30 09:20:32 -07003678ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
3679# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07003680tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07003681else
Dan Willemsen653bea92017-03-21 15:47:37 -07003682tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003683endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003684tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
3685$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
3686$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003687
Sen Jiang4438fd92016-03-07 16:51:01 -08003688ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08003689updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08003690else
Steve Fung48e49f52015-10-01 23:53:31 -07003691# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003692updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07003693endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003694$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07003695
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003696# If we are using recovery as boot, output recovery files to BOOT/.
3697ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
3698$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
3699else
3700$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
3701endif
3702
Dan Willemsen653bea92017-03-21 15:47:37 -07003703ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07003704 ifdef OSRELEASED_DIRECTORY
3705 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
3706 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
3707 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
3708 endif
3709endif
3710
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003711# Run fs_config while creating the target files package
3712# $1: root directory
3713# $2: add prefix
3714define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08003715(cd $(1); find . -type d | sed 's,$$,/,'; find . \! -type d) | cut -c 3- | sort | sed 's,^,$(2),' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) -R "$(2)"
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003716endef
3717
Yifan Hong2b891ac2018-11-29 12:06:31 -08003718# $(1): file
3719define dump-dynamic-partitions-info
3720 $(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \
3721 echo "use_dynamic_partitions=true" >> $(1))
3722 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
3723 echo "dynamic_partition_retrofit=true" >> $(1))
Yifan Hong055e6cf2018-11-29 13:51:48 -08003724 echo "lpmake=$(notdir $(LPMAKE))" >> $(1)
3725 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \
3726 echo "build_super_partition=true" >> $(1)))
Tao Bao519d1822018-12-27 12:47:23 -08003727 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \
3728 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08003729 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1)
3730 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3731 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1))
3732 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3733 echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
3734 $(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
3735 echo "dynamic_partition_list=$(BOARD_SUPER_PARTITION_PARTITION_LIST)" >> $(1))
3736 $(if $(BOARD_SUPER_PARTITION_GROUPS),
3737 echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
3738 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
3739 echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
3740 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
3741 echo "super_$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(1);))
Yifan Hongcb35bd92019-04-02 16:29:59 -07003742 $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)), \
3743 echo "build_non_sparse_super_partition=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08003744endef
3745
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003746# By conditionally including the dependency of the target files package on the
3747# full system image deps, we speed up builds that do not build the system
3748# image.
3749ifdef BUILDING_SYSTEM_IMAGE
3750$(BUILT_TARGET_FILES_PACKAGE): $(FULL_SYSTEMIMAGE_DEPS)
3751endif
3752
The Android Open Source Project88b60792009-03-03 19:28:42 -08003753# Depending on the various images guarantees that the underlying
3754# directories are up-to-date.
3755$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003756 $(INSTALLED_RAMDISK_TARGET) \
3757 $(INSTALLED_BOOTIMAGE_TARGET) \
3758 $(INSTALLED_RADIOIMAGE_TARGET) \
3759 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00003760 $(INSTALLED_USERDATAIMAGE_TARGET) \
3761 $(INSTALLED_CACHEIMAGE_TARGET) \
3762 $(INSTALLED_VENDORIMAGE_TARGET) \
3763 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3764 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3765 $(INSTALLED_VBMETAIMAGE_TARGET) \
3766 $(INSTALLED_ODMIMAGE_TARGET) \
3767 $(INSTALLED_DTBOIMAGE_TARGET) \
3768 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
3769 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
3770 $(INSTALLED_KERNEL_TARGET) \
3771 $(INSTALLED_2NDBOOTLOADER_TARGET) \
3772 $(BOARD_PREBUILT_DTBOIMAGE) \
Hridya Valsarajua9418992019-02-04 10:35:25 -08003773 $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003774 $(BOARD_RECOVERY_ACPIO) \
Anton Hansson8dab0a62019-03-28 15:45:40 +00003775 $(PRODUCT_SYSTEM_BASE_FS_PATH) \
3776 $(PRODUCT_VENDOR_BASE_FS_PATH) \
3777 $(PRODUCT_PRODUCT_BASE_FS_PATH) \
3778 $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3779 $(PRODUCT_ODM_BASE_FS_PATH) \
Anton Hansson6d814982018-11-26 18:12:05 +00003780 $(LPMAKE) \
3781 $(SELINUX_FC) \
3782 $(APKCERTS_FILE) \
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003783 $(SOONG_APEX_KEYS_FILE) \
Anton Hansson6d814982018-11-26 18:12:05 +00003784 $(SOONG_ZIP) \
3785 $(HOST_OUT_EXECUTABLES)/fs_config \
3786 $(HOST_OUT_EXECUTABLES)/imgdiff \
3787 $(HOST_OUT_EXECUTABLES)/bsdiff \
3788 $(HOST_OUT_EXECUTABLES)/care_map_generator \
3789 $(BUILD_IMAGE_SRCS) \
3790 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
3791 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
3792 $(BUILT_SYSTEM_MATRIX) \
3793 $(BUILT_VENDOR_MATRIX) \
3794 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003795 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07003796 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003797 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01003798 $(call create-system-product_services-symlink)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003799 $(call create-vendor-odm-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003800 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003801 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003802ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08003803 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003804 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003805 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003806 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003807ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003808 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003809endif
3810ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003811 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003812endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003813ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08003814ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
3815 $(hide) cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
3816else
cfig28687402018-08-22 16:21:41 +08003817 $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003818endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08003819endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003820ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3821 $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
3822endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003823ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
3824 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
3825endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003826ifdef INTERNAL_KERNEL_CMDLINE
3827 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003828endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003829ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003830 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07003831endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003832ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003833 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07003834endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003835endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08003836 @# Components of the boot image
3837 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07003838 $(hide) mkdir -p $(zip_root)/ROOT
3839 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003840 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
Tom Cherry3871f0f2018-11-06 14:23:44 -08003841 @# If we are using recovery as boot, this is already done when processing recovery.
3842ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherryd14b8952018-08-09 14:26:00 -07003843ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003844 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003845 $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07003846endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003847ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003848 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003849endif
3850ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003851 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003852endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003853ifdef INSTALLED_DTBIMAGE_TARGET
3854 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
3855endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003856ifdef INTERNAL_KERNEL_CMDLINE
3857 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003858endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003859ifdef BOARD_KERNEL_BASE
3860 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
3861endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003862ifdef BOARD_KERNEL_PAGESIZE
3863 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
3864endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003865endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07003866 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
3867 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07003868 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
Dan Willemsen67495202019-01-16 12:42:05 -08003869ifdef BUILDING_SYSTEM_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003870 @# Contents of the system image
3871 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003872 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
Dan Willemsen67495202019-01-16 12:42:05 -08003873endif
3874ifdef BUILDING_USERDATA_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003875 @# Contents of the data image
3876 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003877 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Dan Willemsen67495202019-01-16 12:42:05 -08003878endif
3879ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07003880 @# Contents of the vendor image
3881 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003882 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
Ying Wanga0febe52013-03-20 11:02:05 -07003883endif
Dan Willemsen67495202019-01-16 12:42:05 -08003884ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003885 @# Contents of the product image
3886 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003887 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003888endif
Dan Willemsen67495202019-01-16 12:42:05 -08003889ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01003890 @# Contents of the product_services image
Dario Freni5f681e12018-05-29 13:09:01 +01003891 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003892 $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
Dario Freni5f681e12018-05-29 13:09:01 +01003893endif
Dan Willemsen67495202019-01-16 12:42:05 -08003894ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003895 @# Contents of the odm image
3896 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003897 $(TARGET_OUT_ODM),$(zip_root)/ODM)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003898endif
Dan Willemsen67495202019-01-16 12:42:05 -08003899ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07003900 @# Contents of the system_other image
3901 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003902 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
Alex Light4e358ab2016-06-16 14:47:10 -07003903endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003904 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07003905 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07003906 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07003907ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08003908ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07003909 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07003910 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07003911endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08003912endif
Doug Zongker8678df42009-06-15 14:30:14 -07003913 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08003914 @# build them.
3915 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07003916 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003917 $(hide) cp $(SOONG_APEX_KEYS_FILE) $(zip_root)/META/apexkeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003918ifneq ($(tool_extension),)
3919 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
3920endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07003921 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003922 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07003923 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003924 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003925ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07003926 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003927endif
3928ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003929 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003930endif
Tao Baodb45efa2015-10-27 19:25:18 -07003931ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3932 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
3933endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003934ifdef BOARD_INCLUDE_RECOVERY_DTBO
3935 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
3936endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003937ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3938 $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
3939endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003940ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003941 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003942endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07003943ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
3944 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
3945 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3946else
3947 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3948endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003949 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07003950 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07003951ifdef PRODUCT_EXTRA_RECOVERY_KEYS
3952 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08003953endif
Jianxun Zhang09849492013-04-17 15:19:19 -07003954 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00003955 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08003956 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08003957 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Tao Bao9be20c72019-04-08 21:11:59 -07003958ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
3959 $(hide) echo "build_generic_ota_package=true" >> $(zip_root)/META/misc_info.txt
3960endif
Ying Wange24e17a2014-10-07 18:42:11 -07003961ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07003962 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07003963 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07003964endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00003965ifneq ($(PRODUCT_SYSTEM_BASE_FS_PATH),)
3966 $(hide) cp $(PRODUCT_SYSTEM_BASE_FS_PATH) \
3967 $(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_BASE_FS_PATH))
Tao Baof54216f2016-03-29 15:12:37 -07003968endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00003969ifneq ($(PRODUCT_VENDOR_BASE_FS_PATH),)
3970 $(hide) cp $(PRODUCT_VENDOR_BASE_FS_PATH) \
3971 $(zip_root)/META/$(notdir $(PRODUCT_VENDOR_BASE_FS_PATH))
Tao Baof54216f2016-03-29 15:12:37 -07003972endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00003973ifneq ($(PRODUCT_PRODUCT_BASE_FS_PATH),)
3974 $(hide) cp $(PRODUCT_PRODUCT_BASE_FS_PATH) \
3975 $(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_BASE_FS_PATH))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003976endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00003977ifneq ($(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH),)
3978 $(hide) cp $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3979 $(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH))
Dario Freni5f681e12018-05-29 13:09:01 +01003980endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00003981ifneq ($(PRODUCT_ODM_BASE_FS_PATH),)
3982 $(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \
3983 $(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003984endif
Evgenii Stepanov60beecc2019-01-18 13:53:52 -08003985ifneq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wang2a048392015-06-25 13:56:53 -07003986 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
3987 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
3988endif
Tao Bao8beab692015-07-22 12:33:18 -07003989ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
3990 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
3991endif
David Zeuthen0eb10972016-09-28 17:55:27 -04003992ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003993 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
3994 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3995 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3996 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3997 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3998ifdef BOARD_AVB_BOOT_KEY_PATH
3999 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4000 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4001 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4002endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05004003 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
4004ifdef BOARD_AVB_RECOVERY_KEY_PATH
4005 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4006 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4007 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4008endif # BOARD_AVB_RECOVERY_KEY_PATH
David Anderson7709ab22018-10-15 14:41:34 -07004009ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
4010 $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $(zip_root)/META/misc_info.txt
4011 $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
4012 $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4013 $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4014 $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4015endif # BOARD_AVB_VBMETA_SYSTEM
Tao Bao744c4c72018-08-20 21:09:07 -07004016ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
4017 $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $(zip_root)/META/misc_info.txt
David Anderson7709ab22018-10-15 14:41:34 -07004018 $(hide) echo "avb_vbmeta_vendor_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
Tao Bao744c4c72018-08-20 21:09:07 -07004019 $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4020 $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4021 $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4022endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004023endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04004024ifdef BOARD_BPT_INPUT_FILES
4025 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
4026 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
4027 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
4028endif
4029ifdef BOARD_BPT_DISK_SIZE
4030 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
4031endif
Ying Wangbd93d422011-10-28 17:02:30 -07004032 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07004033ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Daniel Normanadf80962019-03-18 14:20:52 -07004034ifdef BUILDING_SYSTEM_IMAGE
Per Astrandcab66992015-03-25 14:06:30 +01004035 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08004036 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Daniel Normanadf80962019-03-18 14:20:52 -07004037endif # BUILDING_SYSTEM_IMAGE
Tao Baocbc6dc22015-08-18 18:03:56 -07004038endif
Alex Deymo70067ac2015-09-29 19:05:37 -07004039ifeq ($(AB_OTA_UPDATER),true)
4040 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07004041 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07004042 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07004043 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
4044 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08004045 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
4046 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
4047 done
Steve Fung4044b382015-11-05 02:04:04 -08004048 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
4049 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08004050 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07004051ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07004052 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
4053 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
4054 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07004055endif
Alex Deymo70067ac2015-09-29 19:05:37 -07004056endif
Steve Fungdfbab492015-09-24 18:12:33 -07004057ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07004058 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07004059 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
4060endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07004061ifdef BOARD_PREBUILT_VENDORIMAGE
4062 $(hide) mkdir -p $(zip_root)/IMAGES
4063 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
4064endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004065ifdef BOARD_PREBUILT_PRODUCTIMAGE
4066 $(hide) mkdir -p $(zip_root)/IMAGES
4067 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
4068endif
Dario Freni5f681e12018-05-29 13:09:01 +01004069ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
4070 $(hide) mkdir -p $(zip_root)/IMAGES
4071 $(hide) cp $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(zip_root)/IMAGES/
4072endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07004073ifdef BOARD_PREBUILT_BOOTIMAGE
4074 $(hide) mkdir -p $(zip_root)/IMAGES
4075 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
4076endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004077ifdef BOARD_PREBUILT_ODMIMAGE
4078 $(hide) mkdir -p $(zip_root)/IMAGES
4079 $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/
4080endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07004081ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07004082 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
4083 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
4084 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
4085ifeq ($(BOARD_AVB_ENABLE),true)
4086 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004087 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
4088ifdef BOARD_AVB_DTBO_KEY_PATH
4089 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4090 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4091 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07004092 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004093endif # BOARD_AVB_DTBO_KEY_PATH
4094endif # BOARD_AVB_ENABLE
4095endif # BOARD_PREBUILT_DTBOIMAGE
Yifan Hong2b891ac2018-11-29 12:06:31 -08004096 $(call dump-dynamic-partitions-info,$(zip_root)/META/misc_info.txt)
Tao Bao95a95c32017-06-16 15:30:23 -07004097 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
4098 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
4099 @# INSTALLED_RADIOIMAGE_TARGET.
4100 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
4101 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004102 @# Run fs_config on all the system, vendor, boot ramdisk,
4103 @# and recovery ramdisk files in the zip, and save the output
Dan Willemsen67495202019-01-16 12:42:05 -08004104ifdef BUILDING_SYSTEM_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004105 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
Dan Willemsen67495202019-01-16 12:42:05 -08004106endif
4107ifdef BUILDING_VENDOR_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004108 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
4109endif
Dan Willemsen67495202019-01-16 12:42:05 -08004110ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004111 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
4112endif
Dan Willemsen67495202019-01-16 12:42:05 -08004113ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01004114 $(hide) $(call fs_config,$(zip_root)/PRODUCT_SERVICES,product_services/) > $(zip_root)/META/product_services_filesystem_config.txt
Dario Freni5f681e12018-05-29 13:09:01 +01004115endif
Dan Willemsen67495202019-01-16 12:42:05 -08004116ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004117 $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
4118endif
Tom Cherryd14b8952018-08-09 14:26:00 -07004119 @# ROOT always contains the files for the root under normal boot.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004120 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004121ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherry2929cad2018-09-20 11:04:37 -07004122 @# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004123 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004124endif
Tom Cherry2929cad2018-09-20 11:04:37 -07004125ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
4126 @# BOOT/RAMDISK also exists and contains the first stage ramdisk if not using BOARD_BUILD_SYSTEM_ROOT_IMAGE.
Tao Baoda01b212018-02-28 21:20:08 -08004127 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
4128endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004129ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
4130 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
4131endif
Dan Willemsen67495202019-01-16 12:42:05 -08004132ifdef BUILDING_SYSTEM_OTHER_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004133 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
4134endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004135 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07004136 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07004137ifdef BUILT_ASSEMBLED_SYSTEM_MANIFEST
Steven Moreland627debe2018-05-01 09:54:21 -07004138 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07004139endif
Steven Moreland627debe2018-05-01 09:54:21 -07004140ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
4141 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004142endif
Yifan Hongaa212212017-04-14 00:00:46 -07004143ifdef BUILT_VENDOR_MATRIX
4144 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004145endif
Yifan Hong07d3d792018-10-16 15:55:25 -07004146ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
4147 $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
Tao Bao943fa4c2018-12-19 10:39:34 -08004148 @# Remove 'vendor' from the group partition list if the image is not available. This should only
4149 @# happen to AOSP targets built without vendor.img. We can't remove the partition from the
4150 @# BoardConfig file, as it's still needed elsewhere (e.g. when creating super_empty.img).
Yifan Hong07d3d792018-10-16 15:55:25 -07004151 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
Tao Bao943fa4c2018-12-19 10:39:34 -08004152 $(eval _group_partition_list := $(BOARD_$(call to-upper,$(group))_PARTITION_LIST)) \
4153 $(if $(INSTALLED_VENDORIMAGE_TARGET),,$(eval _group_partition_list := $(filter-out vendor,$(_group_partition_list)))) \
Yifan Hong07d3d792018-10-16 15:55:25 -07004154 echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \
Tao Bao943fa4c2018-12-19 10:39:34 -08004155 $(if $(_group_partition_list), \
4156 echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
4157endif # BOARD_SUPER_PARTITION_GROUPS
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004158 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08004159 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08004160 @# Zip everything up, preserving symlinks and placing META/ files first to
4161 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004162 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07004163 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004164 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07004165
Ying Wanga0febe52013-03-20 11:02:05 -07004166.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08004167target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
4168
Ying Wang4709d7c2014-04-14 17:25:43 -07004169ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
4170$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
4171endif
Doug Zongker367910f2009-06-15 18:56:51 -07004172
Dan Albert4d323332016-10-14 13:23:06 -07004173# -----------------------------------------------------------------
4174# NDK Sysroot Package
4175NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07004176$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07004177 @echo Package NDK sysroot...
4178 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
4179
4180$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
4181
Ying Wang09c4b682015-08-11 11:24:19 -07004182ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07004183# -----------------------------------------------------------------
4184# OTA update package
4185
Yifan Hong50e79542018-11-08 17:44:12 -08004186# $(1): output file
4187# $(2): additional args
4188define build-ota-package-target
4189PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
4190 build/make/tools/releasetools/ota_from_target_files -v \
4191 --block \
4192 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
4193 -p $(HOST_OUT) \
4194 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
4195 $(2) \
4196 $(BUILT_TARGET_FILES_PACKAGE) $(1)
4197endef
4198
Doug Zongker8678df42009-06-15 14:30:14 -07004199name := $(TARGET_PRODUCT)
4200ifeq ($(TARGET_BUILD_TYPE),debug)
4201 name := $(name)_debug
4202endif
4203name := $(name)-ota-$(FILE_NAME_TAG)
4204
4205INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4206
xunchang3b548b02019-02-19 14:52:33 -08004207INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata
4208
Doug Zongker8678df42009-06-15 14:30:14 -07004209$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4210
Tao Baoe53c6e72017-04-19 15:54:22 -07004211ifeq ($(AB_OTA_UPDATER),true)
4212$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07004213else
Alex Deymob10e07a2017-11-09 23:53:42 +01004214$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07004215endif
4216
xunchang3b548b02019-02-19 14:52:33 -08004217$(INTERNAL_OTA_PACKAGE_TARGET): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_OTA_METADATA)
4218
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09004219$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004220 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07004221 @echo "Package OTA: $@"
xunchang3b548b02019-02-19 14:52:33 -08004222 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --output_metadata_path $(INTERNAL_OTA_METADATA))
Doug Zongker8678df42009-06-15 14:30:14 -07004223
4224.PHONY: otapackage
4225otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
4226
Tao Bao519d1822018-12-27 12:47:23 -08004227ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true)
Yifan Hong50e79542018-11-08 17:44:12 -08004228name := $(TARGET_PRODUCT)
4229ifeq ($(TARGET_BUILD_TYPE),debug)
4230 name := $(name)_debug
4231endif
4232name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
4233
4234INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4235
4236$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4237
4238ifeq ($(AB_OTA_UPDATER),true)
4239$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
4240else
4241$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BROTLI)
4242endif
4243
4244$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004245 build/make/tools/releasetools/ota_from_target_files
Yifan Hong50e79542018-11-08 17:44:12 -08004246 @echo "Package OTA (retrofit dynamic partitions): $@"
4247 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
4248
4249.PHONY: otardppackage
4250
4251otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
4252
Tao Bao519d1822018-12-27 12:47:23 -08004253endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
Yifan Hong50e79542018-11-08 17:44:12 -08004254
Ying Wang09c4b682015-08-11 11:24:19 -07004255endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07004256
Ying Wang09a00a62010-10-20 14:01:09 -07004257# -----------------------------------------------------------------
4258# The update package
4259
4260name := $(TARGET_PRODUCT)
4261ifeq ($(TARGET_BUILD_TYPE),debug)
4262 name := $(name)_debug
4263endif
4264name := $(name)-img-$(FILE_NAME_TAG)
4265
4266INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4267
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004268$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07004269 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004270 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
4271 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07004272
4273.PHONY: updatepackage
4274updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
4275
The Android Open Source Project88b60792009-03-03 19:28:42 -08004276# -----------------------------------------------------------------
Dario Frenid1011272018-07-23 20:20:15 +01004277# A zip of the appcompat directory containing logs
4278APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip
4279# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
4280ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004281$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004282 $(INSTALLED_RAMDISK_TARGET) \
4283 $(INSTALLED_BOOTIMAGE_TARGET) \
4284 $(INSTALLED_USERDATAIMAGE_TARGET) \
4285 $(INSTALLED_VENDORIMAGE_TARGET) \
4286 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4287 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
Dario Frenid1011272018-07-23 20:20:15 +01004288endif
4289$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
4290$(APPCOMPAT_ZIP): $(SOONG_ZIP)
4291 @echo "appcompat logs: $@"
4292 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4293 $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/appcompat $(dir $(PRIVATE_LIST_FILE))
4294 $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE)
4295 $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE)
4296
4297
4298# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004299# A zip of the symbols directory. Keep the full paths to make it
4300# more obvious where these files came from.
4301#
4302name := $(TARGET_PRODUCT)
4303ifeq ($(TARGET_BUILD_TYPE),debug)
4304 name := $(name)_debug
4305endif
4306name := $(name)-symbols-$(FILE_NAME_TAG)
4307
4308SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004309# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07004310ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004311$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004312 $(INSTALLED_RAMDISK_TARGET) \
4313 $(INSTALLED_BOOTIMAGE_TARGET) \
4314 $(INSTALLED_USERDATAIMAGE_TARGET) \
4315 $(INSTALLED_VENDORIMAGE_TARGET) \
4316 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4317 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4318 $(INSTALLED_ODMIMAGE_TARGET) \
4319 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07004320endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004321$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
4322$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004323 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004324 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4325 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
Jiyong Park88e09802019-03-21 15:19:16 +09004326 $(hide) find -L $(TARGET_OUT_UNSTRIPPED) -type f | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08004327 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004328# -----------------------------------------------------------------
4329# A zip of the coverage directory.
4330#
4331name := $(TARGET_PRODUCT)
4332ifeq ($(TARGET_BUILD_TYPE),debug)
4333name := $(name)_debug
4334endif
4335name := $(name)-coverage-$(FILE_NAME_TAG)
4336COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
4337ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004338$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004339 $(INSTALLED_RAMDISK_TARGET) \
4340 $(INSTALLED_BOOTIMAGE_TARGET) \
4341 $(INSTALLED_USERDATAIMAGE_TARGET) \
4342 $(INSTALLED_VENDORIMAGE_TARGET) \
4343 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4344 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4345 $(INSTALLED_ODMIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004346endif
4347$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
4348$(COVERAGE_ZIP): $(SOONG_ZIP)
4349 @echo "Package coverage: $@"
4350 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4351 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
4352 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
4353 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004354
4355# -----------------------------------------------------------------
4356# A zip of the Android Apps. Not keeping full path so that we don't
4357# include product names when distributing
4358#
4359name := $(TARGET_PRODUCT)
4360ifeq ($(TARGET_BUILD_TYPE),debug)
4361 name := $(name)_debug
4362endif
4363name := $(name)-apps-$(FILE_NAME_TAG)
4364
4365APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Tao Baoe9d61b02018-08-20 21:09:07 -07004366$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004367 @echo "Package apps: $@"
4368 $(hide) rm -rf $@
4369 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004370 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
4371 if [ -z "$$apps_to_zip" ]; then \
Anton Hansson6d814982018-11-26 18:12:05 +00004372 echo "No apps to zip up. Generating empty apps archive." ; \
4373 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004374 else \
Anton Hansson6d814982018-11-26 18:12:05 +00004375 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004376 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07004377
Ying Wangbc415dd2012-08-15 12:22:44 -07004378ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07004379#------------------------------------------------------------------
4380# An archive of classes for use in generating code-coverage reports
4381# These are the uninstrumented versions of any classes that were
4382# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07004383# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004384
Colin Crossa6bc3a82017-09-27 14:28:41 -07004385JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004386$(JACOCO_REPORT_CLASSES_ALL) :
4387 @echo "Collecting uninstrumented classes"
4388 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
Anton Hansson6d814982018-11-26 18:12:05 +00004389 zip -@ -0 -q -X $@
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004390# Meaning of these options:
4391# -@ scan stdin for file paths to add to the zip
4392# -0 don't do any compression
4393# -q supress most output
4394# -X skip storing extended file attributes
4395
Ying Wangbc415dd2012-08-15 12:22:44 -07004396endif # EMMA_INSTRUMENT=true
4397
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004398
Ying Wangae9115a2013-08-22 20:52:47 -07004399#------------------------------------------------------------------
4400# A zip of Proguard obfuscation dictionary files.
4401# Only for apps_only build.
4402#
4403ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07004404PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004405# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07004406$(PROGUARD_DICT_ZIP) :
4407 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07004408 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Anton Hansson6d814982018-11-26 18:12:05 +00004409 if [ -n "$$dict_files" ]; then \
4410 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
4411 zip -qX $@ $$dict_files $$unobfuscated_jars; \
4412 else \
4413 touch $(dir $@)/zipdummy; \
4414 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
4415 zip -qd $@ zipdummy; \
4416 rm $(dir $@)/zipdummy; \
4417 fi
Ying Wangae9115a2013-08-22 20:52:47 -07004418
4419endif # TARGET_BUILD_APPS
4420
The Android Open Source Project88b60792009-03-03 19:28:42 -08004421# -----------------------------------------------------------------
Yifan Hong2b891ac2018-11-29 12:06:31 -08004422# super partition image
4423
4424ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4425
4426# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
4427ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4428
Yifan Hong69e0d612019-03-11 15:55:33 -07004429# Dump variables used by build_super_image.py.
4430define dump-super-image-info
4431 $(call dump-dynamic-partitions-info,$(1))
4432 $(if $(filter true,$(AB_OTA_UPDATER)), \
4433 echo "ab_update=true" >> $(1))
4434endef
4435
Yifan Hong2b891ac2018-11-29 12:06:31 -08004436ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
Yifan Hong54787542019-03-29 14:44:06 -07004437INSTALLED_SUPERIMAGE_TARGET := $(call intermediates-dir-for,PACKAGING,super.img)/super.img
Yifan Hong2b891ac2018-11-29 12:06:31 -08004438$(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
4439$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
4440 $(call pretty,"Target super fs image: $@")
Tao Bao403a2f92018-12-13 10:45:46 -08004441 PATH=$(dir $(LPMAKE)):$$PATH \
4442 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
Yifan Hong69e0d612019-03-11 15:55:33 -07004443
4444# supernod uses images in the $(PRODUCT_OUT) directory instead of images from target files package.
4445.PHONY: superimage-nodeps supernod
4446superimage-nodeps supernod: intermediates := $(call intermediates-dir-for,PACKAGING,superimage-nodeps)
4447superimage-nodeps supernod: | $(LPMAKE) $(BUILD_SUPER_IMAGE) \
4448 $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET))
4449 $(call pretty,"make $(INSTALLED_SUPERIMAGE_TARGET): ignoring dependencies")
4450 mkdir -p $(intermediates)
4451 rm -rf $(intermediates)/misc_info.txt
4452 $(call dump-super-image-info,$(intermediates)/misc_info.txt)
4453 $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
4454 echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(intermediates)/misc_info.txt;)
Yifan Hong438175e2019-04-02 18:54:13 -07004455 mkdir -p $(dir $(INSTALLED_SUPERIMAGE_TARGET))
Yifan Hong69e0d612019-03-11 15:55:33 -07004456 PATH=$(dir $(LPMAKE)):$$PATH \
4457 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $(INSTALLED_SUPERIMAGE_TARGET)
4458
4459endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true"
Yifan Hong2b891ac2018-11-29 12:06:31 -08004460
4461$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
4462
Yifan Hong8b79d162018-11-29 12:32:00 -08004463INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
4464$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty)
4465$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE)
4466 $(call pretty,"Target empty super fs image: $@")
4467 mkdir -p $(intermediates)
4468 rm -rf $(intermediates)/misc_info.txt
Yifan Hong69e0d612019-03-11 15:55:33 -07004469 $(call dump-super-image-info,$(intermediates)/misc_info.txt)
Tao Bao403a2f92018-12-13 10:45:46 -08004470 PATH=$(dir $(LPMAKE)):$$PATH \
4471 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@
Yifan Hong8b79d162018-11-29 12:32:00 -08004472
4473$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
4474
Yifan Hong2b891ac2018-11-29 12:06:31 -08004475endif # BOARD_SUPER_PARTITION_SIZE != ""
4476endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
4477
4478# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004479# dalvik something
4480.PHONY: dalvikfiles
4481dalvikfiles: $(INTERNAL_DALVIK_MODULES)
4482
Bo Huf0d50bb2017-08-01 19:02:09 +00004483ifeq ($(BUILD_QEMU_IMAGES),true)
Bo Huf0d50bb2017-08-01 19:02:09 +00004484MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
4485SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
Roman Kiryanove64998f2019-02-14 16:45:33 -08004486
4487ifdef INSTALLED_SYSTEMIMAGE_TARGET
4488INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
Tao Baoe9d61b02018-08-20 21:09:07 -07004489$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004490 @echo Create system-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004491 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEMIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004492
4493systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
4494droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
Roman Kiryanove64998f2019-02-14 16:45:33 -08004495endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004496ifdef INSTALLED_VENDORIMAGE_TARGET
Bo Huf0d50bb2017-08-01 19:02:09 +00004497INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004498$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004499 @echo Create vendor-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004500 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004501
4502vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
4503droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
4504endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004505ifdef INSTALLED_PRODUCTIMAGE_TARGET
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004506INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004507$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004508 @echo Create product-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004509 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004510
4511productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
4512droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
4513endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004514ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Dario Freni924af7d2018-08-17 00:56:14 +01004515INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004516$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Dario Freni924af7d2018-08-17 00:56:14 +01004517 @echo Create product_services-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004518 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET))
Dario Freni5f681e12018-05-29 13:09:01 +01004519
4520productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4521droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4522endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004523ifdef INSTALLED_ODMIMAGE_TARGET
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004524INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
4525$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
4526 @echo Create odm-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004527 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004528
4529odmimage: $(INSTALLED_QEMU_ODMIMAGE)
4530droidcore: $(INSTALLED_QEMU_ODMIMAGE)
4531endif
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004532
4533ifeq ($(BOARD_AVB_ENABLE),true)
4534QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
4535MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_verified_boot_params.sh
4536$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_QEMU_SYSTEMIMAGE) $(MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) $(SGDISK_HOST) $(AVBTOOL)
4537 @echo Creating $@
Matt Wachowski40afa812018-09-27 12:49:18 -07004538 (export SGDISK=$(SGDISK_HOST) AVBTOOL=$(AVBTOOL); $(MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_QEMU_SYSTEMIMAGE) $(QEMU_VERIFIED_BOOT_PARAMS))
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004539
4540
4541systemimage: $(QEMU_VERIFIED_BOOT_PARAMS)
4542droidcore: $(QEMU_VERIFIED_BOOT_PARAMS)
4543endif
Bo Huf0d50bb2017-08-01 19:02:09 +00004544endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004545# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004546# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07004547ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004548INTERNAL_EMULATOR_PACKAGE_FILES += \
4549 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08004550 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004551 $(INSTALLED_RAMDISK_TARGET) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004552 $(INSTALLED_SYSTEMIMAGE_TARGET) \
4553 $(INSTALLED_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004554
4555name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
4556
4557INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4558
Ying Wang5d887702015-11-04 10:06:25 -08004559$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004560 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07004561 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004562
Ying Wang7d8c5352012-07-26 10:15:21 -07004563endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004564# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08004565# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08004566# The pdk package (Platform Development Kit)
4567
Keun young Park7fc7aad2012-02-27 15:49:23 -08004568#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
4569# include development/pdk/Pdk.mk
4570#endif
4571
The Android Open Source Project88b60792009-03-03 19:28:42 -08004572
4573# -----------------------------------------------------------------
4574# The SDK
4575
The Android Open Source Project88b60792009-03-03 19:28:42 -08004576# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07004577sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004578
4579# Build a name that looks like:
4580#
4581# linux-x86 --> android-sdk_12345_linux-x86
4582# darwin-x86 --> android-sdk_12345_mac-x86
4583# windows-x86 --> android-sdk_12345_windows
4584#
4585sdk_name := android-sdk_$(FILE_NAME_TAG)
4586ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07004587 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08004588else
Joe Onorato03fbe402009-04-13 08:31:16 -07004589 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004590endif
4591ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07004592 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004593endif
Joe Onorato03fbe402009-04-13 08:31:16 -07004594sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004595
4596sdk_dep_file := $(sdk_dir)/sdk_deps.mk
4597
4598ATREE_FILES :=
4599-include $(sdk_dep_file)
4600
4601# if we don't have a real list, then use "everything"
4602ifeq ($(strip $(ATREE_FILES)),)
4603ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004604 $(ALL_DEFAULT_INSTALLED_MODULES) \
4605 $(INSTALLED_RAMDISK_TARGET) \
4606 $(ALL_DOCS) \
Nan Zhangcb0a6882018-08-07 15:26:32 -07004607 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api-stubs-docs_annotations.zip \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004608 $(ALL_SDK_FILES)
4609endif
4610
4611atree_dir := development/build
4612
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01004613
The Android Open Source Project88b60792009-03-03 19:28:42 -08004614sdk_atree_files := \
4615 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07004616 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08004617
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02004618# development/build/sdk-android-<abi>.atree is used to differentiate
4619# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
4620# files like the kernel image. We use TARGET_CPU_ABI because we don't
4621# have a better way to distinguish between CPU models.
4622ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
4623 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
4624endif
4625
Anton Hansson8dab0a62019-03-28 15:45:40 +00004626ifneq ($(PRODUCT_SDK_ATREE_FILES),)
4627sdk_atree_files += $(PRODUCT_SDK_ATREE_FILES)
Griff Hazen433febb2014-02-28 08:45:59 -08004628else
4629sdk_atree_files += $(atree_dir)/sdk.atree
4630endif
4631
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004632include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004633
The Android Open Source Project88b60792009-03-03 19:28:42 -08004634deps := \
4635 $(target_notice_file_txt) \
4636 $(tools_notice_file_txt) \
4637 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07004638 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07004639 $(COVERAGE_ZIP) \
Dario Frenid1011272018-07-23 20:20:15 +01004640 $(APPCOMPAT_ZIP) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004641 $(INSTALLED_SYSTEMIMAGE_TARGET) \
Bo Huf0d50bb2017-08-01 19:02:09 +00004642 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07004643 $(INSTALLED_QEMU_VENDORIMAGE) \
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004644 $(QEMU_VERIFIED_BOOT_PARAMS) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07004645 $(INSTALLED_USERDATAIMAGE_TARGET) \
4646 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004647 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07004648 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004649 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08004650 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004651 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004652 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004653 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004654
4655INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
4656$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
4657$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
4658$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
4659$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
4660
4661# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
4662#
4663#SDK_GNU_ERROR := true
4664
Ying Wang5d887702015-11-04 10:06:25 -08004665$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004666 @echo "Package SDK: $@"
4667 $(hide) rm -rf $(PRIVATE_DIR) $@
4668 $(hide) for f in $(target_gnu_MODULES); do \
4669 if [ -f $$f ]; then \
4670 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
4671 including GNU target $$f >&2; \
4672 FAIL=$(SDK_GNU_ERROR); \
4673 fi; \
4674 done; \
4675 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07004676 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08004677 $(hide) ( \
Anton Hansson6d814982018-11-26 18:12:05 +00004678 ATREE_STRIP="$(HOST_STRIP) -x" \
4679 $(HOST_OUT_EXECUTABLES)/atree \
4680 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
4681 -m $(PRIVATE_DEP_FILE) \
4682 -I . \
4683 -I $(PRODUCT_OUT) \
4684 -I $(HOST_OUT) \
4685 -I $(TARGET_COMMON_OUT_ROOT) \
4686 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
4687 -v "OUT_DIR=$(OUT_DIR)" \
4688 -v "HOST_OUT=$(HOST_OUT)" \
4689 -v "TARGET_ARCH=$(TARGET_ARCH)" \
4690 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
4691 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
4692 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
4693 -o $(PRIVATE_DIR) && \
4694 cp -f $(target_notice_file_txt) \
4695 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
4696 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
4697 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
4698 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
4699 chmod -R ug+rwX $(PRIVATE_DIR) && \
4700 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004701 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
4702
Raphael3d224a02010-04-16 17:50:09 -07004703
4704# Is a Windows SDK requested? If so, we need some definitions from here
4705# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08004706MAIN_SDK_NAME := $(sdk_name)
4707MAIN_SDK_DIR := $(sdk_dir)
4708MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08004709ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07004710include $(TOPDIR)development/build/tools/windows_sdk.mk
4711endif
4712
The Android Open Source Project88b60792009-03-03 19:28:42 -08004713# -----------------------------------------------------------------
4714# Findbugs
4715INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
4716INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
4717$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
4718 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004719 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004720 > $@
4721$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
4722 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004723 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07004724 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08004725
4726# -----------------------------------------------------------------
4727# Findbugs
4728
4729# -----------------------------------------------------------------
4730# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07004731ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004732include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01004733-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07004734-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004735-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07004736# Also the project-specific tasks
4737-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
4738-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004739-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07004740# Also add test specifc tasks
4741include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07004742include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07004743endif
Raphaelc4d47312011-02-15 16:09:36 -08004744
Ying Wang67132ba2015-10-28 16:42:39 -07004745include $(BUILD_SYSTEM)/product-graph.mk
4746
Raphaelc4d47312011-02-15 16:09:36 -08004747# -----------------------------------------------------------------
4748# Create SDK repository packages. Must be done after tasks/* since
4749# we need the addon rules defined.
4750ifneq ($(sdk_repo_goal),)
4751include $(TOPDIR)development/build/tools/sdk_repo.mk
4752endif