blob: 97cb752141a5c84bc3d10d566cc190900336ea08 [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
Haibo Huangee0531d2018-11-04 09:20:09 -0800184FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
185FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT)
186FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
187FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT)
188
Tao Bao5f999232018-09-04 11:42:53 -0700189# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
190# mode (via libminui).
191ifdef TARGET_RECOVERY_DEFAULT_ROTATION
192FINAL_VENDOR_DEFAULT_PROPERTIES += \
193 ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
194endif
195ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
196FINAL_VENDOR_DEFAULT_PROPERTIES += \
197 ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
198endif
199ifdef TARGET_RECOVERY_PIXEL_FORMAT
200FINAL_VENDOR_DEFAULT_PROPERTIES += \
201 ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
202endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900203FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
204 $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
205
206# -----------------------------------------------------------------
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800207# prop.default
Anton Hansson1f8729e2018-08-15 12:11:55 +0100208
209BUILDINFO_SH := build/make/tools/buildinfo.sh
210BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
211# Generates a set of common build system properties to a file.
212# $(1): Partition name
213# $(2): Output file name
214define generate-common-build-props
215 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
216 BUILD_ID="$(BUILD_ID)" \
217 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
218 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
219 DATE="$(DATE_FROM_FILE)" \
220 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
221 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
222 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
223 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
224 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
225 PRODUCT_NAME="$(TARGET_PRODUCT)" \
226 TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
227 TARGET_DEVICE="$(TARGET_DEVICE)" \
228 bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
229endef
230
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800231ifdef property_overrides_split_enabled
232INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800233INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
234ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
235$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800236else
237# legacy path
The Android Open Source Project88b60792009-03-03 19:28:42 -0800238INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800239endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800240ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900241FINAL_DEFAULT_PROPERTIES := \
Jaekyun Seokb31b9ba2017-11-03 15:18:55 +0900242 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
243 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900244ifndef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900245 FINAL_DEFAULT_PROPERTIES += \
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900246 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900247endif
Jaekyun Seok294286d2017-01-20 13:17:12 +0900248FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
249 $(FINAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800250
Andres Moralesb8876e12015-05-06 20:44:22 -0700251intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
252
Anton Hansson1f8729e2018-08-15 12:11:55 +0100253$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800254 @echo Target buildinfo: $@
255 @mkdir -p $(dir $@)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800256 @rm -f $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800257 $(hide) echo "#" > $@; \
258 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
259 echo "#" >> $@;
Jaekyun Seok294286d2017-01-20 13:17:12 +0900260 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000261 echo "$(line)" >> $@;)
Andres Moralesb8876e12015-05-06 20:44:22 -0700262 $(hide) echo "#" >> $@; \
263 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
264 echo "#" >> $@;
Anton Hansson1f8729e2018-08-15 12:11:55 +0100265 $(hide) $(call generate-common-build-props,bootimage,$@)
Colin Crossfdea8932017-12-06 14:38:40 -0800266 $(hide) build/make/tools/post_process_props.py $@
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800267ifdef property_overrides_split_enabled
268 $(hide) mkdir -p $(TARGET_ROOT_OUT)
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800269 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800270endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800271
272# -----------------------------------------------------------------
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900273# vendor default.prop
274INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900275ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900276INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
277ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
278
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900279$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
280 @echo Target buildinfo: $@
281 @mkdir -p $(dir $@)
282 $(hide) echo "#" > $@; \
283 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
284 echo "#" >> $@;
285 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000286 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800287 $(hide) build/make/tools/post_process_props.py $@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900288
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900289endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900290
291# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800292# build.prop
293INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
294ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900295FINAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -0700296 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
Jaekyun Seok294286d2017-01-20 13:17:12 +0900297FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
298 $(FINAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800299
300# A list of arbitrary tags describing the build configuration.
301# Force ":=" so we can use +=
302BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
303ifeq ($(TARGET_BUILD_TYPE),debug)
304 BUILD_VERSION_TAGS += debug
305endif
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700306# The "test-keys" tag marks builds signed with the old test keys,
307# which are available in the SDK. "dev-keys" marks builds signed with
308# non-default dev keys (usually private keys from a vendor directory).
309# Both of these tags will be removed and replaced with "release-keys"
310# when the target-files is signed in a post-build step.
311ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/target/product/security/testkey)
Doug Zongkera8608a72013-07-23 11:51:04 -0700312BUILD_KEYS := test-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700313else
Doug Zongkera8608a72013-07-23 11:51:04 -0700314BUILD_KEYS := dev-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700315endif
Doug Zongkera8608a72013-07-23 11:51:04 -0700316BUILD_VERSION_TAGS += $(BUILD_KEYS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800317BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
318
319# A human-readable string that descibes this build in detail.
Colin Crossf37b4552015-07-16 17:15:19 -0700320build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
Andres Moralesb8876e12015-05-06 20:44:22 -0700321$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800322
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700323# 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 -0800324ifeq (,$(strip $(BUILD_FINGERPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800325 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Dan Willemsen63e48db2019-01-02 12:27:43 -0800326 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
Ying Wang50367cc2014-06-12 18:42:53 -0700327 else
Nan Zhang0abdb582018-02-20 17:00:39 -0800328 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
Ying Wang50367cc2014-06-12 18:42:53 -0700329 endif
330 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 -0800331endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800332# unset it for safety.
333BF_BUILD_NUMBER :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800334
Nan Zhang0abdb582018-02-20 17:00:39 -0800335BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
336ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
337 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
338endif
339BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
340# unset it for safety.
341BUILD_FINGERPRINT :=
Colin Crossf37b4552015-07-16 17:15:19 -0700342
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700343# The string used to uniquely identify the system build; used by the OTA server.
344# This purposefully excludes any product-specific variables.
345ifeq (,$(strip $(BUILD_THUMBPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800346 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700347endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800348
349BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
350ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
351 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700352endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800353BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
354# unset it for safety.
355BUILD_THUMBPRINT :=
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700356
Ying Wange24e17a2014-10-07 18:42:11 -0700357KNOWN_OEM_THUMBPRINT_PROPERTIES := \
358 ro.product.brand \
359 ro.product.name \
360 ro.product.device
361OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
362 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES))
363
Sriram Raman7b641242009-03-24 22:40:59 -0700364# Display parameters shown under Settings -> About Phone
365ifeq ($(TARGET_BUILD_VARIANT),user)
366 # User builds should show:
367 # release build number or branch.buld_number non-release builds
368
369 # Dev. branches should have DISPLAY_BUILD_NUMBER set
Colin Cross63fe36a2017-02-21 17:23:02 -0800370 ifeq (true,$(DISPLAY_BUILD_NUMBER))
Colin Crossf37b4552015-07-16 17:15:19 -0700371 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700372 else
Doug Zongkera8608a72013-07-23 11:51:04 -0700373 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700374 endif
375else
376 # Non-user builds should show detailed build information
377 BUILD_DISPLAY_ID := $(build_desc)
378endif
379
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000380# Accepts a whitespace separated list of product locales such as
381# (en_US en_AU en_GB...) and returns the first locale in the list with
382# underscores replaced with hyphens. In the example above, this will
383# return "en-US".
384define get-default-product-locale
385$(strip $(subst _,-, $(firstword $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800386endef
387
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700388# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
389# harness to distinguish builds. Only add _asan for a sanitized build
390# if it isn't already a part of the flavor (via a dedicated lunch
391# config for example).
Ying Wang21ec03d2015-10-28 18:45:03 -0700392TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
Ivan Lozano0f71db32017-08-14 07:57:37 -0700393ifneq (, $(filter address, $(SANITIZE_TARGET)))
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700394ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
Ying Wang21ec03d2015-10-28 18:45:03 -0700395TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
396endif
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700397endif
Ying Wang21ec03d2015-10-28 18:45:03 -0700398
Andrew Boiefa61ff02012-09-28 09:33:45 -0700399ifdef TARGET_SYSTEM_PROP
400system_prop_file := $(TARGET_SYSTEM_PROP)
401else
402system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
403endif
Dan Willemsenad6a1542018-12-14 01:04:19 -0800404$(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 -0800405 @echo Target buildinfo: $@
406 @mkdir -p $(dir $@)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700407 $(hide) echo > $@
408ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES),)
409 $(hide) echo "#" >> $@; \
410 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700411 echo "#" >> $@;
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700412 $(hide) $(foreach prop,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000413 echo "import /oem/oem.prop $(prop)" >> $@;)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700414endif
Anton Hansson1f8729e2018-08-15 12:11:55 +0100415 $(hide) $(call generate-common-build-props,system,$@)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800416 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000417 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
418 TARGET_DEVICE="$(TARGET_DEVICE)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000419 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
420 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000421 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
422 BUILD_ID="$(BUILD_ID)" \
423 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
424 DATE="$(DATE_FROM_FILE)" \
Dan Willemsen63e48db2019-01-02 12:27:43 -0800425 BUILD_USERNAME="$(BUILD_USERNAME)" \
426 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000427 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
428 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
429 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
430 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
431 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
432 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
433 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
434 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
Dan Willemsenad6a1542018-12-14 01:04:19 -0800435 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(api_fingerprint))" \
Anton Hansson6d814982018-11-26 18:12:05 +0000436 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
437 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
438 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
439 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000440 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
441 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
442 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
443 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
444 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
445 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700446 bash $(BUILDINFO_SH) >> $@
Johan Redestig674a27d2012-04-12 17:00:58 +0200447 $(hide) $(foreach file,$(system_prop_file), \
Anton Hansson6d814982018-11-26 18:12:05 +0000448 if [ -f "$(file)" ]; then \
449 echo Target buildinfo from: "$(file)"; \
450 echo "" >> $@; \
451 echo "#" >> $@; \
452 echo "# from $(file)" >> $@; \
453 echo "#" >> $@; \
454 cat $(file) >> $@; \
455 echo "# end of $(file)" >> $@; \
456 fi;)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900457 $(if $(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000458 $(hide) echo >> $@; \
459 echo "#" >> $@; \
460 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
461 echo "#" >> $@; )
Jaekyun Seok294286d2017-01-20 13:17:12 +0900462 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000463 echo "$(line)" >> $@;)
Andres Morales085a0ce2015-02-06 10:12:55 -0800464 $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
Colin Crossfdea8932017-12-06 14:38:40 -0800465 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800466
467build_desc :=
468
Andres Moralesb8876e12015-05-06 20:44:22 -0700469ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
470INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
471else
472INSTALLED_RECOVERYIMAGE_TARGET :=
473endif
474
475$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
476 @echo "Target build info: $@"
Steven Morelandec082652017-10-22 02:11:47 -0700477 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
Andres Moralesb8876e12015-05-06 20:44:22 -0700478
The Android Open Source Project88b60792009-03-03 19:28:42 -0800479# -----------------------------------------------------------------
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700480# vendor build.prop
481#
Alex Naidis47e24e92016-01-10 14:18:54 +0000482# For verifying that the vendor build is what we think it is
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700483INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
484ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900485
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900486ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900487FINAL_VENDOR_BUILD_PROPERTIES += \
488 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
489FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
490 $(FINAL_VENDOR_BUILD_PROPERTIES),=)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900491endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900492
Anton Hansson1f8729e2018-08-15 12:11:55 +0100493$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700494 @echo Target vendor buildinfo: $@
495 @mkdir -p $(dir $@)
496 $(hide) echo > $@
Sandeep Patil127f5012017-10-23 19:47:43 -0700497 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
Max Biresa1749982018-03-28 15:48:13 -0700498 $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
Isaac Chen8d11feb2018-01-31 14:27:37 +0800499 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
500 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
501 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100502 $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
503 $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
504 $(hide) $(call generate-common-build-props,vendor,$@)
Jaekyun Seokf9af5fa2017-10-25 12:08:32 +0900505ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900506 $(hide) echo "#" >> $@; \
507 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
508 echo "#" >> $@;
509 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000510 echo "$(line)" >> $@;)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900511endif # property_overrides_split_enabled
Ivan Podogovd5726322018-03-29 15:22:33 +0100512 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_PROPERTY_BLACKLIST)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700513
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900514# -----------------------------------------------------------------
515# product build.prop
516INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
517ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
518
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000519ifdef TARGET_PRODUCT_PROP
520product_prop_files := $(TARGET_PRODUCT_PROP)
521else
522product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
523endif
524
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900525FINAL_PRODUCT_PROPERTIES += \
Yifan Hongaf9e7f02018-07-27 13:11:50 -0700526 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900527FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
528 $(FINAL_PRODUCT_PROPERTIES),=)
529
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000530$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900531 @echo Target product buildinfo: $@
532 @mkdir -p $(dir $@)
533 $(hide) echo > $@
534ifdef BOARD_USES_PRODUCTIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100535 $(hide) $(call generate-common-build-props,product,$@)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900536endif # BOARD_USES_PRODUCTIMAGE
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000537 $(hide) $(foreach file,$(product_prop_files), \
Anton Hansson6d814982018-11-26 18:12:05 +0000538 if [ -f "$(file)" ]; then \
539 echo Target product properties from: "$(file)"; \
540 echo "" >> $@; \
541 echo "#" >> $@; \
542 echo "# from $(file)" >> $@; \
543 echo "#" >> $@; \
544 cat $(file) >> $@; \
545 echo "# end of $(file)" >> $@; \
546 fi;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900547 $(hide) echo "#" >> $@; \
548 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
Anton Hansson5ac408b2018-11-05 17:29:28 +0000549 echo "#" >> $@; \
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000550 echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900551 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000552 echo "$(line)" >> $@;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900553 $(hide) build/make/tools/post_process_props.py $@
554
Andres Morales9c820f82015-01-13 15:30:34 -0800555# ----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800556# odm build.prop
557INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop
558ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
559
560FINAL_ODM_BUILD_PROPERTIES += \
561 $(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES))
562FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
563 $(FINAL_ODM_BUILD_PROPERTIES),=)
564
Anton Hansson1f8729e2018-08-15 12:11:55 +0100565$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800566 @echo Target odm buildinfo: $@
567 @mkdir -p $(dir $@)
568 $(hide) echo > $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800569 $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
570 $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
571 $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100572 $(hide) $(call generate-common-build-props,odm,$@)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800573 $(hide) echo "#" >> $@; \
574 echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
575 echo "#" >> $@;
576 $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000577 echo "$(line)" >> $@;)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800578 $(hide) build/make/tools/post_process_props.py $@
Andres Morales9c820f82015-01-13 15:30:34 -0800579
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700580# -----------------------------------------------------------------
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000581# product_services build.prop (unless it's merged into /product)
582ifdef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
583 ifneq (,$(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
584 $(error PRODUCT_PRODUCT_SERVICES_PROPERTIES is not supported in this build.)
585 endif
586else
Dario Freni5f681e12018-05-29 13:09:01 +0100587INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
588ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
589
590FINAL_PRODUCT_SERVICES_PROPERTIES += \
591 $(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
592FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
593 $(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
Anton Hansson1f8729e2018-08-15 12:11:55 +0100594$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Dario Freni924af7d2018-08-17 00:56:14 +0100595 @echo Target product_services buildinfo: $@
Dario Freni5f681e12018-05-29 13:09:01 +0100596 @mkdir -p $(dir $@)
597 $(hide) echo > $@
598ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100599 $(hide) $(call generate-common-build-props,product_services,$@)
Dario Freni5f681e12018-05-29 13:09:01 +0100600endif # BOARD_USES_PRODUCT_SERVICESIMAGE
601 $(hide) echo "#" >> $@; \
602 echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
603 echo "#" >> $@;
604 $(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000605 echo "$(line)" >> $@;)
Dario Freni5f681e12018-05-29 13:09:01 +0100606 $(hide) build/make/tools/post_process_props.py $@
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000607endif # MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Dario Freni5f681e12018-05-29 13:09:01 +0100608
609# ----------------------------------------------------------------
610
611# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800612# sdk-build.prop
613#
614# There are certain things in build.prop that we don't want to
615# ship with the sdk; remove them.
616
617# This must be a list of entire property keys followed by
618# "=" characters, without any internal spaces.
619sdk_build_prop_remove := \
620 ro.build.user= \
621 ro.build.host= \
622 ro.product.brand= \
623 ro.product.manufacturer= \
624 ro.product.device=
625# TODO: Remove this soon-to-be obsolete property
626sdk_build_prop_remove += ro.build.product=
627INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
628$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
629 @echo SDK buildinfo: $@
630 @mkdir -p $(dir $@)
631 $(hide) grep -v "$(subst $(space),\|,$(strip \
Anton Hansson6d814982018-11-26 18:12:05 +0000632 $(sdk_build_prop_remove)))" $< > $@.tmp
The Android Open Source Project88b60792009-03-03 19:28:42 -0800633 $(hide) for x in $(sdk_build_prop_remove); do \
Anton Hansson6d814982018-11-26 18:12:05 +0000634 echo "$$x"generic >> $@.tmp; done
The Android Open Source Project88b60792009-03-03 19:28:42 -0800635 $(hide) mv $@.tmp $@
636
637# -----------------------------------------------------------------
638# package stats
639PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
640PACKAGES_TO_STAT := \
641 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
642 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
643$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
644 @echo Package stats: $@
645 @mkdir -p $(dir $@)
646 $(hide) rm -f $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700647ifeq ($(PACKAGES_TO_STAT),)
648# Create empty package stats file if target builds no jar(s) or apk(s).
649 $(hide) touch $@
650else
Colin Crossfdea8932017-12-06 14:38:40 -0800651 $(hide) build/make/tools/dump-package-stats $^ > $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700652endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800653
654.PHONY: package-stats
655package-stats: $(PACKAGE_STATS_FILE)
656
657# -----------------------------------------------------------------
658# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700659# Use a macro to add newline to each echo command
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100660define _apkcerts_write_line
661$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
662$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
663$(hide) echo '' >> $5
Ying Wangd9a88d52012-10-26 09:21:28 -0700664
665endef
666
The Android Open Source Project88b60792009-03-03 19:28:42 -0800667name := $(TARGET_PRODUCT)
668ifeq ($(TARGET_BUILD_TYPE),debug)
669 name := $(name)_debug
670endif
671name := $(name)-apkcerts-$(FILE_NAME_TAG)
672intermediates := \
673 $(call intermediates-dir-for,PACKAGING,apkcerts)
674APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800675# We don't need to really build all the modules.
676# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700677$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800678 @echo APK certs list: $@
679 @mkdir -p $(dir $@)
680 @rm -f $@
Ying Wangd9a88d52012-10-26 09:21:28 -0700681 $(foreach p,$(PACKAGES),\
682 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100683 $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
684 $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
Ying Wangd9a88d52012-10-26 09:21:28 -0700685 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700686 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800687
688.PHONY: apkcerts-list
689apkcerts-list: $(APKCERTS_FILE)
690
Ying Wang15e487a2011-02-15 10:56:18 -0800691ifneq (,$(TARGET_BUILD_APPS))
692 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900693 $(call dist-for-goals, apps_only, $(SOONG_APEX_KEYS_FILE):apexkeys.txt)
Ying Wang15e487a2011-02-15 10:56:18 -0800694endif
Ying Wangefb21682010-07-23 16:42:13 -0700695
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900696
The Android Open Source Project88b60792009-03-03 19:28:42 -0800697# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700698# build system stats
699BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
700$(BUILD_SYSTEM_STATS):
701 @rm -f $@
702 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
703 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
704$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700705
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700706# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700707# Modules ready to be converted to Soong, ordered by how many
708# modules depend on them.
709SOONG_CONV := $(sort $(SOONG_CONV))
710SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
711$(SOONG_CONV_DATA):
712 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800713 @$(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 -0700714
Colin Crossfdea8932017-12-06 14:38:40 -0800715SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700716SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
717$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
718 @rm -f $@
719 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
720$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
721
722# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800723# Modules use -Wno-error, or added default -Wall -Werror
724WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
725$(WALL_WERROR):
726 @rm -f $@
727 echo "# Modules using -Wno-error" >> $@
728 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 -0800729 echo "# Modules added default -Wall" >> $@
730 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
731
732$(call dist-for-goals,droidcore,$(WALL_WERROR))
733
734# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800735# Modules missing profile files
736PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
737$(PGO_PROFILE_MISSING):
738 @rm -f $@
739 echo "# Modules missing PGO profile files" >> $@
740 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
741
742$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
743
744# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700745# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700746# for future OTA packages installed by this system. Actual product
747# deliverables will be re-signed by hand. We expect this file to
748# exist with the suffixes ".x509.pem" and ".pk8".
Colin Cross21122f92018-09-14 21:51:11 -0700749DEFAULT_KEY_CERT_PAIR := $(strip $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
Doug Zongker8678df42009-06-15 14:30:14 -0700750
751
Jeff Browne33ba4c2011-07-11 22:11:46 -0700752# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800753# if they don't do anything.
754.PHONY: systemimage
755systemimage:
756
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800757# -----------------------------------------------------------------
758
759.PHONY: event-log-tags
760
Joe Onoratob7510532010-07-14 10:22:54 -0700761# Produce an event logs tag file for everything we know about, in order
762# to properly allocate numbers. Then produce a file that's filtered
763# for what's going to be installed.
764
765all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
766
Colin Crossdc8f8e42012-04-12 13:25:54 -0700767event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
768
Joe Onoratob7510532010-07-14 10:22:54 -0700769# Include tags from all packages that we know about
770all_event_log_tags_src := \
771 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
772
Colin Crossdc8f8e42012-04-12 13:25:54 -0700773# PDK builds will already have a full list of tags that needs to get merged
774# in with the ones from source
775pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
776
777$(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 -0800778$(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 -0700779 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900780 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700781
Doug Zongkera34fa952011-02-23 12:17:29 -0800782# Include tags from all packages included in this product, plus all
783# tags that are part of the system (ie, not in a vendor/ or device/
784# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800785event_log_tags_src := \
786 $(sort $(foreach m,\
787 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
788 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800789 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
790 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800791
Colin Crossdc8f8e42012-04-12 13:25:54 -0700792$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700793$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800794$(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 -0800795 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900796 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800797
798event-log-tags: $(event_log_tags_file)
799
800ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
801
Joe Onoratob7510532010-07-14 10:22:54 -0700802
The Android Open Source Project88b60792009-03-03 19:28:42 -0800803# #################################################################
804# Targets for boot/OS images
805# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800806ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
807 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
808 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
809 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
810 else
811 INSTALLED_2NDBOOTLOADER_TARGET :=
812 endif
813else
814 INSTALLED_BOOTLOADER_MODULE :=
815 INSTALLED_2NDBOOTLOADER_TARGET :=
816endif # TARGET_NO_BOOTLOADER
817ifneq ($(strip $(TARGET_NO_KERNEL)),true)
818 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
819else
820 INSTALLED_KERNEL_TARGET :=
821endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800822
823# -----------------------------------------------------------------
Tom Cherryd14b8952018-08-09 14:26:00 -0700824# the root dir
825INTERNAL_ROOT_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800826 $(ALL_GENERATED_SOURCES) \
827 $(ALL_DEFAULT_INSTALLED_MODULES))
828
Luis Hector Chavezff489932018-07-03 15:41:40 -0700829INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
830INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
831$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700832$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700833 @echo Installed file list: $@
834 @mkdir -p $(dir $@)
835 @rm -f $@
836 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
837 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
838
839$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
840
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800841#------------------------------------------------------------------
842# dtb
843
844ifdef BOARD_PREBUILT_DTBIMAGE_DIR
845INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Hridya Valsarajuc63a7442019-02-07 11:38:18 -0800846$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb))
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800847 cat $^ > $@
848endif
849
Tom Cherryd14b8952018-08-09 14:26:00 -0700850# -----------------------------------------------------------------
851# the ramdisk
Dan Willemsen67495202019-01-16 12:42:05 -0800852ifdef BUILDING_RAMDISK_IMAGE
Tom Cherryd14b8952018-08-09 14:26:00 -0700853INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \
854 $(ALL_GENERATED_SOURCES) \
855 $(ALL_DEFAULT_INSTALLED_MODULES))
856
857INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt
858INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json)
859$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK)
860$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
861 @echo Installed file list: $@
862 @mkdir -p $(dir $@)
863 @rm -f $@
864 $(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json)
865 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
866
867$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
Joe Onorato64d85d02009-04-09 19:31:12 -0700868BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
869
870# We just build this directly to the install location.
871INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Tom Cherryd14b8952018-08-09 14:26:00 -0700872$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800873 $(call pretty,"Target ram disk: $@")
Tom Cherryd14b8952018-08-09 14:26:00 -0700874 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800875
Ying Wangad7fd292013-08-08 16:34:29 -0700876.PHONY: ramdisk-nodeps
877ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
878 @echo "make $@: ignoring dependencies"
Tom Cherryd14b8952018-08-09 14:26:00 -0700879 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800880
Dan Willemsen67495202019-01-16 12:42:05 -0800881endif # BUILDING_RAMDISK_IMAGE
882
883
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700884INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
885
The Android Open Source Project88b60792009-03-03 19:28:42 -0800886ifneq ($(strip $(TARGET_NO_KERNEL)),true)
887
888# -----------------------------------------------------------------
889# the boot image, which is a collection of other images.
890INTERNAL_BOOTIMAGE_ARGS := \
891 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700892 --kernel $(INSTALLED_KERNEL_TARGET)
893
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800894ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
895 INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
896endif
897
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700898ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
899INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
900endif
901
The Android Open Source Project88b60792009-03-03 19:28:42 -0800902INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
903
Dima Zavin1e0847c2009-05-07 19:43:08 -0700904ifdef BOARD_KERNEL_BASE
905 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
906endif
907
Ying Wangffff0022010-08-23 12:56:25 -0700908ifdef BOARD_KERNEL_PAGESIZE
909 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
910endif
911
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700912ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
913ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
914VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
915 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
916endif
917endif
918
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700919INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
920ifdef INTERNAL_KERNEL_CMDLINE
921INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700922endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700923
Sami Tolvanen3303d902016-03-15 16:49:30 +0000924INTERNAL_MKBOOTIMG_VERSION_ARGS := \
925 --os_version $(PLATFORM_VERSION) \
926 --os_patch_level $(PLATFORM_SECURITY_PATCH)
927
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800928# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
929ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800930ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800931$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400932
933else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
934
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800935$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400936 $(call pretty,"Target boot image: $@")
937 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800938 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400939 $(hide) $(AVBTOOL) add_hash_footer \
940 --image $@ \
941 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800942 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400943 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
944
945.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800946bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400947 @echo "make $@: ignoring dependencies"
948 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800949 $(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 -0400950 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800951 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400952 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800953 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400954 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
955
956else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700957
958$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
959 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000960 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800961 $(BOOT_SIGNER) /boot $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $@
Geremy Condra740b6632014-07-08 20:07:41 -0700962 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
963
964.PHONY: bootimage-nodeps
965bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
966 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000967 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800968 $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET)
Geremy Condra740b6632014-07-08 20:07:41 -0700969 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
970
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +0100971else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -0800972
Tao Bao4b577412017-02-22 22:54:39 -0800973$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800974 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000975 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700976 $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
David Riley17be3d32015-03-03 08:54:11 -0800977 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
978
979.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -0800980bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800981 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000982 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700983 $(VBOOT_SIGNER) $(FUTILITY) $(INSTALLED_BOOTIMAGE_TARGET).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(INSTALLED_BOOTIMAGE_TARGET).keyblock $(INSTALLED_BOOTIMAGE_TARGET)
David Riley17be3d32015-03-03 08:54:11 -0800984 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
985
986else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800987
988$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
989 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000990 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700991 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700992
993.PHONY: bootimage-nodeps
994bootimage-nodeps: $(MKBOOTIMG)
995 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000996 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700997 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700998
The Android Open Source Project88b60792009-03-03 19:28:42 -0800999endif # TARGET_BOOTIMAGE_USE_EXT2
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001000endif # BOARD_USES_RECOVERY_AS_BOOT
The Android Open Source Project88b60792009-03-03 19:28:42 -08001001
Tao Baob1a2e352018-08-14 16:17:12 -07001002else # TARGET_NO_KERNEL == "true"
Michael Schwartz0dc6f212017-07-18 10:05:13 -07001003ifdef BOARD_PREBUILT_BOOTIMAGE
1004ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
1005# Remove when b/63676296 is resolved.
1006$(error Prebuilt bootimage is only supported for AB targets)
1007endif
1008$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
Tao Baob1a2e352018-08-14 16:17:12 -07001009else # BOARD_PREBUILT_BOOTIMAGE not defined
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001010INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
Tao Baob1a2e352018-08-14 16:17:12 -07001011INSTALLED_BOOTIMAGE_TARGET :=
1012endif # BOARD_PREBUILT_BOOTIMAGE
1013endif # TARGET_NO_KERNEL
The Android Open Source Project88b60792009-03-03 19:28:42 -08001014
1015# -----------------------------------------------------------------
1016# NOTICE files
1017#
Steve Blockd14d3b42012-03-01 11:34:41 +00001018# We are required to publish the licenses for all code under BSD, GPL and
1019# Apache licenses (and possibly other more exotic ones as well). We err on the
1020# side of caution, so the licenses for other third-party code are included here
1021# too.
1022#
The Android Open Source Project88b60792009-03-03 19:28:42 -08001023# This needs to be before the systemimage rules, because it adds to
1024# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
1025# go into the systemimage.
1026
Steve Block495e5852012-02-29 19:18:08 +00001027.PHONY: notice_files
1028
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001029# Create the rule to combine the files into text and html/xml forms
Dario Freniadc972d2018-07-09 18:38:38 +01001030# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001031# $(2) - Plain text output file
1032# $(3) - HTML/XML output file
1033# $(4) - File title
1034# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -08001035# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001036# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -08001037#
1038# The algorithm here is that we go collect a hash for each of the notice
1039# files and write the names of the files that match that hash. Then
1040# to generate the real files, we go print out all of the files and their
1041# hashes.
1042#
1043# These rules are fairly complex, so they depend on this makefile so if
1044# it changes, they'll run again.
1045#
1046# TODO: We could clean this up so that we just record the locations of the
1047# original notice files instead of making rules to copy them somwehere.
1048# Then we could traverse that without quite as much bash drama.
1049define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001050$(2) $(3): PRIVATE_MESSAGE := $(4)
1051$(2) $(3): PRIVATE_DIR := $(5)
1052$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -08001053$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
1054 build/make/tools/generate-notice-files.py --text-output $(2) \
Anton Hansson6d814982018-11-26 18:12:05 +00001055 $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e product_services --xml-output, \
1056 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
1057 $(if $(filter $(1),xml_product),-i product --xml-output, \
1058 $(if $(filter $(1),xml_product_services),-i product_services --xml-output, \
1059 --html-output)))) $(3) \
1060 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001061notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001062endef
1063
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001064# Notice file logic isn't relevant for TARGET_BUILD_APPS
1065ifndef TARGET_BUILD_APPS
1066
The Android Open Source Project88b60792009-03-03 19:28:42 -08001067# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
1068# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
1069# the src subdirectory.
Steve Block495e5852012-02-29 19:18:08 +00001070target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Steve Block495e5852012-02-29 19:18:08 +00001071tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08001072tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001073kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
1074winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
1075pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001076
Steven Morelandae69e572017-12-15 14:49:55 -08001077# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001078ifneq ($(PRODUCT_NOTICE_SPLIT),true)
1079target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
1080target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
1081installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
1082$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001083 $(target_notice_file_txt), \
1084 $(target_notice_file_html), \
1085 "Notices for files contained in the filesystem images in this directory:", \
1086 $(TARGET_OUT_NOTICE_FILES), \
1087 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001088$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
1089 $(hide) $(MINIGZIP) -9 < $< > $@
1090$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
1091 $(copy-file-to-target)
1092else
1093target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
1094target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001095installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
1096
1097target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
1098target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
1099target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
1100installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
Dario Freniadc972d2018-07-09 18:38:38 +01001101
1102target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
1103target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
1104target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
1105installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
Dario Frenicbca1132018-08-28 18:04:03 +01001106
1107target_product_services_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.txt
1108target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml
1109target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz
1110installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001111
Anton Hansson6ad6f6c2018-11-12 23:33:47 +00001112# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
1113# being built. A notice xml file must depend on all modules that could potentially
1114# install a license file relevant to it.
1115license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
1116# Phonys/fakes don't have notice files (though their deps might)
1117license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
1118license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
1119license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
1120license_modules_product_services := $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(license_modules))
1121license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_product_services)
1122license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001123
Dario Frenicbca1132018-08-28 18:04:03 +01001124$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
Anton Hansson6d814982018-11-26 18:12:05 +00001125 $(target_notice_file_txt), \
1126 $(target_notice_file_xml), \
1127 "Notices for files contained in the filesystem images in this directory:", \
1128 $(TARGET_OUT_NOTICE_FILES), \
1129 $(license_modules_rest)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001130$(eval $(call combine-notice-files, xml_vendor, \
Anton Hansson6d814982018-11-26 18:12:05 +00001131 $(target_vendor_notice_file_txt), \
1132 $(target_vendor_notice_file_xml), \
1133 "Notices for files contained in the vendor filesystem image in this directory:", \
1134 $(TARGET_OUT_NOTICE_FILES), \
1135 $(license_modules_vendor)))
Dario Freniadc972d2018-07-09 18:38:38 +01001136$(eval $(call combine-notice-files, xml_product, \
Anton Hansson6d814982018-11-26 18:12:05 +00001137 $(target_product_notice_file_txt), \
1138 $(target_product_notice_file_xml), \
1139 "Notices for files contained in the product filesystem image in this directory:", \
1140 $(TARGET_OUT_NOTICE_FILES), \
1141 $(license_modules_product)))
Dario Frenicbca1132018-08-28 18:04:03 +01001142$(eval $(call combine-notice-files, xml_product_services, \
Anton Hansson6d814982018-11-26 18:12:05 +00001143 $(target_product_services_notice_file_txt), \
1144 $(target_product_services_notice_file_xml), \
1145 "Notices for files contained in the product_services filesystem image in this directory:", \
1146 $(TARGET_OUT_NOTICE_FILES), \
1147 $(license_modules_product_services)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001148
1149$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
1150 $(hide) $(MINIGZIP) -9 < $< > $@
1151$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
1152 $(hide) $(MINIGZIP) -9 < $< > $@
1153$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
1154 $(hide) $(MINIGZIP) -9 < $< > $@
1155$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
1156 $(hide) $(MINIGZIP) -9 < $< > $@
1157$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
1158 $(copy-file-to-target)
1159$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
1160 $(copy-file-to-target)
1161$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
1162 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001163
1164# No notice file for product_services if its contents are merged into /product.
1165# The notices will be part of the /product notice file.
1166ifndef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001167$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
1168 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001169endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001170
1171# if we've been run my mm, mmm, etc, don't reinstall this every time
1172ifeq ($(ONE_SHOT_MAKEFILE),)
1173 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
1174 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
1175 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
1176 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
Dario Frenicbca1132018-08-28 18:04:03 +01001177endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001178endif # PRODUCT_NOTICE_SPLIT
1179
1180ifeq ($(ONE_SHOT_MAKEFILE),)
1181 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001182endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001183
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001184$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001185 $(tools_notice_file_txt), \
1186 $(tools_notice_file_html), \
1187 "Notices for files contained in the tools directory:", \
1188 $(HOST_OUT_NOTICE_FILES), \
1189 $(ALL_DEFAULT_INSTALLED_MODULES) \
1190 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001191
Ying Wang62c81f82013-08-22 20:02:03 -07001192endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -08001193
1194# The kernel isn't really a module, so to get its module file in there, we
1195# make the target NOTICE files depend on this particular file too, which will
1196# then be in the right directory for the find in combine-notice-files to work.
1197$(kernel_notice_file): \
Lee Campbellb463fcd2015-11-08 16:28:15 -08001198 $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001199 | $(ACP)
1200 @echo Copying: $@
1201 $(hide) mkdir -p $(dir $@)
1202 $(hide) $(ACP) $< $@
1203
Josh Gao4d9268e2017-02-23 13:17:46 -08001204$(winpthreads_notice_file): \
1205 $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
1206 | $(ACP)
1207 @echo Copying: $@
1208 $(hide) mkdir -p $(dir $@)
1209 $(hide) $(ACP) $< $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08001210
Doug Zongker8678df42009-06-15 14:30:14 -07001211# -----------------------------------------------------------------
1212# Build a keystore with the authorized keys in it, used to verify the
1213# authenticity of downloaded OTA packages.
1214#
1215# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
1216# before the rules that use that variable to build the image.
Dan Willemsenb589ae42015-10-29 21:26:18 +00001217ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
Colin Cross21122f92018-09-14 21:51:11 -07001218$(TARGET_OUT_ETC)/security/otacerts.zip: PRIVATE_CERT := $(DEFAULT_KEY_CERT_PAIR).x509.pem
1219$(TARGET_OUT_ETC)/security/otacerts.zip: $(SOONG_ZIP)
1220$(TARGET_OUT_ETC)/security/otacerts.zip: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Doug Zongker8678df42009-06-15 14:30:14 -07001221 $(hide) rm -f $@
1222 $(hide) mkdir -p $(dir $@)
Colin Cross21122f92018-09-14 21:51:11 -07001223 $(hide) $(SOONG_ZIP) -o $@ -C $(dir $(PRIVATE_CERT)) -f $(PRIVATE_CERT)
Doug Zongker8678df42009-06-15 14:30:14 -07001224
Alex Deymocec578c2017-03-28 20:48:18 -07001225# Carry the public key for update_engine if it's a non-IoT target that
Tao Bao38812d62016-01-20 20:58:20 -08001226# uses the AB updater. We use the same key as otacerts but in RSA public key
1227# format.
1228ifeq ($(AB_OTA_UPDATER),true)
Alex Deymocec578c2017-03-28 20:48:18 -07001229ifneq ($(PRODUCT_IOT),true)
Tao Bao23c3db92016-01-21 14:28:50 -08001230ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Colin Cross21122f92018-09-14 21:51:11 -07001231$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Tao Bao38812d62016-01-20 20:58:20 -08001232 $(hide) rm -f $@
1233 $(hide) mkdir -p $(dir $@)
1234 $(hide) openssl x509 -pubkey -noout -in $< > $@
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001235
Tao Bao696bb332018-08-17 16:27:01 -07001236ALL_DEFAULT_INSTALLED_MODULES += \
1237 $(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem
1238$(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem: \
Anton Hansson6d814982018-11-26 18:12:05 +00001239 $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001240 $(hide) cp -f $< $@
Tao Bao38812d62016-01-20 20:58:20 -08001241endif
1242endif
1243
Doug Zongker8678df42009-06-15 14:30:14 -07001244.PHONY: otacerts
1245otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
1246
1247
The Android Open Source Project88b60792009-03-03 19:28:42 -08001248# #################################################################
1249# Targets for user images
1250# #################################################################
1251
Ying Wang933abf12010-06-16 14:31:34 -07001252INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001253ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001254INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1255else
1256ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001257INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1258else
1259ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001260INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1261endif
1262endif
1263endif
1264
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001265# These options tell the recovery updater/installer how to mount the partitions writebale.
1266# <fstype>=<fstype_opts>[|<fstype_opts>]...
1267# fstype_opts := <opt>[,<opt>]...
1268# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001269# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1270DEFAULT_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 -07001271
Ying Wang542903a2010-11-17 15:40:38 -08001272ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1273 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1274endif
1275
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001276INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
Mark Salyzyn780f5952018-10-19 13:44:36 -07001277INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK) $(TUNE2FS)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001278ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1279INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1280endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001281
Chris Friesdf0387d2017-06-21 15:51:46 -05001282ifeq ($(BOARD_AVB_ENABLE),true)
1283INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1284endif
1285
Todd Poynorb2a555e2015-12-15 18:00:14 -08001286ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1287 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1288endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001289ifneq ($(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 -07001290INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001291endif
1292
Ying Wang178ef922011-10-31 18:13:30 -07001293INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001294
Colin Cross8a30f722014-04-28 16:27:32 -07001295ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001296INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001297ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC))
1298INTERNAL_USERIMAGES_DEPS += $(FEC)
1299endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001300endif
1301
Alex Klyubin092c9022017-03-13 13:28:34 -07001302SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001303INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1304
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001305INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1306
Jin Qianabcec5e2017-03-10 16:53:45 -08001307INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
Jin Qianabcec5e2017-03-10 16:53:45 -08001308
Yifan Hongc5c01242018-11-09 10:27:23 -08001309ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001310
1311ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
1312 $(error vboot 1.0 doesn't support logical partition)
1313endif
1314
1315# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1316# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1317
Yifan Hongc5c01242018-11-09 10:27:23 -08001318endif # PRODUCT_USE_DYNAMIC_PARTITIONS
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001319
Ying Wangbd93d422011-10-28 17:02:30 -07001320# $(1): the path of the output dictionary file
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001321# $(2): a subset of "system vendor cache userdata product product_services oem odm"
Yifan Hong760d3c02018-05-30 11:16:46 -07001322# $(3): additional "key=value" pairs to append to the dictionary file.
1323define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001324$(if $(filter $(2),system),\
1325 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
Bowgo Tsai867ab662019-01-29 13:30:18 +08001326 $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001327 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1328 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1329 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1330 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1331 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1332 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1333 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1334 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1335 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1336 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001337 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001338)
Yifan Hong760d3c02018-05-30 11:16:46 -07001339$(if $(filter $(2),userdata),\
1340 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1341 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
1342)
Yifan Hong760d3c02018-05-30 11:16:46 -07001343$(if $(filter $(2),cache),\
1344 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1345 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
1346)
1347$(if $(filter $(2),vendor),\
1348 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1349 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1350 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1351 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1352 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1353 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1354 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1355 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1356 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1357 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
Yifan Hong749062d2018-06-19 16:23:16 -07001358 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001359)
1360$(if $(filter $(2),product),\
1361 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1362 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1363 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1364 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1365 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1366 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1367 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1368 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1369 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1370 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
Yifan Hong56a6c3b2018-07-20 15:19:34 -07001371 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001372)
Yifan Hongebc041a2018-07-26 16:02:52 -07001373$(if $(filter $(2),product_services),\
1374 $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_services_fs_type=$(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1375 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_services_extfs_inode_count=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1376 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_services_extfs_rsv_pct=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT)" >> $(1))
1377 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),$(hide) echo "product_services_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)" >> $(1))
1378 $(if $(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE),$(hide) echo "product_services_journal_size=$(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE)" >> $(1))
1379 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_services_squashfs_compressor=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1380 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_services_squashfs_compressor_opt=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1381 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_services_squashfs_block_size=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1382 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_services_squashfs_disable_4k_align=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1383 $(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 +01001384)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001385$(if $(filter $(2),odm),\
1386 $(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1387 $(if $(BOARD_ODMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_extfs_inode_count=$(BOARD_ODMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1388 $(if $(BOARD_ODMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_extfs_rsv_pct=$(BOARD_ODMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1389 $(if $(BOARD_ODMIMAGE_PARTITION_SIZE),$(hide) echo "odm_size=$(BOARD_ODMIMAGE_PARTITION_SIZE)" >> $(1))
1390 $(if $(BOARD_ODMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_journal_size=$(BOARD_ODMIMAGE_JOURNAL_SIZE)" >> $(1))
1391 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_squashfs_compressor=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1392 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_squashfs_compressor_opt=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1393 $(if $(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_squashfs_block_size=$(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1394 $(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1395 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH)" >> $(1))
1396 $(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
1397)
Yifan Hong760d3c02018-05-30 11:16:46 -07001398$(if $(filter $(2),oem),\
1399 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1400 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1401 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1402 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1403)
Tao Bao3602eca2018-07-10 10:53:55 -07001404$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001405
Tao Bao3602eca2018-07-10 10:53:55 -07001406$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001407$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001408$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001409$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1410$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1411$(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 -08001412$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001413$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001414$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
Paul Lawrencea37b2bb2014-11-13 17:54:30 -08001415$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
Claes Elgemarkec996042015-06-02 11:03:27 +02001416$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001417$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1))
Bowgo Tsai6ceeb1a2017-10-11 16:21:48 +08001418$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001419$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1420$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001421$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
Yifan Hongebc041a2018-07-26 16:02:52 -07001422$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION),$(hide) echo "product_services_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION)" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001423$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1424$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001425$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
Tao Bao9b524ef2017-02-23 11:03:45 -08001426$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001427$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001428$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001429$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1430$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1431$(if $(BOARD_AVB_ENABLE),\
1432 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1433 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1434 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1435 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08001436$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1437$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1438$(if $(BOARD_AVB_ENABLE),\
1439 $(if $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH),\
1440 $(hide) echo "avb_system_other_key_path=$(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)" >> $(1)
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08001441 $(hide) echo "avb_system_other_algorithm=$(BOARD_AVB_SYSTEM_OTHER_ALGORITHM)" >> $(1)
1442 $(hide) echo "avb_system_extract_system_other_key=true" >> $(1)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001443$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1444$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1445$(if $(BOARD_AVB_ENABLE),\
1446 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1447 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1448 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1449 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001450$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1451$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1452$(if $(BOARD_AVB_ENABLE),\
1453 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1454 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1455 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1456 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Tao Bao1ebda8d2018-08-01 17:21:14 -07001457$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_services_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1458$(if $(BOARD_AVB_ENABLE),\
1459 $(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 +01001460$(if $(BOARD_AVB_ENABLE),\
1461 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
Yifan Hongebc041a2018-07-26 16:02:52 -07001462 $(hide) echo "avb_product_services_key_path=$(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH)" >> $(1)
1463 $(hide) echo "avb_product_services_algorithm=$(BOARD_AVB_PRODUCT_SERVICES_ALGORITHM)" >> $(1)
1464 $(hide) echo "avb_product_services_rollback_index_location=$(BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001465$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1466$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1467$(if $(BOARD_AVB_ENABLE),\
1468 $(if $(BOARD_AVB_ODM_KEY_PATH),\
1469 $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1)
1470 $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1)
1471 $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001472$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1473 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001474$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Tom Cherryd14b8952018-08-09 14:26:00 -07001475 $(hide) echo "system_root_image=true" >> $(1))
1476$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
Yifan Hong2dae5722018-07-31 12:47:27 -07001477$(if $(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),$(hide) echo "use_dynamic_partition_size=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001478$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1479endef
1480
1481# $(1): the path of the output dictionary file
1482# $(2): additional "key=value" pairs to append to the dictionary file.
1483define generate-userimage-prop-dictionary
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001484$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product product_services oem odm,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001485endef
1486
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001487# $(1): the path of the input dictionary file, where each line has the format key=value
1488# $(2): the key to look up
1489define read-image-prop-dictionary
1490$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1491endef
1492
Xu Chao2b04bf42017-07-06 14:34:31 +08001493# $(1): modules list
1494# $(2): output dir
1495# $(3): mount point
1496# $(4): staging dir
1497# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1498define build-image-kernel-modules
1499 $(hide) rm -rf $(2)/lib/modules
1500 $(hide) mkdir -p $(2)/lib/modules
1501 $(hide) cp $(1) $(2)/lib/modules/
1502 $(hide) rm -rf $(4)
1503 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1504 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1505 $(hide) $(DEPMOD) -b $(4) 0.0
1506 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1507 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1508endef
1509
The Android Open Source Project88b60792009-03-03 19:28:42 -08001510# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001511# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001512
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001513# Recovery image exists if we are building recovery, or building recovery as boot.
1514ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001515
Ying Wang37526142015-03-10 12:02:57 -07001516INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1517 $(ALL_DEFAULT_INSTALLED_MODULES))
1518
Tao Bao10fc9492018-08-14 12:17:48 -07001519INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
1520INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
1521
1522# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other
1523# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in
1524# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with
1525# the call to FILELIST.
1526ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
1527$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET)
1528else
1529$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET)
1530endif
1531
1532$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY)
1533$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST)
1534 @echo Installed file list: $@
1535 @mkdir -p $(dir $@)
1536 @rm -f $@
1537 $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
1538 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
1539
Doug Zongker4647f122009-07-02 09:00:54 -07001540recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001541recovery_sepolicy := \
1542 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001543 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001544 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001545 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001546 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts
1547
Bowgo Tsai99671252017-11-30 22:15:17 +08001548ifdef BOARD_ODM_SEPOLICY_DIRS
1549recovery_sepolicy += \
1550 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
1551 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts
1552endif
1553
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001554# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1555# SELinux files
1556IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1557
Doug Zongker4647f122009-07-02 09:00:54 -07001558recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1559recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Doug Zongker4647f122009-07-02 09:00:54 -07001560recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001561
Tao Baoe1e829e2018-08-29 20:36:00 -07001562# Set recovery_density to a density bucket based on PRODUCT_AAPT_PREF_CONFIG if set. Otherwise use
1563# the default medium density.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001564ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001565# If PRODUCT_AAPT_PREF_CONFIG includes a non-numeric dpi bucket, always perfer that value.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001566recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001567ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density)))
1568recovery_density_value := $(patsubst %dpi,%,$(recovery_density))
1569# Map the numeric dpi value to a bucket. We roughly use the medium point between the primary
1570# densities to split buckets.
1571# ------160------240------320----------480------------640------
1572# mdpi hdpi xhdpi xxhdpi xxxhdpi
1573recovery_density := $(strip \
1574 $(or $(if $(filter $(shell echo $$(($(recovery_density_value) >= 560))),1),xxxhdpi),\
1575 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 400))),1),xxhdpi),\
1576 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
1577 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
Doug Zongker8eaeea92014-05-12 15:32:20 -07001578endif
Tao Baoe1e829e2018-08-29 20:36:00 -07001579else # PRODUCT_AAPT_PREF_CONFIG is empty
1580recovery_density := mdpi
1581endif # PRODUCT_AAPT_PREF_CONFIG
Doug Zongker8eaeea92014-05-12 15:32:20 -07001582
1583ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1584recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1585else
Doug Zongker25d55f82014-04-04 13:51:15 -07001586recovery_resources_common := $(recovery_resources_common)-xhdpi
1587endif
1588
Tao Baoe1e829e2018-08-29 20:36:00 -07001589# Select the 18x32 font on high-density devices (xhdpi and up); and the 12x22 font on other devices.
1590# Note that the font selected here can be overridden for a particular device by putting a font.png
1591# in its private recovery resources.
1592ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001593recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1594else
1595recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1596endif
1597
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001598
1599# We will only generate the recovery background text images if the variable
1600# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the
1601# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for
1602# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their
1603# BoardConfig in order to use this feature.
1604ifeq ($(recovery_density),xxxhdpi)
1605TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440
1606else ifeq ($(recovery_density),xxhdpi)
1607TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080
1608endif
1609
1610ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),)
1611# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative.
1612ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
1613 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10))
1614else
1615 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10))
1616endif
1617
1618
1619RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png
1620RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
1621RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
1622RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
1623RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
1624
xunchangcc57d312018-12-07 12:12:17 -08001625RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
1626RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
1627RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
1628RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
1629RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
1630
1631generated_recovery_text_files := \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001632 $(RECOVERY_INSTALLING_TEXT_FILE) \
1633 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
1634 $(RECOVERY_ERASING_TEXT_FILE) \
1635 $(RECOVERY_ERROR_TEXT_FILE) \
xunchangcc57d312018-12-07 12:12:17 -08001636 $(RECOVERY_NO_COMMAND_TEXT_FILE) \
1637 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
1638 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
1639 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
1640 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
1641 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001642
1643resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
1644image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
xunchangcc57d312018-12-07 12:12:17 -08001645zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001646$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
1647$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
1648$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
1649$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
xunchangcc57d312018-12-07 12:12:17 -08001650$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001651$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
xunchangdbe55e12018-12-19 17:15:14 -08001652$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001653 recovery_installing \
1654 recovery_installing_security \
1655 recovery_erasing \
1656 recovery_error \
xunchangdbe55e12018-12-19 17:15:14 -08001657 recovery_no_command
1658$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001659 recovery_cancel_wipe_data \
1660 recovery_factory_data_reset \
1661 recovery_try_again \
1662 recovery_wipe_data_menu_header \
1663 recovery_wipe_data_confirmation
1664$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
1665$(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 -08001666 # Prepares the font directory.
1667 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1668 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
xunchangcc57d312018-12-07 12:12:17 -08001669 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001670 @rm -rf $(dir $@)
1671 @mkdir -p $(dir $@)
xunchangdbe55e12018-12-19 17:15:14 -08001672 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
xunchangcc57d312018-12-07 12:12:17 -08001673 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
xunchangdbe55e12018-12-19 17:15:14 -08001674 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001675 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
1676 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
1677 --text_name $(text_name) \
1678 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
1679 --resource_dir $(PRIVATE_RESOURCE_DIR) \
xunchangdbe55e12018-12-19 17:15:14 -08001680 --output_file $(output_file) $(center_alignment) && \
xunchangcc57d312018-12-07 12:12:17 -08001681 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001682else
1683RECOVERY_INSTALLING_TEXT_FILE :=
1684RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
1685RECOVERY_ERASING_TEXT_FILE :=
1686RECOVERY_ERROR_TEXT_FILE :=
1687RECOVERY_NO_COMMAND_TEXT_FILE :=
xunchangcc57d312018-12-07 12:12:17 -08001688RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
1689RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
1690RECOVERY_TRY_AGAIN_TEXT_FILE :=
1691RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
1692RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001693endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
1694
Ying Wang9a175682015-08-06 11:47:47 -07001695ifndef TARGET_PRIVATE_RES_DIRS
1696TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1697endif
Doug Zongker4647f122009-07-02 09:00:54 -07001698recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001699 $(TARGET_PRIVATE_RES_DIRS) -type f)
xunchangcc57d312018-12-07 12:12:17 -08001700recovery_resource_deps += $(generated_recovery_text_files)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001701
1702
Andrew Boiefa61ff02012-09-28 09:33:45 -07001703ifdef TARGET_RECOVERY_FSTAB
1704recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1705else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001706recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001707endif
Tao Baoc3c17532016-06-10 10:11:54 -07001708ifdef TARGET_RECOVERY_WIPE
1709recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001710else
Tao Baoc3c17532016-06-10 10:11:54 -07001711recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001712endif
Tao Bao8beab692015-07-22 12:33:18 -07001713
Tao Bao6d5d6232018-03-09 17:04:42 -08001714# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001715# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001716# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1717# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001718#
1719# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001720# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001721# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001722# b) We build a single image that contains boot and recovery both - no recovery image to install
1723# (BOARD_USES_RECOVERY_AS_BOOT = true);
Tom Cherry2929cad2018-09-20 11:04:37 -07001724# c) We mount the system image as / and therefore do not have a ramdisk in boot.img
Tao Bao6d5d6232018-03-09 17:04:42 -08001725# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001726# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1727# do bsdiff because boot and recovery will contain different number of entries
1728# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001729# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
1730# do bsdiff because boot and recovery will contain different number of entries
1731# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001732
Tom Cherry2929cad2018-09-20 11:04:37 -07001733ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001734 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Doug Zongker56588872012-08-20 15:38:58 -07001735# Named '.dat' so we don't attempt to use imgdiff for patching it.
1736RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001737else
Tao Bao8beab692015-07-22 12:33:18 -07001738RECOVERY_RESOURCE_ZIP :=
1739endif
Doug Zongker4647f122009-07-02 09:00:54 -07001740
Tao Bao139c7272018-07-31 13:26:54 -07001741INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1742
1743$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \
Tao Bao139c7272018-07-31 13:26:54 -07001744 TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \
1745 TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \
1746 TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \
1747 TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \
1748 TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE:progress_bar_baseline \
1749 TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD:touch_low_threshold \
1750 TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD:touch_high_threshold \
1751 TARGET_RECOVERY_UI_VR_STEREO_OFFSET:vr_stereo_offset
1752
1753# Parses the given list of build variables and writes their values as build properties if defined.
1754# For example, if a target defines `TARGET_RECOVERY_UI_MARGIN_HEIGHT := 100`,
1755# `ro.recovery.ui.margin_height=100` will be appended to the given output file.
1756# $(1): Map from the build variable names to property names
1757# $(2): Output file
1758define append-recovery-ui-properties
1759echo "#" >> $(2)
1760echo "# RECOVERY UI BUILD PROPERTIES" >> $(2)
1761echo "#" >> $(2)
1762$(foreach prop,$(1), \
1763 $(eval _varname := $(call word-colon,1,$(prop))) \
1764 $(eval _propname := $(call word-colon,2,$(prop))) \
1765 $(eval _value := $($(_varname))) \
1766 $(if $(_value), \
1767 echo ro.recovery.ui.$(_propname)=$(_value) >> $(2) &&)) true
1768endef
1769
1770$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00001771 $(INSTALLED_DEFAULT_PROP_TARGET) \
1772 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1773 $(intermediate_system_build_prop) \
1774 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
1775 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
1776 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
1777 $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
Tao Bao1edaca12018-09-18 10:22:54 -07001778 @echo "Target recovery buildinfo: $@"
Tao Bao139c7272018-07-31 13:26:54 -07001779 $(hide) mkdir -p $(dir $@)
1780 $(hide) rm -f $@
1781 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@
1782 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@
Tao Bao6eb1a992018-08-06 07:33:45 -07001783 $(hide) cat $(intermediate_system_build_prop) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001784 $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001785 $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001786 $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
1787 $(hide) cat $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET) >> $@
1788 $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
1789
Doug Zongker4647f122009-07-02 09:00:54 -07001790INTERNAL_RECOVERYIMAGE_ARGS := \
1791 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1792 --kernel $(recovery_kernel) \
1793 --ramdisk $(recovery_ramdisk)
1794
1795# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001796ifdef INTERNAL_KERNEL_CMDLINE
1797 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001798endif
1799ifdef BOARD_KERNEL_BASE
1800 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1801endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001802ifdef BOARD_KERNEL_PAGESIZE
1803 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1804endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001805ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001806ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1807 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1808else
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001809 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1810endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001811endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001812ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1813 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
1814endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001815ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1816 INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
1817endif
Doug Zongker4647f122009-07-02 09:00:54 -07001818
1819# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001820# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001821# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001822OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001823
1824# Generate a file containing the keys that will be read by the
1825# recovery binary.
1826RECOVERY_INSTALL_OTA_KEYS := \
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001827 $(call intermediates-dir-for,PACKAGING,ota_keys)/otacerts.zip
Doug Zongker4647f122009-07-02 09:00:54 -07001828$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001829$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001830$(RECOVERY_INSTALL_OTA_KEYS): $(SOONG_ZIP) $(OTA_PUBLIC_KEYS) $(extra_keys)
1831 $(hide) rm -f $@
1832 $(hide) mkdir -p $(dir $@)
1833 $(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 -07001834
Andres Moralesb8876e12015-05-06 20:44:22 -07001835RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001836
Ying Wang747b9f12015-01-30 14:05:22 -08001837# $(1): output file
1838define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001839 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001840 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao696bb332018-08-17 16:27:01 -07001841 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001842 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001843 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
Tao Bao696bb332018-08-17 16:27:01 -07001844 $(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001845 # Modifying ramdisk contents...
Tom Cherry3871f0f2018-11-06 14:23:44 -08001846 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
1847 $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
Howard Chen1756f8d2017-02-22 17:27:10 +08001848 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1849 $(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 +08001850 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1851 $(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 -08001852 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Tao Baocf8853b2018-08-13 14:27:32 -07001853 $(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 -08001854 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1855 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1856 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
xunchangcc57d312018-12-07 12:12:17 -08001857 $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
1858 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
Ying Wang747b9f12015-01-30 14:05:22 -08001859 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001860 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1861 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001862 $(hide) $(foreach item,$(recovery_fstab), \
Tao Bao696bb332018-08-17 16:27:01 -07001863 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001864 $(if $(strip $(recovery_wipe)), \
Tao Bao696bb332018-08-17 16:27:01 -07001865 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001866 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security
1867 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security/otacerts.zip
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001868 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001869 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001870 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Tao Baod95e9fd2015-03-29 23:07:41 -07001871 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001872 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1873 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1) --id > $(RECOVERYIMAGE_ID_FILE))
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001874 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001875 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1876 $(BOOT_SIGNER) /boot $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1877 $(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
1878 )\
1879 )
Tao Baod95e9fd2015-03-29 23:07:41 -07001880 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001881 $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001882 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1883 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1884 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001885 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1886 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1887 $(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),\
1888 $(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 -08001889endef
1890
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001891ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Ying Wangbd07ad02016-03-10 12:57:33 -08001892ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
1893$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1894endif
1895ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
1896$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1897endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001898ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001899$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001900endif
Tao Baof4866c72018-08-22 14:35:09 -07001901ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001902ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1903$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1904else
Tao Baof4866c72018-08-22 14:35:09 -07001905$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
1906endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001907endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001908ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1909$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1910endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001911ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1912$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1913endif
Tao Baof4866c72018-08-22 14:35:09 -07001914
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001915$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001916 $(INTERNAL_ROOT_FILES) \
1917 $(INSTALLED_RAMDISK_TARGET) \
1918 $(INTERNAL_RECOVERYIMAGE_FILES) \
1919 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1920 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1921 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1922 $(recovery_resource_deps) \
1923 $(recovery_fstab) \
1924 $(RECOVERY_INSTALL_OTA_KEYS) \
1925 $(BOARD_RECOVERY_KERNEL_MODULES) \
1926 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001927 $(call pretty,"Target boot image from recovery: $@")
1928 $(call build-recoveryimage-target, $@)
1929endif # BOARD_USES_RECOVERY_AS_BOOT
1930
1931ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001932ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1933$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1934else
Tao Baof4866c72018-08-22 14:35:09 -07001935$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001936endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001937endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001938ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1939$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1940endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001941ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1942$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1943endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001944
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001945$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001946 $(INTERNAL_ROOT_FILES) \
1947 $(INSTALLED_RAMDISK_TARGET) \
1948 $(INSTALLED_BOOTIMAGE_TARGET) \
1949 $(INTERNAL_RECOVERYIMAGE_FILES) \
1950 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1951 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1952 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1953 $(recovery_resource_deps) \
1954 $(recovery_fstab) \
1955 $(RECOVERY_INSTALL_OTA_KEYS) \
1956 $(BOARD_RECOVERY_KERNEL_MODULES) \
1957 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001958 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001959
Tao Bao4594d0e2015-12-22 09:47:46 -08001960ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001961$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001962 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001963 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1964 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001965endif
Doug Zongker56588872012-08-20 15:38:58 -07001966
Ying Wang747b9f12015-01-30 14:05:22 -08001967.PHONY: recoveryimage-nodeps
1968recoveryimage-nodeps:
1969 @echo "make $@: ignoring dependencies"
1970 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1971
Tao Bao8beab692015-07-22 12:33:18 -07001972else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07001973RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07001974endif
1975
1976.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001977recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001978
Jiyong Park03eb0612017-10-04 21:22:41 +09001979ifneq ($(BOARD_NAND_PAGE_SIZE),)
1980$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001981endif
1982
Jiyong Park03eb0612017-10-04 21:22:41 +09001983ifneq ($(BOARD_NAND_SPARE_SIZE),)
1984$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001985endif
1986
Doug Zongker4647f122009-07-02 09:00:54 -07001987# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07001988# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08001989#
Ying Wang9c649a72012-08-08 15:27:00 -07001990# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
1991PDK_FUSION_SYSIMG_FILES := \
1992 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
1993 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001994
Dan Willemsen37a19862018-10-31 16:31:46 -07001995INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07001996 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07001997 $(ALL_DEFAULT_INSTALLED_MODULES) \
1998 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08001999 $(RECOVERY_RESOURCE_ZIP)) \
Dan Willemsen37a19862018-10-31 16:31:46 -07002000 $(PDK_FUSION_SYMLINK_STAMP))
Ying Wang160b6702012-03-13 18:58:27 -07002001
Ying Wang82cceba2012-08-13 15:03:00 -07002002FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002003
2004# ASAN libraries in the system image - add dependency.
2005ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
Evgenii Stepanov8841a7f2018-07-27 11:54:32 -07002006ifneq (,$(filter address, $(SANITIZE_TARGET)))
Andreas Gampe039b5c72017-03-24 16:06:31 -07002007 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
2008 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
2009 endif
2010endif
2011
Tom Cherryd14b8952018-08-09 14:26:00 -07002012FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
Luis Hector Chavezff489932018-07-03 15:41:40 -07002013
Ying Wange5e8c5f2011-09-09 16:35:53 -07002014# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07002015# Final System VINTF manifest including fragments. This is not assembled
2016# on the device because it depends on everything in a given device
2017# image which defines a vintf_fragment.
2018
2019BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
2020$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2021$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
2022$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
2023$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
2024 @echo "Verifying system VINTF manifest."
2025 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2026 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Anton Hansson6d814982018-11-26 18:12:05 +00002027 -c $(BUILT_VENDOR_MATRIX) \
2028 -i $(BUILT_SYSTEM_MANIFEST) \
2029 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
2030 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
2031 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002032
2033# -----------------------------------------------------------------
Dan Willemsen67495202019-01-16 12:42:05 -08002034ifdef BUILDING_SYSTEM_IMAGE
2035
Ying Wange5e8c5f2011-09-09 16:35:53 -07002036# installed file list
2037# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
2038# We put installed-files.txt ahead of image itself in the dependency graph
2039# so that we can get the size stat even if the build fails due to too large
2040# system image.
2041INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07002042INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
2043$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002044$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002045 @echo Installed file list: $@
2046 @mkdir -p $(dir $@)
2047 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002048 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002049 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07002050
2051.PHONY: installed-file-list
2052installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08002053
2054$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07002055
2056systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002057 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002058BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
2059
Ying Wang23898df2014-06-18 20:26:24 -07002060# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002061ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07002062define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07002063$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
2064 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
2065 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
2066 exit 1; \
2067fi
Ying Wang23898df2014-06-18 20:26:24 -07002068$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
2069endef
2070else
2071define create-system-vendor-symlink
2072endef
2073endif
2074
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002075# Create symlink /system/product to /product if necessary.
2076ifdef BOARD_USES_PRODUCTIMAGE
2077define create-system-product-symlink
2078$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
2079 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
2080 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
2081 exit 1; \
2082fi
2083$(hide) ln -sf /product $(TARGET_OUT)/product
2084endef
2085else
2086define create-system-product-symlink
2087endef
2088endif
2089
Dario Freni924af7d2018-08-17 00:56:14 +01002090# Create symlink /system/product_services to /product_services if necessary.
Dario Freni5f681e12018-05-29 13:09:01 +01002091ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002092define create-system-product_services-symlink
2093$(hide) if [ -d $(TARGET_OUT)/product_services ] && [ ! -h $(TARGET_OUT)/product_services ]; then \
2094 echo 'Non-symlink $(TARGET_OUT)/product_services detected!' 1>&2; \
2095 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 +01002096 exit 1; \
2097fi
Dario Freni924af7d2018-08-17 00:56:14 +01002098$(hide) ln -sf /product_services $(TARGET_OUT)/product_services
Dario Freni5f681e12018-05-29 13:09:01 +01002099endef
2100else
Dario Freni924af7d2018-08-17 00:56:14 +01002101define create-system-product_services-symlink
Dario Freni5f681e12018-05-29 13:09:01 +01002102endef
2103endif
2104
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002105# Create symlink /vendor/odm to /odm if necessary.
2106ifdef BOARD_USES_ODMIMAGE
2107define create-vendor-odm-symlink
2108$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
2109 echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
2110 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
2111 exit 1; \
2112fi
2113$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
2114endef
2115else
2116define create-vendor-odm-symlink
2117endef
2118endif
2119
The Android Open Source Project88b60792009-03-03 19:28:42 -08002120# $(1): output file
2121define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07002122 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07002123 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002124 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002125 $(call create-system-product_services-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07002126 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002127 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07002128 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002129 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002130 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002131 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002132 $(systemimage_intermediates)/generated_system_image_info.txt \
Dan Willemsen3e8eb372018-10-20 21:37:44 -07002133 || ( mkdir -p $${DIST_DIR}; cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07002134 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08002135endef
2136
Steven Moreland627debe2018-05-01 09:54:21 -07002137$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002138$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002139 $(call build-systemimage-target,$@)
2140
Tao Baoe9d61b02018-08-20 21:09:07 -07002141INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07002142SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002143
Tao Baoe9d61b02018-08-20 21:09:07 -07002144# INSTALLED_SYSTEMIMAGE_TARGET used to be named INSTALLED_SYSTEMIMAGE. Create an alias for backward
2145# compatibility, in case device-specific Makefiles still refer to the old name.
2146INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
2147
Doug Zongker73ef8252009-07-23 15:12:53 -07002148# The system partition needs room for the recovery image as well. We
2149# now store the recovery image as a binary patch using the boot image
2150# as the source (since they are very similar). Generate the patch so
2151# we can see how big it's going to be, and include that in the system
2152# image size check calculation.
Tao Baob1a2e352018-08-14 16:17:12 -07002153ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
Sriram Raman1e96ac82009-07-24 13:52:32 -07002154ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07002155ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Chen, ZhiminX752439b2018-09-23 22:10:47 +08002156ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08002157diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
2158else
2159diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
2160endif
Doug Zongker73ef8252009-07-23 15:12:53 -07002161intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
2162RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08002163$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
2164$(RECOVERY_FROM_BOOT_PATCH): \
Anton Hansson6d814982018-11-26 18:12:05 +00002165 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2166 $(INSTALLED_BOOTIMAGE_TARGET) \
2167 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07002168 @echo "Construct recovery from boot"
2169 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08002170 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07002171else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
2172RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
Tao Baob1a2e352018-08-14 16:17:12 -07002173endif # BOARD_USES_FULL_RECOVERY_IMAGE
2174endif # INSTALLED_RECOVERYIMAGE_TARGET
2175endif # INSTALLED_BOOTIMAGE_TARGET
Doug Zongker73ef8252009-07-23 15:12:53 -07002176
Tao Baoe9d61b02018-08-20 21:09:07 -07002177$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002178 @echo "Install system fs image: $@"
2179 $(copy-file-to-target)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002180 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
Anton Hansson6d814982018-11-26 18:12:05 +00002181 $(call read-image-prop-dictionary,\
2182 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002183
Tao Baoe9d61b02018-08-20 21:09:07 -07002184systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002185
2186.PHONY: systemimage-nodeps snod
2187systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07002188 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002189 @echo "make $@: ignoring dependencies"
Tao Baoe9d61b02018-08-20 21:09:07 -07002190 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
2191 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),\
Anton Hansson6d814982018-11-26 18:12:05 +00002192 $(call read-image-prop-dictionary,\
2193 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002194
Ying Wangacf01ec2012-02-24 11:05:48 -08002195ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
2196ifeq (true,$(WITH_DEXPREOPT))
2197$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
2198endif
2199endif
2200
Dan Willemsen67495202019-01-16 12:42:05 -08002201endif # BUILDING_SYSTEM_IMAGE
2202
Anton Hansson30e061b2018-11-12 13:36:46 +00002203.PHONY: sync syncsys
2204sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
Colin Cross91a52272017-06-20 16:57:52 -07002205
The Android Open Source Project88b60792009-03-03 19:28:42 -08002206#######
2207## system tarball
2208define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07002209 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
2210 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002211 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002212 $(call create-system-product_services-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07002213 $(MKTARBALL) $(FS_GET_STATS) \
2214 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002215 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002216endef
2217
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002218ifndef SYSTEM_TARBALL_FORMAT
2219 SYSTEM_TARBALL_FORMAT := bz2
2220endif
2221
The Android Open Source Project88b60792009-03-03 19:28:42 -08002222system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002223INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002224$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
2225$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
2226 $(build-systemtarball-target)
2227
2228.PHONY: systemtarball-nodeps
2229systemtarball-nodeps: $(FS_GET_STATS) \
2230 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
2231 $(build-systemtarball-target)
2232
2233.PHONY: stnod
2234stnod: systemtarball-nodeps
2235
Ying Wang3a61eeb2016-03-11 10:32:01 -08002236# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07002237## platform.zip: system, plus other files to be used in PDK fusion build,
2238## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07002239##
2240## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
2241## The variable will be typically set from BoardConfig.mk.
2242## Files under out dir will be rejected to prevent possible conflicts with other rules.
Colin Cross53c8f972018-09-28 16:19:42 -07002243ifneq (,$(BUILD_PLATFORM_ZIP))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002244pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002245 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002246pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002247 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002248pdk_classes_dex := $(strip \
2249 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
2250 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
2251
2252pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
2253$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
2254$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
2255$(pdk_odex_config_mk) :
2256 @echo "PDK odex config makefile: $@"
2257 $(hide) mkdir -p $(dir $@)
2258 $(hide) echo "# Auto-generated. Do not modify." > $@
2259 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
2260 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
2261 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
2262 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
2263 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2264 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2265 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2266 )
2267 $(foreach m,$(PRIVATE_APPS),\
2268 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
2269 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2270 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2271 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2272 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07002273 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08002274 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
2275 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
2276 )
2277
keunyoungc0178062013-07-22 14:54:58 -07002278PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07002279INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08002280
2281$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
2282$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
Colin Cross7363cde2018-09-14 21:51:11 -07002283$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP)
2284# dependencies for the other partitions are defined below after their file lists
2285# are known
Dan Willemsenad6a1542018-12-14 01:04:19 -08002286$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(api_fingerprint)
Keun young Park816b9fd2012-05-16 10:32:41 -07002287 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Colin Cross7363cde2018-09-14 21:51:11 -07002288 rm -f $@ $@.lst
2289 echo "-C $(PRODUCT_OUT)" >> $@.lst
2290 echo "-D $(TARGET_OUT)" >> $@.lst
2291 echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst
2292 echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst
Dan Willemsen67495202019-01-16 12:42:05 -08002293ifdef BUILDING_VENDOR_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002294 echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst
Ying Wangcff38622014-07-16 17:46:35 -07002295endif
Dan Willemsen67495202019-01-16 12:42:05 -08002296ifdef BUILDING_PRODUCT_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002297 echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002298endif
Dan Willemsen67495202019-01-16 12:42:05 -08002299ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002300 echo "-D $(TARGET_OUT_PRODUCT_SERVICES)" >> $@.lst
Dario Freni5f681e12018-05-29 13:09:01 +01002301endif
Dan Willemsen67495202019-01-16 12:42:05 -08002302ifdef BUILDING_ODM_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002303 echo "-D $(TARGET_OUT_ODM)" >> $@.lst
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002304endif
Colin Crossc451a372013-12-18 19:36:44 -08002305ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Colin Cross7363cde2018-09-14 21:51:11 -07002306 echo "-C $(OUT_DIR)" >> $@.lst
2307 for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \
2308 if [ -e $$f ]; then \
2309 echo "-f $$f"; \
2310 fi \
2311 done >> $@.lst
Keun young Park816b9fd2012-05-16 10:32:41 -07002312endif
keunyoungc0178062013-07-22 14:54:58 -07002313ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Colin Cross7363cde2018-09-14 21:51:11 -07002314 echo "-C . $(addprefix -f ,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))" >> $@.lst
keunyoungc0178062013-07-22 14:54:58 -07002315endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08002316 @# Add dex-preopt files and config.
Colin Cross7363cde2018-09-14 21:51:11 -07002317 $(if $(PRIVATE_DEX_FILES),\
2318 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst
Dan Willemsenad6a1542018-12-14 01:04:19 -08002319 echo "-C $(dir $(api_fingerprint)) -f $(api_fingerprint)" >> $@.lst
Colin Cross7363cde2018-09-14 21:51:11 -07002320 touch $(PRODUCT_OUT)/pdk.mk
2321 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst
2322 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst
Ying Wang4c289e52012-03-30 13:52:54 -07002323
2324.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07002325platform: $(INSTALLED_PLATFORM_ZIP)
2326
2327.PHONY: platform-java
2328platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07002329
2330# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07002331ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
2332$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07002333endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002334
Colin Cross53c8f972018-09-28 16:19:42 -07002335endif # BUILD_PLATFORM_ZIP
2336
Ying Wang3a61eeb2016-03-11 10:32:01 -08002337# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07002338## boot tarball
2339define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07002340 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07002341 $(hide) mkdir -p $(PRODUCT_OUT)/boot
2342 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002343 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07002344 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
2345 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002346 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07002347endef
2348
2349ifndef BOOT_TARBALL_FORMAT
2350 BOOT_TARBALL_FORMAT := bz2
2351endif
2352
2353boot_tar := $(PRODUCT_OUT)/boot.tar
2354INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
2355$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
2356$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
2357 $(build-boottarball-target)
2358
2359.PHONY: boottarball-nodeps btnod
2360boottarball-nodeps btnod: $(FS_GET_STATS) \
2361 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
2362 $(build-boottarball-target)
2363
2364
The Android Open Source Project88b60792009-03-03 19:28:42 -08002365# -----------------------------------------------------------------
2366# data partition image
2367INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002368 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002369
Dan Willemsen67495202019-01-16 12:42:05 -08002370ifdef BUILDING_USERDATA_IMAGE
Ying Wangbd93d422011-10-28 17:02:30 -07002371userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002372 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07002373BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
2374
Ying Wangbd93d422011-10-28 17:02:30 -07002375define build-userdataimage-target
2376 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
2377 @mkdir -p $(TARGET_OUT_DATA)
2378 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002379 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002380 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002381 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002382 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002383 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07002384endef
2385
Joe Onorato64d85d02009-04-09 19:31:12 -07002386# We just build this directly to the install location.
2387INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002388INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
2389 $(INTERNAL_USERIMAGES_DEPS) \
2390 $(INTERNAL_USERDATAIMAGE_FILES) \
2391 $(BUILD_IMAGE_SRCS)
2392$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002393 $(build-userdataimage-target)
2394
2395.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07002396userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002397 $(build-userdataimage-target)
2398
Dan Willemsen67495202019-01-16 12:42:05 -08002399endif # BUILDING_USERDATA_IMAGE
Ying Wange215ed52012-10-15 14:36:22 -07002400
Andreas Gampe039b5c72017-03-24 16:06:31 -07002401# ASAN libraries in the system image - build rule.
2402ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
2403 $(TARGET_OUT_SHARED_LIBRARIES) \
2404 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
2405 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
2406 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07002407# Extra options: Enforce the system user for the files to avoid having to change ownership.
2408ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07002409# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
2410# enough space.
2411$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07002412 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 -07002413
The Android Open Source Project88b60792009-03-03 19:28:42 -08002414#######
2415## data partition tarball
2416define build-userdatatarball-target
2417 $(call pretty,"Target userdata fs tarball: " \
2418 "$(INSTALLED_USERDATATARBALL_TARGET)")
2419 $(MKTARBALL) $(FS_GET_STATS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002420 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
2421 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002422endef
2423
2424userdata_tar := $(PRODUCT_OUT)/userdata.tar
2425INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
2426$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
2427$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
2428 $(build-userdatatarball-target)
2429
Dan Willemsen69af2e42016-08-16 16:36:05 -07002430$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
2431
The Android Open Source Project88b60792009-03-03 19:28:42 -08002432.PHONY: userdatatarball-nodeps
2433userdatatarball-nodeps: $(FS_GET_STATS)
2434 $(build-userdatatarball-target)
2435
2436
The Android Open Source Project88b60792009-03-03 19:28:42 -08002437# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04002438# partition table image
2439ifdef BOARD_BPT_INPUT_FILES
2440
2441BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002442BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04002443
2444INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
2445 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002446 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04002447 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
2448
2449ifdef BOARD_BPT_DISK_SIZE
2450INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
2451endif
2452
2453define build-bptimage-target
2454 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
2455 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
2456endef
2457
2458INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002459$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
2460 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
2461
David Zeuthen25328622016-04-08 15:08:03 -04002462$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
2463 $(build-bptimage-target)
2464
2465.PHONY: bptimage-nodeps
2466bptimage-nodeps:
2467 $(build-bptimage-target)
2468
2469endif # BOARD_BPT_INPUT_FILES
2470
2471# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07002472# cache partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002473ifdef BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002474INTERNAL_CACHEIMAGE_FILES := \
2475 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
2476
2477cacheimage_intermediates := \
2478 $(call intermediates-dir-for,PACKAGING,cache)
2479BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
2480
2481define build-cacheimage-target
2482 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
2483 @mkdir -p $(TARGET_OUT_CACHE)
2484 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002485 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002486 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002487 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002488 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002489 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07002490endef
2491
2492# We just build this directly to the install location.
2493INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002494$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002495 $(build-cacheimage-target)
2496
2497.PHONY: cacheimage-nodeps
2498cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2499 $(build-cacheimage-target)
2500
Dan Willemsen67495202019-01-16 12:42:05 -08002501else # BUILDING_CACHE_IMAGE
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07002502# we need to ignore the broken cache link when doing the rsync
2503IGNORE_CACHE_LINK := --exclude=cache
Dan Willemsen67495202019-01-16 12:42:05 -08002504endif # BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002505
David Zeuthen0eb10972016-09-28 17:55:27 -04002506# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07002507# system_other partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002508ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002509ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
Alex Light4e358ab2016-06-16 14:47:10 -07002510# Marker file to identify that odex files are installed
2511INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2512ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2513$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2514 $(hide) touch $@
2515endif
2516
Alex Light4e358ab2016-06-16 14:47:10 -07002517INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2518 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2519 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002520 $(ALL_PDK_FUSION_FILES)) \
2521 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002522
Colin Cross6db5b0e2018-11-16 21:26:33 -08002523# system_other dex files are installed as a side-effect of installing system image files
2524INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES)
2525
Alex Light4e358ab2016-06-16 14:47:10 -07002526INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002527INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2528$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002529$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07002530 @echo Installed file list: $@
2531 @mkdir -p $(dir $@)
2532 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002533 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002534 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002535
Bowgo Tsai867ab662019-01-29 13:30:18 +08002536# Determines partition size for system_other.img.
2537ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
2538ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
2539INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE)
2540endif
2541endif
2542
2543ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE
2544INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE)
2545endif
2546
Alex Light4e358ab2016-06-16 14:47:10 -07002547systemotherimage_intermediates := \
2548 $(call intermediates-dir-for,PACKAGING,system_other)
2549BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2550
2551# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2552define build-systemotherimage-target
2553 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2554 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2555 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002556 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002557 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002558 build/make/tools/releasetools/build_image.py \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002559 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
2560 $(systemotherimage_intermediates)/generated_system_other_image_info.txt
2561 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
2562 $(call read-image-prop-dictionary,\
Bowgo Tsai867ab662019-01-29 13:30:18 +08002563 $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_other_size))
Alex Light4e358ab2016-06-16 14:47:10 -07002564endef
2565
2566# We just build this directly to the install location.
2567INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002568ifneq (true,$(SANITIZE_LITE))
2569# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002570$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2571 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002572endif
Alex Light4e358ab2016-06-16 14:47:10 -07002573
2574.PHONY: systemotherimage-nodeps
2575systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2576 $(build-systemotherimage-target)
2577
Dan Willemsen67495202019-01-16 12:42:05 -08002578endif # BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002579
2580
2581# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002582# vendor partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002583ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07002584INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002585 $(filter $(TARGET_OUT_VENDOR)/%,\
2586 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002587 $(ALL_PDK_FUSION_FILES)) \
2588 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002589
Steven Moreland627debe2018-05-01 09:54:21 -07002590# Final Vendor VINTF manifest including fragments. This is not assembled
2591# on the device because it depends on everything in a given device
2592# image which defines a vintf_fragment.
2593ifdef BUILT_VENDOR_MANIFEST
2594BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
2595ifeq (true,$(strip $(PRODUCT_ENFORCE_VINTF_MANIFEST)))
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002596ifneq ($(strip $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)),)
Steven Moreland627debe2018-05-01 09:54:21 -07002597$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002598endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
Steven Moreland627debe2018-05-01 09:54:21 -07002599endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2600$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2601$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2602$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2603$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
Yifan Hong770ab052018-11-02 13:43:30 -07002604
2605$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS :=
2606
2607# -- Kernel version and configurations.
2608ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
2609
2610# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
2611# from INSTALLED_KERNEL_TARGET.
2612ifdef BOARD_KERNEL_CONFIG_FILE
2613ifdef BOARD_KERNEL_VERSION
2614$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BOARD_KERNEL_CONFIG_FILE)
2615$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $(BOARD_KERNEL_VERSION):$(BOARD_KERNEL_CONFIG_FILE)
2616my_board_extracted_kernel := true
2617endif # BOARD_KERNEL_VERSION
2618endif # BOARD_KERNEL_CONFIG_FILE
2619
2620ifneq ($(my_board_extracted_kernel),true)
2621ifndef INSTALLED_KERNEL_TARGET
2622$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2623 is true. Information about the updated kernel cannot be built into OTA update package. \
2624 You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
2625 to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
2626 or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
2627 BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2628 manually.)
2629else
2630intermediates := $(call intermediates-dir-for,ETC,$(notdir $(BUILT_ASSEMBLED_VENDOR_MANIFEST)))
2631
2632# Tools for decompression that is not in PATH.
2633# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
2634# Algorithms that are in the script but not in this list will be found in PATH.
2635my_decompress_tools := \
2636 lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
2637
2638my_kernel_configs := $(intermediates)/kernel_configs.txt
2639my_kernel_version := $(intermediates)/kernel_version.txt
2640$(my_kernel_configs): .KATI_IMPLICIT_OUTPUTS := $(my_kernel_version)
2641$(my_kernel_configs): PRIVATE_KERNEL_VERSION_FILE := $(my_kernel_version)
2642$(my_kernel_configs): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
2643$(my_kernel_configs): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
2644$(my_kernel_configs): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
2645 $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
2646 --output-configs $@ \
2647 --output-version $(PRIVATE_KERNEL_VERSION_FILE)
2648
2649$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(my_kernel_configs) $(my_kernel_version)
2650$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $$(cat $(my_kernel_version)):$(my_kernel_configs)
2651
2652intermediates :=
2653my_kernel_configs :=
2654my_kernel_version :=
2655my_decompress_tools :=
2656
2657endif # my_board_extracted_kernel
2658my_board_extracted_kernel :=
2659
2660endif # INSTALLED_KERNEL_TARGET
2661endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
2662
2663$(BUILT_ASSEMBLED_VENDOR_MANIFEST):
Steven Moreland627debe2018-05-01 09:54:21 -07002664 @echo "Verifying vendor VINTF manifest."
2665 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2666 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2667 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Yifan Hong770ab052018-11-02 13:43:30 -07002668 $(PRIVATE_FLAGS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002669 -c $(BUILT_SYSTEM_MATRIX) \
2670 -i $(BUILT_VENDOR_MANIFEST) \
2671 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2672 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2673 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002674endif # BUILT_VENDOR_MANIFEST
2675
Ying Wangcff38622014-07-16 17:46:35 -07002676# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2677$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002678
Ying Wang8da19e32015-09-15 14:22:12 -07002679INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002680INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2681$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002682$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002683 @echo Installed file list: $@
2684 @mkdir -p $(dir $@)
2685 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002686 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002687 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002688
Ying Wanga0febe52013-03-20 11:02:05 -07002689vendorimage_intermediates := \
2690 $(call intermediates-dir-for,PACKAGING,vendor)
2691BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002692define build-vendorimage-target
2693 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2694 @mkdir -p $(TARGET_OUT_VENDOR)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002695 $(call create-vendor-odm-symlink)
Ying Wanga0febe52013-03-20 11:02:05 -07002696 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002697 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002698 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2699 $(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 -07002700 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002701 build/make/tools/releasetools/build_image.py \
Yifan Hong749062d2018-06-19 16:23:16 -07002702 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
2703 $(vendorimage_intermediates)/generated_vendor_image_info.txt
2704 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
2705 $(call read-image-prop-dictionary,\
2706 $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
Ying Wanga0febe52013-03-20 11:02:05 -07002707endef
2708
2709# We just build this directly to the install location.
2710INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002711ifdef BUILT_VENDOR_MANIFEST
2712$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2713endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002714$(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 -07002715 $(build-vendorimage-target)
2716
Steven Morelanda2e734d2017-03-07 12:10:09 -08002717.PHONY: vendorimage-nodeps vnod
2718vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002719 $(build-vendorimage-target)
2720
Colin Cross91a52272017-06-20 16:57:52 -07002721sync: $(INTERNAL_VENDORIMAGE_FILES)
2722
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002723else ifdef BOARD_PREBUILT_VENDORIMAGE
2724INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2725$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2726endif
Ying Wanga0febe52013-03-20 11:02:05 -07002727
Ying Wang9f8e8db2011-11-04 11:37:01 -07002728# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002729# product partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002730ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002731INTERNAL_PRODUCTIMAGE_FILES := \
2732 $(filter $(TARGET_OUT_PRODUCT)/%,\
2733 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002734 $(ALL_PDK_FUSION_FILES)) \
2735 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002736
2737# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2738$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2739
2740INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002741INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2742$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002743$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2744 @echo Installed file list: $@
2745 @mkdir -p $(dir $@)
2746 @rm -f $@
2747 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2748 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2749
2750productimage_intermediates := \
2751 $(call intermediates-dir-for,PACKAGING,product)
2752BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2753define build-productimage-target
2754 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2755 @mkdir -p $(TARGET_OUT_PRODUCT)
2756 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002757 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002758 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2759 ./build/tools/releasetools/build_image.py \
Yifan Hong56a6c3b2018-07-20 15:19:34 -07002760 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT) \
2761 $(productimage_intermediates)/generated_product_image_info.txt
2762 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),\
2763 $(call read-image-prop-dictionary,\
2764 $(productimage_intermediates)/generated_product_image_info.txt,product_size))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002765endef
2766
2767# We just build this directly to the install location.
2768INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2769$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2770 $(build-productimage-target)
2771
2772.PHONY: productimage-nodeps pnod
2773productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2774 $(build-productimage-target)
2775
2776sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2777
2778else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2779INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2780$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2781endif
2782
2783# -----------------------------------------------------------------
Dario Freni924af7d2018-08-17 00:56:14 +01002784# product_services partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002785ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni5f681e12018-05-29 13:09:01 +01002786INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
2787 $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
2788 $(ALL_DEFAULT_INSTALLED_MODULES)\
2789 $(ALL_PDK_FUSION_FILES)) \
2790 $(PDK_FUSION_SYMLINK_STAMP)
2791
2792# platform.zip depends on $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES).
2793$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2794
Dario Freni924af7d2018-08-17 00:56:14 +01002795INSTALLED_FILES_FILE_PRODUCT_SERVICES := $(PRODUCT_OUT)/installed-files-product_services.txt
Dario Freni5f681e12018-05-29 13:09:01 +01002796INSTALLED_FILES_JSON_PRODUCT_SERVICES := $(INSTALLED_FILES_FILE_PRODUCT_SERVICES:.txt=.json)
2797$(INSTALLED_FILES_FILE_PRODUCT_SERVICES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT_SERVICES)
2798$(INSTALLED_FILES_FILE_PRODUCT_SERVICES) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(FILESLIST)
2799 @echo Installed file list: $@
2800 @mkdir -p $(dir $@)
2801 @rm -f $@
2802 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT_SERVICES) > $(@:.txt=.json)
2803 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2804
Yifan Hongebc041a2018-07-26 16:02:52 -07002805product_servicesimage_intermediates := \
2806 $(call intermediates-dir-for,PACKAGING,product_services)
Dario Freni924af7d2018-08-17 00:56:14 +01002807BUILT_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
2808define build-product_servicesimage-target
2809 $(call pretty,"Target product_services fs image: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)")
Dario Freni5f681e12018-05-29 13:09:01 +01002810 @mkdir -p $(TARGET_OUT_PRODUCT_SERVICES)
Yifan Hongebc041a2018-07-26 16:02:52 -07002811 @mkdir -p $(product_servicesimage_intermediates) && rm -rf $(product_servicesimage_intermediates)/product_services_image_info.txt
2812 $(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 +01002813 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2814 ./build/tools/releasetools/build_image.py \
Yifan Hongebc041a2018-07-26 16:02:52 -07002815 $(TARGET_OUT_PRODUCT_SERVICES) $(product_servicesimage_intermediates)/product_services_image_info.txt $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(TARGET_OUT) \
2816 $(product_servicesimage_intermediates)/generated_product_services_image_info.txt
Yifan Hong9c35a022018-07-20 15:33:47 -07002817 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),\
2818 $(call read-image-prop-dictionary,\
Yifan Hongebc041a2018-07-26 16:02:52 -07002819 $(product_servicesimage_intermediates)/generated_product_services_image_info.txt,product_services_size))
Dario Freni5f681e12018-05-29 13:09:01 +01002820endef
2821
2822# We just build this directly to the install location.
2823INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(BUILT_PRODUCT_SERVICESIMAGE_TARGET)
2824$(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 +01002825 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002826
2827.PHONY: productservicesimage-nodeps psnod
2828productservicesimage-nodeps psnod: | $(INTERNAL_USERIMAGES_DEPS)
Dario Freni924af7d2018-08-17 00:56:14 +01002829 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002830
2831sync: $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2832
2833else ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002834INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
Dario Freni5f681e12018-05-29 13:09:01 +01002835$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCT_SERVICESIMAGE),$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)))
2836endif
2837
2838# -----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002839# odm partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002840ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002841INTERNAL_ODMIMAGE_FILES := \
2842 $(filter $(TARGET_OUT_ODM)/%,\
2843 $(ALL_DEFAULT_INSTALLED_MODULES)\
2844 $(ALL_PDK_FUSION_FILES)) \
2845 $(PDK_FUSION_SYMLINK_STAMP)
2846# platform.zip depends on $(INTERNAL_ODMIMAGE_FILES).
2847$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODMIMAGE_FILES)
2848
2849INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt
2850INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json)
2851$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM)
2852$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST)
2853 @echo Installed file list: $@
2854 @mkdir -p $(dir $@)
2855 @rm -f $@
2856 $(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json)
2857 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2858
2859odmimage_intermediates := \
2860 $(call intermediates-dir-for,PACKAGING,odm)
2861BUILT_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2862define build-odmimage-target
2863 $(call pretty,"Target odm fs image: $(INSTALLED_ODMIMAGE_TARGET)")
2864 @mkdir -p $(TARGET_OUT_ODM)
2865 @mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt
2866 $(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true)
2867 $(if $(BOARD_ODM_KERNEL_MODULES), \
2868 $(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm/,$(call intermediates-dir-for,PACKAGING,depmod_odm)))
2869 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2870 ./build/tools/releasetools/build_image.py \
2871 $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT) \
2872 $(odmimage_intermediates)/generated_odm_image_info.txt
2873 $(hide) $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),\
2874 $(call read-image-prop-dictionary,\
2875 $(odmimage_intermediates)/generated_odm_image_info.txt,odm_size))
2876endef
2877
2878# We just build this directly to the install location.
2879INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET)
2880$(INSTALLED_ODMIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_ODMIMAGE_FILES) $(INSTALLED_FILES_FILE_ODM) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_ODM_KERNEL_MODULES)
2881 $(build-odmimage-target)
2882
2883.PHONY: odmimage-nodeps onod
2884odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
2885 $(build-odmimage-target)
2886
2887sync: $(INTERNAL_ODMIMAGE_FILES)
2888
2889else ifdef BOARD_PREBUILT_ODMIMAGE
2890INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2891$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET)))
2892endif
2893
2894# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07002895# dtbo image
2896ifdef BOARD_PREBUILT_DTBOIMAGE
2897INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
2898
2899ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002900$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002901 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2902 $(AVBTOOL) add_hash_footer \
Anton Hansson6d814982018-11-26 18:12:05 +00002903 --image $@ \
2904 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
2905 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
2906 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002907else
2908$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
2909 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2910endif
2911
Tao Bao0da43472018-08-22 22:53:41 -07002912endif # BOARD_PREBUILT_DTBOIMAGE
2913
2914# Returns a list of image targets corresponding to the given list of partitions. For example, it
2915# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET)
2916# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor".
2917# (1): list of partitions like "system", "vendor" or "system product product_services".
2918define images-for-partitions
2919$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))
2920endef
Yueyao Zhu211c9012017-04-27 00:34:50 -07002921
2922# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002923# vbmeta image
2924ifeq ($(BOARD_AVB_ENABLE),true)
2925
2926BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002927AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002928
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002929ifdef BOARD_AVB_KEY_PATH
2930$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
2931else
2932# If key path isn't specified, use the 4096-bit test key.
2933BOARD_AVB_ALGORITHM := SHA256_RSA4096
2934BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
2935endif
2936
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08002937# AVB signing for system_other.img.
2938ifdef BUILDING_SYSTEM_OTHER_IMAGE
2939ifdef BOARD_AVB_SYSTEM_OTHER_KEY_PATH
2940$(if $(BOARD_AVB_SYSTEM_OTHER_ALGORITHM),,$(error BOARD_AVB_SYSTEM_OTHER_ALGORITHM is not defined))
2941else
2942# If key path isn't specified, use the same key as BOARD_AVB_KEY_PATH.
2943BOARD_AVB_SYSTEM_OTHER_KEY_PATH := $(BOARD_AVB_KEY_PATH)
2944BOARD_AVB_SYSTEM_OTHER_ALGORITHM := $(BOARD_AVB_ALGORITHM)
2945endif
2946
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08002947# To extract the public key of SYSTEM_OTHER_KEY_PATH will into system.img:
2948# /system/etc/security/avb/system_other.avbpubkey.
2949FULL_SYSTEMIMAGE_DEPS += $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)
2950
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08002951ifndef BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX
2952BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
2953endif
2954
2955BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX)
2956endif # end of AVB for BUILDING_SYSTEM_OTHER_IMAGE
2957
Tao Bao744c4c72018-08-20 21:09:07 -07002958INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \
David Anderson7709ab22018-10-15 14:41:34 -07002959 $(BOARD_AVB_VBMETA_SYSTEM) \
Tao Bao744c4c72018-08-20 21:09:07 -07002960 $(BOARD_AVB_VBMETA_VENDOR)
2961
2962# Not allowing the same partition to appear in multiple groups.
2963ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
David Anderson7709ab22018-10-15 14:41:34 -07002964 $(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates)
Tao Bao744c4c72018-08-20 21:09:07 -07002965endif
2966
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08002967# Appends security patch level as a AVB property descriptor
2968
2969BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
2970 --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
2971
2972BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
2973 --prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
2974
2975BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS += \
2976 --prop com.android.build.product_services.security_patch:$(PLATFORM_SECURITY_PATCH)
2977
2978# The following vendor- and odm-specific images needs explicitly set per board.
2979ifdef BOOT_SECURITY_PATCH
2980BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
2981 --prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH)
2982endif
2983
2984ifdef VENDOR_SECURITY_PATCH
2985BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
2986 --prop com.android.build.vendor.security_patch:$(VENDOR_SECURITY_PATCH)
2987endif
2988
2989ifdef ODM_SECURITY_PATCH
2990BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
2991 --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH)
2992endif
2993
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002994BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
2995DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
2996SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
2997VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05002998RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002999PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Dario Freni5f681e12018-05-29 13:09:01 +01003000PRODUCT_SERVICES_FOOTER_ARGS := BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003001ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003002
Tao Bao0da43472018-08-22 22:53:41 -07003003# Helper function that checks and sets required build variables for an AVB chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003004# $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system.
Tao Bao0da43472018-08-22 22:53:41 -07003005define _check-and-set-avb-chain-args
3006$(eval part := $(1))
3007$(eval PART=$(call to-upper,$(part)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003008
3009$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
3010$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
3011$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
3012$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
3013$(if $($(_key_path)),,$(error $(_key_path) is not defined))
3014$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
3015$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
3016$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
3017
3018# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
3019$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
3020$(eval $(_signing_args) := \
3021 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
3022
3023$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3024 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
3025
Tao Bao744c4c72018-08-20 21:09:07 -07003026# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up
David Anderson7709ab22018-10-15 14:41:34 -07003027# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX).
Tao Bao744c4c72018-08-20 21:09:07 -07003028$(if $(filter $(part),$(part:vbmeta_%=%)),\
3029 $(eval _footer_args := $(PART)_FOOTER_ARGS) \
3030 $(eval $($(_footer_args)) += --rollback_index $($(_rollback_index))))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003031endef
3032
Tao Bao0da43472018-08-22 22:53:41 -07003033# Checks and sets the required build variables for an AVB partition. The partition will be
3034# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the
Tao Bao744c4c72018-08-20 21:09:07 -07003035# image descriptor will be included into vbmeta.img, unless it has been already added to any chained
3036# VBMeta image.
Tao Bao0da43472018-08-22 22:53:41 -07003037# $(1): Partition name, e.g. boot or system.
3038define check-and-set-avb-args
Tao Bao744c4c72018-08-20 21:09:07 -07003039$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
Tao Bao0da43472018-08-22 22:53:41 -07003040$(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\
Tao Bao744c4c72018-08-20 21:09:07 -07003041 $(if $(_in_chained_vbmeta),\
3042 $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \
Tao Bao0da43472018-08-22 22:53:41 -07003043 $(call _check-and-set-avb-chain-args,$(1)),\
Tao Bao744c4c72018-08-20 21:09:07 -07003044 $(if $(_in_chained_vbmeta),,\
3045 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3046 --include_descriptors_from_image $(call images-for-partitions,$(1)))))
Tao Bao0da43472018-08-22 22:53:41 -07003047endef
3048
Tao Baob1a2e352018-08-14 16:17:12 -07003049ifdef INSTALLED_BOOTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003050$(eval $(call check-and-set-avb-args,boot))
Tao Baob1a2e352018-08-14 16:17:12 -07003051endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003052
Tao Bao0da43472018-08-22 22:53:41 -07003053$(eval $(call check-and-set-avb-args,system))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003054
3055ifdef INSTALLED_VENDORIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003056$(eval $(call check-and-set-avb-args,vendor))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003057endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003058
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003059ifdef INSTALLED_PRODUCTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003060$(eval $(call check-and-set-avb-args,product))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003061endif
3062
Tao Baocee6d042018-08-22 23:39:03 -07003063ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003064$(eval $(call check-and-set-avb-args,product_services))
Tao Baocee6d042018-08-22 23:39:03 -07003065endif
3066
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003067ifdef INSTALLED_ODMIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003068$(eval $(call check-and-set-avb-args,odm))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003069endif
3070
Yueyao Zhu211c9012017-04-27 00:34:50 -07003071ifdef INSTALLED_DTBOIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003072$(eval $(call check-and-set-avb-args,dtbo))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003073endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07003074
David Zeuthen8fecb282017-12-01 16:24:01 -05003075ifdef INSTALLED_RECOVERYIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003076$(eval $(call check-and-set-avb-args,recovery))
David Zeuthen8fecb282017-12-01 16:24:01 -05003077endif
Bowgo Tsai53cf9992017-06-13 11:27:06 +08003078
David Anderson7709ab22018-10-15 14:41:34 -07003079# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet.
3080ifdef BOARD_AVB_VBMETA_SYSTEM
3081$(eval $(call check-and-set-avb-args,vbmeta_system))
Tao Bao744c4c72018-08-20 21:09:07 -07003082endif
3083
3084ifdef BOARD_AVB_VBMETA_VENDOR
3085$(eval $(call check-and-set-avb-args,vbmeta_vendor))
3086endif
3087
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003088# Add kernel cmdline descriptor for kernel to mount system.img as root with
3089# dm-verity. This works when system.img is either chained or not-chained:
3090# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
3091# cmdline descriptor to system.img
3092# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
3093# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08003094ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
David Anderson8916a2a2018-09-18 15:46:59 -07003095ifeq ($(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003096BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08003097endif
David Anderson8916a2a2018-09-18 15:46:59 -07003098endif
Bowgo Tsai9b377602017-04-14 18:50:11 +08003099
Tao Bao0da43472018-08-22 22:53:41 -07003100BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
David Anderson7709ab22018-10-15 14:41:34 -07003101BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += --padding_size 4096
Tao Bao744c4c72018-08-20 21:09:07 -07003102BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += --padding_size 4096
3103
3104ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
Tao Bao240dcb82018-10-22 13:02:53 -07003105# We only need the flag in top-level vbmeta.img.
Tao Bao744c4c72018-08-20 21:09:07 -07003106BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
Tao Bao744c4c72018-08-20 21:09:07 -07003107endif
Tao Bao0da43472018-08-22 22:53:41 -07003108
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003109ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003110BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003111endif
3112
David Anderson7709ab22018-10-15 14:41:34 -07003113ifdef BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX
3114BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += \
3115 --rollback_index $(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX)
Tao Bao744c4c72018-08-20 21:09:07 -07003116endif
3117
3118ifdef BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX
3119BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += \
3120 --rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX)
John Reck0588b432018-05-03 13:20:01 -07003121endif
3122
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003123# $(1): the directory to extract public keys to
3124define extract-avb-chain-public-keys
3125 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
3126 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
3127 --output $(1)/boot.avbpubkey)
3128 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
3129 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
3130 --output $(1)/system.avbpubkey)
3131 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
3132 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
3133 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003134 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
3135 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
3136 --output $(1)/product.avbpubkey)
Dario Freni5f681e12018-05-29 13:09:01 +01003137 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
3138 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH) \
Dario Freni924af7d2018-08-17 00:56:14 +01003139 --output $(1)/product_services.avbpubkey)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003140 $(if $(BOARD_AVB_ODM_KEY_PATH),\
3141 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \
3142 --output $(1)/odm.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003143 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
3144 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
3145 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05003146 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
3147 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
3148 --output $(1)/recovery.avbpubkey)
David Anderson7709ab22018-10-15 14:41:34 -07003149 $(if $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH),\
3150 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3151 --output $(1)/vbmeta_system.avbpubkey)
Tao Bao744c4c72018-08-20 21:09:07 -07003152 $(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\
3153 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3154 --output $(1)/vbmeta_vendor.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003155endef
3156
Tao Bao744c4c72018-08-20 21:09:07 -07003157# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
3158# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level
David Anderson7709ab22018-10-15 14:41:34 -07003159# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM
3160# := system product_services`, `vbmeta_system.img` will be created that includes the descriptors
3161# for `system.img` and `product_services.img`. `vbmeta_system.img` itself will be included into
Tao Bao744c4c72018-08-20 21:09:07 -07003162# `vbmeta.img` as a chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003163# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
Tao Bao744c4c72018-08-20 21:09:07 -07003164# $(2): Output filename.
3165define build-chained-vbmeta-image
3166 $(call pretty,"Target chained vbmeta image: $@")
3167 $(hide) $(AVBTOOL) make_vbmeta_image \
3168 $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
3169 $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
3170 $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
3171 --include_descriptors_from_image $(call images-for-partitions,$(image))) \
3172 --output $@
3173endef
3174
David Anderson7709ab22018-10-15 14:41:34 -07003175ifdef BOARD_AVB_VBMETA_SYSTEM
3176INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img
3177$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003178 $(AVBTOOL) \
3179 $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
3180 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
David Anderson7709ab22018-10-15 14:41:34 -07003181 $(call build-chained-vbmeta-image,vbmeta_system)
Tao Bao744c4c72018-08-20 21:09:07 -07003182endif
3183
3184ifdef BOARD_AVB_VBMETA_VENDOR
3185INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img
3186$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003187 $(AVBTOOL) \
3188 $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
3189 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
Tao Bao744c4c72018-08-20 21:09:07 -07003190 $(call build-chained-vbmeta-image,vbmeta_vendor)
3191endif
3192
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003193define build-vbmetaimage-target
3194 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003195 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
3196 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003197 $(hide) $(AVBTOOL) make_vbmeta_image \
3198 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
Tao Bao0da43472018-08-22 22:53:41 -07003199 $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003200 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
3201 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003202 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003203endef
3204
3205INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
Tao Bao0da43472018-08-22 22:53:41 -07003206$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
3207 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
3208
David Zeuthen8fecb282017-12-01 16:24:01 -05003209$(INSTALLED_VBMETAIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003210 $(AVBTOOL) \
3211 $(INSTALLED_BOOTIMAGE_TARGET) \
3212 $(INSTALLED_SYSTEMIMAGE_TARGET) \
3213 $(INSTALLED_VENDORIMAGE_TARGET) \
3214 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3215 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3216 $(INSTALLED_ODMIMAGE_TARGET) \
3217 $(INSTALLED_DTBOIMAGE_TARGET) \
3218 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3219 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
3220 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
3221 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3222 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3223 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003224 $(build-vbmetaimage-target)
3225
3226.PHONY: vbmetaimage-nodeps
3227vbmetaimage-nodeps:
3228 $(build-vbmetaimage-target)
3229
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003230endif # BOARD_AVB_ENABLE
3231
3232# -----------------------------------------------------------------
Yifan Hong055e6cf2018-11-29 13:51:48 -08003233# Check image sizes <= size of super partition
3234
3235ifeq (,$(TARGET_BUILD_APPS))
3236# Do not check for apps-only build
3237
3238ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003239
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003240# (1): list of items like "system", "vendor", "product", "product_services"
3241# return: map each item into a command ( wrapped in $$() ) that reads the size
3242define read-size-of-partitions
3243$(foreach p,$(1),$(call read-image-prop-dictionary,$($(p)image_intermediates)/generated_$(p)_image_info.txt,$(p)_size))
3244endef
3245
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003246# round result to BOARD_SUPER_PARTITION_ALIGNMENT
3247#$(1): the calculated size
3248ifeq (,$(BOARD_SUPER_PARTITION_ALIGNMENT))
3249define round-partition-size
3250$(1)
3251endef
3252else
3253define round-partition-size
3254$$((($(1)+$(BOARD_SUPER_PARTITION_ALIGNMENT)-1)/$(BOARD_SUPER_PARTITION_ALIGNMENT)*$(BOARD_SUPER_PARTITION_ALIGNMENT)))
3255endef
3256endif
3257
David Anderson619fe2d2018-10-30 18:47:59 -07003258define super-slot-suffix
3259$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
3260endef
David Anderson1ef03e22018-08-30 13:11:47 -07003261
Yifan Hongb43012f2018-10-01 17:30:01 -07003262droid_targets: check-all-partition-sizes
Yifan Hong17dd45d2018-07-20 16:45:57 -07003263
Yifan Hongb43012f2018-10-01 17:30:01 -07003264.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
Yifan Hong17dd45d2018-07-20 16:45:57 -07003265
Yifan Hong17dd45d2018-07-20 16:45:57 -07003266# Add image dependencies so that generated_*_image_info.txt are written before checking.
Yifan Hongb43012f2018-10-01 17:30:01 -07003267check-all-partition-sizes: $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
Yifan Hong17dd45d2018-07-20 16:45:57 -07003268
David Anderson619fe2d2018-10-30 18:47:59 -07003269ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
Yifan Hongf39d8af2018-11-19 14:22:43 -08003270# Check sum(super partition block devices) == super partition
David Anderson619fe2d2018-10-30 18:47:59 -07003271# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
3272define check-super-partition-size
3273 size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
3274 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003275 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003276 if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003277 echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003278 echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
3279 exit 1; \
3280 else \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003281 echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003282 echo $${sum_sizes_expr} '==' $${max_size_expr}; \
3283 fi
3284endef
3285endif
3286
Yifan Hongb43012f2018-10-01 17:30:01 -07003287# $(1): human-readable max size string
3288# $(2): max size expression
3289# $(3): list of partition names
3290define check-sum-of-partition-sizes
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003291 partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
3292 echo $(call round-partition-size,$${i}); \
3293 done)"; \
3294 sum_sizes_expr=$$(tr '\n' '+' <<< "$${partition_size_list}" | sed 's/+$$//'); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003295 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \
3296 echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \
3297 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
3298 exit 1; \
3299 else \
3300 echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
3301 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
Yifan Hongd58e70b2019-01-11 13:20:52 -08003302 fi;
Yifan Hongb43012f2018-10-01 17:30:01 -07003303endef
Yifan Hong17dd45d2018-07-20 16:45:57 -07003304
Yifan Hongb43012f2018-10-01 17:30:01 -07003305define check-all-partition-sizes-target
Yifan Hongf39d8af2018-11-19 14:22:43 -08003306 # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003307 $(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003308 $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
3309 $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
Yifan Hongb43012f2018-10-01 17:30:01 -07003310
3311 # For each group, check sum(partitions in group) <= group size
3312 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
3313 $(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
3314 $(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
3315
Yifan Hongf39d8af2018-11-19 14:22:43 -08003316 # Check sum(all group sizes) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003317 if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
3318 group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
3319 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003320 max_size_tail=$(if $(call super-slot-suffix)," / 2"); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003321 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
3322 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
3323 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3324 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3325 exit 1; \
3326 else \
3327 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3328 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3329 fi \
3330 fi
3331endef
3332
3333check-all-partition-sizes check-all-partition-sizes-nodeps:
3334 $(call check-all-partition-sizes-target)
David Anderson619fe2d2018-10-30 18:47:59 -07003335 $(call check-super-partition-size)
Yifan Hongb43012f2018-10-01 17:30:01 -07003336
Yifan Hong2dae5722018-07-31 12:47:27 -07003337endif # PRODUCT_BUILD_SUPER_PARTITION
Yifan Hong17dd45d2018-07-20 16:45:57 -07003338
3339endif # TARGET_BUILD_APPS
3340
3341# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08003342# bring in the installer image generation defines if necessary
3343ifeq ($(TARGET_USE_DISKINSTALLER),true)
3344include bootable/diskinstaller/config.mk
3345endif
3346
3347# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07003348# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08003349
Ying Wangbd2d0242015-09-22 11:17:52 -07003350ifeq ($(BUILD_OS),darwin)
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003351 build_ota_package := false
3352 build_otatools_package := false
3353else
3354 # set build_ota_package, and allow opt-out below
3355 build_ota_package := true
3356 ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
3357 build_ota_package := false
3358 endif
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003359 ifneq (,$(filter address, $(SANITIZE_TARGET)))
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003360 build_ota_package := false
3361 endif
3362 ifeq ($(TARGET_PRODUCT),sdk)
3363 build_ota_package := false
3364 endif
3365 ifneq ($(filter generic%,$(TARGET_DEVICE)),)
3366 build_ota_package := false
3367 endif
3368 ifeq ($(TARGET_NO_KERNEL),true)
3369 build_ota_package := false
3370 endif
3371 ifeq ($(recovery_fstab),)
3372 build_ota_package := false
3373 endif
3374 ifeq ($(TARGET_BUILD_PDK),true)
3375 build_ota_package := false
3376 endif
3377
3378 # set build_otatools_package, and allow opt-out below
3379 build_otatools_package := true
3380 ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
3381 build_otatools_package := false
3382 endif
Colin Cross481cc5a2016-02-04 15:09:23 -08003383endif
Ying Wangbd2d0242015-09-22 11:17:52 -07003384
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003385ifeq ($(build_otatools_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07003386OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
3387 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08003388 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07003389 $(HOST_OUT_EXECUTABLES)/mkbootfs \
3390 $(HOST_OUT_EXECUTABLES)/mkbootimg \
3391 $(HOST_OUT_EXECUTABLES)/fs_config \
3392 $(HOST_OUT_EXECUTABLES)/zipalign \
3393 $(HOST_OUT_EXECUTABLES)/bsdiff \
3394 $(HOST_OUT_EXECUTABLES)/imgdiff \
Ying Wangc45a47b2015-04-08 12:24:37 -07003395 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
3396 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003397 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08003398 $(HOST_OUT_EXECUTABLES)/mke2fs \
Tianjie Xu57332222018-08-15 16:16:21 -07003399 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs \
Tao Baobcc31092017-01-06 14:24:18 -08003400 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Mark Salyzyn780f5952018-10-19 13:44:36 -07003401 $(HOST_OUT_EXECUTABLES)/tune2fs \
Tao Baocffaf732016-04-14 12:11:36 -07003402 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
3403 $(HOST_OUT_EXECUTABLES)/mksquashfs \
3404 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
3405 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08003406 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07003407 $(HOST_OUT_EXECUTABLES)/simg2img \
3408 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003409 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07003410 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08003411 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07003412 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07003413 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01003414 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003415 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08003416 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
3417 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07003418 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tianjie Xuccbae482018-08-15 14:28:27 -07003419 $(HOST_OUT_EXECUTABLES)/care_map_generator \
David Anderson1ef03e22018-08-30 13:11:47 -07003420 $(LPMAKE) \
Tao Bao3cba3742017-05-16 16:27:25 -07003421 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003422 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07003423 $(BROTLI) \
3424 $(BUILD_VERITY_METADATA) \
3425 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08003426
3427ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
3428OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08003429 $(FUTILITY) \
3430 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08003431endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08003432
Ying Wangc45a47b2015-04-08 12:24:37 -07003433# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07003434OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07003435 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
3436 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
3437 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003438 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003439 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003440 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003441 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
3442 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
3443 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
3444 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08003445 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003446 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
3447 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08003448 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003449 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
3450 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
3451 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003452 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
3453 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00003454 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08003455 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003456 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01003457 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08003458 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01003459 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003460 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
David Anderson1ef03e22018-08-30 13:11:47 -07003461 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) \
3462 $(HOST_LIBRARY_PATH)/liblp$(HOST_SHLIB_SUFFIX) \
Tao Baoa19f8e92019-01-02 23:22:42 -08003463 $(HOST_LIBRARY_PATH)/libext4_utils$(HOST_SHLIB_SUFFIX) \
Tao Baobeea6c02019-01-03 12:18:24 -08003464 $(HOST_LIBRARY_PATH)/libfec$(HOST_SHLIB_SUFFIX) \
3465 $(HOST_LIBRARY_PATH)/libsquashfs_utils$(HOST_SHLIB_SUFFIX)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003466
The Android Open Source Project88b60792009-03-03 19:28:42 -08003467
Ying Wang06898662010-06-17 17:52:18 -07003468.PHONY: otatools
3469otatools: $(OTATOOLS)
3470
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003471BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07003472$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003473
Tao Baoe8ef8f702017-05-17 11:41:50 -07003474OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003475 system/extras/ext4_utils/mke2fs.conf \
Dan Willemsen60c66442018-05-01 19:07:27 -07003476 $(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Tao Bao93ab8442018-10-12 11:03:04 -07003477 -name verity_key))
3478
3479ifneq (,$(wildcard device))
3480OTATOOLS_DEPS += \
Dan Willemsen60c66442018-05-01 19:07:27 -07003481 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
3482 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Bao93ab8442018-10-12 11:03:04 -07003483endif
3484ifneq (,$(wildcard external/avb))
3485OTATOOLS_DEPS += \
3486 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
3487 -name "atx_metadata.bin"))
3488endif
3489ifneq (,$(wildcard system/update_engine))
3490OTATOOLS_DEPS += \
3491 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print))
3492endif
Tao Baoe8ef8f702017-05-17 11:41:50 -07003493
3494OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07003495 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003496
3497ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
3498OTATOOLS_DEPS += \
Tao Bao5232f092018-02-10 04:03:32 +00003499 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003500endif
3501
Colin Cross21122f92018-09-14 21:51:11 -07003502$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) $(SOONG_ZIP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003503 @echo "Package OTA tools: $@"
3504 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07003505 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07003506 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Bill Peckhameabb7132019-02-15 11:25:34 -08003507 $(hide) cp $(SOONG_ZIP) $(zip_root)/bin/
Colin Cross21122f92018-09-14 21:51:11 -07003508 $(hide) cp -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003509 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Colin Cross21122f92018-09-14 21:51:11 -07003510 $(hide) $(SOONG_ZIP) -o $@ -C $(zip_root) -D $(zip_root) \
3511 -C . $(addprefix -f ,$(OTATOOLS_DEPS))
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003512
3513.PHONY: otatools-package
3514otatools-package: $(BUILT_OTATOOLS_PACKAGE)
3515
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003516endif # build_otatools_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003517
The Android Open Source Project88b60792009-03-03 19:28:42 -08003518# -----------------------------------------------------------------
3519# A zip of the directories that map to the target filesystem.
3520# This zip can be used to create an OTA package or filesystem image
3521# as a post-build step.
3522#
3523name := $(TARGET_PRODUCT)
3524ifeq ($(TARGET_BUILD_TYPE),debug)
3525 name := $(name)_debug
3526endif
3527name := $(name)-target_files-$(FILE_NAME_TAG)
3528
3529intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
3530BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
3531$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
3532$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003533 zip_root := $(intermediates)/$(name)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003534
3535# $(1): Directory to copy
3536# $(2): Location to copy it to
3537# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
3538define package_files-copy-root
3539 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
3540 mkdir -p $(2) && \
3541 $(ACP) -rd $(strip $(1))/* $(2); \
3542 fi
3543endef
3544
Tao Baoa04fca32015-11-30 12:22:24 -08003545built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07003546
3547# We can't build static executables when SANITIZE_TARGET=address
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003548ifeq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wange6e544e2015-06-22 18:35:35 -07003549built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07003550 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
3551endif
3552
The Android Open Source Project88b60792009-03-03 19:28:42 -08003553$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
3554
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003555$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003556$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003557
Doug Zongkerc18736b2009-09-30 09:20:32 -07003558ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
3559# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07003560tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07003561else
Dan Willemsen653bea92017-03-21 15:47:37 -07003562tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003563endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003564tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
3565$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
3566$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003567
Sen Jiang4438fd92016-03-07 16:51:01 -08003568ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08003569updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08003570else
Steve Fung48e49f52015-10-01 23:53:31 -07003571# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003572updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07003573endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003574$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07003575
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003576# If we are using recovery as boot, output recovery files to BOOT/.
3577ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
3578$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
3579else
3580$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
3581endif
3582
Dan Willemsen653bea92017-03-21 15:47:37 -07003583ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07003584 ifdef OSRELEASED_DIRECTORY
3585 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
3586 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
3587 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
3588 endif
3589endif
3590
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003591# Run fs_config while creating the target files package
3592# $1: root directory
3593# $2: add prefix
3594define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08003595(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 -08003596endef
3597
Yifan Hong2b891ac2018-11-29 12:06:31 -08003598# $(1): file
3599define dump-dynamic-partitions-info
3600 $(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \
3601 echo "use_dynamic_partitions=true" >> $(1))
3602 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
3603 echo "dynamic_partition_retrofit=true" >> $(1))
Yifan Hong055e6cf2018-11-29 13:51:48 -08003604 echo "lpmake=$(notdir $(LPMAKE))" >> $(1)
3605 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \
3606 echo "build_super_partition=true" >> $(1)))
Tao Bao519d1822018-12-27 12:47:23 -08003607 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \
3608 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08003609 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1)
3610 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3611 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1))
3612 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3613 echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
3614 $(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
3615 echo "dynamic_partition_list=$(BOARD_SUPER_PARTITION_PARTITION_LIST)" >> $(1))
3616 $(if $(BOARD_SUPER_PARTITION_GROUPS),
3617 echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
3618 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
3619 echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
3620 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
3621 echo "super_$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(1);))
3622endef
3623
The Android Open Source Project88b60792009-03-03 19:28:42 -08003624# Depending on the various images guarantees that the underlying
3625# directories are up-to-date.
3626$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003627 $(INSTALLED_RAMDISK_TARGET) \
3628 $(INSTALLED_BOOTIMAGE_TARGET) \
3629 $(INSTALLED_RADIOIMAGE_TARGET) \
3630 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3631 $(FULL_SYSTEMIMAGE_DEPS) \
3632 $(INSTALLED_USERDATAIMAGE_TARGET) \
3633 $(INSTALLED_CACHEIMAGE_TARGET) \
3634 $(INSTALLED_VENDORIMAGE_TARGET) \
3635 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3636 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3637 $(INSTALLED_VBMETAIMAGE_TARGET) \
3638 $(INSTALLED_ODMIMAGE_TARGET) \
3639 $(INSTALLED_DTBOIMAGE_TARGET) \
3640 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
3641 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
3642 $(INSTALLED_KERNEL_TARGET) \
3643 $(INSTALLED_2NDBOOTLOADER_TARGET) \
3644 $(BOARD_PREBUILT_DTBOIMAGE) \
Hridya Valsarajua9418992019-02-04 10:35:25 -08003645 $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003646 $(BOARD_RECOVERY_ACPIO) \
Anton Hansson6d814982018-11-26 18:12:05 +00003647 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
3648 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
3649 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
3650 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3651 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
3652 $(LPMAKE) \
3653 $(SELINUX_FC) \
3654 $(APKCERTS_FILE) \
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003655 $(SOONG_APEX_KEYS_FILE) \
Anton Hansson6d814982018-11-26 18:12:05 +00003656 $(SOONG_ZIP) \
3657 $(HOST_OUT_EXECUTABLES)/fs_config \
3658 $(HOST_OUT_EXECUTABLES)/imgdiff \
3659 $(HOST_OUT_EXECUTABLES)/bsdiff \
3660 $(HOST_OUT_EXECUTABLES)/care_map_generator \
3661 $(BUILD_IMAGE_SRCS) \
3662 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
3663 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
3664 $(BUILT_SYSTEM_MATRIX) \
3665 $(BUILT_VENDOR_MATRIX) \
3666 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003667 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07003668 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003669 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01003670 $(call create-system-product_services-symlink)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003671 $(call create-vendor-odm-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003672 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003673 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003674ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08003675 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003676 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003677 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003678 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003679ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003680 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003681endif
3682ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003683 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003684endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003685ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08003686ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
3687 $(hide) cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
3688else
cfig28687402018-08-22 16:21:41 +08003689 $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003690endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08003691endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003692ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3693 $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
3694endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003695ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
3696 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
3697endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003698ifdef INTERNAL_KERNEL_CMDLINE
3699 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003700endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003701ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003702 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07003703endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003704ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003705 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07003706endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003707endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08003708 @# Components of the boot image
3709 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07003710 $(hide) mkdir -p $(zip_root)/ROOT
3711 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003712 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
Tom Cherry3871f0f2018-11-06 14:23:44 -08003713 @# If we are using recovery as boot, this is already done when processing recovery.
3714ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherryd14b8952018-08-09 14:26:00 -07003715ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003716 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003717 $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07003718endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003719ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003720 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003721endif
3722ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003723 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003724endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003725ifdef INSTALLED_DTBIMAGE_TARGET
3726 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
3727endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003728ifdef INTERNAL_KERNEL_CMDLINE
3729 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003730endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003731ifdef BOARD_KERNEL_BASE
3732 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
3733endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003734ifdef BOARD_KERNEL_PAGESIZE
3735 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
3736endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003737endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07003738 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
3739 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07003740 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
Dan Willemsen67495202019-01-16 12:42:05 -08003741ifdef BUILDING_SYSTEM_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003742 @# Contents of the system image
3743 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003744 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
Dan Willemsen67495202019-01-16 12:42:05 -08003745endif
3746ifdef BUILDING_USERDATA_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003747 @# Contents of the data image
3748 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003749 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Dan Willemsen67495202019-01-16 12:42:05 -08003750endif
3751ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07003752 @# Contents of the vendor image
3753 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003754 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
Ying Wanga0febe52013-03-20 11:02:05 -07003755endif
Dan Willemsen67495202019-01-16 12:42:05 -08003756ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003757 @# Contents of the product image
3758 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003759 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003760endif
Dan Willemsen67495202019-01-16 12:42:05 -08003761ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01003762 @# Contents of the product_services image
Dario Freni5f681e12018-05-29 13:09:01 +01003763 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003764 $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
Dario Freni5f681e12018-05-29 13:09:01 +01003765endif
Dan Willemsen67495202019-01-16 12:42:05 -08003766ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003767 @# Contents of the odm image
3768 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003769 $(TARGET_OUT_ODM),$(zip_root)/ODM)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003770endif
Dan Willemsen67495202019-01-16 12:42:05 -08003771ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07003772 @# Contents of the system_other image
3773 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003774 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
Alex Light4e358ab2016-06-16 14:47:10 -07003775endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003776 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07003777 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07003778 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07003779ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08003780ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07003781 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07003782 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07003783endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08003784endif
Doug Zongker8678df42009-06-15 14:30:14 -07003785 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08003786 @# build them.
3787 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07003788 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003789 $(hide) cp $(SOONG_APEX_KEYS_FILE) $(zip_root)/META/apexkeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003790ifneq ($(tool_extension),)
3791 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
3792endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07003793 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003794 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07003795 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003796 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003797ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07003798 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003799endif
3800ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003801 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003802endif
Tao Baodb45efa2015-10-27 19:25:18 -07003803ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3804 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
3805endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003806ifdef BOARD_INCLUDE_RECOVERY_DTBO
3807 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
3808endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003809ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3810 $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
3811endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003812ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003813 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003814endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07003815ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
3816 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
3817 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3818else
3819 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3820endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003821 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07003822 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07003823ifdef PRODUCT_EXTRA_RECOVERY_KEYS
3824 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08003825endif
Jianxun Zhang09849492013-04-17 15:19:19 -07003826 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00003827 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08003828 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08003829 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Ying Wange24e17a2014-10-07 18:42:11 -07003830ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07003831 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07003832 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07003833endif
Tao Baof54216f2016-03-29 15:12:37 -07003834ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003835 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003836 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH))
3837endif
3838ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003839 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003840 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
3841endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003842ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
3843 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
3844 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
3845endif
Dario Freni5f681e12018-05-29 13:09:01 +01003846ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH),)
3847 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3848 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH))
3849endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003850ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH),)
3851 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
3852 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH))
3853endif
Evgenii Stepanov60beecc2019-01-18 13:53:52 -08003854ifneq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wang2a048392015-06-25 13:56:53 -07003855 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
3856 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
3857endif
Tao Bao8beab692015-07-22 12:33:18 -07003858ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
3859 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
3860endif
David Zeuthen0eb10972016-09-28 17:55:27 -04003861ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003862 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
3863 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3864 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3865 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3866 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3867ifdef BOARD_AVB_BOOT_KEY_PATH
3868 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3869 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3870 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3871endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05003872 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3873ifdef BOARD_AVB_RECOVERY_KEY_PATH
3874 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3875 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3876 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3877endif # BOARD_AVB_RECOVERY_KEY_PATH
David Anderson7709ab22018-10-15 14:41:34 -07003878ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
3879 $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $(zip_root)/META/misc_info.txt
3880 $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3881 $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3882 $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3883 $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3884endif # BOARD_AVB_VBMETA_SYSTEM
Tao Bao744c4c72018-08-20 21:09:07 -07003885ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
3886 $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $(zip_root)/META/misc_info.txt
David Anderson7709ab22018-10-15 14:41:34 -07003887 $(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 -07003888 $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3889 $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3890 $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3891endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003892endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04003893ifdef BOARD_BPT_INPUT_FILES
3894 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
3895 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
3896 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
3897endif
3898ifdef BOARD_BPT_DISK_SIZE
3899 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
3900endif
Ying Wangbd93d422011-10-28 17:02:30 -07003901 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07003902ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Per Astrandcab66992015-03-25 14:06:30 +01003903 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08003904 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07003905endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003906ifeq ($(AB_OTA_UPDATER),true)
3907 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07003908 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07003909 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07003910 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
3911 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08003912 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
3913 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
3914 done
Steve Fung4044b382015-11-05 02:04:04 -08003915 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
3916 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003917 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003918ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07003919 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
3920 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
3921 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003922endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003923endif
Steve Fungdfbab492015-09-24 18:12:33 -07003924ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07003925 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07003926 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
3927endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07003928ifdef BOARD_PREBUILT_VENDORIMAGE
3929 $(hide) mkdir -p $(zip_root)/IMAGES
3930 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
3931endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003932ifdef BOARD_PREBUILT_PRODUCTIMAGE
3933 $(hide) mkdir -p $(zip_root)/IMAGES
3934 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
3935endif
Dario Freni5f681e12018-05-29 13:09:01 +01003936ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
3937 $(hide) mkdir -p $(zip_root)/IMAGES
3938 $(hide) cp $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(zip_root)/IMAGES/
3939endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07003940ifdef BOARD_PREBUILT_BOOTIMAGE
3941 $(hide) mkdir -p $(zip_root)/IMAGES
3942 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
3943endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003944ifdef BOARD_PREBUILT_ODMIMAGE
3945 $(hide) mkdir -p $(zip_root)/IMAGES
3946 $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/
3947endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07003948ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07003949 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
3950 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
3951 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
3952ifeq ($(BOARD_AVB_ENABLE),true)
3953 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003954 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3955ifdef BOARD_AVB_DTBO_KEY_PATH
3956 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3957 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3958 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07003959 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003960endif # BOARD_AVB_DTBO_KEY_PATH
3961endif # BOARD_AVB_ENABLE
3962endif # BOARD_PREBUILT_DTBOIMAGE
Yifan Hong2b891ac2018-11-29 12:06:31 -08003963 $(call dump-dynamic-partitions-info,$(zip_root)/META/misc_info.txt)
Tao Bao95a95c32017-06-16 15:30:23 -07003964 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
3965 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
3966 @# INSTALLED_RADIOIMAGE_TARGET.
3967 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
3968 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003969 @# Run fs_config on all the system, vendor, boot ramdisk,
3970 @# and recovery ramdisk files in the zip, and save the output
Dan Willemsen67495202019-01-16 12:42:05 -08003971ifdef BUILDING_SYSTEM_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003972 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
Dan Willemsen67495202019-01-16 12:42:05 -08003973endif
3974ifdef BUILDING_VENDOR_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003975 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
3976endif
Dan Willemsen67495202019-01-16 12:42:05 -08003977ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003978 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
3979endif
Dan Willemsen67495202019-01-16 12:42:05 -08003980ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01003981 $(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 +01003982endif
Dan Willemsen67495202019-01-16 12:42:05 -08003983ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003984 $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
3985endif
Tom Cherryd14b8952018-08-09 14:26:00 -07003986 @# ROOT always contains the files for the root under normal boot.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003987 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08003988ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherry2929cad2018-09-20 11:04:37 -07003989 @# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003990 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08003991endif
Tom Cherry2929cad2018-09-20 11:04:37 -07003992ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
3993 @# 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 -08003994 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
3995endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003996ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3997 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
3998endif
Dan Willemsen67495202019-01-16 12:42:05 -08003999ifdef BUILDING_SYSTEM_OTHER_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004000 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
4001endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004002 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07004003 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Steven Moreland627debe2018-05-01 09:54:21 -07004004 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
4005ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
4006 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004007endif
Yifan Hongaa212212017-04-14 00:00:46 -07004008ifdef BUILT_VENDOR_MATRIX
4009 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004010endif
Yifan Hong07d3d792018-10-16 15:55:25 -07004011ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
4012 $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
Tao Bao943fa4c2018-12-19 10:39:34 -08004013 @# Remove 'vendor' from the group partition list if the image is not available. This should only
4014 @# happen to AOSP targets built without vendor.img. We can't remove the partition from the
4015 @# BoardConfig file, as it's still needed elsewhere (e.g. when creating super_empty.img).
Yifan Hong07d3d792018-10-16 15:55:25 -07004016 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
Tao Bao943fa4c2018-12-19 10:39:34 -08004017 $(eval _group_partition_list := $(BOARD_$(call to-upper,$(group))_PARTITION_LIST)) \
4018 $(if $(INSTALLED_VENDORIMAGE_TARGET),,$(eval _group_partition_list := $(filter-out vendor,$(_group_partition_list)))) \
Yifan Hong07d3d792018-10-16 15:55:25 -07004019 echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \
Tao Bao943fa4c2018-12-19 10:39:34 -08004020 $(if $(_group_partition_list), \
4021 echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
4022endif # BOARD_SUPER_PARTITION_GROUPS
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004023 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08004024 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08004025 @# Zip everything up, preserving symlinks and placing META/ files first to
4026 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004027 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07004028 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004029 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07004030
Ying Wanga0febe52013-03-20 11:02:05 -07004031.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08004032target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
4033
Ying Wang4709d7c2014-04-14 17:25:43 -07004034ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
4035$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
4036endif
Doug Zongker367910f2009-06-15 18:56:51 -07004037
Dan Albert4d323332016-10-14 13:23:06 -07004038# -----------------------------------------------------------------
4039# NDK Sysroot Package
4040NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07004041$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07004042 @echo Package NDK sysroot...
4043 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
4044
4045$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
4046
Ying Wang09c4b682015-08-11 11:24:19 -07004047ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07004048# -----------------------------------------------------------------
4049# OTA update package
4050
Yifan Hong50e79542018-11-08 17:44:12 -08004051# $(1): output file
4052# $(2): additional args
4053define build-ota-package-target
4054PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
4055 build/make/tools/releasetools/ota_from_target_files -v \
4056 --block \
4057 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
4058 -p $(HOST_OUT) \
4059 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
4060 $(2) \
4061 $(BUILT_TARGET_FILES_PACKAGE) $(1)
4062endef
4063
Doug Zongker8678df42009-06-15 14:30:14 -07004064name := $(TARGET_PRODUCT)
4065ifeq ($(TARGET_BUILD_TYPE),debug)
4066 name := $(name)_debug
4067endif
4068name := $(name)-ota-$(FILE_NAME_TAG)
4069
4070INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4071
4072$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4073
Tao Baoe53c6e72017-04-19 15:54:22 -07004074ifeq ($(AB_OTA_UPDATER),true)
4075$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07004076else
Alex Deymob10e07a2017-11-09 23:53:42 +01004077$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07004078endif
4079
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09004080$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004081 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07004082 @echo "Package OTA: $@"
Yifan Hong50e79542018-11-08 17:44:12 -08004083 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR))
Doug Zongker8678df42009-06-15 14:30:14 -07004084
4085.PHONY: otapackage
4086otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
4087
Tao Bao519d1822018-12-27 12:47:23 -08004088ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true)
Yifan Hong50e79542018-11-08 17:44:12 -08004089name := $(TARGET_PRODUCT)
4090ifeq ($(TARGET_BUILD_TYPE),debug)
4091 name := $(name)_debug
4092endif
4093name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
4094
4095INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4096
4097$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4098
4099ifeq ($(AB_OTA_UPDATER),true)
4100$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
4101else
4102$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BROTLI)
4103endif
4104
4105$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004106 build/make/tools/releasetools/ota_from_target_files
Yifan Hong50e79542018-11-08 17:44:12 -08004107 @echo "Package OTA (retrofit dynamic partitions): $@"
4108 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
4109
4110.PHONY: otardppackage
4111
4112otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
4113
Tao Bao519d1822018-12-27 12:47:23 -08004114endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
Yifan Hong50e79542018-11-08 17:44:12 -08004115
Ying Wang09c4b682015-08-11 11:24:19 -07004116endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07004117
Ying Wang09a00a62010-10-20 14:01:09 -07004118# -----------------------------------------------------------------
4119# The update package
4120
4121name := $(TARGET_PRODUCT)
4122ifeq ($(TARGET_BUILD_TYPE),debug)
4123 name := $(name)_debug
4124endif
4125name := $(name)-img-$(FILE_NAME_TAG)
4126
4127INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4128
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004129$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07004130 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004131 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
4132 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07004133
4134.PHONY: updatepackage
4135updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
4136
The Android Open Source Project88b60792009-03-03 19:28:42 -08004137# -----------------------------------------------------------------
Dario Frenid1011272018-07-23 20:20:15 +01004138# A zip of the appcompat directory containing logs
4139APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip
4140# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
4141ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004142$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004143 $(INSTALLED_RAMDISK_TARGET) \
4144 $(INSTALLED_BOOTIMAGE_TARGET) \
4145 $(INSTALLED_USERDATAIMAGE_TARGET) \
4146 $(INSTALLED_VENDORIMAGE_TARGET) \
4147 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4148 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
Dario Frenid1011272018-07-23 20:20:15 +01004149endif
4150$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
4151$(APPCOMPAT_ZIP): $(SOONG_ZIP)
4152 @echo "appcompat logs: $@"
4153 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4154 $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/appcompat $(dir $(PRIVATE_LIST_FILE))
4155 $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE)
4156 $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE)
4157
4158
4159# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004160# A zip of the symbols directory. Keep the full paths to make it
4161# more obvious where these files came from.
4162#
4163name := $(TARGET_PRODUCT)
4164ifeq ($(TARGET_BUILD_TYPE),debug)
4165 name := $(name)_debug
4166endif
4167name := $(name)-symbols-$(FILE_NAME_TAG)
4168
4169SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004170# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07004171ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004172$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004173 $(INSTALLED_RAMDISK_TARGET) \
4174 $(INSTALLED_BOOTIMAGE_TARGET) \
4175 $(INSTALLED_USERDATAIMAGE_TARGET) \
4176 $(INSTALLED_VENDORIMAGE_TARGET) \
4177 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4178 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4179 $(INSTALLED_ODMIMAGE_TARGET) \
4180 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07004181endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004182$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
4183$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004184 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004185 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4186 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
4187 $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08004188 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004189# -----------------------------------------------------------------
4190# A zip of the coverage directory.
4191#
4192name := $(TARGET_PRODUCT)
4193ifeq ($(TARGET_BUILD_TYPE),debug)
4194name := $(name)_debug
4195endif
4196name := $(name)-coverage-$(FILE_NAME_TAG)
4197COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
4198ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004199$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004200 $(INSTALLED_RAMDISK_TARGET) \
4201 $(INSTALLED_BOOTIMAGE_TARGET) \
4202 $(INSTALLED_USERDATAIMAGE_TARGET) \
4203 $(INSTALLED_VENDORIMAGE_TARGET) \
4204 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4205 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4206 $(INSTALLED_ODMIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004207endif
4208$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
4209$(COVERAGE_ZIP): $(SOONG_ZIP)
4210 @echo "Package coverage: $@"
4211 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4212 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
4213 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
4214 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004215
4216# -----------------------------------------------------------------
4217# A zip of the Android Apps. Not keeping full path so that we don't
4218# include product names when distributing
4219#
4220name := $(TARGET_PRODUCT)
4221ifeq ($(TARGET_BUILD_TYPE),debug)
4222 name := $(name)_debug
4223endif
4224name := $(name)-apps-$(FILE_NAME_TAG)
4225
4226APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Tao Baoe9d61b02018-08-20 21:09:07 -07004227$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004228 @echo "Package apps: $@"
4229 $(hide) rm -rf $@
4230 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004231 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
4232 if [ -z "$$apps_to_zip" ]; then \
Anton Hansson6d814982018-11-26 18:12:05 +00004233 echo "No apps to zip up. Generating empty apps archive." ; \
4234 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004235 else \
Anton Hansson6d814982018-11-26 18:12:05 +00004236 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004237 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07004238
Ying Wangbc415dd2012-08-15 12:22:44 -07004239ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07004240#------------------------------------------------------------------
4241# An archive of classes for use in generating code-coverage reports
4242# These are the uninstrumented versions of any classes that were
4243# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07004244# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004245
Colin Crossa6bc3a82017-09-27 14:28:41 -07004246JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004247$(JACOCO_REPORT_CLASSES_ALL) :
4248 @echo "Collecting uninstrumented classes"
4249 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
Anton Hansson6d814982018-11-26 18:12:05 +00004250 zip -@ -0 -q -X $@
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004251# Meaning of these options:
4252# -@ scan stdin for file paths to add to the zip
4253# -0 don't do any compression
4254# -q supress most output
4255# -X skip storing extended file attributes
4256
Ying Wangbc415dd2012-08-15 12:22:44 -07004257endif # EMMA_INSTRUMENT=true
4258
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004259
Ying Wangae9115a2013-08-22 20:52:47 -07004260#------------------------------------------------------------------
4261# A zip of Proguard obfuscation dictionary files.
4262# Only for apps_only build.
4263#
4264ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07004265PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004266# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07004267$(PROGUARD_DICT_ZIP) :
4268 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07004269 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Anton Hansson6d814982018-11-26 18:12:05 +00004270 if [ -n "$$dict_files" ]; then \
4271 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
4272 zip -qX $@ $$dict_files $$unobfuscated_jars; \
4273 else \
4274 touch $(dir $@)/zipdummy; \
4275 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
4276 zip -qd $@ zipdummy; \
4277 rm $(dir $@)/zipdummy; \
4278 fi
Ying Wangae9115a2013-08-22 20:52:47 -07004279
4280endif # TARGET_BUILD_APPS
4281
The Android Open Source Project88b60792009-03-03 19:28:42 -08004282# -----------------------------------------------------------------
Yifan Hong2b891ac2018-11-29 12:06:31 -08004283# super partition image
4284
4285ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4286
4287# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
4288ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4289
4290ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
4291INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
4292$(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
4293$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
4294 $(call pretty,"Target super fs image: $@")
Tao Bao403a2f92018-12-13 10:45:46 -08004295 PATH=$(dir $(LPMAKE)):$$PATH \
4296 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
Yifan Hong2b891ac2018-11-29 12:06:31 -08004297endif
4298
4299$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
4300
Yifan Hong8b79d162018-11-29 12:32:00 -08004301INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
4302$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty)
4303$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE)
4304 $(call pretty,"Target empty super fs image: $@")
4305 mkdir -p $(intermediates)
4306 rm -rf $(intermediates)/misc_info.txt
4307 $(call dump-dynamic-partitions-info,$(intermediates)/misc_info.txt)
4308ifeq ($(AB_OTA_UPDATER),true)
Tao Bao403a2f92018-12-13 10:45:46 -08004309 echo "ab_update=true" >> $(intermediates)/misc_info.txt
Yifan Hong8b79d162018-11-29 12:32:00 -08004310endif
Tao Bao403a2f92018-12-13 10:45:46 -08004311 PATH=$(dir $(LPMAKE)):$$PATH \
4312 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@
Yifan Hong8b79d162018-11-29 12:32:00 -08004313
4314$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
4315
Yifan Hong2b891ac2018-11-29 12:06:31 -08004316endif # BOARD_SUPER_PARTITION_SIZE != ""
4317endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
4318
4319# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004320# dalvik something
4321.PHONY: dalvikfiles
4322dalvikfiles: $(INTERNAL_DALVIK_MODULES)
4323
Bo Huf0d50bb2017-08-01 19:02:09 +00004324ifeq ($(BUILD_QEMU_IMAGES),true)
Bo Huf0d50bb2017-08-01 19:02:09 +00004325MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
4326SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
Roman Kiryanove64998f2019-02-14 16:45:33 -08004327
4328ifdef INSTALLED_SYSTEMIMAGE_TARGET
4329INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
Tao Baoe9d61b02018-08-20 21:09:07 -07004330$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004331 @echo Create system-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004332 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEMIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004333
4334systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
4335droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
Roman Kiryanove64998f2019-02-14 16:45:33 -08004336endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004337ifdef INSTALLED_VENDORIMAGE_TARGET
Bo Huf0d50bb2017-08-01 19:02:09 +00004338INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004339$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004340 @echo Create vendor-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004341 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004342
4343vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
4344droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
4345endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004346ifdef INSTALLED_PRODUCTIMAGE_TARGET
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004347INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004348$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004349 @echo Create product-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004350 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004351
4352productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
4353droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
4354endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004355ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Dario Freni924af7d2018-08-17 00:56:14 +01004356INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004357$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Dario Freni924af7d2018-08-17 00:56:14 +01004358 @echo Create product_services-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004359 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET))
Dario Freni5f681e12018-05-29 13:09:01 +01004360
4361productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4362droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4363endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004364ifdef INSTALLED_ODMIMAGE_TARGET
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004365INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
4366$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
4367 @echo Create odm-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004368 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004369
4370odmimage: $(INSTALLED_QEMU_ODMIMAGE)
4371droidcore: $(INSTALLED_QEMU_ODMIMAGE)
4372endif
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004373
4374ifeq ($(BOARD_AVB_ENABLE),true)
4375QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
4376MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_verified_boot_params.sh
4377$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_QEMU_SYSTEMIMAGE) $(MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) $(SGDISK_HOST) $(AVBTOOL)
4378 @echo Creating $@
Matt Wachowski40afa812018-09-27 12:49:18 -07004379 (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 -07004380
4381
4382systemimage: $(QEMU_VERIFIED_BOOT_PARAMS)
4383droidcore: $(QEMU_VERIFIED_BOOT_PARAMS)
4384endif
Bo Huf0d50bb2017-08-01 19:02:09 +00004385endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004386# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004387# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07004388ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004389INTERNAL_EMULATOR_PACKAGE_FILES += \
4390 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08004391 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004392 $(INSTALLED_RAMDISK_TARGET) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004393 $(INSTALLED_SYSTEMIMAGE_TARGET) \
4394 $(INSTALLED_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004395
4396name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
4397
4398INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4399
Ying Wang5d887702015-11-04 10:06:25 -08004400$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004401 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07004402 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004403
Ying Wang7d8c5352012-07-26 10:15:21 -07004404endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004405# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08004406# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08004407# The pdk package (Platform Development Kit)
4408
Keun young Park7fc7aad2012-02-27 15:49:23 -08004409#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
4410# include development/pdk/Pdk.mk
4411#endif
4412
The Android Open Source Project88b60792009-03-03 19:28:42 -08004413
4414# -----------------------------------------------------------------
4415# The SDK
4416
The Android Open Source Project88b60792009-03-03 19:28:42 -08004417# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07004418sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004419
4420# Build a name that looks like:
4421#
4422# linux-x86 --> android-sdk_12345_linux-x86
4423# darwin-x86 --> android-sdk_12345_mac-x86
4424# windows-x86 --> android-sdk_12345_windows
4425#
4426sdk_name := android-sdk_$(FILE_NAME_TAG)
4427ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07004428 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08004429else
Joe Onorato03fbe402009-04-13 08:31:16 -07004430 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004431endif
4432ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07004433 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004434endif
Joe Onorato03fbe402009-04-13 08:31:16 -07004435sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004436
4437sdk_dep_file := $(sdk_dir)/sdk_deps.mk
4438
4439ATREE_FILES :=
4440-include $(sdk_dep_file)
4441
4442# if we don't have a real list, then use "everything"
4443ifeq ($(strip $(ATREE_FILES)),)
4444ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004445 $(ALL_DEFAULT_INSTALLED_MODULES) \
4446 $(INSTALLED_RAMDISK_TARGET) \
4447 $(ALL_DOCS) \
Nan Zhangcb0a6882018-08-07 15:26:32 -07004448 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api-stubs-docs_annotations.zip \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004449 $(ALL_SDK_FILES)
4450endif
4451
4452atree_dir := development/build
4453
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01004454
The Android Open Source Project88b60792009-03-03 19:28:42 -08004455sdk_atree_files := \
4456 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07004457 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08004458
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02004459# development/build/sdk-android-<abi>.atree is used to differentiate
4460# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
4461# files like the kernel image. We use TARGET_CPU_ABI because we don't
4462# have a better way to distinguish between CPU models.
4463ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
4464 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
4465endif
4466
Griff Hazen433febb2014-02-28 08:45:59 -08004467ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES),)
4468sdk_atree_files += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES)
4469else
4470sdk_atree_files += $(atree_dir)/sdk.atree
4471endif
4472
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004473include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004474
The Android Open Source Project88b60792009-03-03 19:28:42 -08004475deps := \
4476 $(target_notice_file_txt) \
4477 $(tools_notice_file_txt) \
4478 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07004479 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07004480 $(COVERAGE_ZIP) \
Dario Frenid1011272018-07-23 20:20:15 +01004481 $(APPCOMPAT_ZIP) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004482 $(INSTALLED_SYSTEMIMAGE_TARGET) \
Bo Huf0d50bb2017-08-01 19:02:09 +00004483 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07004484 $(INSTALLED_QEMU_VENDORIMAGE) \
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004485 $(QEMU_VERIFIED_BOOT_PARAMS) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07004486 $(INSTALLED_USERDATAIMAGE_TARGET) \
4487 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004488 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07004489 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004490 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08004491 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004492 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004493 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004494 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004495
4496INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
4497$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
4498$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
4499$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
4500$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
4501
4502# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
4503#
4504#SDK_GNU_ERROR := true
4505
Ying Wang5d887702015-11-04 10:06:25 -08004506$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004507 @echo "Package SDK: $@"
4508 $(hide) rm -rf $(PRIVATE_DIR) $@
4509 $(hide) for f in $(target_gnu_MODULES); do \
4510 if [ -f $$f ]; then \
4511 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
4512 including GNU target $$f >&2; \
4513 FAIL=$(SDK_GNU_ERROR); \
4514 fi; \
4515 done; \
4516 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07004517 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08004518 $(hide) ( \
Anton Hansson6d814982018-11-26 18:12:05 +00004519 ATREE_STRIP="$(HOST_STRIP) -x" \
4520 $(HOST_OUT_EXECUTABLES)/atree \
4521 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
4522 -m $(PRIVATE_DEP_FILE) \
4523 -I . \
4524 -I $(PRODUCT_OUT) \
4525 -I $(HOST_OUT) \
4526 -I $(TARGET_COMMON_OUT_ROOT) \
4527 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
4528 -v "OUT_DIR=$(OUT_DIR)" \
4529 -v "HOST_OUT=$(HOST_OUT)" \
4530 -v "TARGET_ARCH=$(TARGET_ARCH)" \
4531 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
4532 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
4533 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
4534 -o $(PRIVATE_DIR) && \
4535 cp -f $(target_notice_file_txt) \
4536 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
4537 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
4538 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
4539 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
4540 chmod -R ug+rwX $(PRIVATE_DIR) && \
4541 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004542 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
4543
Raphael3d224a02010-04-16 17:50:09 -07004544
4545# Is a Windows SDK requested? If so, we need some definitions from here
4546# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08004547MAIN_SDK_NAME := $(sdk_name)
4548MAIN_SDK_DIR := $(sdk_dir)
4549MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08004550ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07004551include $(TOPDIR)development/build/tools/windows_sdk.mk
4552endif
4553
The Android Open Source Project88b60792009-03-03 19:28:42 -08004554# -----------------------------------------------------------------
4555# Findbugs
4556INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
4557INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
4558$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
4559 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004560 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004561 > $@
4562$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
4563 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004564 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07004565 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08004566
4567# -----------------------------------------------------------------
4568# Findbugs
4569
4570# -----------------------------------------------------------------
4571# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07004572ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004573include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01004574-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07004575-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004576-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07004577# Also the project-specific tasks
4578-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
4579-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004580-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07004581# Also add test specifc tasks
4582include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07004583include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07004584endif
Raphaelc4d47312011-02-15 16:09:36 -08004585
Ying Wang67132ba2015-10-28 16:42:39 -07004586include $(BUILD_SYSTEM)/product-graph.mk
4587
Raphaelc4d47312011-02-15 16:09:36 -08004588# -----------------------------------------------------------------
4589# Create SDK repository packages. Must be done after tasks/* since
4590# we need the addon rules defined.
4591ifneq ($(sdk_repo_goal),)
4592include $(TOPDIR)development/build/tools/sdk_repo.mk
4593endif
Jayant Chowdhary67e0cc52018-02-23 16:50:39 -08004594
4595#------------------------------------------------------------------
4596# Find lsdump paths
4597FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
4598$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
Yi-yo Chiangac0d49f2018-07-25 13:34:28 +08004599 $(hide) rm -rf $@ && echo "$^" | sed -e 's/ /\n/g' > $@