blob: eba764d6fc84e6d708a7de3322a4829df4a6c602 [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 \
Yifan Hong5e57a772020-01-09 16:15:11 -080019 Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!))) \
20$(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \
21 $(if $(filter $(TARGET_COPY_OUT_SYSTEM)/etc/vintf/% \
22 $(TARGET_COPY_OUT_SYSTEM)/manifest.xml \
23 $(TARGET_COPY_OUT_SYSTEM)/compatibility_matrix.xml,$(2)), \
24 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), use vintf_fragments instead!)) \
25 $(if $(filter $(TARGET_COPY_OUT_PRODUCT)/etc/vintf/%,$(2)), \
26 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
27 use PRODUCT_MANIFEST_FILES / DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
28 $(if $(filter $(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/%,$(2)), \
29 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
30 use vintf_compatibility_matrix / vintf_fragments instead!)) \
31 $(if $(filter $(TARGET_COPY_OUT_VENDOR)/etc/vintf/% \
32 $(TARGET_COPY_OUT_VENDOR)/manifest.xml \
33 $(TARGET_COPY_OUT_VENDOR)/compatibility_matrix.xml,$(2)), \
34 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
35 use DEVICE_MANIFEST_FILE / DEVICE_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \
36 $(if $(filter $(TARGET_COPY_OUT_ODM)/etc/vintf/% \
37 $(TARGET_COPY_OUT_ODM)/etc/manifest%,$(2)), \
38 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \
39 use ODM_MANIFEST_FILES / vintf_fragments instead!)) \
40)
Ying Wang68864102011-09-29 13:23:25 -070041endef
Yo Chiang0b49c032020-03-17 17:49:49 +080042
Yo Chiang0b49c032020-03-17 17:49:49 +080043check_elf_prebuilt_product_copy_files := true
Yo Chiang73d31482020-04-07 15:59:59 +080044ifneq (,$(filter true,$(BUILD_BROKEN_ELF_PREBUILT_PRODUCT_COPY_FILES)))
45check_elf_prebuilt_product_copy_files :=
Yo Chiang0b49c032020-03-17 17:49:49 +080046endif
47check_elf_prebuilt_product_copy_files_hint := \
48 found ELF prebuilt in PRODUCT_COPY_FILES, use cc_prebuilt_binary / cc_prebuilt_library_shared instead.
49
Ying Wang619fccf2012-09-05 18:08:29 -070050# filter out the duplicate <source file>:<dest file> pairs.
51unique_product_copy_files_pairs :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080052$(foreach cf,$(PRODUCT_COPY_FILES), \
Ying Wang619fccf2012-09-05 18:08:29 -070053 $(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\
54 $(eval unique_product_copy_files_pairs += $(cf))))
55unique_product_copy_files_destinations :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080056product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070057$(foreach cf,$(unique_product_copy_files_pairs), \
Ying Wang462d26b2010-11-02 21:31:47 -070058 $(eval _src := $(call word-colon,1,$(cf))) \
59 $(eval _dest := $(call word-colon,2,$(cf))) \
Dan Willemsen7d957c92018-04-30 16:01:33 -070060 $(call check-product-copy-files,$(cf),$(_dest)) \
Ying Wang193010c2011-12-16 11:54:25 -080061 $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
Dan Willemsen403b98a2017-11-15 11:13:23 -080062 $(eval product_copy_files_ignored += $(cf)), \
Ying Wang462d26b2010-11-02 21:31:47 -070063 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
Ying Wang3ceecfa2012-05-14 14:39:00 -070064 $(if $(filter %.xml,$(_dest)),\
65 $(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
Nicolas Geoffraya95fbd12017-09-19 13:10:31 +010066 $(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\
67 $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
Tom Cherryfc977642018-06-13 14:51:05 -070068 $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
69 $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
Yo Chiang0b49c032020-03-17 17:49:49 +080070 $(if $(and $(filter true,$(check_elf_prebuilt_product_copy_files)), \
71 $(filter bin lib lib64,$(subst /,$(space),$(_dest)))), \
72 $(eval $(call copy-non-elf-file-checked,$(_src),$(_fulldest),$(check_elf_prebuilt_product_copy_files_hint))), \
73 $(eval $(call copy-one-file,$(_src),$(_fulldest))))))) \
Ying Wang7e8d4422011-06-17 17:05:35 -070074 $(eval unique_product_copy_files_destinations += $(_dest))))
Dan Willemsen403b98a2017-11-15 11:13:23 -080075
76# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
Dan Willemsen7537fd02018-10-16 23:15:08 -070077pcf_ignored_file := $(PRODUCT_OUT)/product_copy_files_ignored.txt
78$(pcf_ignored_file): PRIVATE_IGNORED := $(sort $(product_copy_files_ignored))
79$(pcf_ignored_file):
80 echo "$(PRIVATE_IGNORED)" | tr " " "\n" >$@
Dan Willemsen403b98a2017-11-15 11:13:23 -080081
Dan Willemsen7537fd02018-10-16 23:15:08 -070082$(call dist-for-goals,droidcore,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file)))
83
84pcf_ignored_file :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080085product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070086unique_product_copy_files_pairs :=
Ying Wang7e8d4422011-06-17 17:05:35 -070087unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080088
89# -----------------------------------------------------------------
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +080090# Returns the max allowed size for an image suitable for hash verification
91# (e.g., boot.img, recovery.img, etc).
92# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL).
93# $(1): partition size to flash the image
94define get-hash-image-max-size
95$(if $(1), \
96 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
97 $(eval _hash_meta_size := 69632), \
98 $(eval _hash_meta_size := 0)) \
99 $(1)-$(_hash_meta_size))
100endef
101
102# -----------------------------------------------------------------
Dan Willemsen6f60f022016-02-23 13:40:07 -0800103# Define rules to copy headers defined in copy_headers.mk
104# If more than one makefile declared a header, print a warning,
105# then copy the last one defined. This matches the previous make
106# behavior.
Dan Willemsen7f9bd562018-08-15 14:28:01 -0700107has_dup_copy_headers :=
Dan Willemsen6f60f022016-02-23 13:40:07 -0800108$(foreach dest,$(ALL_COPIED_HEADERS), \
109 $(eval _srcs := $(ALL_COPIED_HEADERS.$(dest).SRC)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -0800110 $(eval _src := $(lastword $(_srcs))) \
Dan Willemsen6f60f022016-02-23 13:40:07 -0800111 $(if $(call streq,$(_src),$(_srcs)),, \
112 $(warning Duplicate header copy: $(dest)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -0800113 $(warning _ Using $(_src)) \
114 $(warning __ from $(lastword $(ALL_COPIED_HEADERS.$(dest).MAKEFILE))) \
115 $(eval _makefiles := $$(wordlist 1,$(call int_subtract,$(words $(ALL_COPIED_HEADERS.$(dest).MAKEFILE)),1),$$(ALL_COPIED_HEADERS.$$(dest).MAKEFILE))) \
116 $(foreach src,$(wordlist 1,$(call int_subtract,$(words $(_srcs)),1),$(_srcs)), \
117 $(warning _ Ignoring $(src)) \
118 $(warning __ from $(firstword $(_makefiles))) \
119 $(eval _makefiles := $$(wordlist 2,9999,$$(_makefiles)))) \
120 $(eval has_dup_copy_headers := true)) \
Dan Willemsen6f60f022016-02-23 13:40:07 -0800121 $(eval $(call copy-one-header,$(_src),$(dest))))
122all_copied_headers: $(ALL_COPIED_HEADERS)
123
Dan Willemsen7f9bd562018-08-15 14:28:01 -0700124ifdef has_dup_copy_headers
125 has_dup_copy_headers :=
Dan Willemsen1d4a56f2019-04-18 09:38:25 -0700126 $(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)
Dan Willemsen7f9bd562018-08-15 14:28:01 -0700127endif
128
Dan Willemsen79a0caf2019-12-13 18:55:18 -0800129$(file >$(PRODUCT_OUT)/.copied_headers_list,$(TARGET_OUT_HEADERS) $(ALL_COPIED_HEADERS))
130
Dan Willemsen6f60f022016-02-23 13:40:07 -0800131# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800132# docs/index.html
Martin Stjernholm7a430fd2020-06-04 15:16:39 +0100133ifeq (,$(TARGET_BUILD_UNBUNDLED))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800134gen := $(OUT_DOCS)/index.html
135ALL_DOCS += $(gen)
136$(gen): frameworks/base/docs/docs-redirect-index.html
137 @mkdir -p $(dir $@)
138 @cp -f $< $@
Ying Wang3f45b3c2012-04-02 18:21:36 -0700139endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800140
Dan Albert303e6032017-10-04 10:20:20 -0700141ndk_doxygen_out := $(OUT_NDK_DOCS)
142ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include
143ndk_docs_src_dir := frameworks/native/docs
144ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile
145ifneq ($(wildcard $(ndk_docs_src_dir)),)
146ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\
147 $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.))
148$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp
149 @mkdir -p $(ndk_doxygen_out)
150 @echo "Generating NDK docs to $(ndk_doxygen_out)"
151 @( cat $(ndk_doxyfile); \
152 echo "INPUT=$(ndk_headers)"; \
153 echo "HTML_OUTPUT=$(ndk_doxygen_out)" \
154 ) | doxygen -
155
156# Note: Not a part of the docs target because we don't have doxygen available.
157# You can run this target locally if you have doxygen installed.
158ndk-docs: $(ndk_doxygen_out)/index.html
159.PHONY: ndk-docs
160endif
161
Colin Crossd60401a2019-04-18 14:46:48 -0700162$(call dist-for-goals,sdk,$(API_FINGERPRINT))
Dan Willemsenad6a1542018-12-14 01:04:19 -0800163
Andres Moralesb8876e12015-05-06 20:44:22 -0700164INSTALLED_RECOVERYIMAGE_TARGET :=
Chris Grossa784ef12019-04-22 11:09:57 -0700165ifdef BUILDING_RECOVERY_IMAGE
166ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
167INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
168endif
Andres Moralesb8876e12015-05-06 20:44:22 -0700169endif
170
Jiyong Parke1346862020-05-18 14:31:30 +0900171include $(BUILD_SYSTEM)/sysprop.mk
Dario Freni5f681e12018-05-29 13:09:01 +0100172
173# ----------------------------------------------------------------
174
175# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800176# sdk-build.prop
177#
178# There are certain things in build.prop that we don't want to
179# ship with the sdk; remove them.
180
181# This must be a list of entire property keys followed by
182# "=" characters, without any internal spaces.
183sdk_build_prop_remove := \
184 ro.build.user= \
185 ro.build.host= \
186 ro.product.brand= \
187 ro.product.manufacturer= \
188 ro.product.device=
189# TODO: Remove this soon-to-be obsolete property
190sdk_build_prop_remove += ro.build.product=
191INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
192$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
193 @echo SDK buildinfo: $@
194 @mkdir -p $(dir $@)
195 $(hide) grep -v "$(subst $(space),\|,$(strip \
Anton Hansson6d814982018-11-26 18:12:05 +0000196 $(sdk_build_prop_remove)))" $< > $@.tmp
The Android Open Source Project88b60792009-03-03 19:28:42 -0800197 $(hide) for x in $(sdk_build_prop_remove); do \
Anton Hansson6d814982018-11-26 18:12:05 +0000198 echo "$$x"generic >> $@.tmp; done
The Android Open Source Project88b60792009-03-03 19:28:42 -0800199 $(hide) mv $@.tmp $@
200
201# -----------------------------------------------------------------
Colin Cross4f60e362019-06-05 11:53:43 -0700202# kernel modules
203
204# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
205DEPMOD_STAGING_SUBDIR :=$= lib/modules/0.0
206
J. Avilaa2ceec62020-05-12 23:40:02 +0000207define copy-and-strip-kernel-module
208$(2): $(1)
J. Avilaf7586022020-06-19 20:42:17 +0000209 $(LLVM_STRIP) -o $(2) --strip-debug $(1)
J. Avilaa2ceec62020-05-12 23:40:02 +0000210endef
211
Colin Cross4f60e362019-06-05 11:53:43 -0700212# $(1): modules list
213# $(2): output dir
214# $(3): mount point
215# $(4): staging dir
Steve Muckle474e4d02019-06-19 12:56:48 -0700216# $(5): module load list
217# $(6): module load list filename
Steve Muckle810a0ba2019-11-13 13:29:02 -0800218# $(7): module archive
J. Avilaa2ceec62020-05-12 23:40:02 +0000219# $(8): staging dir for stripped modules
Steve Muckle2335d762020-05-28 18:39:38 -0700220# $(9): module directory name
Colin Cross4f60e362019-06-05 11:53:43 -0700221# Returns the a list of src:dest pairs to install the modules using copy-many-files.
222define build-image-kernel-modules
Steve Muckle950d7232020-06-05 11:31:22 -0700223 $(if $(9), \
224 $(eval _dir := $(9)/), \
225 $(eval _dir :=)) \
J. Avilaa2ceec62020-05-12 23:40:02 +0000226 $(foreach module,$(1), \
227 $(eval _src := $(module)) \
228 $(if $(8), \
229 $(eval _src := $(8)/$(notdir $(module))) \
230 $(eval $(call copy-and-strip-kernel-module,$(module),$(_src)))) \
Steve Muckle950d7232020-06-05 11:31:22 -0700231 $(_src):$(2)/lib/modules/$(_dir)$(notdir $(module))) \
Steve Muckle2335d762020-05-28 18:39:38 -0700232 $(eval $(call build-image-kernel-modules-depmod,$(1),$(3),$(4),$(5),$(6),$(7),$(2),$(9))) \
Steve Muckle950d7232020-06-05 11:31:22 -0700233 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep:$(2)/lib/modules/$(_dir)modules.dep \
234 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.alias:$(2)/lib/modules/$(_dir)modules.alias \
235 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep:$(2)/lib/modules/$(_dir)modules.softdep \
236 $(4)/$(DEPMOD_STAGING_SUBDIR)/$(6):$(2)/lib/modules/$(_dir)$(6)
Colin Cross4f60e362019-06-05 11:53:43 -0700237endef
238
239# $(1): modules list
Steve Muckle474e4d02019-06-19 12:56:48 -0700240# $(2): mount point
241# $(3): staging dir
242# $(4): module load list
243# $(5): module load list filename
Steve Muckle810a0ba2019-11-13 13:29:02 -0800244# $(6): module archive
245# $(7): output dir
Steve Muckle2335d762020-05-28 18:39:38 -0700246# $(8): module directory name
Steve Muckle810a0ba2019-11-13 13:29:02 -0800247# TODO(b/144844424): If a module archive is being used, this step (which
248# generates obj/PACKAGING/.../modules.dep) also unzips the module archive into
249# the output directory. This should be moved to a module with a
250# LOCAL_POST_INSTALL_CMD so that if modules.dep is removed from the output dir,
251# the archive modules are restored along with modules.dep.
Colin Cross4f60e362019-06-05 11:53:43 -0700252define build-image-kernel-modules-depmod
Steve Muckle0f7bb1b2019-07-11 17:42:13 -0700253$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: .KATI_IMPLICIT_OUTPUTS := $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.alias $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
Steve Muckle474e4d02019-06-19 12:56:48 -0700254$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(DEPMOD)
255$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULES := $(1)
256$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MOUNT_POINT := $(2)
Steve Muckle2335d762020-05-28 18:39:38 -0700257$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_DIR := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules/$(8)
Steve Muckle474e4d02019-06-19 12:56:48 -0700258$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_STAGING_DIR := $(3)
259$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_MODULES := $(4)
260$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_FILE := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
Steve Muckle810a0ba2019-11-13 13:29:02 -0800261$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_ARCHIVE := $(6)
262$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_OUTPUT_DIR := $(7)
263$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1) $(6)
Colin Cross4f60e362019-06-05 11:53:43 -0700264 @echo depmod $$(PRIVATE_STAGING_DIR)
265 rm -rf $$(PRIVATE_STAGING_DIR)
Steve Muckle474e4d02019-06-19 12:56:48 -0700266 mkdir -p $$(PRIVATE_MODULE_DIR)
Steve Muckle810a0ba2019-11-13 13:29:02 -0800267 $(if $(6),\
Colin Crossc27d7952020-07-11 22:33:30 -0700268 unzip -qoDD -d $$(PRIVATE_MODULE_DIR) $$(PRIVATE_MODULE_ARCHIVE); \
Steve Muckle810a0ba2019-11-13 13:29:02 -0800269 mkdir -p $$(PRIVATE_OUTPUT_DIR)/lib; \
Steve Muckle2335d762020-05-28 18:39:38 -0700270 cp -r $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules $$(PRIVATE_OUTPUT_DIR)/lib/; \
Steve Muckle810a0ba2019-11-13 13:29:02 -0800271 find $$(PRIVATE_MODULE_DIR) -type f -name *.ko | xargs basename -a > $$(PRIVATE_LOAD_FILE); \
272 )
273 $(if $(1),\
274 cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/; \
275 for MODULE in $$(PRIVATE_LOAD_MODULES); do \
276 basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); \
277 done; \
278 )
Colin Cross4f60e362019-06-05 11:53:43 -0700279 $(DEPMOD) -b $$(PRIVATE_STAGING_DIR) 0.0
280 # Turn paths in modules.dep into absolute paths
Steve Muckle474e4d02019-06-19 12:56:48 -0700281 sed -i.tmp -e 's|\([^: ]*lib/modules/[^: ]*\)|/\1|g' $$(PRIVATE_STAGING_DIR)/$$(DEPMOD_STAGING_SUBDIR)/modules.dep
282 touch $$(PRIVATE_LOAD_FILE)
Colin Cross4f60e362019-06-05 11:53:43 -0700283endef
284
Steve Muckle474e4d02019-06-19 12:56:48 -0700285# $(1): staging dir
Mark Salyzyn4e209652020-05-15 09:10:29 -0700286# $(2): modules list
287# $(3): module load list
288# $(4): module load list filename
289# $(5): output dir
Steve Muckle474e4d02019-06-19 12:56:48 -0700290define module-load-list-copy-paths
Mark Salyzyn4e209652020-05-15 09:10:29 -0700291 $(eval $(call build-image-module-load-list,$(1),$(2),$(3),$(4))) \
292 $(1)/$(DEPMOD_STAGING_SUBDIR)/$(4):$(5)/lib/modules/$(4)
Steve Muckle474e4d02019-06-19 12:56:48 -0700293endef
294
295# $(1): staging dir
Mark Salyzyn4e209652020-05-15 09:10:29 -0700296# $(2): modules list
297# $(3): module load list
298# $(4): module load list filename
Steve Muckle474e4d02019-06-19 12:56:48 -0700299define build-image-module-load-list
Mark Salyzyn4e209652020-05-15 09:10:29 -0700300$(1)/$(DEPMOD_STAGING_SUBDIR)/$(4): PRIVATE_LOAD_MODULES := $(3)
301$(1)/$(DEPMOD_STAGING_SUBDIR)/$(4): $(2)
302 @echo load-list $$(@)
303 @echo '$$(strip $$(notdir $$(PRIVATE_LOAD_MODULES)))' | tr ' ' '\n' > $$(@)
Steve Muckle474e4d02019-06-19 12:56:48 -0700304endef
305
Steve Muckle2335d762020-05-28 18:39:38 -0700306# $(1): image name
307# $(2): build output directory (TARGET_OUT_VENDOR, TARGET_RECOVERY_ROOT_OUT, etc)
308# $(3): mount point
309# $(4): module load filename
310# $(5): stripped staging directory
311# $(6): kernel module directory name (top is an out of band value for no directory)
312define build-image-kernel-modules-dir
313$(if $(filter top,$(6)),\
314 $(eval _kver :=)$(eval _sep :=),\
315 $(eval _kver := $(6))$(eval _sep :=_))\
316$(if $(5),\
317 $(eval _stripped_staging_dir := $(5)$(_sep)$(_kver)),\
318 $(eval _stripped_staging_dir :=))\
319$(if $(strip $(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver))$(BOARD_$(1)_KERNEL_MODULES_ARCHIVE$(_sep)$(_kver))),\
320 $(if $(BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver)),,\
321 $(eval BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver) := $(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver)))) \
322 $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver)),$(2),$(3),$(call intermediates-dir-for,PACKAGING,depmod_$(1)$(_sep)$(_kver)),$(BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver)),$(4),$(BOARD_$(1)_KERNEL_MODULES_ARCHIVE$(_sep)$(_kver)),$(_stripped_staging_dir),$(_kver))))
323endef
324
325# $(1): kernel module directory name (top is an out of band value for no directory)
326define build-recovery-as-boot-load
327$(if $(filter top,$(1)),\
328 $(eval _kver :=)$(eval _sep :=),\
329 $(eval _kver := $(1))$(eval _sep :=_))\
330 $(if $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD$(_sep)$(_kver)),\
331 $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,ramdisk_module_list$(_sep)$(_kver)),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES$(_sep)$(_kver)),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD$(_sep)$(_kver)),modules.load,$(TARGET_RECOVERY_ROOT_OUT))))
332endef
333
334# $(1): kernel module directory name (top is an out of band value for no directory)
335define build-vendor-ramdisk-recovery-load
336$(if $(filter top,$(1)),\
337 $(eval _kver :=)$(eval _sep :=),\
338 $(eval _kver := $(1))$(eval _sep :=_))\
339 $(if $(BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD$(_sep)$(_kver)),\
340 $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,vendor_ramdisk_recovery_module_list$(_sep)$(_kver)),$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES$(_sep)$(_kver)),$(BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD$(_sep)$(_kver)),modules.load.recovery,$(TARGET_VENDOR_RAMDISK_OUT))))
341endef
342
Mark Salyzyn46a9c022020-06-25 04:35:16 -0700343# $(1): kernel module directory name (top is an out of band value for no directory)
344define build-vendor-charger-load
345$(if $(filter top,$(1)),\
346 $(eval _kver :=)$(eval _sep :=),\
347 $(eval _kver := $(1))$(eval _sep :=_))\
348 $(if $(BOARD_VENDOR_CHARGER_KERNEL_MODULES_LOAD$(_sep)$(_kver)),\
349 $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,vendor_charger_module_list$(_sep)$(_kver)),$(BOARD_VENDOR_CHARGER_KERNEL_MODULES$(_sep)$(_kver)),$(BOARD_VENDOR_CHARGER_KERNEL_MODULES_LOAD$(_sep)$(_kver)),modules.load.charger,$(TARGET_OUT_VENDOR))))
350endef
351
Steve Mucklee1b10862019-07-10 10:49:37 -0700352ifneq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
353 # If there is no vendor boot partition, store vendor ramdisk kernel modules in the
354 # boot ramdisk.
Steve Muckle69280d22019-07-11 12:23:38 -0700355 BOARD_GENERIC_RAMDISK_KERNEL_MODULES += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES)
Steve Muckle69280d22019-07-11 12:23:38 -0700356 BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD)
357endif
Steve Muckle474e4d02019-06-19 12:56:48 -0700358
Steve Muckle69280d22019-07-11 12:23:38 -0700359ifeq ($(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),)
360 BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD := $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)
Steve Muckle474e4d02019-06-19 12:56:48 -0700361endif
362
Steve Mucklee1b10862019-07-10 10:49:37 -0700363ifneq ($(strip $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)),)
Steve Muckle474e4d02019-06-19 12:56:48 -0700364 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
Steve Muckle69280d22019-07-11 12:23:38 -0700365 BOARD_RECOVERY_KERNEL_MODULES += $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)
Steve Muckle474e4d02019-06-19 12:56:48 -0700366 endif
367endif
368
J. Avilaa2ceec62020-05-12 23:40:02 +0000369ifneq ($(BOARD_DO_NOT_STRIP_VENDOR_MODULES),true)
370 VENDOR_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_vendor_stripped)
371else
372 VENDOR_STRIPPED_MODULE_STAGING_DIR :=
373endif
Colin Cross4f60e362019-06-05 11:53:43 -0700374
Pierre Couillaudd99da8f2020-06-02 13:13:32 -0700375ifneq ($(BOARD_DO_NOT_STRIP_VENDOR_RAMDISK_MODULES),true)
376 VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_vendor_ramdisk_stripped)
377else
378 VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR :=
379endif
380
Steve Muckle2335d762020-05-28 18:39:38 -0700381BOARD_KERNEL_MODULE_DIRS += top
382$(foreach dir,$(BOARD_KERNEL_MODULE_DIRS), \
383 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,RECOVERY,$(TARGET_RECOVERY_ROOT_OUT),,modules.load.recovery,,$(dir))) \
Pierre Couillaudd99da8f2020-06-02 13:13:32 -0700384 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR_RAMDISK,$(TARGET_VENDOR_RAMDISK_OUT),,modules.load,$(VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR),$(dir))) \
Steve Muckle2335d762020-05-28 18:39:38 -0700385 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-ramdisk-recovery-load,$(dir))) \
Yifan Honge51dff22020-06-23 17:26:57 -0700386 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR,$(if $(filter true,$(BOARD_USES_VENDOR_DLKMIMAGE)),$(TARGET_OUT_VENDOR_DLKM),$(TARGET_OUT_VENDOR)),vendor,modules.load,$(VENDOR_STRIPPED_MODULE_STAGING_DIR),$(dir))) \
Mark Salyzyn46a9c022020-06-25 04:35:16 -0700387 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-charger-load,$(dir))) \
Steve Muckle2335d762020-05-28 18:39:38 -0700388 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(TARGET_OUT_ODM),odm,modules.load,,$(dir))) \
389 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
390 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-recovery-as-boot-load,$(dir))),\
391 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,GENERIC_RAMDISK,$(TARGET_RAMDISK_OUT),,modules.load,,$(dir)))))
Colin Cross4f60e362019-06-05 11:53:43 -0700392
393# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800394# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700395# Use a macro to add newline to each echo command
Jiyong Park7b96c592020-05-01 10:29:09 +0900396# $1 stem name of the package
Bill Peckham19c3feb2020-03-20 18:31:43 -0700397# $2 certificate
398# $3 private key
399# $4 compressed
400# $5 partition tag
401# $6 output file
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100402define _apkcerts_write_line
Bill Peckham19c3feb2020-03-20 18:31:43 -0700403$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $6
404$(if $(4), $(hide) echo -n ' compressed="$4"' >> $6)
405$(if $(5), $(hide) echo -n ' partition="$5"' >> $6)
406$(hide) echo '' >> $6
Ying Wangd9a88d52012-10-26 09:21:28 -0700407
408endef
409
Jaewoong Jung704b4542020-06-29 19:37:53 -0700410# -----------------------------------------------------------------
411# Merge an individual apkcerts output into the final apkcerts.txt output.
412# Use a macro to make it compatible with _apkcerts_write_line
413# $1 apkcerts file to be merged
414# $2 output file
415define _apkcerts_merge
416$(hide) cat $1 >> $2
417
418endef
419
The Android Open Source Project88b60792009-03-03 19:28:42 -0800420name := $(TARGET_PRODUCT)
421ifeq ($(TARGET_BUILD_TYPE),debug)
422 name := $(name)_debug
423endif
424name := $(name)-apkcerts-$(FILE_NAME_TAG)
425intermediates := \
426 $(call intermediates-dir-for,PACKAGING,apkcerts)
427APKCERTS_FILE := $(intermediates)/$(name).txt
Jaewoong Jung704b4542020-06-29 19:37:53 -0700428all_apkcerts_files := $(sort $(foreach p,$(PACKAGES),$(PACKAGES.$(p).APKCERTS_FILE)))
429$(APKCERTS_FILE): $(all_apkcerts_files)
Ying Wang15e487a2011-02-15 10:56:18 -0800430# We don't need to really build all the modules.
431# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700432$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800433 @echo APK certs list: $@
434 @mkdir -p $(dir $@)
435 @rm -f $@
Chris Grossfabf50a2019-05-02 12:42:09 -0700436 $(foreach p,$(sort $(PACKAGES)),\
Jaewoong Jung704b4542020-06-29 19:37:53 -0700437 $(if $(PACKAGES.$(p).APKCERTS_FILE),\
438 $(call _apkcerts_merge,$(PACKAGES.$(p).APKCERTS_FILE), $@),\
439 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
440 $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@),\
441 $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@))))
Ying Wangd9a88d52012-10-26 09:21:28 -0700442 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700443 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800444
445.PHONY: apkcerts-list
446apkcerts-list: $(APKCERTS_FILE)
447
Ying Wang15e487a2011-02-15 10:56:18 -0800448ifneq (,$(TARGET_BUILD_APPS))
449 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900450 $(call dist-for-goals, apps_only, $(SOONG_APEX_KEYS_FILE):apexkeys.txt)
Ying Wang15e487a2011-02-15 10:56:18 -0800451endif
Ying Wangefb21682010-07-23 16:42:13 -0700452
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900453
The Android Open Source Project88b60792009-03-03 19:28:42 -0800454# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700455# build system stats
456BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
457$(BUILD_SYSTEM_STATS):
458 @rm -f $@
459 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
460 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
461$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700462
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700463# -----------------------------------------------------------------
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800464# build /product/etc/security/avb/system_other.avbpubkey if needed
465ifdef BUILDING_SYSTEM_OTHER_IMAGE
Bowgo Tsai8802b712019-03-21 14:24:31 +0800466ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800467INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET := $(TARGET_OUT_PRODUCT_ETC)/security/avb/system_other.avbpubkey
468ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET)
Bowgo Tsai8802b712019-03-21 14:24:31 +0800469endif # BOARD_AVB_ENABLE
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800470endif # BUILDING_SYSTEM_OTHER_IMAGE
471
472# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700473# Modules ready to be converted to Soong, ordered by how many
474# modules depend on them.
475SOONG_CONV := $(sort $(SOONG_CONV))
476SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
477$(SOONG_CONV_DATA):
478 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800479 @$(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 -0700480
Colin Crossfdea8932017-12-06 14:38:40 -0800481SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700482SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
483$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
484 @rm -f $@
485 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
486$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
487
488# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800489# Modules use -Wno-error, or added default -Wall -Werror
490WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
491$(WALL_WERROR):
492 @rm -f $@
493 echo "# Modules using -Wno-error" >> $@
494 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 -0800495 echo "# Modules added default -Wall" >> $@
496 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
497
498$(call dist-for-goals,droidcore,$(WALL_WERROR))
499
500# -----------------------------------------------------------------
Jesse Paid0046922019-09-13 17:02:32 -0700501# C/C++ flag information for modules
502$(call dist-for-goals,droidcore,$(SOONG_MODULES_CFLAG_ARTIFACTS))
503
504# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800505# Modules missing profile files
506PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
507$(PGO_PROFILE_MISSING):
508 @rm -f $@
509 echo "# Modules missing PGO profile files" >> $@
510 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
511
512$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
513
514# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700515# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700516# for future OTA packages installed by this system. Actual product
517# deliverables will be re-signed by hand. We expect this file to
518# exist with the suffixes ".x509.pem" and ".pk8".
Colin Cross21122f92018-09-14 21:51:11 -0700519DEFAULT_KEY_CERT_PAIR := $(strip $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
Doug Zongker8678df42009-06-15 14:30:14 -0700520
521
Jeff Browne33ba4c2011-07-11 22:11:46 -0700522# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800523# if they don't do anything.
524.PHONY: systemimage
525systemimage:
526
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800527# -----------------------------------------------------------------
528
529.PHONY: event-log-tags
530
Joe Onoratob7510532010-07-14 10:22:54 -0700531# Produce an event logs tag file for everything we know about, in order
532# to properly allocate numbers. Then produce a file that's filtered
533# for what's going to be installed.
534
535all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
536
Colin Crossdc8f8e42012-04-12 13:25:54 -0700537event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
538
Joe Onoratob7510532010-07-14 10:22:54 -0700539# Include tags from all packages that we know about
540all_event_log_tags_src := \
541 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
542
Colin Crossdc8f8e42012-04-12 13:25:54 -0700543# PDK builds will already have a full list of tags that needs to get merged
544# in with the ones from source
545pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
546
547$(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 -0800548$(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 -0700549 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900550 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700551
Doug Zongkera34fa952011-02-23 12:17:29 -0800552# Include tags from all packages included in this product, plus all
553# tags that are part of the system (ie, not in a vendor/ or device/
554# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800555event_log_tags_src := \
556 $(sort $(foreach m,\
Yo Chiang5e85bfe2020-05-13 20:19:05 +0800557 $(call resolve-bitness-for-modules,TARGET,$(PRODUCT_PACKAGES)) \
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800558 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800559 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
560 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800561
Colin Crossdc8f8e42012-04-12 13:25:54 -0700562$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700563$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800564$(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 -0800565 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900566 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800567
568event-log-tags: $(event_log_tags_file)
569
570ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
571
Joe Onoratob7510532010-07-14 10:22:54 -0700572
The Android Open Source Project88b60792009-03-03 19:28:42 -0800573# #################################################################
574# Targets for boot/OS images
575# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800576ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
577 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
578 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
579 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
580 else
581 INSTALLED_2NDBOOTLOADER_TARGET :=
582 endif
583else
584 INSTALLED_BOOTLOADER_MODULE :=
585 INSTALLED_2NDBOOTLOADER_TARGET :=
586endif # TARGET_NO_BOOTLOADER
587ifneq ($(strip $(TARGET_NO_KERNEL)),true)
Steve Muckleb3dda772020-03-11 16:03:07 -0700588 ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
589 INSTALLED_KERNEL_TARGET := $(foreach k,$(BOARD_KERNEL_BINARIES), \
590 $(PRODUCT_OUT)/$(k))
591 else
592 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
593 endif
Ying Wangc6349742014-01-13 16:14:20 -0800594else
595 INSTALLED_KERNEL_TARGET :=
596endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800597
598# -----------------------------------------------------------------
Tom Cherryd14b8952018-08-09 14:26:00 -0700599# the root dir
600INTERNAL_ROOT_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800601 $(ALL_GENERATED_SOURCES) \
602 $(ALL_DEFAULT_INSTALLED_MODULES))
603
Luis Hector Chavezff489932018-07-03 15:41:40 -0700604INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
605INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
606$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -0700607$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700608 @echo Installed file list: $@
609 @mkdir -p $(dir $@)
610 @rm -f $@
611 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -0700612 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Luis Hector Chavezff489932018-07-03 15:41:40 -0700613
614$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
615
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800616#------------------------------------------------------------------
617# dtb
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700618ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800619INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700620ifdef BOARD_PREBUILT_DTBIMAGE_DIR
Hridya Valsarajuc63a7442019-02-07 11:38:18 -0800621$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb))
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800622 cat $^ > $@
623endif
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700624endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800625
Tom Cherryd14b8952018-08-09 14:26:00 -0700626# -----------------------------------------------------------------
627# the ramdisk
Dan Willemsen67495202019-01-16 12:42:05 -0800628ifdef BUILDING_RAMDISK_IMAGE
Tom Cherryd14b8952018-08-09 14:26:00 -0700629INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \
630 $(ALL_GENERATED_SOURCES) \
631 $(ALL_DEFAULT_INSTALLED_MODULES))
632
633INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt
634INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json)
635$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -0700636$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Tom Cherryd14b8952018-08-09 14:26:00 -0700637 @echo Installed file list: $@
SzuWei Lin29770fa2019-03-28 11:46:48 +0800638 @mkdir -p $(TARGET_RAMDISK_OUT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700639 @mkdir -p $(dir $@)
640 @rm -f $@
641 $(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -0700642 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Tom Cherryd14b8952018-08-09 14:26:00 -0700643
644$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
Joe Onorato64d85d02009-04-09 19:31:12 -0700645BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
646
J. Avila3f6560e2020-05-11 20:20:03 +0000647ifeq ($(BOARD_RAMDISK_USE_LZ4),true)
648# -l enables the legacy format used by the Linux kernel
649COMPRESSION_COMMAND_DEPS := $(LZ4)
650COMPRESSION_COMMAND := $(LZ4) -l -12 --favor-decSpeed
651RAMDISK_EXT := .lz4
652else
653COMPRESSION_COMMAND_DEPS := $(MINIGZIP)
654COMPRESSION_COMMAND := $(MINIGZIP)
655RAMDISK_EXT := .gz
656endif
657
Joe Onorato64d85d02009-04-09 19:31:12 -0700658# We just build this directly to the install location.
659INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
J. Avila3f6560e2020-05-11 20:20:03 +0000660$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(COMPRESSION_COMMAND_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800661 $(call pretty,"Target ram disk: $@")
J. Avila3f6560e2020-05-11 20:20:03 +0000662 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800663
Ying Wangad7fd292013-08-08 16:34:29 -0700664.PHONY: ramdisk-nodeps
J. Avila3f6560e2020-05-11 20:20:03 +0000665ramdisk-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
Ying Wangad7fd292013-08-08 16:34:29 -0700666 @echo "make $@: ignoring dependencies"
J. Avila3f6560e2020-05-11 20:20:03 +0000667 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800668
Dan Willemsen67495202019-01-16 12:42:05 -0800669endif # BUILDING_RAMDISK_IMAGE
670
The Android Open Source Project88b60792009-03-03 19:28:42 -0800671# -----------------------------------------------------------------
672# the boot image, which is a collection of other images.
Chris Grossa784ef12019-04-22 11:09:57 -0700673
674# This is defined here since we may be building recovery as boot
675# below and only want to define this once
Steve Muckleb3dda772020-03-11 16:03:07 -0700676ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
677 BUILT_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot,$(BOARD_KERNEL_BINARIES)), $(PRODUCT_OUT)/$(k).img)
678else
679 BUILT_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
680endif
681
Steve Muckle903a1ca2020-05-07 17:32:10 -0700682ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
683 BOARD_KERNEL_BOOTIMAGE_PARTITION_SIZE := $(BOARD_BOOTIMAGE_PARTITION_SIZE)
684endif
685
686# $1: boot image file name
687# $2: boot image variant (boot, boot-debug)
688define get-bootimage-partition-size
689 $(BOARD_$(call to-upper,$(subst .img,,$(subst $(2),kernel,$(notdir $(1)))))_BOOTIMAGE_PARTITION_SIZE)
690endef
Chris Grossa784ef12019-04-22 11:09:57 -0700691
692ifneq ($(strip $(TARGET_NO_KERNEL)),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800693INTERNAL_BOOTIMAGE_ARGS := \
694 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700695 --kernel $(INSTALLED_KERNEL_TARGET)
696
697ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
698INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
699endif
700
Steve Mucklee1b10862019-07-10 10:49:37 -0700701ifndef BUILDING_VENDOR_BOOT_IMAGE
702ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
703 INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
704endif
705endif
706
The Android Open Source Project88b60792009-03-03 19:28:42 -0800707INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
708
Anton Hansson8dab0a62019-03-28 15:45:40 +0000709ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700710ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Anton Hansson8dab0a62019-03-28 15:45:40 +0000711VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700712 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
713endif
714endif
715
Anton Hansson72e36f02019-02-26 17:36:30 +0000716INTERNAL_KERNEL_CMDLINE := $(strip $(INTERNAL_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
Steve Mucklee1b10862019-07-10 10:49:37 -0700717
718ifndef BUILDING_VENDOR_BOOT_IMAGE
719ifdef BOARD_KERNEL_BASE
720 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
721endif
722ifdef BOARD_KERNEL_PAGESIZE
723 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
724endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700725ifdef INTERNAL_KERNEL_CMDLINE
Steve Mucklee1b10862019-07-10 10:49:37 -0700726 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
727endif
728else
729# building vendor boot image, dtb/base/pagesize go there
730ifdef GENERIC_KERNEL_CMDLINE
731 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)"
732endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700733endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700734
Sami Tolvanen3303d902016-03-15 16:49:30 +0000735INTERNAL_MKBOOTIMG_VERSION_ARGS := \
736 --os_version $(PLATFORM_VERSION) \
737 --os_patch_level $(PLATFORM_SECURITY_PATCH)
738
Chris Grossa784ef12019-04-22 11:09:57 -0700739# Define these only if we are building boot
740ifdef BUILDING_BOOT_IMAGE
741INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
742
The Android Open Source Project88b60792009-03-03 19:28:42 -0800743ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800744$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400745
746else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
747
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800748$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400749 $(call pretty,"Target boot image: $@")
750 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800751 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400752 $(hide) $(AVBTOOL) add_hash_footer \
753 --image $@ \
754 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800755 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400756 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
757
758.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800759bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400760 @echo "make $@: ignoring dependencies"
761 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800762 $(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 -0400763 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800764 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400765 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800766 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400767 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
768
Anton Hansson8dab0a62019-03-28 15:45:40 +0000769else ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700770
771$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
772 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000773 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Anton Hansson8dab0a62019-03-28 15:45:40 +0000774 $(BOOT_SIGNER) /boot $@ $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $@
Geremy Condra740b6632014-07-08 20:07:41 -0700775 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
776
777.PHONY: bootimage-nodeps
778bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
779 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000780 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Anton Hansson8dab0a62019-03-28 15:45:40 +0000781 $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET)
Geremy Condra740b6632014-07-08 20:07:41 -0700782 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
783
Anton Hansson8dab0a62019-03-28 15:45:40 +0000784else ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -0800785
Tao Bao4b577412017-02-22 22:54:39 -0800786$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800787 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000788 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Anton Hansson8dab0a62019-03-28 15:45:40 +0000789 $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
David Riley17be3d32015-03-03 08:54:11 -0800790 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
791
792.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -0800793bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800794 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000795 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Anton Hansson8dab0a62019-03-28 15:45:40 +0000796 $(VBOOT_SIGNER) $(FUTILITY) $(INSTALLED_BOOTIMAGE_TARGET).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(INSTALLED_BOOTIMAGE_TARGET).keyblock $(INSTALLED_BOOTIMAGE_TARGET)
David Riley17be3d32015-03-03 08:54:11 -0800797 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
798
799else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800800
801$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
802 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000803 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700804 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700805
806.PHONY: bootimage-nodeps
807bootimage-nodeps: $(MKBOOTIMG)
808 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000809 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700810 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700811
The Android Open Source Project88b60792009-03-03 19:28:42 -0800812endif # TARGET_BOOTIMAGE_USE_EXT2
Chris Grossa784ef12019-04-22 11:09:57 -0700813endif # BUILDING_BOOT_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -0800814
Tao Baob1a2e352018-08-14 16:17:12 -0700815else # TARGET_NO_KERNEL == "true"
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700816ifdef BOARD_PREBUILT_BOOTIMAGE
817ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
818# Remove when b/63676296 is resolved.
819$(error Prebuilt bootimage is only supported for AB targets)
820endif
Kiyoung Kim62e22312019-06-20 14:27:45 +0900821INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700822$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
Tao Baob1a2e352018-08-14 16:17:12 -0700823else # BOARD_PREBUILT_BOOTIMAGE not defined
Tao Baob1a2e352018-08-14 16:17:12 -0700824INSTALLED_BOOTIMAGE_TARGET :=
825endif # BOARD_PREBUILT_BOOTIMAGE
826endif # TARGET_NO_KERNEL
The Android Open Source Project88b60792009-03-03 19:28:42 -0800827
828# -----------------------------------------------------------------
Steve Mucklee1b10862019-07-10 10:49:37 -0700829# vendor boot image
830ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
831
832ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
833 $(error vboot 1.0 does not support vendor_boot partition)
834endif
835
836INTERNAL_VENDOR_RAMDISK_FILES := $(filter $(TARGET_VENDOR_RAMDISK_OUT)/%, \
837 $(ALL_GENERATED_SOURCES) \
838 $(ALL_DEFAULT_INSTALLED_MODULES))
839
Steve Muckle414dbe12020-06-18 21:38:35 -0700840INTERNAL_VENDOR_RAMDISK_TARGET := $(call intermediates-dir-for,PACKAGING,vendor-boot)/vendor-ramdisk.cpio$(RAMDISK_EXT)
J. Avila3f6560e2020-05-11 20:20:03 +0000841$(INTERNAL_VENDOR_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_VENDOR_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
842 $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_VENDOR_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $@
Steve Mucklee1b10862019-07-10 10:49:37 -0700843
844ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
845 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
846endif
847ifdef BOARD_KERNEL_BASE
848 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
849endif
850ifdef BOARD_KERNEL_PAGESIZE
851 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
852endif
853ifdef INTERNAL_KERNEL_CMDLINE
854 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --vendor_cmdline "$(INTERNAL_KERNEL_CMDLINE)"
855endif
856
857INSTALLED_VENDOR_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot.img
858$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_DTBIMAGE_TARGET)
859ifeq ($(BOARD_AVB_ENABLE),true)
860$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOTIMAGE_KEY_PATH)
861 $(call pretty,"Target vendor_boot image: $@")
cfig125efba2020-05-11 15:00:35 +0800862 $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@
Steve Mucklee1b10862019-07-10 10:49:37 -0700863 $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
864 $(AVBTOOL) add_hash_footer \
865 --image $@ \
866 --partition_size $(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE) \
867 --partition_name vendor_boot $(INTERNAL_AVB_VENDOR_BOOT_SIGNING_ARGS) \
868 $(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS)
869else
870$(INSTALLED_VENDOR_BOOTIMAGE_TARGET):
871 $(call pretty,"Target vendor_boot image: $@")
cfig125efba2020-05-11 15:00:35 +0800872 $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@
Steve Mucklee1b10862019-07-10 10:49:37 -0700873 $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
874endif
875endif # BUILDING_VENDOR_BOOT_IMAGE
876
877# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800878# NOTICE files
879#
Steve Blockd14d3b42012-03-01 11:34:41 +0000880# We are required to publish the licenses for all code under BSD, GPL and
881# Apache licenses (and possibly other more exotic ones as well). We err on the
882# side of caution, so the licenses for other third-party code are included here
883# too.
884#
The Android Open Source Project88b60792009-03-03 19:28:42 -0800885# This needs to be before the systemimage rules, because it adds to
886# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
887# go into the systemimage.
888
Steve Block495e5852012-02-29 19:18:08 +0000889.PHONY: notice_files
890
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900891# Create the rule to combine the files into text and html/xml forms
Yifan Hong3d3f0302020-05-11 18:35:11 -0700892# $(1) - xml_excluded_system_product_odm_vendor_dlkm|
893# xml_excluded_vendor_product_odm_vendor_dlkm|
894# xml_product|xml_odm|xml_system_ext|xml_system|xml_vendor_dlkm|html
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900895# $(2) - Plain text output file
896# $(3) - HTML/XML output file
897# $(4) - File title
Jaewoong Junge6f57e02019-06-16 21:48:42 -0700898# $(5) - Directory to use. Notice files are all $(5)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -0800899# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900900# $(6) - Dependencies for the output files
Bob Badour4b25c902020-01-28 13:23:39 -0800901# $(7) - Directories to exclude
The Android Open Source Project88b60792009-03-03 19:28:42 -0800902#
903# The algorithm here is that we go collect a hash for each of the notice
904# files and write the names of the files that match that hash. Then
905# to generate the real files, we go print out all of the files and their
906# hashes.
907#
908# These rules are fairly complex, so they depend on this makefile so if
909# it changes, they'll run again.
910#
911# TODO: We could clean this up so that we just record the locations of the
912# original notice files instead of making rules to copy them somwehere.
913# Then we could traverse that without quite as much bash drama.
914define combine-notice-files
Dan Willemsenf4cbafa2020-04-28 15:57:32 -0700915$(2): PRIVATE_MESSAGE := $(4)
916$(2): PRIVATE_DIR := $(5)
917$(2): .KATI_IMPLICIT_OUTPUTS := $(3)
918$(2): $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
Bob Badour4b25c902020-01-28 13:23:39 -0800919 build/make/tools/generate-notice-files.py --text-output $(2) $(foreach xdir, $(7), -e $(xdir) )\
Yifan Hong3d3f0302020-05-11 18:35:11 -0700920 $(if $(filter $(1),xml_excluded_vendor_product_odm_vendor_dlkm),-e vendor -e product -e system_ext -e odm -e vendor_dlkm --xml-output, \
921 $(if $(filter $(1),xml_excluded_system_product_odm_vendor_dlkm),-e system -e product -e system_ext -e odm -e vendor_dlkm --xml-output, \
Anton Hansson6d814982018-11-26 18:12:05 +0000922 $(if $(filter $(1),xml_product),-i product --xml-output, \
Justin Yun6151e3f2019-06-25 15:58:13 +0900923 $(if $(filter $(1),xml_system_ext),-i system_ext --xml-output, \
Chris Grossaad39b32019-06-13 09:43:26 -0700924 $(if $(filter $(1),xml_system),-i system --xml-output, \
925 $(if $(filter $(1),xml_odm),-i odm --xml-output, \
Yifan Hong3d3f0302020-05-11 18:35:11 -0700926 $(if $(filter $(1),xml_vendor_dlkm),-i vendor_dlkm --xml-output, \
927 --html-output))))))) $(3) \
Anton Hansson6d814982018-11-26 18:12:05 +0000928 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900929notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800930endef
931
Anton Hanssonbfbaa982018-11-12 23:29:13 +0000932# Notice file logic isn't relevant for TARGET_BUILD_APPS
933ifndef TARGET_BUILD_APPS
934
The Android Open Source Project88b60792009-03-03 19:28:42 -0800935# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
936# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
937# the src subdirectory.
Steve Block495e5852012-02-29 19:18:08 +0000938target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Steve Block495e5852012-02-29 19:18:08 +0000939tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -0800940tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
Anton Hanssonbfbaa982018-11-12 23:29:13 +0000941kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
942winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
943pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800944
Bob Badour4b25c902020-01-28 13:23:39 -0800945# Some targets get included under $(PRODUCT_OUT) for debug symbols or other
946# reasons--not to be flashed onto any device. Targets under these directories
947# need no associated notice file on the device UI.
948exclude_target_dirs := apex
949
Steven Morelandae69e572017-12-15 14:49:55 -0800950# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
Anton Hanssonbfbaa982018-11-12 23:29:13 +0000951ifneq ($(PRODUCT_NOTICE_SPLIT),true)
952target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
953target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
954installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
955$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +0000956 $(target_notice_file_txt), \
957 $(target_notice_file_html), \
958 "Notices for files contained in the filesystem images in this directory:", \
959 $(TARGET_OUT_NOTICE_FILES), \
Bob Badour4b25c902020-01-28 13:23:39 -0800960 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files), \
961 $(exclude_target_dirs)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +0000962$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
963 $(hide) $(MINIGZIP) -9 < $< > $@
964$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
965 $(copy-file-to-target)
966else
967target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
968target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900969installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
970
971target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
972target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
973target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
974installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
Dario Freniadc972d2018-07-09 18:38:38 +0100975
976target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
977target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
978target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
979installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
Dario Frenicbca1132018-08-28 18:04:03 +0100980
Justin Yun6151e3f2019-06-25 15:58:13 +0900981target_system_ext_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.txt
982target_system_ext_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.xml
983target_system_ext_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.xml.gz
984installed_system_ext_notice_xml_gz := $(TARGET_OUT_SYSTEM_EXT)/etc/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900985
Chris Gross15d96552019-07-16 14:38:43 -0700986target_odm_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.txt
987target_odm_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml
988target_odm_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml.gz
989installed_odm_notice_xml_gz := $(TARGET_OUT_ODM)/etc/NOTICE.xml.gz
990
Yifan Hong3d3f0302020-05-11 18:35:11 -0700991target_vendor_dlkm_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR_DLKM.txt
992target_vendor_dlkm_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR_DLKM.xml
993target_vendor_dlkm_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR_DLKM.xml.gz
994installed_vendor_dlkm_notice_xml_gz := $(TARGET_OUT_VENDOR_DLKM)/etc/NOTICE.xml.gz
995
Anton Hansson6ad6f6c2018-11-12 23:33:47 +0000996# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
997# being built. A notice xml file must depend on all modules that could potentially
998# install a license file relevant to it.
999license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
Bob Badour4b25c902020-01-28 13:23:39 -08001000# Only files copied to a system image need system image notices.
1001license_modules := $(filter $(PRODUCT_OUT)/%,$(license_modules))
Anton Hansson6ad6f6c2018-11-12 23:33:47 +00001002# Phonys/fakes don't have notice files (though their deps might)
1003license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
Jooyung Han4416b002019-05-29 18:28:22 +09001004# testcases are not relevant to the system image.
1005license_modules := $(filter-out $(TARGET_OUT_TESTCASES)/%,$(license_modules))
Yifan Hong3d3f0302020-05-11 18:35:11 -07001006# filesystem images: system, vendor, product, system_ext, odm, and vendor_dlkm
Chris Grossaad39b32019-06-13 09:43:26 -07001007license_modules_system := $(filter $(TARGET_OUT)/%,$(license_modules))
Anton Hansson6ad6f6c2018-11-12 23:33:47 +00001008license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
1009license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
Justin Yun6151e3f2019-06-25 15:58:13 +09001010license_modules_system_ext := $(filter $(TARGET_OUT_SYSTEM_EXT)/%,$(license_modules))
Chris Gross15d96552019-07-16 14:38:43 -07001011license_modules_odm := $(filter $(TARGET_OUT_ODM)/%,$(license_modules))
Yifan Hong3d3f0302020-05-11 18:35:11 -07001012license_modules_vendor_dlkm := $(filter $(TARGET_OUT_VENDOR_DLKM)/%,$(license_modules))
Chris Grossaad39b32019-06-13 09:43:26 -07001013license_modules_agg := $(license_modules_system) \
1014 $(license_modules_vendor) \
Chris Gross15d96552019-07-16 14:38:43 -07001015 $(license_modules_product) \
1016 $(license_modules_system_ext) \
Yifan Hong3d3f0302020-05-11 18:35:11 -07001017 $(license_modules_odm) \
1018 $(license_modules_vendor_dlkm)
Bob Badour4b25c902020-01-28 13:23:39 -08001019# targets used for debug symbols only and do not get copied to the device
1020license_modules_symbols_only := $(filter $(PRODUCT_OUT)/apex/%,$(license_modules))
1021
Chris Grosse5d4a9e2019-07-30 15:46:35 -07001022license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
Bob Badour4b25c902020-01-28 13:23:39 -08001023license_modules_rest := $(filter-out $(license_modules_symbols_only),$(license_modules_rest))
1024
1025# Identify the other targets we expect to have notices for:
1026# targets copied to the device but are not readable by the UI (e.g. must boot
1027# into a different partition to read or don't have an associated /etc
1028# directory) must have their notices built somewhere readable.
1029license_modules_rehomed := $(filter-out $(PRODUCT_OUT)/%/%,$(license_modules_rest)) # files in root have no /etc
1030license_modules_rehomed += $(filter $(PRODUCT_OUT)/recovery/%,$(license_modules_rest))
1031license_modules_rehomed += $(filter $(PRODUCT_OUT)/root/%,$(license_modules_rest))
1032license_modules_rehomed += $(filter $(PRODUCT_OUT)/data/%,$(license_modules_rest))
1033license_modules_rehomed += $(filter $(PRODUCT_OUT)/ramdisk/%,$(license_modules_rest))
1034license_modules_rehomed += $(filter $(PRODUCT_OUT)/debug_ramdisk/%,$(license_modules_rest))
1035license_modules_rehomed += $(filter $(PRODUCT_OUT)/vendor-ramdisk/%,$(license_modules_rest))
1036license_modules_rehomed += $(filter $(PRODUCT_OUT)/persist/%,$(license_modules_rest))
1037license_modules_rehomed += $(filter $(PRODUCT_OUT)/persist.img,$(license_modules_rest))
1038license_modules_rehomed += $(filter $(PRODUCT_OUT)/system_other/%,$(license_modules_rest))
1039license_modules_rehomed += $(filter $(PRODUCT_OUT)/kernel%,$(license_modules_rest))
1040license_modules_rehomed += $(filter $(PRODUCT_OUT)/%.img,$(license_modules_rest))
1041license_modules_rehomed += $(filter $(PRODUCT_OUT)/%.bin,$(license_modules_rest))
1042
1043# after removing targets in system images, targets reported in system images, and
1044# targets used for debug symbols that do not need notices, nothing must remain.
1045license_modules_rest := $(filter-out $(license_modules_rehomed),$(license_modules_rest))
1046$(call maybe-print-list-and-error, $(license_modules_rest), \
1047 "Targets added under $(PRODUCT_OUT)/ unaccounted for notice handling.")
The Android Open Source Project88b60792009-03-03 19:28:42 -08001048
Chris Grossaad39b32019-06-13 09:43:26 -07001049# If we are building in a configuration that includes a prebuilt vendor.img, we can't
1050# update its notice file, so include those notices in the system partition instead
1051ifdef BOARD_PREBUILT_VENDORIMAGE
Bob Badour4b25c902020-01-28 13:23:39 -08001052license_modules_system += $(license_modules_rehomed)
Yifan Hong3d3f0302020-05-11 18:35:11 -07001053system_xml_directories := xml_excluded_vendor_product_odm_vendor_dlkm
1054system_notice_file_message := "Notices for files contained in all filesystem images except vendor/system_ext/product/odm/vendor_dlkm in this directory:"
Chris Grosse5d4a9e2019-07-30 15:46:35 -07001055else
Bob Badour4b25c902020-01-28 13:23:39 -08001056license_modules_vendor += $(license_modules_rehomed)
Chris Grosse5d4a9e2019-07-30 15:46:35 -07001057system_xml_directories := xml_system
1058system_notice_file_message := "Notices for files contained in the system filesystem image in this directory:"
Chris Grossaad39b32019-06-13 09:43:26 -07001059endif
1060
1061$(eval $(call combine-notice-files, $(system_xml_directories), \
Anton Hansson6d814982018-11-26 18:12:05 +00001062 $(target_notice_file_txt), \
1063 $(target_notice_file_xml), \
Chris Grossaad39b32019-06-13 09:43:26 -07001064 $(system_notice_file_message), \
Anton Hansson6d814982018-11-26 18:12:05 +00001065 $(TARGET_OUT_NOTICE_FILES), \
Bob Badour4b25c902020-01-28 13:23:39 -08001066 $(license_modules_system), \
1067 $(exclude_target_dirs)))
Yifan Hong3d3f0302020-05-11 18:35:11 -07001068$(eval $(call combine-notice-files, xml_excluded_system_product_odm_vendor_dlkm, \
Anton Hansson6d814982018-11-26 18:12:05 +00001069 $(target_vendor_notice_file_txt), \
1070 $(target_vendor_notice_file_xml), \
Yifan Hong3d3f0302020-05-11 18:35:11 -07001071 "Notices for files contained in all filesystem images except system/system_ext/product/odm/vendor_dlkm in this directory:", \
Anton Hansson6d814982018-11-26 18:12:05 +00001072 $(TARGET_OUT_NOTICE_FILES), \
Bob Badour4b25c902020-01-28 13:23:39 -08001073 $(license_modules_vendor), \
1074 $(exclude_target_dirs)))
Dario Freniadc972d2018-07-09 18:38:38 +01001075$(eval $(call combine-notice-files, xml_product, \
Anton Hansson6d814982018-11-26 18:12:05 +00001076 $(target_product_notice_file_txt), \
1077 $(target_product_notice_file_xml), \
1078 "Notices for files contained in the product filesystem image in this directory:", \
1079 $(TARGET_OUT_NOTICE_FILES), \
Bob Badour4b25c902020-01-28 13:23:39 -08001080 $(license_modules_product), \
1081 $(exclude_target_dirs)))
Justin Yun6151e3f2019-06-25 15:58:13 +09001082$(eval $(call combine-notice-files, xml_system_ext, \
1083 $(target_system_ext_notice_file_txt), \
1084 $(target_system_ext_notice_file_xml), \
1085 "Notices for files contained in the system_ext filesystem image in this directory:", \
Anton Hansson6d814982018-11-26 18:12:05 +00001086 $(TARGET_OUT_NOTICE_FILES), \
Bob Badour4b25c902020-01-28 13:23:39 -08001087 $(license_modules_system_ext), \
1088 $(exclude_target_dirs)))
Chris Gross15d96552019-07-16 14:38:43 -07001089$(eval $(call combine-notice-files, xml_odm, \
1090 $(target_odm_notice_file_txt), \
1091 $(target_odm_notice_file_xml), \
1092 "Notices for files contained in the odm filesystem image in this directory:", \
1093 $(TARGET_OUT_NOTICE_FILES), \
Bob Badour4b25c902020-01-28 13:23:39 -08001094 $(license_modules_odm), \
1095 $(exclude_target_dirs)))
Yifan Hong3d3f0302020-05-11 18:35:11 -07001096$(eval $(call combine-notice-files, xml_vendor_dlkm, \
1097 $(target_vendor_dlkm_notice_file_txt), \
1098 $(target_vendor_dlkm_notice_file_xml), \
1099 "Notices for files contained in the vendor_dlkm filesystem image in this directory:", \
1100 $(TARGET_OUT_NOTICE_FILES), \
1101 $(license_modules_vendor_dlkm), \
1102 $(exclude_target_dirs)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001103
1104$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
1105 $(hide) $(MINIGZIP) -9 < $< > $@
1106$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
1107 $(hide) $(MINIGZIP) -9 < $< > $@
1108$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
1109 $(hide) $(MINIGZIP) -9 < $< > $@
Justin Yun6151e3f2019-06-25 15:58:13 +09001110$(target_system_ext_notice_file_xml_gz): $(target_system_ext_notice_file_xml) | $(MINIGZIP)
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001111 $(hide) $(MINIGZIP) -9 < $< > $@
Chris Gross15d96552019-07-16 14:38:43 -07001112$(target_odm_notice_file_xml_gz): $(target_odm_notice_file_xml) | $(MINIGZIP)
1113 $(hide) $(MINIGZIP) -9 < $< > $@
Yifan Hong3d3f0302020-05-11 18:35:11 -07001114$(target_vendor_dlkm_notice_file_xml_gz): $(target_vendor_dlkm_notice_file_xml) | $(MINIGZIP)
1115 $(hide) $(MINIGZIP) -9 < $< > $@
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001116$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
1117 $(copy-file-to-target)
1118$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
1119 $(copy-file-to-target)
1120$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
1121 $(copy-file-to-target)
Justin Yun6151e3f2019-06-25 15:58:13 +09001122$(installed_system_ext_notice_xml_gz): $(target_system_ext_notice_file_xml_gz)
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001123 $(copy-file-to-target)
Chris Gross15d96552019-07-16 14:38:43 -07001124$(installed_odm_notice_xml_gz): $(target_odm_notice_file_xml_gz)
1125 $(copy-file-to-target)
Yifan Hong3d3f0302020-05-11 18:35:11 -07001126$(installed_vendor_dlkm_notice_xml_gz): $(target_vendor_dlkm_notice_file_xml_gz)
1127 $(copy-file-to-target)
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001128
Dan Willemsen5c3fc2a2019-07-29 23:45:19 -07001129ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
1130ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
1131ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
1132ALL_DEFAULT_INSTALLED_MODULES += $(installed_system_ext_notice_xml_gz)
1133ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_notice_xml_gz)
Yifan Hong3d3f0302020-05-11 18:35:11 -07001134ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_dlkm_notice_xml_gz)
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001135endif # PRODUCT_NOTICE_SPLIT
1136
Dan Willemsen5c3fc2a2019-07-29 23:45:19 -07001137ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001138
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001139$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001140 $(tools_notice_file_txt), \
1141 $(tools_notice_file_html), \
1142 "Notices for files contained in the tools directory:", \
1143 $(HOST_OUT_NOTICE_FILES), \
1144 $(ALL_DEFAULT_INSTALLED_MODULES) \
Bob Badour4b25c902020-01-28 13:23:39 -08001145 $(winpthreads_notice_file), \
1146 $(exclude_target_dirs)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001147
Ying Wang62c81f82013-08-22 20:02:03 -07001148endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -08001149
1150# The kernel isn't really a module, so to get its module file in there, we
1151# make the target NOTICE files depend on this particular file too, which will
1152# then be in the right directory for the find in combine-notice-files to work.
Dan Willemsen288bedf2019-05-28 15:36:47 -07001153$(eval $(call copy-one-file,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,$(kernel_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001154
Dan Willemsen288bedf2019-05-28 15:36:47 -07001155$(eval $(call copy-one-file,$(BUILD_SYSTEM)/WINPTHREADS_COPYING,$(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001156
Doug Zongker8678df42009-06-15 14:30:14 -07001157
The Android Open Source Project88b60792009-03-03 19:28:42 -08001158# #################################################################
1159# Targets for user images
1160# #################################################################
1161
Ying Wang933abf12010-06-16 14:31:34 -07001162INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001163ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001164INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1165else
1166ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001167INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1168else
1169ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001170INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1171endif
1172endif
1173endif
1174
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001175# These options tell the recovery updater/installer how to mount the partitions writebale.
1176# <fstype>=<fstype_opts>[|<fstype_opts>]...
1177# fstype_opts := <opt>[,<opt>]...
1178# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001179# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1180DEFAULT_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 -07001181
Ying Wang542903a2010-11-17 15:40:38 -08001182ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1183 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1184endif
Todd Poynorb2a555e2015-12-15 18:00:14 -08001185ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1186 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1187endif
Alistair Delva91238cc2019-10-16 10:53:41 -07001188ifneq (true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED))
1189 INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG := -S
1190endif
Tao Baodba635a2019-06-24 10:39:54 -07001191
1192INTERNAL_USERIMAGES_DEPS := \
Tao Bao2bbb07c2019-05-07 13:12:21 -07001193 $(BUILD_IMAGE) \
Tao Baodba635a2019-06-24 10:39:54 -07001194 $(MKE2FS_CONF) \
Tao Bao2bbb07c2019-05-07 13:12:21 -07001195 $(MKEXTUSERIMG)
Tao Baodba635a2019-06-24 10:39:54 -07001196
1197ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1198INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001199endif
1200
Yifan Hongcfb917a2020-05-07 14:58:20 -07001201ifneq ($(filter \
1202 $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) \
1203 $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE) \
1204 $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) \
1205 $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) \
1206 $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE) \
1207 $(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE) \
1208 ,squashfs),)
Tao Baodba635a2019-06-24 10:39:54 -07001209INTERNAL_USERIMAGES_DEPS += $(MKSQUASHFSUSERIMG)
1210endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001211
Anton Hansson8dab0a62019-03-28 15:45:40 +00001212ifeq (true,$(PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001213INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001214ifeq (true,$(PRODUCT_SUPPORTS_VERITY_FEC))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001215INTERNAL_USERIMAGES_DEPS += $(FEC)
1216endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001217endif
1218
Tao Baodba635a2019-06-24 10:39:54 -07001219ifeq ($(BOARD_AVB_ENABLE),true)
1220INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1221endif
1222
1223# Get a colon-separated list of search paths.
1224INTERNAL_USERIMAGES_BINARY_PATHS := $(subst $(space),:,$(sort $(dir $(INTERNAL_USERIMAGES_DEPS))))
1225
Alex Klyubin092c9022017-03-13 13:28:34 -07001226SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001227INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1228
Yifan Hongc5c01242018-11-09 10:27:23 -08001229ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001230
Anton Hansson8dab0a62019-03-28 15:45:40 +00001231ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001232 $(error vboot 1.0 doesn't support logical partition)
1233endif
1234
Yifan Hongc5c01242018-11-09 10:27:23 -08001235endif # PRODUCT_USE_DYNAMIC_PARTITIONS
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001236
Ying Wangbd93d422011-10-28 17:02:30 -07001237# $(1): the path of the output dictionary file
Yifan Hongcfb917a2020-05-07 14:58:20 -07001238# $(2): a subset of "system vendor cache userdata product system_ext oem odm vendor_dlkm"
Yifan Hong760d3c02018-05-30 11:16:46 -07001239# $(3): additional "key=value" pairs to append to the dictionary file.
1240define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001241$(if $(filter $(2),system),\
1242 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
Bowgo Tsai867ab662019-01-29 13:30:18 +08001243 $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001244 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1245 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1246 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1247 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1248 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1249 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1250 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1251 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001252 $(if $(PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1253 $(if $(PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCT_SYSTEM_HEADROOM)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001254 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001255 $(hide) echo "system_selinux_fc=$(SELINUX_FC)" >> $(1)
Chris Gross203191b2020-05-30 02:39:12 +00001256 $(hide) echo "building_system_image=$(BUILDING_SYSTEM_IMAGE)" >> $(1)
1257)
1258$(if $(filter $(2),system_other),\
1259 $(hide) echo "building_system_other_image=$(BUILDING_SYSTEM_OTHER_IMAGE)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001260)
Yifan Hong760d3c02018-05-30 11:16:46 -07001261$(if $(filter $(2),userdata),\
1262 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1263 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
Daniel Rosenberg6cc2c812019-12-17 17:36:31 -08001264 $(if $(PRODUCT_FS_CASEFOLD),$(hide) echo "needs_casefold=$(PRODUCT_FS_CASEFOLD)" >> $(1))
1265 $(if $(PRODUCT_QUOTA_PROJID),$(hide) echo "needs_projid=$(PRODUCT_QUOTA_PROJID)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001266 $(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1)
Chris Gross203191b2020-05-30 02:39:12 +00001267 $(hide) echo "building_userdata_image=$(BUILDING_USERDATA_IMAGE)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001268)
Yifan Hong760d3c02018-05-30 11:16:46 -07001269$(if $(filter $(2),cache),\
1270 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1271 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001272 $(hide) echo "cache_selinux_fc=$(SELINUX_FC)" >> $(1)
Chris Gross203191b2020-05-30 02:39:12 +00001273 $(hide) echo "building_cache_image=$(BUILDING_CACHE_IMAGE)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001274)
1275$(if $(filter $(2),vendor),\
1276 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1277 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1278 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1279 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1280 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1281 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1282 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1283 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1284 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001285 $(if $(PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
Yifan Hong749062d2018-06-19 16:23:16 -07001286 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001287 $(hide) echo "vendor_selinux_fc=$(SELINUX_FC)" >> $(1)
Chris Gross203191b2020-05-30 02:39:12 +00001288 $(hide) echo "building_vendor_image=$(BUILDING_VENDOR_IMAGE)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001289)
1290$(if $(filter $(2),product),\
1291 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1292 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1293 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1294 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1295 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1296 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1297 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1298 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1299 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001300 $(if $(PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
Yifan Hong56a6c3b2018-07-20 15:19:34 -07001301 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001302 $(hide) echo "product_selinux_fc=$(SELINUX_FC)" >> $(1)
Chris Gross203191b2020-05-30 02:39:12 +00001303 $(hide) echo "building_product_image=$(BUILDING_PRODUCT_IMAGE)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001304)
Justin Yun6151e3f2019-06-25 15:58:13 +09001305$(if $(filter $(2),system_ext),\
1306 $(if $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_ext_fs_type=$(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1307 $(if $(BOARD_SYSTEM_EXTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_ext_extfs_inode_count=$(BOARD_SYSTEM_EXTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1308 $(if $(BOARD_SYSTEM_EXTIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_ext_extfs_rsv_pct=$(BOARD_SYSTEM_EXTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1309 $(if $(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE),$(hide) echo "system_ext_size=$(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE)" >> $(1))
1310 $(if $(BOARD_SYSTEM_EXTIMAGE_JOURNAL_SIZE),$(hide) echo "system_ext_journal_size=$(BOARD_SYSTEM_EXTIMAGE_JOURNAL_SIZE)" >> $(1))
1311 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_ext_squashfs_compressor=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1312 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_ext_squashfs_compressor_opt=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1313 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_ext_squashfs_block_size=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1314 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_ext_squashfs_disable_4k_align=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1315 $(if $(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_ext_reserved_size=$(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
1316 $(hide) echo "system_ext_selinux_fc=$(SELINUX_FC)" >> $(1)
Chris Gross203191b2020-05-30 02:39:12 +00001317 $(hide) echo "building_system_ext_image=$(BUILDING_SYSTEM_EXT_IMAGE)" >> $(1)
Dario Freni5f681e12018-05-29 13:09:01 +01001318)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001319$(if $(filter $(2),odm),\
1320 $(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1321 $(if $(BOARD_ODMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_extfs_inode_count=$(BOARD_ODMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1322 $(if $(BOARD_ODMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_extfs_rsv_pct=$(BOARD_ODMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1323 $(if $(BOARD_ODMIMAGE_PARTITION_SIZE),$(hide) echo "odm_size=$(BOARD_ODMIMAGE_PARTITION_SIZE)" >> $(1))
1324 $(if $(BOARD_ODMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_journal_size=$(BOARD_ODMIMAGE_JOURNAL_SIZE)" >> $(1))
1325 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_squashfs_compressor=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1326 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_squashfs_compressor_opt=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1327 $(if $(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_squashfs_block_size=$(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1328 $(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001329 $(if $(PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCT_ODM_BASE_FS_PATH)" >> $(1))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001330 $(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001331 $(hide) echo "odm_selinux_fc=$(SELINUX_FC)" >> $(1)
Chris Gross203191b2020-05-30 02:39:12 +00001332 $(hide) echo "building_odm_image=$(BUILDING_ODM_IMAGE)" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001333)
Yifan Hongcfb917a2020-05-07 14:58:20 -07001334$(if $(filter $(2),vendor_dlkm),\
1335 $(if $(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_dlkm_fs_type=$(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1336 $(if $(BOARD_VENDOR_DLKMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_dlkm_extfs_inode_count=$(BOARD_VENDOR_DLKMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1337 $(if $(BOARD_VENDOR_DLKMIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_dlkm_extfs_rsv_pct=$(BOARD_VENDOR_DLKMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1338 $(if $(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE),$(hide) echo "vendor_dlkm_size=$(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE)" >> $(1))
1339 $(if $(BOARD_VENDOR_DLKMIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_dlkm_journal_size=$(BOARD_VENDOR_DLKMIMAGE_JOURNAL_SIZE)" >> $(1))
1340 $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_dlkm_squashfs_compressor=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1341 $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_dlkm_squashfs_compressor_opt=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1342 $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_dlkm_squashfs_block_size=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1343 $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_dlkm_squashfs_disable_4k_align=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1344 $(if $(BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_dlkm_reserved_size=$(BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
1345 $(hide) echo "vendor_dlkm_selinux_fc=$(SELINUX_FC)" >> $(1)
1346 $(hide) echo "building_vendor_dlkm_image=$(BUILDING_VENDOR_DLKM_IMAGE)" >> $(1)
1347)
Yifan Hong760d3c02018-05-30 11:16:46 -07001348$(if $(filter $(2),oem),\
1349 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1350 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1351 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1352 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001353 $(hide) echo "oem_selinux_fc=$(SELINUX_FC)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001354)
Tao Bao3602eca2018-07-10 10:53:55 -07001355$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001356
Tao Bao3602eca2018-07-10 10:53:55 -07001357$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001358$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001359$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Alistair Delva91238cc2019-10-16 10:53:41 -07001360$(if $(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG),$(hide) echo "f2fs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001361$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1362$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1363$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001364$(if $(PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
1365$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCT_SUPPORTS_VERITY)" >> $(1))
1366$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
1367$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
1368$(if $(PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1))
Bowgo Tsai6ceeb1a2017-10-11 16:21:48 +08001369$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001370$(if $(PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1371$(if $(PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
1372$(if $(PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
Justin Yun6151e3f2019-06-25 15:58:13 +09001373$(if $(PRODUCT_SYSTEM_EXT_VERITY_PARTITION),$(hide) echo "system_ext_verity_block_device=$(PRODUCT_SYSTEM_EXT_VERITY_PARTITION)" >> $(1))
Yifan Hongcfb917a2020-05-07 14:58:20 -07001374$(if $(PRODUCT_VENDOR_DLKM_VERITY_PARTITION),$(hide) echo "vendor_dlkm_verity_block_device=$(PRODUCT_VENDOR_DLKM_VERITY_PARTITION)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001375$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1376$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
1377$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
1378$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
1379$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001380$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001381$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1382$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1383$(if $(BOARD_AVB_ENABLE),\
1384 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1385 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1386 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1387 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08001388$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1389$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1390$(if $(BOARD_AVB_ENABLE),\
1391 $(if $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH),\
1392 $(hide) echo "avb_system_other_key_path=$(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)" >> $(1)
Bowgo Tsaie4544b12019-02-27 10:15:51 +08001393 $(hide) echo "avb_system_other_algorithm=$(BOARD_AVB_SYSTEM_OTHER_ALGORITHM)" >> $(1)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001394$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1395$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1396$(if $(BOARD_AVB_ENABLE),\
1397 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1398 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1399 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1400 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001401$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1402$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1403$(if $(BOARD_AVB_ENABLE),\
1404 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1405 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1406 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1407 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Justin Yun6151e3f2019-06-25 15:58:13 +09001408$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_ext_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
Tao Bao1ebda8d2018-08-01 17:21:14 -07001409$(if $(BOARD_AVB_ENABLE),\
Justin Yun6151e3f2019-06-25 15:58:13 +09001410 $(hide) echo "avb_system_ext_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001411$(if $(BOARD_AVB_ENABLE),\
Justin Yun6151e3f2019-06-25 15:58:13 +09001412 $(if $(BOARD_AVB_SYSTEM_EXT_KEY_PATH),\
1413 $(hide) echo "avb_system_ext_key_path=$(BOARD_AVB_SYSTEM_EXT_KEY_PATH)" >> $(1)
1414 $(hide) echo "avb_system_ext_algorithm=$(BOARD_AVB_SYSTEM_EXT_ALGORITHM)" >> $(1)
1415 $(hide) echo "avb_system_ext_rollback_index_location=$(BOARD_AVB_SYSTEM_EXT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001416$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1417$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1418$(if $(BOARD_AVB_ENABLE),\
1419 $(if $(BOARD_AVB_ODM_KEY_PATH),\
1420 $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1)
1421 $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1)
1422 $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Yifan Hongcfb917a2020-05-07 14:58:20 -07001423$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_dlkm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1424$(if $(BOARD_AVB_ENABLE),\
1425 $(hide) echo "avb_vendor_dlkm_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1426$(if $(BOARD_AVB_ENABLE),\
1427 $(if $(BOARD_AVB_VENDOR_DLKM_KEY_PATH),\
1428 $(hide) echo "avb_vendor_dlkm_key_path=$(BOARD_AVB_VENDOR_DLKM_KEY_PATH)" >> $(1)
1429 $(hide) echo "avb_vendor_dlkm_algorithm=$(BOARD_AVB_VENDOR_DLKM_ALGORITHM)" >> $(1)
1430 $(hide) echo "avb_vendor_dlkm_rollback_index_location=$(BOARD_AVB_VENDOR_DLKM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001431$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1432 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001433$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Tom Cherryd14b8952018-08-09 14:26:00 -07001434 $(hide) echo "system_root_image=true" >> $(1))
1435$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
Tamas Petz89418f02020-02-03 15:40:15 +01001436$(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITION_SIZE)),\
1437 $(hide) echo "use_dynamic_partition_size=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001438$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1439endef
1440
1441# $(1): the path of the output dictionary file
1442# $(2): additional "key=value" pairs to append to the dictionary file.
Daniel Norman72c626f2019-05-13 15:58:14 -07001443PROP_DICTIONARY_IMAGES := oem
1444ifdef BUILDING_CACHE_IMAGE
1445 PROP_DICTIONARY_IMAGES += cache
1446endif
1447ifdef BUILDING_SYSTEM_IMAGE
1448 PROP_DICTIONARY_IMAGES += system
1449endif
Chris Gross203191b2020-05-30 02:39:12 +00001450ifdef BUILDING_SYSTEM_OTHER_IMAGE
1451 PROP_DICTIONARY_IMAGES += system_other
1452endif
Daniel Norman72c626f2019-05-13 15:58:14 -07001453ifdef BUILDING_USERDATA_IMAGE
1454 PROP_DICTIONARY_IMAGES += userdata
1455endif
1456ifdef BUILDING_VENDOR_IMAGE
1457 PROP_DICTIONARY_IMAGES += vendor
1458endif
1459ifdef BUILDING_PRODUCT_IMAGE
1460 PROP_DICTIONARY_IMAGES += product
1461endif
Justin Yun6151e3f2019-06-25 15:58:13 +09001462ifdef BUILDING_SYSTEM_EXT_IMAGE
1463 PROP_DICTIONARY_IMAGES += system_ext
Daniel Norman72c626f2019-05-13 15:58:14 -07001464endif
1465ifdef BUILDING_ODM_IMAGE
1466 PROP_DICTIONARY_IMAGES += odm
1467endif
Yifan Hongcfb917a2020-05-07 14:58:20 -07001468ifdef BUILDING_VENDOR_DLKM_IMAGE
1469 PROP_DICTIONARY_IMAGES += vendor_dlkm
1470endif
Yifan Hong760d3c02018-05-30 11:16:46 -07001471define generate-userimage-prop-dictionary
Daniel Norman72c626f2019-05-13 15:58:14 -07001472 $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001473endef
1474
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001475# $(1): the path of the input dictionary file, where each line has the format key=value
1476# $(2): the key to look up
1477define read-image-prop-dictionary
1478$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1479endef
1480
The Android Open Source Project88b60792009-03-03 19:28:42 -08001481# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001482# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001483
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001484# Recovery image exists if we are building recovery, or building recovery as boot.
Chris Grossa784ef12019-04-22 11:09:57 -07001485ifdef BUILDING_RECOVERY_IMAGE
Doug Zongker4647f122009-07-02 09:00:54 -07001486
Ying Wang37526142015-03-10 12:02:57 -07001487INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1488 $(ALL_DEFAULT_INSTALLED_MODULES))
1489
Tao Bao10fc9492018-08-14 12:17:48 -07001490INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
1491INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
1492
1493# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other
1494# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in
1495# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with
1496# the call to FILELIST.
1497ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Chris Grossa784ef12019-04-22 11:09:57 -07001498INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
Tao Bao10fc9492018-08-14 12:17:48 -07001499$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET)
1500else
1501$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET)
1502endif
1503
1504$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07001505$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Tao Bao10fc9492018-08-14 12:17:48 -07001506 @echo Installed file list: $@
1507 @mkdir -p $(dir $@)
1508 @rm -f $@
1509 $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07001510 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Tao Bao10fc9492018-08-14 12:17:48 -07001511
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001512recovery_sepolicy := \
1513 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001514 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001515 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Bowgo Tsai07365df2019-09-28 09:04:51 +08001516 $(TARGET_RECOVERY_ROOT_OUT)/system_ext_file_contexts \
1517 $(TARGET_RECOVERY_ROOT_OUT)/system_ext_property_contexts \
1518 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001519 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts \
Bowgo Tsai99671252017-11-30 22:15:17 +08001520 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001521 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts \
1522 $(TARGET_RECOVERY_ROOT_OUT)/product_file_contexts \
1523 $(TARGET_RECOVERY_ROOT_OUT)/product_property_contexts
Bowgo Tsai99671252017-11-30 22:15:17 +08001524
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001525# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1526# SELinux files
1527IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1528
Doug Zongker4647f122009-07-02 09:00:54 -07001529recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1530recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Dan Willemsen97672232020-05-27 00:09:16 -07001531recovery_resources_common := bootable/recovery/res
Doug Zongkere1297322013-03-06 15:04:31 -08001532
Anton Hansson45a40da2019-01-18 14:06:34 +00001533# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
1534# or mdpi, in order of preference. We support both specific buckets (e.g. xdpi) and numbers,
1535# which get remapped to a bucket.
1536recovery_density := $(or $(TARGET_SCREEN_DENSITY),$(PRODUCT_AAPT_PREF_CONFIG),mdpi)
Tao Baoe1e829e2018-08-29 20:36:00 -07001537ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density)))
1538recovery_density_value := $(patsubst %dpi,%,$(recovery_density))
Anton Hansson45a40da2019-01-18 14:06:34 +00001539# We roughly use the medium point between the primary densities to split buckets.
Tao Baoe1e829e2018-08-29 20:36:00 -07001540# ------160------240------320----------480------------640------
1541# mdpi hdpi xhdpi xxhdpi xxxhdpi
1542recovery_density := $(strip \
1543 $(or $(if $(filter $(shell echo $$(($(recovery_density_value) >= 560))),1),xxxhdpi),\
1544 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 400))),1),xxhdpi),\
1545 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
1546 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
Doug Zongker8eaeea92014-05-12 15:32:20 -07001547endif
1548
1549ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1550recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1551else
Doug Zongker25d55f82014-04-04 13:51:15 -07001552recovery_resources_common := $(recovery_resources_common)-xhdpi
1553endif
1554
Tao Baoe1e829e2018-08-29 20:36:00 -07001555# Select the 18x32 font on high-density devices (xhdpi and up); and the 12x22 font on other devices.
1556# Note that the font selected here can be overridden for a particular device by putting a font.png
1557# in its private recovery resources.
1558ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density)))
Dan Willemsen97672232020-05-27 00:09:16 -07001559recovery_font := bootable/recovery/fonts/18x32.png
Doug Zongkere1297322013-03-06 15:04:31 -08001560else
Dan Willemsen97672232020-05-27 00:09:16 -07001561recovery_font := bootable/recovery/fonts/12x22.png
Doug Zongkere1297322013-03-06 15:04:31 -08001562endif
1563
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001564
1565# We will only generate the recovery background text images if the variable
1566# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the
1567# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for
1568# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their
1569# BoardConfig in order to use this feature.
1570ifeq ($(recovery_density),xxxhdpi)
1571TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440
1572else ifeq ($(recovery_density),xxhdpi)
1573TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080
1574endif
1575
1576ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),)
1577# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative.
1578ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
1579 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10))
1580else
1581 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10))
1582endif
1583
1584
Dan Willemsen97672232020-05-27 00:09:16 -07001585RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,ETC,recovery_text_res)/installing_text.png
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001586RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
1587RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
1588RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
1589RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
1590
xunchangcc57d312018-12-07 12:12:17 -08001591RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
1592RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
1593RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
1594RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
1595RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
1596
1597generated_recovery_text_files := \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001598 $(RECOVERY_INSTALLING_TEXT_FILE) \
1599 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
1600 $(RECOVERY_ERASING_TEXT_FILE) \
1601 $(RECOVERY_ERROR_TEXT_FILE) \
xunchangcc57d312018-12-07 12:12:17 -08001602 $(RECOVERY_NO_COMMAND_TEXT_FILE) \
1603 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
1604 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
1605 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
1606 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
1607 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001608
Dan Willemsen97672232020-05-27 00:09:16 -07001609resource_dir := bootable/recovery/tools/recovery_l10n/res/
1610resource_dir_deps := $(sort $(shell find $(resource_dir) -name *.xml -not -name .*))
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001611image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
xunchangcc57d312018-12-07 12:12:17 -08001612zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001613$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
Dan Willemsen97672232020-05-27 00:09:16 -07001614$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,ETC,recovery_font_files)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001615$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
1616$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
xunchangcc57d312018-12-07 12:12:17 -08001617$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001618$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
xunchangdbe55e12018-12-19 17:15:14 -08001619$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001620 recovery_installing \
1621 recovery_installing_security \
1622 recovery_erasing \
1623 recovery_error \
xunchangdbe55e12018-12-19 17:15:14 -08001624 recovery_no_command
1625$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001626 recovery_cancel_wipe_data \
1627 recovery_factory_data_reset \
1628 recovery_try_again \
1629 recovery_wipe_data_menu_header \
1630 recovery_wipe_data_confirmation
1631$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
Dan Willemsen97672232020-05-27 00:09:16 -07001632$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir_deps) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001633 # Prepares the font directory.
1634 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1635 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
xunchangcc57d312018-12-07 12:12:17 -08001636 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001637 @rm -rf $(dir $@)
1638 @mkdir -p $(dir $@)
xunchangdbe55e12018-12-19 17:15:14 -08001639 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
xunchangcc57d312018-12-07 12:12:17 -08001640 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
xunchangdbe55e12018-12-19 17:15:14 -08001641 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001642 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
1643 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
1644 --text_name $(text_name) \
1645 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
1646 --resource_dir $(PRIVATE_RESOURCE_DIR) \
xunchangdbe55e12018-12-19 17:15:14 -08001647 --output_file $(output_file) $(center_alignment) && \
xunchangcc57d312018-12-07 12:12:17 -08001648 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001649else
1650RECOVERY_INSTALLING_TEXT_FILE :=
1651RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
1652RECOVERY_ERASING_TEXT_FILE :=
1653RECOVERY_ERROR_TEXT_FILE :=
1654RECOVERY_NO_COMMAND_TEXT_FILE :=
xunchangcc57d312018-12-07 12:12:17 -08001655RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
1656RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
1657RECOVERY_TRY_AGAIN_TEXT_FILE :=
1658RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
1659RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001660endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
1661
Ying Wang9a175682015-08-06 11:47:47 -07001662ifndef TARGET_PRIVATE_RES_DIRS
1663TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1664endif
Doug Zongker4647f122009-07-02 09:00:54 -07001665recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001666 $(TARGET_PRIVATE_RES_DIRS) -type f)
xunchangcc57d312018-12-07 12:12:17 -08001667recovery_resource_deps += $(generated_recovery_text_files)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001668
1669
Andrew Boiefa61ff02012-09-28 09:33:45 -07001670ifdef TARGET_RECOVERY_FSTAB
1671recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1672else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001673recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001674endif
Tao Baoc3c17532016-06-10 10:11:54 -07001675ifdef TARGET_RECOVERY_WIPE
1676recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001677else
Tao Baoc3c17532016-06-10 10:11:54 -07001678recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001679endif
Tao Bao8beab692015-07-22 12:33:18 -07001680
Tao Bao6d5d6232018-03-09 17:04:42 -08001681# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001682# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001683# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1684# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001685#
1686# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001687# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001688# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001689# b) We build a single image that contains boot and recovery both - no recovery image to install
1690# (BOARD_USES_RECOVERY_AS_BOOT = true);
Tom Cherry2929cad2018-09-20 11:04:37 -07001691# c) We mount the system image as / and therefore do not have a ramdisk in boot.img
Tao Bao6d5d6232018-03-09 17:04:42 -08001692# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001693# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1694# do bsdiff because boot and recovery will contain different number of entries
1695# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001696# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
1697# do bsdiff because boot and recovery will contain different number of entries
1698# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001699
Tom Cherry2929cad2018-09-20 11:04:37 -07001700ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001701 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Doug Zongker56588872012-08-20 15:38:58 -07001702# Named '.dat' so we don't attempt to use imgdiff for patching it.
Bill Peckhame868aec2019-09-17 17:06:47 -07001703RECOVERY_RESOURCE_ZIP := $(TARGET_OUT_VENDOR)/etc/recovery-resource.dat
1704ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_RESOURCE_ZIP)
Tao Bao8beab692015-07-22 12:33:18 -07001705else
Tao Bao8beab692015-07-22 12:33:18 -07001706RECOVERY_RESOURCE_ZIP :=
1707endif
Doug Zongker4647f122009-07-02 09:00:54 -07001708
Tao Bao139c7272018-07-31 13:26:54 -07001709INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1710
1711$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \
Tao Bao139c7272018-07-31 13:26:54 -07001712 TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \
1713 TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \
1714 TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \
1715 TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \
1716 TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE:progress_bar_baseline \
1717 TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD:touch_low_threshold \
1718 TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD:touch_high_threshold \
1719 TARGET_RECOVERY_UI_VR_STEREO_OFFSET:vr_stereo_offset
1720
1721# Parses the given list of build variables and writes their values as build properties if defined.
1722# For example, if a target defines `TARGET_RECOVERY_UI_MARGIN_HEIGHT := 100`,
1723# `ro.recovery.ui.margin_height=100` will be appended to the given output file.
1724# $(1): Map from the build variable names to property names
1725# $(2): Output file
1726define append-recovery-ui-properties
1727echo "#" >> $(2)
1728echo "# RECOVERY UI BUILD PROPERTIES" >> $(2)
1729echo "#" >> $(2)
1730$(foreach prop,$(1), \
1731 $(eval _varname := $(call word-colon,1,$(prop))) \
1732 $(eval _propname := $(call word-colon,2,$(prop))) \
1733 $(eval _value := $($(_varname))) \
1734 $(if $(_value), \
1735 echo ro.recovery.ui.$(_propname)=$(_value) >> $(2) &&)) true
1736endef
1737
1738$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
Jiyong Parkbb26c6f2020-05-26 03:18:36 +09001739 $(INSTALLED_BUILD_PROP_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00001740 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
1741 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
1742 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
Justin Yun6151e3f2019-06-25 15:58:13 +09001743 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)
Tao Bao1edaca12018-09-18 10:22:54 -07001744 @echo "Target recovery buildinfo: $@"
Tao Bao139c7272018-07-31 13:26:54 -07001745 $(hide) mkdir -p $(dir $@)
1746 $(hide) rm -f $@
Jiyong Parkbb26c6f2020-05-26 03:18:36 +09001747 $(hide) cat $(INSTALLED_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001748 $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001749 $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001750 $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
Justin Yun6151e3f2019-06-25 15:58:13 +09001751 $(hide) cat $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001752 $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
1753
Steve Mucklef84668e2020-03-16 19:13:46 -07001754ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
Steve Muckle10346272020-04-07 16:39:10 -07001755 INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk)
Steve Mucklee1b10862019-07-10 10:49:37 -07001756ifdef GENERIC_KERNEL_CMDLINE
1757 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)"
1758endif
Steve Mucklef84668e2020-03-16 19:13:46 -07001759else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
Steve Mucklee1b10862019-07-10 10:49:37 -07001760 INTERNAL_RECOVERYIMAGE_ARGS := \
1761 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Steve Muckleb3dda772020-03-11 16:03:07 -07001762 --ramdisk $(recovery_ramdisk)
Doug Zongker4647f122009-07-02 09:00:54 -07001763# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001764ifdef INTERNAL_KERNEL_CMDLINE
1765 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001766endif
1767ifdef BOARD_KERNEL_BASE
1768 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1769endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001770ifdef BOARD_KERNEL_PAGESIZE
1771 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1772endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001773ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001774ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1775 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1776else
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001777 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1778endif
Steve Mucklee1b10862019-07-10 10:49:37 -07001779endif # BOARD_INCLUDE_RECOVERY_DTBO
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001780ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1781 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
1782endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001783ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1784 INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
1785endif
Steve Mucklee1b10862019-07-10 10:49:37 -07001786endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
Steve Mucklef84668e2020-03-16 19:13:46 -07001787ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
1788 BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
1789endif
Doug Zongker4647f122009-07-02 09:00:54 -07001790
J. Avila3f6560e2020-05-11 20:20:03 +00001791$(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
Steve Muckleb3dda772020-03-11 16:03:07 -07001792 $(INTERNAL_ROOT_FILES) \
1793 $(INSTALLED_RAMDISK_TARGET) \
1794 $(INTERNAL_RECOVERYIMAGE_FILES) \
1795 $(recovery_sepolicy) \
1796 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1797 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1798 $(recovery_resource_deps) \
1799 $(recovery_fstab)
1800 # Making recovery image
1801 mkdir -p $(TARGET_RECOVERY_OUT)
1802 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
1803 # Copying baseline ramdisk...
1804 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
1805 rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
1806 # Modifying ramdisk contents...
1807 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
1808 ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
1809 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1810 find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f
1811 cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ 2> /dev/null || true # Ignore error when the src file doesn't exist.
1812 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1813 rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1814 cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
1815 $(foreach recovery_text_file,$(generated_recovery_text_files), \
1816 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
1817 cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
1818 $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1819 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
1820 $(foreach item,$(recovery_fstab), \
1821 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
1822 $(if $(strip $(recovery_wipe)), \
1823 cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
1824 ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
1825 $(BOARD_RECOVERY_IMAGE_PREPARE)
J. Avila3f6560e2020-05-11 20:20:03 +00001826 $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk)
Steve Muckleb3dda772020-03-11 16:03:07 -07001827
Ying Wang747b9f12015-01-30 14:05:22 -08001828# $(1): output file
Steve Muckleb3dda772020-03-11 16:03:07 -07001829# $(2): kernel file
Ying Wang747b9f12015-01-30 14:05:22 -08001830define build-recoveryimage-target
Anton Hansson8dab0a62019-03-28 15:45:40 +00001831 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
Steve Muckle10346272020-04-07 16:39:10 -07001832 $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \
Steve Mucklef84668e2020-03-16 19:13:46 -07001833 $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \
Steve Muckleb3dda772020-03-11 16:03:07 -07001834 --output $(1).unsigned, \
Steve Muckle10346272020-04-07 16:39:10 -07001835 $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \
Steve Mucklef84668e2020-03-16 19:13:46 -07001836 $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \
Steve Muckleb3dda772020-03-11 16:03:07 -07001837 --output $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001838 $(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001839 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
Anton Hansson8dab0a62019-03-28 15:45:40 +00001840 $(BOOT_SIGNER) /boot $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1841 $(BOOT_SIGNER) /recovery $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001842 )\
1843 )
Anton Hansson8dab0a62019-03-28 15:45:40 +00001844 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
1845 $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001846 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
Steve Muckle903a1ca2020-05-07 17:32:10 -07001847 $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(call get-bootimage-partition-size,$(1),boot))), \
Steve Muckleb3dda772020-03-11 16:03:07 -07001848 $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001849 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1850 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
Steve Muckle903a1ca2020-05-07 17:32:10 -07001851 $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(call get-bootimage-partition-size,$(1),boot) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\
Steve Muckleb3dda772020-03-11 16:03:07 -07001852 $(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 -08001853endef
1854
Dan Willemsend120ac62020-06-12 02:39:34 +00001855recoveryimage-deps := $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001856ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER))
Dan Willemsend120ac62020-06-12 02:39:34 +00001857 recoveryimage-deps += $(BOOT_SIGNER)
Ying Wangbd07ad02016-03-10 12:57:33 -08001858endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00001859ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Dan Willemsend120ac62020-06-12 02:39:34 +00001860 recoveryimage-deps += $(VBOOT_SIGNER)
Ying Wangbd07ad02016-03-10 12:57:33 -08001861endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001862ifeq (true,$(BOARD_AVB_ENABLE))
Dan Willemsend120ac62020-06-12 02:39:34 +00001863 recoveryimage-deps += $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001864endif
Tao Baof4866c72018-08-22 14:35:09 -07001865ifdef BOARD_INCLUDE_RECOVERY_DTBO
Dan Willemsend120ac62020-06-12 02:39:34 +00001866 ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1867 recoveryimage-deps += $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1868 else
1869 recoveryimage-deps += $(BOARD_PREBUILT_DTBOIMAGE)
1870 endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001871endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001872ifdef BOARD_INCLUDE_RECOVERY_ACPIO
Dan Willemsend120ac62020-06-12 02:39:34 +00001873 recoveryimage-deps += $(BOARD_RECOVERY_ACPIO)
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001874endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001875ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
Dan Willemsend120ac62020-06-12 02:39:34 +00001876 recoveryimage-deps += $(INSTALLED_DTBIMAGE_TARGET)
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001877endif
Tao Baof4866c72018-08-22 14:35:09 -07001878
Dan Willemsend120ac62020-06-12 02:39:34 +00001879ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
1880$(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps)
Tao Baof4866c72018-08-22 14:35:09 -07001881 $(call pretty,"Target boot image from recovery: $@")
Steve Muckleb3dda772020-03-11 16:03:07 -07001882 $(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@))))
Tao Baof4866c72018-08-22 14:35:09 -07001883endif # BOARD_USES_RECOVERY_AS_BOOT
1884
Dan Willemsend120ac62020-06-12 02:39:34 +00001885$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps)
Steve Muckleb3dda772020-03-11 16:03:07 -07001886 $(call build-recoveryimage-target, $@, $(recovery_kernel))
Doug Zongker4647f122009-07-02 09:00:54 -07001887
Tao Bao4594d0e2015-12-22 09:47:46 -08001888ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001889$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001890 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001891 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1892 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001893endif
Doug Zongker56588872012-08-20 15:38:58 -07001894
Ying Wang747b9f12015-01-30 14:05:22 -08001895.PHONY: recoveryimage-nodeps
1896recoveryimage-nodeps:
1897 @echo "make $@: ignoring dependencies"
1898 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1899
Chris Grossa784ef12019-04-22 11:09:57 -07001900else # BUILDING_RECOVERY_IMAGE
Doug Zongker56588872012-08-20 15:38:58 -07001901RECOVERY_RESOURCE_ZIP :=
Chris Grossa784ef12019-04-22 11:09:57 -07001902endif # BUILDING_RECOVERY_IMAGE
Doug Zongker4647f122009-07-02 09:00:54 -07001903
1904.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001905recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001906
Jiyong Park03eb0612017-10-04 21:22:41 +09001907ifneq ($(BOARD_NAND_PAGE_SIZE),)
1908$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001909endif
1910
Jiyong Park03eb0612017-10-04 21:22:41 +09001911ifneq ($(BOARD_NAND_SPARE_SIZE),)
1912$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001913endif
1914
Bowgo Tsai5c40c712019-10-08 10:22:19 +08001915ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Doug Zongker4647f122009-07-02 09:00:54 -07001916# -----------------------------------------------------------------
Bowgo Tsai0013f552019-03-20 17:59:52 +08001917# the debug ramdisk, which is the original ramdisk plus additional
1918# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
1919# When /force_debuggable is present, /init will load userdebug sepolicy
1920# and property files to allow adb root, if the device is unlocked.
1921
1922ifdef BUILDING_RAMDISK_IMAGE
1923BUILT_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-debug.img
1924INSTALLED_DEBUG_RAMDISK_TARGET := $(BUILT_DEBUG_RAMDISK_TARGET)
1925
1926INTERNAL_DEBUG_RAMDISK_FILES := $(filter $(TARGET_DEBUG_RAMDISK_OUT)/%, \
1927 $(ALL_GENERATED_SOURCES) \
1928 $(ALL_DEFAULT_INSTALLED_MODULES))
1929
1930# Note: TARGET_DEBUG_RAMDISK_OUT will be $(PRODUCT_OUT)/debug_ramdisk/first_stage_ramdisk,
1931# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/debug_ramdisk.
1932# But the root dir of the ramdisk to build is always $(PRODUCT_OUT)/debug_ramdisk.
1933my_debug_ramdisk_root_dir := $(PRODUCT_OUT)/debug_ramdisk
1934
1935INSTALLED_FILES_FILE_DEBUG_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk-debug.txt
1936INSTALLED_FILES_JSON_DEBUG_RAMDISK := $(INSTALLED_FILES_FILE_DEBUG_RAMDISK:.txt=.json)
1937$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_DEBUG_RAMDISK)
1938$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
1939
1940# Cannot just depend on INTERNAL_DEBUG_RAMDISK_FILES like other INSTALLED_FILES_FILE_* rules.
1941# Because ramdisk-debug.img will rsync from either ramdisk.img or ramdisk-recovery.img.
1942# Need to depend on the built ramdisk-debug.img, to get a complete list of the installed files.
1943$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INSTALLED_DEBUG_RAMDISK_TARGET)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07001944$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INTERNAL_DEBUG_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Bowgo Tsai0013f552019-03-20 17:59:52 +08001945 echo Installed file list: $@
1946 mkdir -p $(dir $@)
1947 rm -f $@
1948 $(FILESLIST) $(DEBUG_RAMDISK_ROOT_DIR) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07001949 $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Bowgo Tsai0013f552019-03-20 17:59:52 +08001950
1951# ramdisk-debug.img will rsync the content from either ramdisk.img or ramdisk-recovery.img,
1952# depending on whether BOARD_USES_RECOVERY_AS_BOOT is set or not.
1953ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
1954my_debug_ramdisk_sync_dir := $(TARGET_RECOVERY_ROOT_OUT)
1955else
1956my_debug_ramdisk_sync_dir := $(TARGET_RAMDISK_OUT)
1957endif # BOARD_USES_RECOVERY_AS_BOOT
1958
1959$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir)
1960$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
Bowgo Tsaic3e8cc92019-04-24 12:35:50 +08001961
1962ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
1963# ramdisk-recovery.img isn't a make target, need to depend on boot.img if it's for recovery.
Bowgo Tsai0013f552019-03-20 17:59:52 +08001964$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsaic3e8cc92019-04-24 12:35:50 +08001965else
1966# Depends on ramdisk.img, note that some target has ramdisk.img but no boot.img, e.g., emulator.
1967$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET)
1968endif # BOARD_USES_RECOVERY_AS_BOOT
J. Avila3f6560e2020-05-11 20:20:03 +00001969$(INSTALLED_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_DEBUG_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
Bowgo Tsai0013f552019-03-20 17:59:52 +08001970 $(call pretty,"Target debug ram disk: $@")
1971 mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
1972 touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
Bowgo Tsai1578e232019-04-24 15:33:03 +08001973 rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
J. Avila3f6560e2020-05-11 20:20:03 +00001974 $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $@
Bowgo Tsai0013f552019-03-20 17:59:52 +08001975
1976.PHONY: ramdisk_debug-nodeps
1977ramdisk_debug-nodeps: DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir)
1978ramdisk_debug-nodeps: DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
J. Avila3f6560e2020-05-11 20:20:03 +00001979ramdisk_debug-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
Bowgo Tsai0013f552019-03-20 17:59:52 +08001980 echo "make $@: ignoring dependencies"
1981 mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
1982 touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
Bowgo Tsai1578e232019-04-24 15:33:03 +08001983 rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
J. Avila3f6560e2020-05-11 20:20:03 +00001984 $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
Bowgo Tsai0013f552019-03-20 17:59:52 +08001985
1986my_debug_ramdisk_sync_dir :=
1987my_debug_ramdisk_root_dir :=
1988
1989endif # BUILDING_RAMDISK_IMAGE
1990
1991# -----------------------------------------------------------------
1992# the boot-debug.img, which is the kernel plus ramdisk-debug.img
1993#
1994# Note: it's intentional to skip signing for boot-debug.img, because it
1995# can only be used if the device is unlocked with verification error.
1996ifneq ($(strip $(TARGET_NO_KERNEL)),true)
Steve Muckleb3dda772020-03-11 16:03:07 -07001997ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
1998 INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-debug,$(BOARD_KERNEL_BINARIES)), \
1999 $(PRODUCT_OUT)/$(k).img)
2000else
2001 INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-debug.img
2002endif
Bowgo Tsai0013f552019-03-20 17:59:52 +08002003
2004# Replace ramdisk.img in $(MKBOOTIMG) ARGS with ramdisk-debug.img to build boot-debug.img
2005ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2006INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(recovery_ramdisk),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_RECOVERYIMAGE_ARGS))
2007else
2008INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(INSTALLED_RAMDISK_TARGET),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_BOOTIMAGE_ARGS))
2009endif
2010
Bowgo Tsai26b0a262019-05-03 16:38:34 +08002011# If boot.img is chained but boot-debug.img is not signed, libavb in bootloader
2012# will fail to find valid AVB metadata from the end of /boot, thus stop booting.
2013# Using a test key to sign boot-debug.img to continue booting with the mismatched
2014# public key, if the device is unlocked.
2015ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002016$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH)
Bowgo Tsai26b0a262019-05-03 16:38:34 +08002017endif
2018
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002019BOARD_AVB_BOOT_TEST_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
2020INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS := --algorithm SHA256_RSA2048 --key $(BOARD_AVB_BOOT_TEST_KEY_PATH)
2021# $(1): the bootimage to sign
2022define test-key-sign-bootimage
Steve Muckle903a1ca2020-05-07 17:32:10 -07002023$(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(call get-bootimage-partition-size,$(1),boot-debug)))
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002024$(AVBTOOL) add_hash_footer \
2025 --image $(1) \
Steve Muckle903a1ca2020-05-07 17:32:10 -07002026 --partition_size $(call get-bootimage-partition-size,$(1),boot-debug)\
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002027 --partition_name boot $(INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS) \
2028 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
Steve Muckle903a1ca2020-05-07 17:32:10 -07002029$(call assert-max-image-size,$(1),$(call get-bootimage-partition-size,$(1),boot-debug))
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002030endef
2031
Steve Muckleb3dda772020-03-11 16:03:07 -07002032# $(1): output file
2033define build-debug-bootimage-target
2034 $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-debug,kernel,$(notdir $(1)))) \
2035 $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $1
2036 $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$1))
2037endef
2038
Bowgo Tsai0013f552019-03-20 17:59:52 +08002039# Depends on original boot.img and ramdisk-debug.img, to build the new boot-debug.img
2040$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET)
2041 $(call pretty,"Target boot debug image: $@")
Steve Muckleb3dda772020-03-11 16:03:07 -07002042 $(call build-debug-bootimage-target, $@)
Bowgo Tsai0013f552019-03-20 17:59:52 +08002043
2044.PHONY: bootimage_debug-nodeps
2045bootimage_debug-nodeps: $(MKBOOTIMG)
2046 echo "make $@: ignoring dependencies"
Steve Muckleb3dda772020-03-11 16:03:07 -07002047 $(foreach b,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call build-debug-bootimage-target,$b))
Bowgo Tsai0013f552019-03-20 17:59:52 +08002048
2049endif # TARGET_NO_KERNEL
2050
Bowgo Tsai6a683672020-02-14 19:00:15 +08002051ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true)
2052ifeq ($(BUILDING_RAMDISK_IMAGE),true)
2053# -----------------------------------------------------------------
2054# vendor debug ramdisk
2055# Combines vendor ramdisk files and debug ramdisk files to build the vendor debug ramdisk.
J. Avila3f6560e2020-05-11 20:20:03 +00002056INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/vendor-ramdisk-debug.cpio$(RAMDISK_EXT)
Bowgo Tsai6a683672020-02-14 19:00:15 +08002057$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_FILES := $(INTERNAL_DEBUG_RAMDISK_FILES)
2058$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): VENDOR_RAMDISK_DIR := $(TARGET_VENDOR_RAMDISK_OUT)
2059
2060INTERNAL_VENDOR_DEBUG_RAMDISK_FILES := $(filter $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)/%, \
2061 $(ALL_GENERATED_SOURCES) \
2062 $(ALL_DEFAULT_INSTALLED_MODULES))
2063
2064# Note: TARGET_VENDOR_DEBUG_RAMDISK_OUT will be $(PRODUCT_OUT)/vendor_debug_ramdisk/first_stage_ramdisk,
2065# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/vendor_debug_ramdisk.
2066# But the path of $(VENDOR_DEBUG_RAMDISK_DIR) to build the vendor debug ramdisk, is always
2067# $(PRODUCT_OUT)/vendor_debug_ramdisk.
2068$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): VENDOR_DEBUG_RAMDISK_DIR := $(PRODUCT_OUT)/vendor_debug_ramdisk
2069$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET)
J. Avila3f6560e2020-05-11 20:20:03 +00002070$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_VENDOR_DEBUG_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
Bowgo Tsai6a683672020-02-14 19:00:15 +08002071 $(call pretty,"Target vendor debug ram disk: $@")
2072 mkdir -p $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)
2073 touch $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)/force_debuggable
2074 $(foreach debug_file,$(DEBUG_RAMDISK_FILES), \
2075 cp -f $(debug_file) $(subst $(PRODUCT_OUT)/debug_ramdisk,$(PRODUCT_OUT)/vendor_debug_ramdisk,$(debug_file)) &&) true
2076 rsync -a $(VENDOR_RAMDISK_DIR)/ $(VENDOR_DEBUG_RAMDISK_DIR)
J. Avila3f6560e2020-05-11 20:20:03 +00002077 $(MKBOOTFS) -d $(TARGET_OUT) $(VENDOR_DEBUG_RAMDISK_DIR) | $(COMPRESSION_COMMAND) > $@
Bowgo Tsai6a683672020-02-14 19:00:15 +08002078
2079INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK := $(PRODUCT_OUT)/installed-files-vendor-ramdisk-debug.txt
2080INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK := $(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK:.txt=.json)
2081$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK)
2082$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): VENDOR_DEBUG_RAMDISK_DIR := $(PRODUCT_OUT)/vendor_debug_ramdisk
2083
2084# The vendor debug ramdisk will rsync from $(TARGET_VENDOR_RAMDISK_OUT) and $(INTERNAL_DEBUG_RAMDISK_FILES),
2085# so we have to wait for the vendor debug ramdisk to be built before generating the installed file list.
2086$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET)
2087$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): $(INTERNAL_VENDOR_DEBUG_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL)
2088 echo Installed file list: $@
2089 mkdir -p $(dir $@)
2090 rm -f $@
2091 $(FILESLIST) $(VENDOR_DEBUG_RAMDISK_DIR) > $(@:.txt=.json)
2092 $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
2093
2094# -----------------------------------------------------------------
2095# vendor_boot-debug.img.
2096INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot-debug.img
2097
2098# The util to sign vendor_boot-debug.img with a test key.
2099BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
2100INTERNAL_AVB_VENDOR_BOOT_TEST_SIGNING_ARGS := --algorithm SHA256_RSA2048 --key $(BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH)
2101# $(1): the vendor bootimage to sign
2102define test-key-sign-vendor-bootimage
2103$(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)))
2104$(AVBTOOL) add_hash_footer \
2105 --image $(1) \
2106 --partition_size $(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE) \
2107 --partition_name vendor_boot $(INTERNAL_AVB_VENDOR_BOOT_TEST_SIGNING_ARGS) \
2108 $(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS)
2109$(call assert-max-image-size,$(1),$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
2110endef
2111
2112ifneq ($(BOARD_AVB_VENDOR_BOOT_KEY_PATH),)
2113$(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH)
2114endif
2115
2116# Depends on vendor_boot.img and vendor-ramdisk-debug.cpio.gz to build the new vendor_boot-debug.img
2117$(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET)
2118 $(call pretty,"Target vendor_boot debug image: $@")
cfig125efba2020-05-11 15:00:35 +08002119 $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) --vendor_boot $@
Bowgo Tsai6a683672020-02-14 19:00:15 +08002120 $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))
2121 $(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),$(call test-key-sign-vendor-bootimage,$@))
2122
2123endif # BUILDING_RAMDISK_IMAGE
2124endif # BUILDING_VENDOR_BOOT_IMAGE
2125
Bowgo Tsai0013f552019-03-20 17:59:52 +08002126# -----------------------------------------------------------------
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002127# The test harness ramdisk, which is based off debug_ramdisk, plus a
2128# few additional test-harness-specific properties in adb_debug.prop.
2129
2130ifdef BUILDING_RAMDISK_IMAGE
2131BUILT_TEST_HARNESS_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-test-harness.img
2132INSTALLED_TEST_HARNESS_RAMDISK_TARGET := $(BUILT_TEST_HARNESS_RAMDISK_TARGET)
2133
2134# rsync the content from ramdisk-debug.img to ramdisk-test-harness.img, then
2135# appends a few test harness specific properties into the adb_debug.prop.
2136TEST_HARNESS_RAMDISK_SYNC_DIR := $(PRODUCT_OUT)/debug_ramdisk
2137TEST_HARNESS_RAMDISK_ROOT_DIR := $(PRODUCT_OUT)/test_harness_ramdisk
2138
2139# The following TARGET_TEST_HARNESS_RAMDISK_OUT will be $(PRODUCT_OUT)/test_harness_ramdisk/first_stage_ramdisk,
2140# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/test_harness_ramdisk.
2141TEST_HARNESS_PROP_TARGET := $(TARGET_TEST_HARNESS_RAMDISK_OUT)/adb_debug.prop
2142ADDITIONAL_TEST_HARNESS_PROPERTIES := ro.audio.silent=1
2143ADDITIONAL_TEST_HARNESS_PROPERTIES += ro.test_harness=1
2144
2145# $(1): a list of key=value pairs for additional property assignments
2146# $(2): the target .prop file to append the properties from $(1)
2147define append-test-harness-props
2148 echo "#" >> $(2); \
2149 echo "# ADDITIONAL TEST HARNESS_PROPERTIES" >> $(2); \
2150 echo "#" >> $(2);
2151 $(foreach line,$(1), echo "$(line)" >> $(2);)
2152endef
2153
2154$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(INSTALLED_DEBUG_RAMDISK_TARGET)
J. Avila3f6560e2020-05-11 20:20:03 +00002155$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_TEST_HARNESS_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS)
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002156 $(call pretty,"Target test harness ram disk: $@")
2157 rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR)
2158 $(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
J. Avila3f6560e2020-05-11 20:20:03 +00002159 $(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $@
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002160
2161.PHONY: ramdisk_test_harness-nodeps
J. Avila3f6560e2020-05-11 20:20:03 +00002162ramdisk_test_harness-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS)
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002163 echo "make $@: ignoring dependencies"
2164 rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR)
2165 $(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET))
J. Avila3f6560e2020-05-11 20:20:03 +00002166 $(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002167
2168endif # BUILDING_RAMDISK_IMAGE
2169
2170# -----------------------------------------------------------------
2171# the boot-test-harness.img, which is the kernel plus ramdisk-test-harness.img
2172#
2173# Note: it's intentional to skip signing for boot-test-harness.img, because it
2174# can only be used if the device is unlocked with verification error.
2175ifneq ($(strip $(TARGET_NO_KERNEL)),true)
2176
Steve Muckle4866bd62020-04-02 11:31:08 -07002177ifneq ($(strip $(BOARD_KERNEL_BINARIES)),)
2178 INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-test-harness,$(BOARD_KERNEL_BINARIES)), \
2179 $(PRODUCT_OUT)/$(k).img)
2180else
2181 INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-test-harness.img
2182endif
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002183
2184# Replace ramdisk-debug.img in $(MKBOOTIMG) ARGS with ramdisk-test-harness.img to build boot-test-harness.img
2185INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS := $(subst $(INSTALLED_DEBUG_RAMDISK_TARGET),$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET),$(INTERNAL_DEBUG_BOOTIMAGE_ARGS))
2186
2187# If boot.img is chained but boot-test-harness.img is not signed, libavb in bootloader
2188# will fail to find valid AVB metadata from the end of /boot, thus stop booting.
2189# Using a test key to sign boot-test-harness.img to continue booting with the mismatched
2190# public key, if the device is unlocked.
2191ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
2192$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH)
2193endif
2194
Steve Muckle4866bd62020-04-02 11:31:08 -07002195# $(1): output file
2196define build-boot-test-harness-target
2197 $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-test-harness,kernel,$(notdir $(1)))) \
2198 $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
2199 $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@))
2200endef
2201
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002202# Build the new boot-test-harness.img, based on boot-debug.img and ramdisk-test-harness.img.
2203$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET)
2204 $(call pretty,"Target boot test harness image: $@")
Steve Muckle4866bd62020-04-02 11:31:08 -07002205 $(call build-boot-test-harness-target,$@)
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002206
2207.PHONY: bootimage_test_harness-nodeps
2208bootimage_test_harness-nodeps: $(MKBOOTIMG)
2209 echo "make $@: ignoring dependencies"
Steve Muckle4866bd62020-04-02 11:31:08 -07002210 $(foreach b,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET),$(call build-boot-test-harness-target,$b))
Bowgo Tsai5c40c712019-10-08 10:22:19 +08002211
2212endif # TARGET_NO_KERNEL
2213endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true
2214
2215# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07002216# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08002217#
Ying Wang9c649a72012-08-08 15:27:00 -07002218# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
2219PDK_FUSION_SYSIMG_FILES := \
2220 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
2221 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002222
Dan Willemsen37a19862018-10-31 16:31:46 -07002223INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07002224 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07002225 $(ALL_DEFAULT_INSTALLED_MODULES) \
Bill Peckhame868aec2019-09-17 17:06:47 -07002226 $(PDK_FUSION_SYSIMG_FILES)) \
Dan Willemsen37a19862018-10-31 16:31:46 -07002227 $(PDK_FUSION_SYMLINK_STAMP))
Ying Wang160b6702012-03-13 18:58:27 -07002228
Ying Wang82cceba2012-08-13 15:03:00 -07002229FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002230
2231# ASAN libraries in the system image - add dependency.
2232ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
Evgenii Stepanov8841a7f2018-07-27 11:54:32 -07002233ifneq (,$(filter address, $(SANITIZE_TARGET)))
Andreas Gampe039b5c72017-03-24 16:06:31 -07002234 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
2235 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
2236 endif
2237endif
2238
Tom Cherryd14b8952018-08-09 14:26:00 -07002239FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
Luis Hector Chavezff489932018-07-03 15:41:40 -07002240
Ying Wange5e8c5f2011-09-09 16:35:53 -07002241# -----------------------------------------------------------------
Dan Willemsen67495202019-01-16 12:42:05 -08002242ifdef BUILDING_SYSTEM_IMAGE
2243
Ying Wange5e8c5f2011-09-09 16:35:53 -07002244# installed file list
2245# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
2246# We put installed-files.txt ahead of image itself in the dependency graph
2247# so that we can get the size stat even if the build fails due to too large
2248# system image.
2249INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07002250INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
2251$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002252$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST) $(FILESLIST_UTIL)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002253 @echo Installed file list: $@
2254 @mkdir -p $(dir $@)
2255 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002256 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002257 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07002258
2259.PHONY: installed-file-list
2260installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08002261
2262$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07002263
2264systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002265 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002266BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
2267
Ying Wang23898df2014-06-18 20:26:24 -07002268# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002269ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07002270define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07002271$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
2272 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
2273 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
2274 exit 1; \
2275fi
Ying Wang23898df2014-06-18 20:26:24 -07002276$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
2277endef
2278else
2279define create-system-vendor-symlink
2280endef
2281endif
2282
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002283# Create symlink /system/product to /product if necessary.
2284ifdef BOARD_USES_PRODUCTIMAGE
2285define create-system-product-symlink
2286$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
2287 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
2288 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
2289 exit 1; \
2290fi
2291$(hide) ln -sf /product $(TARGET_OUT)/product
2292endef
2293else
2294define create-system-product-symlink
2295endef
2296endif
2297
Justin Yun6151e3f2019-06-25 15:58:13 +09002298# Create symlink /system/system_ext to /system_ext if necessary.
2299ifdef BOARD_USES_SYSTEM_EXTIMAGE
2300define create-system-system_ext-symlink
2301$(hide) if [ -d $(TARGET_OUT)/system_ext ] && [ ! -h $(TARGET_OUT)/system_ext ]; then \
2302 echo 'Non-symlink $(TARGET_OUT)/system_ext detected!' 1>&2; \
2303 echo 'You cannot install files to $(TARGET_OUT)/system_ext while building a separate system_ext.img!' 1>&2; \
Dario Freni5f681e12018-05-29 13:09:01 +01002304 exit 1; \
2305fi
Justin Yun6151e3f2019-06-25 15:58:13 +09002306$(hide) ln -sf /system_ext $(TARGET_OUT)/system_ext
Dario Freni5f681e12018-05-29 13:09:01 +01002307endef
2308else
Justin Yun6151e3f2019-06-25 15:58:13 +09002309define create-system-system_ext-symlink
Dario Freni5f681e12018-05-29 13:09:01 +01002310endef
2311endif
2312
The Android Open Source Project88b60792009-03-03 19:28:42 -08002313# $(1): output file
2314define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07002315 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07002316 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002317 $(call create-system-product-symlink)
Justin Yun6151e3f2019-06-25 15:58:13 +09002318 $(call create-system-system_ext-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07002319 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002320 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07002321 skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002322 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002323 $(BUILD_IMAGE) \
2324 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
2325 || ( mkdir -p $${DIST_DIR}; \
2326 cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \
2327 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08002328endef
2329
Dan Willemsen6b72c732019-06-12 21:33:38 +00002330ifeq ($(BOARD_AVB_ENABLE),true)
2331$(BUILT_SYSTEMIMAGE): $(BOARD_AVB_SYSTEM_KEY_PATH)
2332endif
Tao Bao2bbb07c2019-05-07 13:12:21 -07002333$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002334 $(call build-systemimage-target,$@)
2335
Tao Baoe9d61b02018-08-20 21:09:07 -07002336INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07002337SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002338
Tao Baoe9d61b02018-08-20 21:09:07 -07002339# INSTALLED_SYSTEMIMAGE_TARGET used to be named INSTALLED_SYSTEMIMAGE. Create an alias for backward
2340# compatibility, in case device-specific Makefiles still refer to the old name.
2341INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
2342
Doug Zongker73ef8252009-07-23 15:12:53 -07002343# The system partition needs room for the recovery image as well. We
2344# now store the recovery image as a binary patch using the boot image
2345# as the source (since they are very similar). Generate the patch so
2346# we can see how big it's going to be, and include that in the system
2347# image size check calculation.
Tao Baob1a2e352018-08-14 16:17:12 -07002348ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
Sriram Raman1e96ac82009-07-24 13:52:32 -07002349ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07002350ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Chen, ZhiminX752439b2018-09-23 22:10:47 +08002351ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08002352diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
2353else
2354diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
2355endif
Doug Zongker73ef8252009-07-23 15:12:53 -07002356intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
2357RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08002358$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
2359$(RECOVERY_FROM_BOOT_PATCH): \
Anton Hansson6d814982018-11-26 18:12:05 +00002360 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2361 $(INSTALLED_BOOTIMAGE_TARGET) \
2362 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07002363 @echo "Construct recovery from boot"
2364 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08002365 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07002366else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
2367RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
Tao Baob1a2e352018-08-14 16:17:12 -07002368endif # BOARD_USES_FULL_RECOVERY_IMAGE
2369endif # INSTALLED_RECOVERYIMAGE_TARGET
2370endif # INSTALLED_BOOTIMAGE_TARGET
Doug Zongker73ef8252009-07-23 15:12:53 -07002371
Yifan Hong9a3cad92020-04-27 19:06:59 -07002372$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002373 @echo "Install system fs image: $@"
2374 $(copy-file-to-target)
Yifan Hong9a3cad92020-04-27 19:06:59 -07002375 $(hide) $(call assert-max-image-size,$@,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002376
Tao Baoe9d61b02018-08-20 21:09:07 -07002377systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002378
2379.PHONY: systemimage-nodeps snod
2380systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07002381 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002382 @echo "make $@: ignoring dependencies"
Tao Baoe9d61b02018-08-20 21:09:07 -07002383 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
Yifan Hong8c3dce02019-04-09 17:03:57 +00002384 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
Ying Wangacf01ec2012-02-24 11:05:48 -08002385ifeq (true,$(WITH_DEXPREOPT))
Dan Willemsen395358e2020-03-04 23:50:53 +00002386 $(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
Ying Wangacf01ec2012-02-24 11:05:48 -08002387endif
2388
Dan Willemsen67495202019-01-16 12:42:05 -08002389endif # BUILDING_SYSTEM_IMAGE
2390
Anton Hansson30e061b2018-11-12 13:36:46 +00002391.PHONY: sync syncsys
2392sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
Colin Cross91a52272017-06-20 16:57:52 -07002393
Ying Wang3a61eeb2016-03-11 10:32:01 -08002394# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07002395## platform.zip: system, plus other files to be used in PDK fusion build,
2396## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07002397##
2398## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
2399## The variable will be typically set from BoardConfig.mk.
2400## Files under out dir will be rejected to prevent possible conflicts with other rules.
Colin Cross53c8f972018-09-28 16:19:42 -07002401ifneq (,$(BUILD_PLATFORM_ZIP))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002402pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002403 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002404pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002405 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002406pdk_classes_dex := $(strip \
2407 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
Nicolas Geoffray2ca0e492019-10-18 14:47:19 +01002408 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.apk))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002409
2410pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
2411$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
2412$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
2413$(pdk_odex_config_mk) :
2414 @echo "PDK odex config makefile: $@"
2415 $(hide) mkdir -p $(dir $@)
2416 $(hide) echo "# Auto-generated. Do not modify." > $@
2417 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
2418 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
2419 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
2420 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
2421 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2422 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2423 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2424 )
2425 $(foreach m,$(PRIVATE_APPS),\
Nicolas Geoffray2ca0e492019-10-18 14:47:19 +01002426 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.apk)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08002427 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2428 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2429 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2430 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07002431 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08002432 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
2433 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
2434 )
2435
keunyoungc0178062013-07-22 14:54:58 -07002436PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07002437INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08002438
2439$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
2440$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
Colin Cross7363cde2018-09-14 21:51:11 -07002441$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP)
2442# dependencies for the other partitions are defined below after their file lists
2443# are known
Colin Crossd60401a2019-04-18 14:46:48 -07002444$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(API_FINGERPRINT)
Keun young Park816b9fd2012-05-16 10:32:41 -07002445 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Colin Cross7363cde2018-09-14 21:51:11 -07002446 rm -f $@ $@.lst
2447 echo "-C $(PRODUCT_OUT)" >> $@.lst
2448 echo "-D $(TARGET_OUT)" >> $@.lst
2449 echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst
2450 echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst
Dan Willemsen67495202019-01-16 12:42:05 -08002451ifdef BUILDING_VENDOR_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002452 echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst
Ying Wangcff38622014-07-16 17:46:35 -07002453endif
Dan Willemsen67495202019-01-16 12:42:05 -08002454ifdef BUILDING_PRODUCT_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002455 echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002456endif
Justin Yun6151e3f2019-06-25 15:58:13 +09002457ifdef BUILDING_SYSTEM_EXT_IMAGE
2458 echo "-D $(TARGET_OUT_SYSTEM_EXT)" >> $@.lst
Dario Freni5f681e12018-05-29 13:09:01 +01002459endif
Dan Willemsen67495202019-01-16 12:42:05 -08002460ifdef BUILDING_ODM_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002461 echo "-D $(TARGET_OUT_ODM)" >> $@.lst
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002462endif
Yifan Hongcfb917a2020-05-07 14:58:20 -07002463ifdef BUILDING_VENDOR_DLKM_IMAGE
2464 echo "-D $(TARGET_OUT_VENDOR_DLKM)" >> $@.lst
2465endif
Colin Crossc451a372013-12-18 19:36:44 -08002466ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Colin Cross7363cde2018-09-14 21:51:11 -07002467 echo "-C $(OUT_DIR)" >> $@.lst
2468 for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \
2469 if [ -e $$f ]; then \
2470 echo "-f $$f"; \
2471 fi \
2472 done >> $@.lst
Keun young Park816b9fd2012-05-16 10:32:41 -07002473endif
keunyoungc0178062013-07-22 14:54:58 -07002474ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Colin Cross7363cde2018-09-14 21:51:11 -07002475 echo "-C . $(addprefix -f ,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))" >> $@.lst
keunyoungc0178062013-07-22 14:54:58 -07002476endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08002477 @# Add dex-preopt files and config.
Colin Cross7363cde2018-09-14 21:51:11 -07002478 $(if $(PRIVATE_DEX_FILES),\
2479 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst
Colin Crossd60401a2019-04-18 14:46:48 -07002480 echo "-C $(dir $(API_FINGERPRINT)) -f $(API_FINGERPRINT)" >> $@.lst
Colin Cross7363cde2018-09-14 21:51:11 -07002481 touch $(PRODUCT_OUT)/pdk.mk
2482 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst
2483 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst
Ying Wang4c289e52012-03-30 13:52:54 -07002484
2485.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07002486platform: $(INSTALLED_PLATFORM_ZIP)
2487
2488.PHONY: platform-java
2489platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07002490
2491# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07002492ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
2493$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07002494endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002495
Colin Cross53c8f972018-09-28 16:19:42 -07002496endif # BUILD_PLATFORM_ZIP
2497
Ying Wang3a61eeb2016-03-11 10:32:01 -08002498# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08002499# data partition image
2500INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002501 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002502
Dan Willemsen67495202019-01-16 12:42:05 -08002503ifdef BUILDING_USERDATA_IMAGE
Ying Wangbd93d422011-10-28 17:02:30 -07002504userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002505 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07002506BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
2507
Ying Wangbd93d422011-10-28 17:02:30 -07002508define build-userdataimage-target
2509 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
2510 @mkdir -p $(TARGET_OUT_DATA)
2511 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002512 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002513 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002514 $(BUILD_IMAGE) \
2515 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt \
2516 $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
2517 $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07002518endef
2519
Joe Onorato64d85d02009-04-09 19:31:12 -07002520# We just build this directly to the install location.
2521INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002522INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
2523 $(INTERNAL_USERIMAGES_DEPS) \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002524 $(INTERNAL_USERDATAIMAGE_FILES)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002525$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002526 $(build-userdataimage-target)
2527
2528.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07002529userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002530 $(build-userdataimage-target)
2531
Dan Willemsen67495202019-01-16 12:42:05 -08002532endif # BUILDING_USERDATA_IMAGE
Ying Wange215ed52012-10-15 14:36:22 -07002533
Andreas Gampe039b5c72017-03-24 16:06:31 -07002534# ASAN libraries in the system image - build rule.
2535ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
2536 $(TARGET_OUT_SHARED_LIBRARIES) \
2537 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
2538 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
2539 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07002540# Extra options: Enforce the system user for the files to avoid having to change ownership.
2541ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07002542# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
2543# enough space.
2544$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07002545 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 -07002546
The Android Open Source Project88b60792009-03-03 19:28:42 -08002547# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04002548# partition table image
2549ifdef BOARD_BPT_INPUT_FILES
2550
2551BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002552BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04002553
2554INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
2555 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002556 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04002557 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
2558
2559ifdef BOARD_BPT_DISK_SIZE
2560INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
2561endif
2562
2563define build-bptimage-target
2564 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
2565 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
2566endef
2567
2568INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002569$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
2570 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
2571
David Zeuthen25328622016-04-08 15:08:03 -04002572$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
2573 $(build-bptimage-target)
2574
2575.PHONY: bptimage-nodeps
2576bptimage-nodeps:
2577 $(build-bptimage-target)
2578
2579endif # BOARD_BPT_INPUT_FILES
2580
2581# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07002582# cache partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002583ifdef BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002584INTERNAL_CACHEIMAGE_FILES := \
2585 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
2586
2587cacheimage_intermediates := \
2588 $(call intermediates-dir-for,PACKAGING,cache)
2589BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
2590
2591define build-cacheimage-target
2592 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
2593 @mkdir -p $(TARGET_OUT_CACHE)
2594 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002595 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002596 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002597 $(BUILD_IMAGE) \
2598 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt \
2599 $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
2600 $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07002601endef
2602
2603# We just build this directly to the install location.
2604INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Tao Bao2bbb07c2019-05-07 13:12:21 -07002605$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002606 $(build-cacheimage-target)
2607
2608.PHONY: cacheimage-nodeps
2609cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2610 $(build-cacheimage-target)
2611
Dan Willemsen67495202019-01-16 12:42:05 -08002612else # BUILDING_CACHE_IMAGE
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07002613# we need to ignore the broken cache link when doing the rsync
2614IGNORE_CACHE_LINK := --exclude=cache
Dan Willemsen67495202019-01-16 12:42:05 -08002615endif # BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002616
David Zeuthen0eb10972016-09-28 17:55:27 -04002617# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07002618# system_other partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002619ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002620ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
Alex Light4e358ab2016-06-16 14:47:10 -07002621# Marker file to identify that odex files are installed
2622INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2623ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2624$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2625 $(hide) touch $@
2626endif
2627
Alex Light4e358ab2016-06-16 14:47:10 -07002628INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2629 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2630 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002631 $(ALL_PDK_FUSION_FILES)) \
2632 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002633
Colin Cross6db5b0e2018-11-16 21:26:33 -08002634# system_other dex files are installed as a side-effect of installing system image files
2635INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES)
2636
Alex Light4e358ab2016-06-16 14:47:10 -07002637INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002638INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2639$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002640$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Alex Light4e358ab2016-06-16 14:47:10 -07002641 @echo Installed file list: $@
2642 @mkdir -p $(dir $@)
2643 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002644 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002645 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002646
Bowgo Tsai867ab662019-01-29 13:30:18 +08002647# Determines partition size for system_other.img.
2648ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
2649ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
2650INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE)
2651endif
2652endif
2653
2654ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE
2655INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE)
2656endif
2657
Alex Light4e358ab2016-06-16 14:47:10 -07002658systemotherimage_intermediates := \
2659 $(call intermediates-dir-for,PACKAGING,system_other)
2660BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2661
2662# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2663define build-systemotherimage-target
2664 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2665 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2666 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002667 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002668 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002669 $(BUILD_IMAGE) \
2670 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt \
2671 $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)
2672 $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
Alex Light4e358ab2016-06-16 14:47:10 -07002673endef
2674
2675# We just build this directly to the install location.
2676INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002677ifneq (true,$(SANITIZE_LITE))
2678# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002679$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2680 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002681endif
Alex Light4e358ab2016-06-16 14:47:10 -07002682
2683.PHONY: systemotherimage-nodeps
2684systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2685 $(build-systemotherimage-target)
2686
Dan Willemsen67495202019-01-16 12:42:05 -08002687endif # BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002688
2689
2690# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002691# vendor partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002692ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07002693INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002694 $(filter $(TARGET_OUT_VENDOR)/%,\
2695 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002696 $(ALL_PDK_FUSION_FILES)) \
2697 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002698
2699# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2700$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002701
Ying Wang8da19e32015-09-15 14:22:12 -07002702INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002703INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2704$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002705$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Ying Wang8da19e32015-09-15 14:22:12 -07002706 @echo Installed file list: $@
2707 @mkdir -p $(dir $@)
2708 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002709 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002710 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002711
Bill Peckham1f9b8f02019-07-03 15:58:48 -07002712# Create symlink /vendor/odm to /odm if necessary.
2713ifdef BOARD_USES_ODMIMAGE
2714define create-vendor-odm-symlink
2715$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
2716 echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
2717 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
2718 exit 1; \
2719fi
2720$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
2721endef
2722else
2723define create-vendor-odm-symlink
2724endef
2725endif
2726
Yifan Honge51dff22020-06-23 17:26:57 -07002727# Create symlinks for vendor_dlkm on devices with a vendor_dlkm partition:
2728# /vendor/lib/modules -> /vendor_dlkm/lib/modules
2729#
2730# On devices with a vendor_dlkm partition,
2731# - /vendor/lib/modules is a symlink to a directory that stores vendor DLKMs.
2732# - /vendor_dlkm/{etc,...} store other vendor_dlkm files directly. The vendor_dlkm partition is
2733# mounted at /vendor_dlkm at runtime and the symlinks created in system/core/rootdir/Android.mk
2734# are hidden.
2735# On devices without a vendor_dlkm partition,
2736# - /vendor/lib/modules stores vendor DLKMs directly.
2737# - /vendor_dlkm/{etc,...} are symlinks to directories that store other vendor_dlkm files.
2738# See system/core/rootdir/Android.mk for a list of created symlinks.
2739# The vendor DLKMs and other vendor_dlkm files must not be accessed using other paths because they
2740# are not guaranteed to exist on all devices.
2741ifdef BOARD_USES_VENDOR_DLKMIMAGE
2742define create-vendor-vendor_dlkm-symlink
2743$(hide) if [ -d $(TARGET_OUT_VENDOR)/lib/modules ] && [ ! -h $(TARGET_OUT_VENDOR)/lib/modules ]; then \
2744 echo 'Non-symlink $(TARGET_OUT_VENDOR)/lib/modules detected!' 1>&2; \
2745 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/lib/modules while building a separate vendor_dlkm.img!' 1>&2; \
2746 exit 1; \
2747fi
2748$(hide) ln -sf /vendor_dlkm/lib/modules $(TARGET_OUT_VENDOR)/lib/modules
2749endef
2750else
2751define create-vendor-vendor_dlkm-symlink
2752endef
2753endif
2754
Ying Wanga0febe52013-03-20 11:02:05 -07002755vendorimage_intermediates := \
2756 $(call intermediates-dir-for,PACKAGING,vendor)
2757BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002758define build-vendorimage-target
2759 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2760 @mkdir -p $(TARGET_OUT_VENDOR)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002761 $(call create-vendor-odm-symlink)
Yifan Honge51dff22020-06-23 17:26:57 -07002762 $(call create-vendor-vendor_dlkm-symlink)
Ying Wanga0febe52013-03-20 11:02:05 -07002763 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002764 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002765 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002766 $(BUILD_IMAGE) \
2767 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt \
2768 $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
Yifan Hong9a3cad92020-04-27 19:06:59 -07002769 $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET) $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
Ying Wanga0febe52013-03-20 11:02:05 -07002770endef
2771
2772# We just build this directly to the install location.
2773INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Tao Bao2bbb07c2019-05-07 13:12:21 -07002774$(INSTALLED_VENDORIMAGE_TARGET): \
2775 $(INTERNAL_USERIMAGES_DEPS) \
2776 $(INTERNAL_VENDORIMAGE_FILES) \
Yifan Hong9a3cad92020-04-27 19:06:59 -07002777 $(INSTALLED_FILES_FILE_VENDOR) \
2778 $(RECOVERY_FROM_BOOT_PATCH)
Ying Wanga0febe52013-03-20 11:02:05 -07002779 $(build-vendorimage-target)
2780
Steven Morelanda2e734d2017-03-07 12:10:09 -08002781.PHONY: vendorimage-nodeps vnod
Colin Cross4f60e362019-06-05 11:53:43 -07002782vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS)
Ying Wanga0febe52013-03-20 11:02:05 -07002783 $(build-vendorimage-target)
2784
Colin Cross91a52272017-06-20 16:57:52 -07002785sync: $(INTERNAL_VENDORIMAGE_FILES)
2786
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002787else ifdef BOARD_PREBUILT_VENDORIMAGE
2788INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2789$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2790endif
Ying Wanga0febe52013-03-20 11:02:05 -07002791
Ying Wang9f8e8db2011-11-04 11:37:01 -07002792# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002793# product partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002794ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002795INTERNAL_PRODUCTIMAGE_FILES := \
2796 $(filter $(TARGET_OUT_PRODUCT)/%,\
2797 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002798 $(ALL_PDK_FUSION_FILES)) \
2799 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002800
2801# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2802$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2803
2804INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002805INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2806$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002807$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002808 @echo Installed file list: $@
2809 @mkdir -p $(dir $@)
2810 @rm -f $@
2811 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002812 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002813
2814productimage_intermediates := \
2815 $(call intermediates-dir-for,PACKAGING,product)
2816BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2817define build-productimage-target
2818 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2819 @mkdir -p $(TARGET_OUT_PRODUCT)
2820 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002821 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002822 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002823 $(BUILD_IMAGE) \
2824 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt \
2825 $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
2826 $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002827endef
2828
2829# We just build this directly to the install location.
2830INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
Tao Bao2bbb07c2019-05-07 13:12:21 -07002831$(INSTALLED_PRODUCTIMAGE_TARGET): \
2832 $(INTERNAL_USERIMAGES_DEPS) \
2833 $(INTERNAL_PRODUCTIMAGE_FILES) \
2834 $(INSTALLED_FILES_FILE_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002835 $(build-productimage-target)
2836
2837.PHONY: productimage-nodeps pnod
2838productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2839 $(build-productimage-target)
2840
2841sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2842
2843else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2844INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2845$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2846endif
2847
2848# -----------------------------------------------------------------
Justin Yun6151e3f2019-06-25 15:58:13 +09002849# system_ext partition image
2850ifdef BUILDING_SYSTEM_EXT_IMAGE
2851INTERNAL_SYSTEM_EXTIMAGE_FILES := \
2852 $(filter $(TARGET_OUT_SYSTEM_EXT)/%,\
Dario Freni5f681e12018-05-29 13:09:01 +01002853 $(ALL_DEFAULT_INSTALLED_MODULES)\
2854 $(ALL_PDK_FUSION_FILES)) \
2855 $(PDK_FUSION_SYMLINK_STAMP)
2856
Justin Yun6151e3f2019-06-25 15:58:13 +09002857# platform.zip depends on $(INTERNAL_SYSTEM_EXTIMAGE_FILES).
2858$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEM_EXTIMAGE_FILES)
Dario Freni5f681e12018-05-29 13:09:01 +01002859
Justin Yun6151e3f2019-06-25 15:58:13 +09002860INSTALLED_FILES_FILE_SYSTEM_EXT := $(PRODUCT_OUT)/installed-files-system_ext.txt
2861INSTALLED_FILES_JSON_SYSTEM_EXT := $(INSTALLED_FILES_FILE_SYSTEM_EXT:.txt=.json)
2862$(INSTALLED_FILES_FILE_SYSTEM_EXT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEM_EXT)
2863$(INSTALLED_FILES_FILE_SYSTEM_EXT) : $(INTERNAL_SYSTEM_EXTIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Dario Freni5f681e12018-05-29 13:09:01 +01002864 @echo Installed file list: $@
2865 @mkdir -p $(dir $@)
2866 @rm -f $@
Justin Yun6151e3f2019-06-25 15:58:13 +09002867 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_EXT) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002868 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Dario Freni5f681e12018-05-29 13:09:01 +01002869
Justin Yun6151e3f2019-06-25 15:58:13 +09002870system_extimage_intermediates := \
2871 $(call intermediates-dir-for,PACKAGING,system_ext)
2872BUILT_SYSTEM_EXTIMAGE_TARGET := $(PRODUCT_OUT)/system_ext.img
2873define build-system_extimage-target
2874 $(call pretty,"Target system_ext fs image: $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)")
2875 @mkdir -p $(TARGET_OUT_SYSTEM_EXT)
2876 @mkdir -p $(system_extimage_intermediates) && rm -rf $(system_extimage_intermediates)/system_ext_image_info.txt
2877 $(call generate-image-prop-dictionary, $(system_extimage_intermediates)/system_ext_image_info.txt,system_ext, skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002878 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002879 $(BUILD_IMAGE) \
2880 $(TARGET_OUT_SYSTEM_EXT) \
2881 $(system_extimage_intermediates)/system_ext_image_info.txt \
2882 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
2883 $(TARGET_OUT)
2884 $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE))
Dario Freni5f681e12018-05-29 13:09:01 +01002885endef
2886
2887# We just build this directly to the install location.
Justin Yun6151e3f2019-06-25 15:58:13 +09002888INSTALLED_SYSTEM_EXTIMAGE_TARGET := $(BUILT_SYSTEM_EXTIMAGE_TARGET)
Tao Bao2bbb07c2019-05-07 13:12:21 -07002889$(INSTALLED_SYSTEM_EXTIMAGE_TARGET): \
2890 $(INTERNAL_USERIMAGES_DEPS) \
2891 $(INTERNAL_SYSTEM_EXTIMAGE_FILES) \
2892 $(INSTALLED_FILES_FILE_SYSTEM_EXT)
Justin Yun6151e3f2019-06-25 15:58:13 +09002893 $(build-system_extimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002894
Justin Yun6151e3f2019-06-25 15:58:13 +09002895.PHONY: systemextimage-nodeps senod
2896systemextimage-nodeps senod: | $(INTERNAL_USERIMAGES_DEPS)
2897 $(build-system_extimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002898
Justin Yun6151e3f2019-06-25 15:58:13 +09002899sync: $(INTERNAL_SYSTEM_EXTIMAGE_FILES)
Dario Freni5f681e12018-05-29 13:09:01 +01002900
Justin Yun6151e3f2019-06-25 15:58:13 +09002901else ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
2902INSTALLED_SYSTEM_EXTIMAGE_TARGET := $(PRODUCT_OUT)/system_ext.img
2903$(eval $(call copy-one-file,$(BOARD_PREBUILT_SYSTEM_EXTIMAGE),$(INSTALLED_SYSTEM_EXTIMAGE_TARGET)))
Dario Freni5f681e12018-05-29 13:09:01 +01002904endif
2905
2906# -----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002907# odm partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002908ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002909INTERNAL_ODMIMAGE_FILES := \
2910 $(filter $(TARGET_OUT_ODM)/%,\
2911 $(ALL_DEFAULT_INSTALLED_MODULES)\
2912 $(ALL_PDK_FUSION_FILES)) \
2913 $(PDK_FUSION_SYMLINK_STAMP)
2914# platform.zip depends on $(INTERNAL_ODMIMAGE_FILES).
2915$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODMIMAGE_FILES)
2916
2917INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt
2918INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json)
2919$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002920$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002921 @echo Installed file list: $@
2922 @mkdir -p $(dir $@)
2923 @rm -f $@
2924 $(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json)
Dan Willemsenc84e4cb2019-06-10 16:39:45 -07002925 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002926
2927odmimage_intermediates := \
2928 $(call intermediates-dir-for,PACKAGING,odm)
2929BUILT_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2930define build-odmimage-target
2931 $(call pretty,"Target odm fs image: $(INSTALLED_ODMIMAGE_TARGET)")
2932 @mkdir -p $(TARGET_OUT_ODM)
2933 @mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt
2934 $(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true)
Tao Baocf821fc2019-06-24 12:39:10 -07002935 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao2bbb07c2019-05-07 13:12:21 -07002936 $(BUILD_IMAGE) \
2937 $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt \
2938 $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT)
2939 $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),$(BOARD_ODMIMAGE_PARTITION_SIZE))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002940endef
2941
2942# We just build this directly to the install location.
2943INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET)
Tao Bao2bbb07c2019-05-07 13:12:21 -07002944$(INSTALLED_ODMIMAGE_TARGET): \
2945 $(INTERNAL_USERIMAGES_DEPS) \
2946 $(INTERNAL_ODMIMAGE_FILES) \
2947 $(INSTALLED_FILES_FILE_ODM)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002948 $(build-odmimage-target)
2949
2950.PHONY: odmimage-nodeps onod
Colin Cross4f60e362019-06-05 11:53:43 -07002951odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002952 $(build-odmimage-target)
2953
2954sync: $(INTERNAL_ODMIMAGE_FILES)
2955
2956else ifdef BOARD_PREBUILT_ODMIMAGE
2957INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2958$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET)))
2959endif
2960
2961# -----------------------------------------------------------------
Yifan Hongcfb917a2020-05-07 14:58:20 -07002962# vendor_dlkm partition image
2963ifdef BUILDING_VENDOR_DLKM_IMAGE
2964INTERNAL_VENDOR_DLKMIMAGE_FILES := \
2965 $(filter $(TARGET_OUT_VENDOR_DLKM)/%,\
2966 $(ALL_DEFAULT_INSTALLED_MODULES)\
2967 $(ALL_PDK_FUSION_FILES)) \
2968 $(PDK_FUSION_SYMLINK_STAMP)
2969# platform.zip depends on $(INTERNAL_VENDOR_DLKMIMAGE_FILES).
2970$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDOR_DLKMIMAGE_FILES)
2971
2972INSTALLED_FILES_FILE_VENDOR_DLKM := $(PRODUCT_OUT)/installed-files-vendor_dlkm.txt
2973INSTALLED_FILES_JSON_VENDOR_DLKM := $(INSTALLED_FILES_FILE_VENDOR_DLKM:.txt=.json)
2974$(INSTALLED_FILES_FILE_VENDOR_DLKM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR_DLKM)
2975$(INSTALLED_FILES_FILE_VENDOR_DLKM) : $(INTERNAL_VENDOR_DLKMIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
2976 @echo Installed file list: $@
2977 @mkdir -p $(dir $@)
2978 @rm -f $@
2979 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR_DLKM) > $(@:.txt=.json)
2980 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
2981
2982vendor_dlkmimage_intermediates := \
2983 $(call intermediates-dir-for,PACKAGING,vendor_dlkm)
2984BUILT_VENDOR_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/vendor_dlkm.img
2985define build-vendor_dlkmimage-target
2986 $(call pretty,"Target vendor_dlkm fs image: $(INSTALLED_VENDOR_DLKMIMAGE_TARGET)")
2987 @mkdir -p $(TARGET_OUT_VENDOR_DLKM)
2988 @mkdir -p $(vendor_dlkmimage_intermediates) && rm -rf $(vendor_dlkmimage_intermediates)/vendor_dlkm_image_info.txt
2989 $(call generate-userimage-prop-dictionary, $(vendor_dlkmimage_intermediates)/vendor_dlkm_image_info.txt, skip_fsck=true)
2990 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
2991 $(BUILD_IMAGE) \
2992 $(TARGET_OUT_VENDOR_DLKM) $(vendor_dlkmimage_intermediates)/vendor_dlkm_image_info.txt \
2993 $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) $(TARGET_OUT)
2994 $(call assert-max-image-size,$(INSTALLED_VENDOR_DLKMIMAGE_TARGET),$(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE))
2995endef
2996
2997# We just build this directly to the install location.
2998INSTALLED_VENDOR_DLKMIMAGE_TARGET := $(BUILT_VENDOR_DLKMIMAGE_TARGET)
2999$(INSTALLED_VENDOR_DLKMIMAGE_TARGET): \
3000 $(INTERNAL_USERIMAGES_DEPS) \
3001 $(INTERNAL_VENDOR_DLKMIMAGE_FILES) \
3002 $(INSTALLED_FILES_FILE_VENDOR_DLKM)
3003 $(build-vendor_dlkmimage-target)
3004
3005.PHONY: vendor_dlkmimage-nodeps vdnod
3006vendor_dlkmimage-nodeps vdnod: | $(INTERNAL_USERIMAGES_DEPS)
3007 $(build-vendor_dlkmimage-target)
3008
3009sync: $(INTERNAL_VENDOR_DLKMIMAGE_FILES)
3010
3011else ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE
3012INSTALLED_VENDOR_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/vendor_dlkm.img
3013$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDOR_DLKMIMAGE),$(INSTALLED_VENDOR_DLKMIMAGE_TARGET)))
3014endif
3015
3016# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07003017# dtbo image
3018ifdef BOARD_PREBUILT_DTBOIMAGE
3019INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
3020
3021ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003022$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07003023 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
3024 $(AVBTOOL) add_hash_footer \
Anton Hansson6d814982018-11-26 18:12:05 +00003025 --image $@ \
3026 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
3027 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
3028 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
Yueyao Zhu211c9012017-04-27 00:34:50 -07003029else
3030$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
3031 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
3032endif
3033
Tao Bao0da43472018-08-22 22:53:41 -07003034endif # BOARD_PREBUILT_DTBOIMAGE
3035
3036# Returns a list of image targets corresponding to the given list of partitions. For example, it
3037# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET)
3038# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor".
Justin Yun6151e3f2019-06-25 15:58:13 +09003039# (1): list of partitions like "system", "vendor" or "system product system_ext".
Tao Bao0da43472018-08-22 22:53:41 -07003040define images-for-partitions
3041$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))
3042endef
Yueyao Zhu211c9012017-04-27 00:34:50 -07003043
3044# -----------------------------------------------------------------
Hongguang Chenf23364d2020-04-27 18:36:36 -07003045# custom images
3046INSTALLED_CUSTOMIMAGES_TARGET :=
3047
3048ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),)
3049INTERNAL_AVB_CUSTOMIMAGES_SIGNING_ARGS :=
3050
3051# Sign custom image.
3052# $(1): the prebuilt custom image.
3053# $(2): the mount point of the prebuilt custom image.
3054# $(3): the signed custom image target.
3055define sign_custom_image
3056$(3): $(1) $(INTERNAL_USERIMAGES_DEPS)
3057 @echo Target custom image: $(3)
3058 mkdir -p $(dir $(3))
3059 cp $(1) $(3)
3060ifeq ($(BOARD_AVB_ENABLE),true)
3061 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$$$PATH \
3062 $(AVBTOOL) add_hashtree_footer \
3063 --image $(3) \
3064 --key $(BOARD_AVB_$(call to-upper,$(2))_KEY_PATH) \
3065 --algorithm $(BOARD_AVB_$(call to-upper,$(2))_ALGORITHM) \
3066 --partition_size $(BOARD_AVB_$(call to-upper,$(2))_PARTITION_SIZE) \
3067 --partition_name $(2) \
3068 $(INTERNAL_AVB_CUSTOMIMAGES_SIGNING_ARGS) \
3069 $(BOARD_AVB_$(call to-upper,$(2))_ADD_HASHTREE_FOOTER_ARGS)
3070endif
3071INSTALLED_CUSTOMIMAGES_TARGET += $(3)
3072endef
3073
3074$(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
3075 $(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST), \
3076 $(eval $(call sign_custom_image,$(image),$(partition),$(PRODUCT_OUT)/$(notdir $(image))))))
3077endif
3078
3079# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003080# vbmeta image
3081ifeq ($(BOARD_AVB_ENABLE),true)
3082
3083BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003084AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003085
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003086ifdef BOARD_AVB_KEY_PATH
3087$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
3088else
3089# If key path isn't specified, use the 4096-bit test key.
3090BOARD_AVB_ALGORITHM := SHA256_RSA4096
3091BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
3092endif
3093
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08003094# AVB signing for system_other.img.
3095ifdef BUILDING_SYSTEM_OTHER_IMAGE
3096ifdef BOARD_AVB_SYSTEM_OTHER_KEY_PATH
3097$(if $(BOARD_AVB_SYSTEM_OTHER_ALGORITHM),,$(error BOARD_AVB_SYSTEM_OTHER_ALGORITHM is not defined))
3098else
3099# If key path isn't specified, use the same key as BOARD_AVB_KEY_PATH.
3100BOARD_AVB_SYSTEM_OTHER_KEY_PATH := $(BOARD_AVB_KEY_PATH)
3101BOARD_AVB_SYSTEM_OTHER_ALGORITHM := $(BOARD_AVB_ALGORITHM)
3102endif
3103
Bowgo Tsaie4544b12019-02-27 10:15:51 +08003104$(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET): $(AVBTOOL) $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)
3105 @echo Extracting system_other avb key: $@
3106 @rm -f $@
3107 @mkdir -p $(dir $@)
3108 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH) --output $@
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08003109
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08003110ifndef BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX
3111BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
3112endif
3113
3114BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX)
3115endif # end of AVB for BUILDING_SYSTEM_OTHER_IMAGE
3116
Tao Bao744c4c72018-08-20 21:09:07 -07003117INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \
David Anderson7709ab22018-10-15 14:41:34 -07003118 $(BOARD_AVB_VBMETA_SYSTEM) \
Tao Bao744c4c72018-08-20 21:09:07 -07003119 $(BOARD_AVB_VBMETA_VENDOR)
3120
3121# Not allowing the same partition to appear in multiple groups.
3122ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
David Anderson7709ab22018-10-15 14:41:34 -07003123 $(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates)
Tao Bao744c4c72018-08-20 21:09:07 -07003124endif
3125
cfig1aeef722019-09-20 22:45:06 +08003126# When building a standalone recovery image for non-A/B devices, recovery image must be self-signed
3127# to be verified independently, and cannot be chained into vbmeta.img. See the link below for
3128# details.
Yifan Hong65afc072020-04-17 10:08:10 -07003129ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
cfig1aeef722019-09-20 22:45:06 +08003130ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3131$(if $(BOARD_AVB_RECOVERY_KEY_PATH),,\
Yifan Hong65afc072020-04-17 10:08:10 -07003132 $(error BOARD_AVB_RECOVERY_KEY_PATH must be defined for if non-A/B is supported. \
cfig1aeef722019-09-20 22:45:06 +08003133 See https://android.googlesource.com/platform/external/avb/+/master/README.md#booting-into-recovery))
3134endif
3135endif
3136
Bowgo Tsai9b548012019-05-14 16:57:03 +08003137# Appends os version and security patch level as a AVB property descriptor
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003138
3139BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
Tao Bao19b02fe2019-10-09 00:04:28 -07003140 --prop com.android.build.system.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003141 --prop com.android.build.system.os_version:$(PLATFORM_VERSION) \
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003142 --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
3143
3144BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
Tao Bao19b02fe2019-10-09 00:04:28 -07003145 --prop com.android.build.product.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003146 --prop com.android.build.product.os_version:$(PLATFORM_VERSION) \
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003147 --prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
3148
Justin Yun6151e3f2019-06-25 15:58:13 +09003149BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS += \
Tao Bao19b02fe2019-10-09 00:04:28 -07003150 --prop com.android.build.system_ext.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
Justin Yun6151e3f2019-06-25 15:58:13 +09003151 --prop com.android.build.system_ext.os_version:$(PLATFORM_VERSION) \
3152 --prop com.android.build.system_ext.security_patch:$(PLATFORM_SECURITY_PATCH)
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003153
Bowgo Tsai9b548012019-05-14 16:57:03 +08003154BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
Tao Bao19b02fe2019-10-09 00:04:28 -07003155 --prop com.android.build.boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003156 --prop com.android.build.boot.os_version:$(PLATFORM_VERSION)
3157
Tao Bao19b02fe2019-10-09 00:04:28 -07003158BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS += \
3159 --prop com.android.build.vendor_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
3160
3161BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS += \
3162 --prop com.android.build.recovery.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
3163
Bowgo Tsai9b548012019-05-14 16:57:03 +08003164BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
Tao Bao19b02fe2019-10-09 00:04:28 -07003165 --prop com.android.build.vendor.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003166 --prop com.android.build.vendor.os_version:$(PLATFORM_VERSION)
3167
3168BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
Tao Bao19b02fe2019-10-09 00:04:28 -07003169 --prop com.android.build.odm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003170 --prop com.android.build.odm.os_version:$(PLATFORM_VERSION)
3171
Yifan Hongcfb917a2020-05-07 14:58:20 -07003172BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
3173 --prop com.android.build.vendor_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \
3174 --prop com.android.build.vendor_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE)
3175
Tao Bao19b02fe2019-10-09 00:04:28 -07003176BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \
3177 --prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE)
3178
Bowgo Tsai9b548012019-05-14 16:57:03 +08003179# The following vendor- and odm-specific images needs explicit SPL set per board.
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003180ifdef BOOT_SECURITY_PATCH
3181BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
3182 --prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH)
3183endif
3184
3185ifdef VENDOR_SECURITY_PATCH
3186BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
3187 --prop com.android.build.vendor.security_patch:$(VENDOR_SECURITY_PATCH)
3188endif
3189
3190ifdef ODM_SECURITY_PATCH
3191BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
3192 --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH)
3193endif
3194
Yifan Hongcfb917a2020-05-07 14:58:20 -07003195ifdef VENDOR_DLKM_SECURITY_PATCH
3196BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += \
3197 --prop com.android.build.vendor_dlkm.security_patch:$(VENDOR_DLKM_SECURITY_PATCH)
3198endif
3199
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003200BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
Steve Mucklee1b10862019-07-10 10:49:37 -07003201VENDOR_BOOT_FOOTER_ARGS := BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003202DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
3203SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
3204VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05003205RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003206PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Justin Yun6151e3f2019-06-25 15:58:13 +09003207SYSTEM_EXT_FOOTER_ARGS := BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003208ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
Yifan Hongcfb917a2020-05-07 14:58:20 -07003209VENDOR_DLKM_FOOTER_ARGS := BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003210
Tao Bao0da43472018-08-22 22:53:41 -07003211# Helper function that checks and sets required build variables for an AVB chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003212# $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system.
Tao Bao0da43472018-08-22 22:53:41 -07003213define _check-and-set-avb-chain-args
3214$(eval part := $(1))
3215$(eval PART=$(call to-upper,$(part)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003216
3217$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
3218$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
3219$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
3220$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
3221$(if $($(_key_path)),,$(error $(_key_path) is not defined))
3222$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
3223$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
3224$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
3225
3226# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
3227$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
3228$(eval $(_signing_args) := \
3229 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
3230
cfig1aeef722019-09-20 22:45:06 +08003231# The recovery partition in non-A/B devices should be verified separately. Skip adding the chain
3232# partition descriptor for recovery partition into vbmeta.img.
Yifan Hong65afc072020-04-17 10:08:10 -07003233$(if $(or $(filter-out true,$(TARGET_OTA_ALLOW_NON_AB)),$(filter-out recovery,$(part))),\
cfig1aeef722019-09-20 22:45:06 +08003234 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3235 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003236
Tao Bao744c4c72018-08-20 21:09:07 -07003237# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up
David Anderson7709ab22018-10-15 14:41:34 -07003238# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX).
Tao Bao744c4c72018-08-20 21:09:07 -07003239$(if $(filter $(part),$(part:vbmeta_%=%)),\
3240 $(eval _footer_args := $(PART)_FOOTER_ARGS) \
3241 $(eval $($(_footer_args)) += --rollback_index $($(_rollback_index))))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003242endef
3243
Tao Bao0da43472018-08-22 22:53:41 -07003244# Checks and sets the required build variables for an AVB partition. The partition will be
3245# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the
Tao Bao744c4c72018-08-20 21:09:07 -07003246# image descriptor will be included into vbmeta.img, unless it has been already added to any chained
3247# VBMeta image.
Roopesh Nataraja3e15f6e2020-06-08 19:54:13 -07003248# Multiple boot images can be generated based on BOARD_KERNEL_BINARIES
3249# but vbmeta would capture the image descriptor of only the first boot
3250# image specified in BUILT_BOOTIMAGE_TARGET.
Tao Bao0da43472018-08-22 22:53:41 -07003251# $(1): Partition name, e.g. boot or system.
3252define check-and-set-avb-args
Tao Bao744c4c72018-08-20 21:09:07 -07003253$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
Tao Bao0da43472018-08-22 22:53:41 -07003254$(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\
Tao Bao744c4c72018-08-20 21:09:07 -07003255 $(if $(_in_chained_vbmeta),\
3256 $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \
Tao Bao0da43472018-08-22 22:53:41 -07003257 $(call _check-and-set-avb-chain-args,$(1)),\
Tao Bao744c4c72018-08-20 21:09:07 -07003258 $(if $(_in_chained_vbmeta),,\
Roopesh Nataraja3e15f6e2020-06-08 19:54:13 -07003259 $(if $(filter boot,$(1)),\
3260 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3261 --include_descriptors_from_image $(firstword $(call images-for-partitions,$(1)))),\
3262 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3263 --include_descriptors_from_image $(call images-for-partitions,$(1))))))
Tao Bao0da43472018-08-22 22:53:41 -07003264endef
3265
Hongguang Chenf23364d2020-04-27 18:36:36 -07003266# Checks and sets build variables for a custom chained partition to include it into vbmeta.img.
3267# $(1): the custom partition to enable AVB chain.
3268define check-and-set-custom-avb-chain-args
3269$(eval part := $(1))
3270$(eval PART=$(call to-upper,$(part)))
3271$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
3272$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
3273
3274INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3275 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey
3276endef
3277
Tao Baob1a2e352018-08-14 16:17:12 -07003278ifdef INSTALLED_BOOTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003279$(eval $(call check-and-set-avb-args,boot))
Tao Baob1a2e352018-08-14 16:17:12 -07003280endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003281
Steve Mucklee1b10862019-07-10 10:49:37 -07003282ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
3283$(eval $(call check-and-set-avb-args,vendor_boot))
3284endif
3285
Tao Bao0da43472018-08-22 22:53:41 -07003286$(eval $(call check-and-set-avb-args,system))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003287
3288ifdef INSTALLED_VENDORIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003289$(eval $(call check-and-set-avb-args,vendor))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003290endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003291
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003292ifdef INSTALLED_PRODUCTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003293$(eval $(call check-and-set-avb-args,product))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003294endif
3295
Justin Yun6151e3f2019-06-25 15:58:13 +09003296ifdef INSTALLED_SYSTEM_EXTIMAGE_TARGET
3297$(eval $(call check-and-set-avb-args,system_ext))
Tao Baocee6d042018-08-22 23:39:03 -07003298endif
3299
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003300ifdef INSTALLED_ODMIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003301$(eval $(call check-and-set-avb-args,odm))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003302endif
3303
Yifan Hongcfb917a2020-05-07 14:58:20 -07003304ifdef INSTALLED_VENDOR_DLKMIMAGE_TARGET
3305$(eval $(call check-and-set-avb-args,vendor_dlkm))
3306endif
3307
Yueyao Zhu211c9012017-04-27 00:34:50 -07003308ifdef INSTALLED_DTBOIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003309$(eval $(call check-and-set-avb-args,dtbo))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003310endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07003311
David Zeuthen8fecb282017-12-01 16:24:01 -05003312ifdef INSTALLED_RECOVERYIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003313$(eval $(call check-and-set-avb-args,recovery))
David Zeuthen8fecb282017-12-01 16:24:01 -05003314endif
Bowgo Tsai53cf9992017-06-13 11:27:06 +08003315
David Anderson7709ab22018-10-15 14:41:34 -07003316# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet.
3317ifdef BOARD_AVB_VBMETA_SYSTEM
3318$(eval $(call check-and-set-avb-args,vbmeta_system))
Tao Bao744c4c72018-08-20 21:09:07 -07003319endif
3320
3321ifdef BOARD_AVB_VBMETA_VENDOR
3322$(eval $(call check-and-set-avb-args,vbmeta_vendor))
3323endif
3324
Hongguang Chenf23364d2020-04-27 18:36:36 -07003325ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),)
3326$(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
3327 $(eval $(call check-and-set-custom-avb-chain-args,$(partition))))
3328endif
3329
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003330# Add kernel cmdline descriptor for kernel to mount system.img as root with
3331# dm-verity. This works when system.img is either chained or not-chained:
3332# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
3333# cmdline descriptor to system.img
3334# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
3335# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08003336ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
David Anderson8916a2a2018-09-18 15:46:59 -07003337ifeq ($(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003338BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08003339endif
David Anderson8916a2a2018-09-18 15:46:59 -07003340endif
Bowgo Tsai9b377602017-04-14 18:50:11 +08003341
Tao Bao0da43472018-08-22 22:53:41 -07003342BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
David Anderson7709ab22018-10-15 14:41:34 -07003343BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += --padding_size 4096
Tao Bao744c4c72018-08-20 21:09:07 -07003344BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += --padding_size 4096
3345
3346ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
Tao Bao240dcb82018-10-22 13:02:53 -07003347# We only need the flag in top-level vbmeta.img.
Tao Bao744c4c72018-08-20 21:09:07 -07003348BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
Tao Bao744c4c72018-08-20 21:09:07 -07003349endif
Tao Bao0da43472018-08-22 22:53:41 -07003350
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003351ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003352BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003353endif
3354
David Anderson7709ab22018-10-15 14:41:34 -07003355ifdef BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX
3356BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += \
3357 --rollback_index $(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX)
Tao Bao744c4c72018-08-20 21:09:07 -07003358endif
3359
3360ifdef BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX
3361BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += \
3362 --rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX)
John Reck0588b432018-05-03 13:20:01 -07003363endif
3364
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003365# $(1): the directory to extract public keys to
3366define extract-avb-chain-public-keys
3367 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
3368 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
3369 --output $(1)/boot.avbpubkey)
Steve Mucklee1b10862019-07-10 10:49:37 -07003370 $(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),\
3371 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_BOOT_KEY_PATH) \
3372 --output $(1)/vendor_boot.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003373 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
3374 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
3375 --output $(1)/system.avbpubkey)
3376 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
3377 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
3378 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003379 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
3380 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
3381 --output $(1)/product.avbpubkey)
Justin Yun6151e3f2019-06-25 15:58:13 +09003382 $(if $(BOARD_AVB_SYSTEM_EXT_KEY_PATH),\
3383 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_EXT_KEY_PATH) \
3384 --output $(1)/system_ext.avbpubkey)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003385 $(if $(BOARD_AVB_ODM_KEY_PATH),\
3386 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \
3387 --output $(1)/odm.avbpubkey)
Yifan Hongcfb917a2020-05-07 14:58:20 -07003388 $(if $(BOARD_AVB_VENDOR_DLKM_KEY_PATH),\
3389 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_DLKM_KEY_PATH) \
3390 --output $(1)/vendor_dlkm.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003391 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
3392 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
3393 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05003394 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
3395 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
3396 --output $(1)/recovery.avbpubkey)
David Anderson7709ab22018-10-15 14:41:34 -07003397 $(if $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH),\
3398 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3399 --output $(1)/vbmeta_system.avbpubkey)
Tao Bao744c4c72018-08-20 21:09:07 -07003400 $(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\
3401 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3402 --output $(1)/vbmeta_vendor.avbpubkey)
Hongguang Chenf23364d2020-04-27 18:36:36 -07003403 $(if $(BOARD_CUSTOMIMAGES_PARTITION_LIST),\
3404 $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
3405 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH) \
3406 --output $(1)/$(partition).avbpubkey;))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003407endef
3408
Tao Bao744c4c72018-08-20 21:09:07 -07003409# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
3410# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level
David Anderson7709ab22018-10-15 14:41:34 -07003411# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM
Justin Yun6151e3f2019-06-25 15:58:13 +09003412# := system system_ext`, `vbmeta_system.img` will be created that includes the descriptors for
3413# `system.img` and `system_ext.img`. `vbmeta_system.img` itself will be included into
Tao Bao744c4c72018-08-20 21:09:07 -07003414# `vbmeta.img` as a chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003415# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
Tao Bao744c4c72018-08-20 21:09:07 -07003416# $(2): Output filename.
3417define build-chained-vbmeta-image
3418 $(call pretty,"Target chained vbmeta image: $@")
3419 $(hide) $(AVBTOOL) make_vbmeta_image \
3420 $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
3421 $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
3422 $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
3423 --include_descriptors_from_image $(call images-for-partitions,$(image))) \
3424 --output $@
3425endef
3426
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003427ifdef BUILDING_SYSTEM_IMAGE
David Anderson7709ab22018-10-15 14:41:34 -07003428ifdef BOARD_AVB_VBMETA_SYSTEM
3429INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img
3430$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003431 $(AVBTOOL) \
3432 $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
3433 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
David Anderson7709ab22018-10-15 14:41:34 -07003434 $(call build-chained-vbmeta-image,vbmeta_system)
Tao Bao744c4c72018-08-20 21:09:07 -07003435endif
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003436endif # BUILDING_SYSTEM_IMAGE
Tao Bao744c4c72018-08-20 21:09:07 -07003437
3438ifdef BOARD_AVB_VBMETA_VENDOR
3439INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img
3440$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003441 $(AVBTOOL) \
3442 $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
3443 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
Tao Bao744c4c72018-08-20 21:09:07 -07003444 $(call build-chained-vbmeta-image,vbmeta_vendor)
3445endif
3446
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003447define build-vbmetaimage-target
3448 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003449 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
3450 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003451 $(hide) $(AVBTOOL) make_vbmeta_image \
3452 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
Tao Bao0da43472018-08-22 22:53:41 -07003453 $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003454 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
3455 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003456 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003457endef
3458
Paul Trautrim4e143232019-08-13 16:30:57 +09003459ifdef BUILDING_VBMETA_IMAGE
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003460INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
Tao Bao0da43472018-08-22 22:53:41 -07003461$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
3462 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
3463
David Zeuthen8fecb282017-12-01 16:24:01 -05003464$(INSTALLED_VBMETAIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003465 $(AVBTOOL) \
3466 $(INSTALLED_BOOTIMAGE_TARGET) \
Steve Mucklee1b10862019-07-10 10:49:37 -07003467 $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00003468 $(INSTALLED_SYSTEMIMAGE_TARGET) \
3469 $(INSTALLED_VENDORIMAGE_TARGET) \
3470 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Justin Yun6151e3f2019-06-25 15:58:13 +09003471 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00003472 $(INSTALLED_ODMIMAGE_TARGET) \
Yifan Hongcfb917a2020-05-07 14:58:20 -07003473 $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00003474 $(INSTALLED_DTBOIMAGE_TARGET) \
Hongguang Chenf23364d2020-04-27 18:36:36 -07003475 $(INSTALLED_CUSTOMIMAGES_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00003476 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3477 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
3478 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
3479 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3480 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3481 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003482 $(build-vbmetaimage-target)
3483
3484.PHONY: vbmetaimage-nodeps
Bowgo Tsai6a4eaa52019-12-09 15:48:09 +08003485vbmetaimage-nodeps: PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
3486 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003487vbmetaimage-nodeps:
3488 $(build-vbmetaimage-target)
Paul Trautrim4e143232019-08-13 16:30:57 +09003489endif # BUILDING_VBMETA_IMAGE
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003490
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003491endif # BOARD_AVB_ENABLE
3492
3493# -----------------------------------------------------------------
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003494# Check VINTF of build
3495
Yifan Hongcfb917a2020-05-07 14:58:20 -07003496# Note: vendor_dlkm does not have VINTF files.
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01003497ifeq (,$(TARGET_BUILD_UNBUNDLED))
Yifan Hongcfb917a2020-05-07 14:58:20 -07003498
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003499intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all)
3500check_vintf_all_deps :=
3501
Yifan Hongaf9b0702020-01-21 12:46:57 -08003502# The build system only writes VINTF metadata to */etc/vintf paths. Legacy paths aren't needed here
3503# because they are only used for prebuilt images.
3504check_vintf_common_srcs_patterns := \
3505 $(TARGET_OUT)/etc/vintf/% \
3506 $(TARGET_OUT_VENDOR)/etc/vintf/% \
3507 $(TARGET_OUT_ODM)/etc/vintf/% \
3508 $(TARGET_OUT_PRODUCT)/etc/vintf/% \
3509 $(TARGET_OUT_SYSTEM_EXT)/etc/vintf/% \
3510
3511check_vintf_common_srcs := $(sort $(filter $(check_vintf_common_srcs_patterns), \
3512 $(INTERNAL_SYSTEMIMAGE_FILES) \
3513 $(INTERNAL_VENDORIMAGE_FILES) \
3514 $(INTERNAL_ODMIMAGE_FILES) \
3515 $(INTERNAL_PRODUCTIMAGE_FILES) \
3516 $(INTERNAL_SYSTEM_EXTIMAGE_FILES) \
3517))
3518check_vintf_common_srcs_patterns :=
3519
3520check_vintf_has_system :=
3521check_vintf_has_vendor :=
3522
Yifan Hong28ffd732020-03-13 13:11:10 -07003523ifneq (,$(filter EMPTY_ODM_SKU_PLACEHOLDER,$(ODM_MANIFEST_SKUS)))
3524$(error EMPTY_ODM_SKU_PLACEHOLDER is an internal variable and cannot be used for ODM_MANIFEST_SKUS)
3525endif
3526ifneq (,$(filter EMPTY_VENDOR_SKU_PLACEHOLDER,$(DEVICE_MANIFEST_SKUS)))
3527$(error EMPTY_VENDOR_SKU_PLACEHOLDER is an internal variable and cannot be used for DEIVCE_MANIFEST_SKUS)
3528endif
3529
Yifan Hong605ea042020-01-14 21:36:00 +00003530# -- Check system manifest / matrix including fragments (excluding other framework manifests / matrices, e.g. product);
Yifan Hongaf9b0702020-01-21 12:46:57 -08003531check_vintf_system_deps := $(filter $(TARGET_OUT)/etc/vintf/%, $(check_vintf_common_srcs))
3532ifneq ($(check_vintf_system_deps),)
3533check_vintf_has_system := true
Yifan Hong605ea042020-01-14 21:36:00 +00003534check_vintf_system_log := $(intermediates)/check_vintf_system_log
3535check_vintf_all_deps += $(check_vintf_system_log)
Yifan Hongaf9b0702020-01-21 12:46:57 -08003536$(check_vintf_system_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_system_deps)
Yifan Hong605ea042020-01-14 21:36:00 +00003537 @( $< --check-one --dirmap /system:$(TARGET_OUT) > $@ 2>&1 ) || ( cat $@ && exit 1 )
3538check_vintf_system_log :=
Yifan Hongaf9b0702020-01-21 12:46:57 -08003539endif # check_vintf_system_deps
3540check_vintf_system_deps :=
Yifan Hong605ea042020-01-14 21:36:00 +00003541
3542# -- Check vendor manifest / matrix including fragments (excluding other device manifests / matrices)
Yifan Hongaf9b0702020-01-21 12:46:57 -08003543check_vintf_vendor_deps := $(filter $(TARGET_OUT_VENDOR)/etc/vintf/%, $(check_vintf_common_srcs))
3544ifneq ($(check_vintf_vendor_deps),)
3545check_vintf_has_vendor := true
Yifan Hong605ea042020-01-14 21:36:00 +00003546check_vintf_vendor_log := $(intermediates)/check_vintf_vendor_log
3547check_vintf_all_deps += $(check_vintf_vendor_log)
Yifan Hong69430e62020-03-17 15:18:34 -07003548# Check vendor SKU=(empty) case when:
3549# - DEVICE_MANIFEST_FILE is not empty; OR
3550# - DEVICE_MANIFEST_FILE is empty AND DEVICE_MANIFEST_SKUS is empty (only vendor manifest fragments are used)
Yifan Hong28ffd732020-03-13 13:11:10 -07003551$(check_vintf_vendor_log): PRIVATE_VENDOR_SKUS := \
Yifan Hong69430e62020-03-17 15:18:34 -07003552 $(if $(DEVICE_MANIFEST_FILE),EMPTY_VENDOR_SKU_PLACEHOLDER,\
3553 $(if $(DEVICE_MANIFEST_SKUS),,EMPTY_VENDOR_SKU_PLACEHOLDER)) \
Yifan Hong28ffd732020-03-13 13:11:10 -07003554 $(DEVICE_MANIFEST_SKUS)
Yifan Hongaf9b0702020-01-21 12:46:57 -08003555$(check_vintf_vendor_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_vendor_deps)
Yifan Hong28ffd732020-03-13 13:11:10 -07003556 $(foreach vendor_sku,$(PRIVATE_VENDOR_SKUS), \
3557 ( $< --check-one --dirmap /vendor:$(TARGET_OUT_VENDOR) \
3558 --property ro.boot.product.vendor.sku=$(filter-out EMPTY_VENDOR_SKU_PLACEHOLDER,$(vendor_sku)) \
3559 > $@ 2>&1 ) || ( cat $@ && exit 1 ); )
Yifan Hong605ea042020-01-14 21:36:00 +00003560check_vintf_vendor_log :=
Yifan Hongaf9b0702020-01-21 12:46:57 -08003561endif # check_vintf_vendor_deps
3562check_vintf_vendor_deps :=
Yifan Hong605ea042020-01-14 21:36:00 +00003563
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003564# -- Check VINTF compatibility of build.
3565# Skip partial builds; only check full builds. Only check if:
3566# - PRODUCT_ENFORCE_VINTF_MANIFEST is true
Yifan Hongaf9b0702020-01-21 12:46:57 -08003567# - system / vendor VINTF metadata exists
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003568# - Building product / system_ext / odm images if board has product / system_ext / odm images
3569ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true)
Yifan Hongaf9b0702020-01-21 12:46:57 -08003570ifeq ($(check_vintf_has_system),true)
3571ifeq ($(check_vintf_has_vendor),true)
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003572ifeq ($(filter true,$(BUILDING_ODM_IMAGE)),$(filter true,$(BOARD_USES_ODMIMAGE)))
3573ifeq ($(filter true,$(BUILDING_PRODUCT_IMAGE)),$(filter true,$(BOARD_USES_PRODUCTIMAGE)))
3574ifeq ($(filter true,$(BUILDING_SYSTEM_EXT_IMAGE)),$(filter true,$(BOARD_USES_SYSTEM_EXTIMAGE)))
3575
3576check_vintf_compatible_log := $(intermediates)/check_vintf_compatible_log
3577check_vintf_all_deps += $(check_vintf_compatible_log)
3578
3579check_vintf_compatible_args :=
Yifan Hongaf9b0702020-01-21 12:46:57 -08003580check_vintf_compatible_deps := $(check_vintf_common_srcs)
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003581
3582# -- Kernel version and configurations.
3583ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
3584
Yifan Hong605ea042020-01-14 21:36:00 +00003585BUILT_KERNEL_CONFIGS_FILE := $(intermediates)/kernel_configs.txt
3586BUILT_KERNEL_VERSION_FILE := $(intermediates)/kernel_version.txt
3587
3588my_board_extracted_kernel :=
3589
3590# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
3591# from INSTALLED_KERNEL_TARGET.
3592ifdef BOARD_KERNEL_CONFIG_FILE
3593ifdef BOARD_KERNEL_VERSION
3594$(BUILT_KERNEL_CONFIGS_FILE): $(BOARD_KERNEL_CONFIG_FILE)
3595 cp $< $@
3596$(BUILT_KERNEL_VERSION_FILE):
3597 echo $(BOARD_KERNEL_VERSION) > $@
3598
3599my_board_extracted_kernel := true
3600endif # BOARD_KERNEL_VERSION
3601endif # BOARD_KERNEL_CONFIG_FILE
3602
3603ifneq ($(my_board_extracted_kernel),true)
3604ifndef INSTALLED_KERNEL_TARGET
3605$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
3606 is true. Information about the updated kernel cannot be built into OTA update package. \
3607 You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
3608 to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
3609 or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
3610 BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
3611 manually.)
3612else
3613
3614# Tools for decompression that is not in PATH.
3615# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
3616# Algorithms that are in the script but not in this list will be found in PATH.
3617my_decompress_tools := \
3618 lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
3619
3620$(BUILT_KERNEL_CONFIGS_FILE): .KATI_IMPLICIT_OUTPUTS := $(BUILT_KERNEL_VERSION_FILE)
3621$(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
3622$(BUILT_KERNEL_CONFIGS_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
Steve Mucklebbdfbda2020-06-26 16:39:34 -07003623$(BUILT_KERNEL_CONFIGS_FILE): $(EXTRACT_KERNEL) $(firstword $(INSTALLED_KERNEL_TARGET))
3624 $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(firstword $(INSTALLED_KERNEL_TARGET)) \
Yifan Hong605ea042020-01-14 21:36:00 +00003625 --output-configs $@ \
3626 --output-version $(BUILT_KERNEL_VERSION_FILE)
3627
3628my_decompress_tools :=
3629
3630endif # my_board_extracted_kernel
3631my_board_extracted_kernel :=
3632
3633endif # INSTALLED_KERNEL_TARGET
3634
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003635check_vintf_compatible_args += --kernel $$(cat $(BUILT_KERNEL_VERSION_FILE)):$(BUILT_KERNEL_CONFIGS_FILE)
3636check_vintf_compatible_deps += $(BUILT_KERNEL_CONFIGS_FILE) $(BUILT_KERNEL_VERSION_FILE)
3637
3638endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
3639
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003640check_vintf_compatible_args += \
3641 --dirmap /system:$(TARGET_OUT) \
3642 --dirmap /vendor:$(TARGET_OUT_VENDOR) \
3643 --dirmap /odm:$(TARGET_OUT_ODM) \
3644 --dirmap /product:$(TARGET_OUT_PRODUCT) \
3645 --dirmap /system_ext:$(TARGET_OUT_SYSTEM_EXT) \
3646
3647ifdef PRODUCT_SHIPPING_API_LEVEL
3648check_vintf_compatible_args += --property ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL)
3649endif # PRODUCT_SHIPPING_API_LEVEL
3650
3651$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_ARGS := $(check_vintf_compatible_args)
3652$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_DEPS := $(check_vintf_compatible_deps)
Yifan Hong69430e62020-03-17 15:18:34 -07003653# Check ODM SKU=(empty) case when:
3654# - ODM_MANIFEST_FILES is not empty; OR
3655# - ODM_MANIFEST_FILES is empty AND ODM_MANIFEST_SKUS is empty (only ODM manifest fragments are used)
Yifan Hong28ffd732020-03-13 13:11:10 -07003656$(check_vintf_compatible_log): PRIVATE_ODM_SKUS := \
Yifan Hong69430e62020-03-17 15:18:34 -07003657 $(if $(ODM_MANIFEST_FILES),EMPTY_ODM_SKU_PLACEHOLDER,\
3658 $(if $(ODM_MANIFEST_SKUS),,EMPTY_ODM_SKU_PLACEHOLDER)) \
Yifan Hong28ffd732020-03-13 13:11:10 -07003659 $(ODM_MANIFEST_SKUS)
Yifan Hong69430e62020-03-17 15:18:34 -07003660# Check vendor SKU=(empty) case when:
3661# - DEVICE_MANIFEST_FILE is not empty; OR
3662# - DEVICE_MANIFEST_FILE is empty AND DEVICE_MANIFEST_SKUS is empty (only vendor manifest fragments are used)
Yifan Hong28ffd732020-03-13 13:11:10 -07003663$(check_vintf_compatible_log): PRIVATE_VENDOR_SKUS := \
Yifan Hong69430e62020-03-17 15:18:34 -07003664 $(if $(DEVICE_MANIFEST_FILE),EMPTY_VENDOR_SKU_PLACEHOLDER,\
3665 $(if $(DEVICE_MANIFEST_SKUS),,EMPTY_VENDOR_SKU_PLACEHOLDER)) \
Yifan Hong28ffd732020-03-13 13:11:10 -07003666 $(DEVICE_MANIFEST_SKUS)
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003667$(check_vintf_compatible_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_compatible_deps)
3668 @echo -n -e 'Deps: \n ' > $@
3669 @sed 's/ /\n /g' <<< "$(PRIVATE_CHECK_VINTF_DEPS)" >> $@
3670 @echo -n -e 'Args: \n ' >> $@
3671 @cat <<< "$(PRIVATE_CHECK_VINTF_ARGS)" >> $@
Yifan Hong28ffd732020-03-13 13:11:10 -07003672 $(foreach odm_sku,$(PRIVATE_ODM_SKUS), $(foreach vendor_sku,$(PRIVATE_VENDOR_SKUS), \
3673 echo "For ODM SKU = $(odm_sku), vendor SKU = $(vendor_sku)" >> $@; \
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003674 ( $< --check-compat $(PRIVATE_CHECK_VINTF_ARGS) \
Yifan Hong28ffd732020-03-13 13:11:10 -07003675 --property ro.boot.product.hardware.sku=$(filter-out EMPTY_ODM_SKU_PLACEHOLDER,$(odm_sku)) \
3676 --property ro.boot.product.vendor.sku=$(filter-out EMPTY_VENDOR_SKU_PLACEHOLDER,$(vendor_sku)) \
3677 >> $@ 2>&1 ) || (cat $@ && exit 1); ))
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003678
3679check_vintf_compatible_log :=
3680check_vintf_compatible_args :=
3681check_vintf_compatible_deps :=
3682
3683endif # BUILDING_SYSTEM_EXT_IMAGE equals BOARD_USES_SYSTEM_EXTIMAGE
3684endif # BUILDING_PRODUCT_IMAGE equals BOARD_USES_PRODUCTIMAGE
3685endif # BUILDING_ODM_IMAGE equals BOARD_USES_ODMIMAGE
Yifan Hongaf9b0702020-01-21 12:46:57 -08003686endif # check_vintf_has_vendor
3687endif # check_vintf_has_system
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003688endif # PRODUCT_ENFORCE_VINTF_MANIFEST
3689
3690# Add all logs of VINTF checks to dist builds
3691droid_targets: $(check_vintf_all_deps)
3692$(call dist-for-goals, droid_targets, $(check_vintf_all_deps))
3693
3694# Helper alias to check all VINTF of current build.
3695.PHONY: check-vintf-all
3696check-vintf-all: $(check_vintf_all_deps)
3697 $(foreach file,$^,echo "$(file)"; cat "$(file)"; echo;)
3698
Yifan Hongaf9b0702020-01-21 12:46:57 -08003699check_vintf_has_vendor :=
3700check_vintf_has_system :=
3701check_vintf_common_srcs :=
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003702check_vintf_all_deps :=
3703intermediates :=
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01003704endif # !TARGET_BUILD_UNBUNDLED
Yifan Hongbcd46bc2020-01-14 21:35:45 +00003705
3706# -----------------------------------------------------------------
Yifan Hong055e6cf2018-11-29 13:51:48 -08003707# Check image sizes <= size of super partition
3708
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01003709ifeq (,$(TARGET_BUILD_UNBUNDLED))
Yifan Hong055e6cf2018-11-29 13:51:48 -08003710
3711ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003712
Yifan Hong3a7c2ef2019-11-01 18:23:19 +00003713# $(1): misc_info.txt
Yifan Hong30910932019-10-25 20:36:55 -07003714# #(2): optional log file
Yifan Hongb43012f2018-10-01 17:30:01 -07003715define check-all-partition-sizes-target
Yifan Hong3a7c2ef2019-11-01 18:23:19 +00003716 mkdir -p $(dir $(1))
3717 rm -f $(1)
3718 $(call dump-super-image-info, $(1))
3719 $(foreach partition,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
3720 echo "$(partition)_image="$(call images-for-partitions,$(partition)) >> $(1);)
Yifan Hong30910932019-10-25 20:36:55 -07003721 $(CHECK_PARTITION_SIZES) $(if $(2),--logfile $(2),-v) $(1)
Yifan Hongb43012f2018-10-01 17:30:01 -07003722endef
3723
Yifan Hong30910932019-10-25 20:36:55 -07003724check_all_partition_sizes_log := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/check_all_partition_sizes_log
3725droid_targets: $(check_all_partition_sizes_log)
3726$(call dist-for-goals, droid_targets, $(check_all_partition_sizes_log))
Colin Cross606c9f42019-05-17 15:51:39 -07003727
Yifan Hong30910932019-10-25 20:36:55 -07003728$(check_all_partition_sizes_log): \
3729 $(CHECK_PARTITION_SIZES) \
3730 $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
3731 $(call check-all-partition-sizes-target, \
3732 $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/misc_info.txt, \
3733 $@)
3734
3735.PHONY: check-all-partition-sizes
3736check-all-partition-sizes: $(check_all_partition_sizes_log)
3737
3738.PHONY: check-all-partition-sizes-nodeps
Colin Cross606c9f42019-05-17 15:51:39 -07003739check-all-partition-sizes-nodeps:
Yifan Hong3a7c2ef2019-11-01 18:23:19 +00003740 $(call check-all-partition-sizes-target, \
3741 $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes-nodeps)/misc_info.txt)
Yifan Hongb43012f2018-10-01 17:30:01 -07003742
Yifan Hong2dae5722018-07-31 12:47:27 -07003743endif # PRODUCT_BUILD_SUPER_PARTITION
Yifan Hong17dd45d2018-07-20 16:45:57 -07003744
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01003745endif # !TARGET_BUILD_UNBUNDLED
Yifan Hong17dd45d2018-07-20 16:45:57 -07003746
3747# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08003748# bring in the installer image generation defines if necessary
3749ifeq ($(TARGET_USE_DISKINSTALLER),true)
3750include bootable/diskinstaller/config.mk
3751endif
3752
3753# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07003754# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08003755
Ying Wangbd2d0242015-09-22 11:17:52 -07003756ifeq ($(BUILD_OS),darwin)
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003757 build_ota_package := false
3758 build_otatools_package := false
3759else
Tao Bao9be20c72019-04-08 21:11:59 -07003760 # Set build_ota_package, and allow opt-out below.
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003761 build_ota_package := true
3762 ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
3763 build_ota_package := false
3764 endif
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003765 ifneq (,$(filter address, $(SANITIZE_TARGET)))
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003766 build_ota_package := false
3767 endif
3768 ifeq ($(TARGET_PRODUCT),sdk)
3769 build_ota_package := false
3770 endif
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003771 ifeq ($(TARGET_BUILD_PDK),true)
3772 build_ota_package := false
3773 endif
Tao Bao9be20c72019-04-08 21:11:59 -07003774 ifneq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
3775 ifneq ($(filter generic%,$(TARGET_DEVICE)),)
3776 build_ota_package := false
3777 endif
3778 ifeq ($(TARGET_NO_KERNEL),true)
3779 build_ota_package := false
3780 endif
3781 ifeq ($(recovery_fstab),)
3782 build_ota_package := false
3783 endif
3784 endif # PRODUCT_BUILD_GENERIC_OTA_PACKAGE
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003785
Tao Bao9be20c72019-04-08 21:11:59 -07003786 # Set build_otatools_package, and allow opt-out below.
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003787 build_otatools_package := true
3788 ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
3789 build_otatools_package := false
3790 endif
Colin Cross481cc5a2016-02-04 15:09:23 -08003791endif
Ying Wangbd2d0242015-09-22 11:17:52 -07003792
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003793ifeq ($(build_otatools_package),true)
Tao Bao96daeeb2019-05-01 21:17:13 -07003794
3795INTERNAL_OTATOOLS_MODULES := \
changho.shin0f125362019-07-08 10:59:00 +09003796 aapt2 \
Tao Baoc1966a82019-06-25 11:42:12 -07003797 add_img_to_target_files \
Tianjie Xueaed60c2020-03-12 00:33:28 -07003798 aftltool \
Baligh Uddinab25b2d2020-05-29 19:01:32 +00003799 apksigner \
Tao Bao96daeeb2019-05-01 21:17:13 -07003800 append2simg \
3801 avbtool \
3802 blk_alloc_to_base_fs \
3803 boot_signer \
3804 brillo_update_payload \
3805 brotli \
3806 bsdiff \
Tao Bao2bbb07c2019-05-07 13:12:21 -07003807 build_image \
3808 build_super_image \
Tao Bao96daeeb2019-05-01 21:17:13 -07003809 build_verity_metadata \
3810 build_verity_tree \
3811 care_map_generator \
Tao Baoc1966a82019-06-25 11:42:12 -07003812 check_ota_package_signature \
3813 check_target_files_signatures \
Yifan Honge3ba82c2019-08-21 13:29:30 -07003814 check_target_files_vintf \
Tao Bao96daeeb2019-05-01 21:17:13 -07003815 checkvintf \
3816 delta_generator \
3817 e2fsck \
3818 e2fsdroid \
3819 fc_sort \
3820 fec \
3821 fs_config \
3822 generate_verity_key \
3823 img2simg \
Tao Baoc1966a82019-06-25 11:42:12 -07003824 img_from_target_files \
Tao Bao96daeeb2019-05-01 21:17:13 -07003825 imgdiff \
3826 libconscrypt_openjdk_jni \
3827 lpmake \
Isaac Cheneec4a7c2019-06-25 11:50:58 +08003828 lpunpack \
Tianjie3031c292020-06-24 11:20:36 -07003829 lz4 \
Tao Bao96daeeb2019-05-01 21:17:13 -07003830 make_f2fs \
Jaegeuk Kim8ba4bab2020-07-17 20:18:10 -07003831 make_f2fs_casefold \
Tao Baoc1966a82019-06-25 11:42:12 -07003832 merge_target_files \
Tao Bao96daeeb2019-05-01 21:17:13 -07003833 minigzip \
Isaac Chen9e09d472019-07-05 17:30:41 +08003834 mk_combined_img \
Tao Bao96daeeb2019-05-01 21:17:13 -07003835 mkbootfs \
3836 mkbootimg \
3837 mke2fs \
Baligh Uddin6a8234b2020-01-29 17:42:59 -08003838 mke2fs.conf \
Tao Bao96daeeb2019-05-01 21:17:13 -07003839 mkf2fsuserimg.sh \
3840 mksquashfs \
3841 mksquashfsimage.sh \
3842 mkuserimg_mke2fs \
Tao Bao8821d642019-08-05 12:05:45 -07003843 ota_from_target_files \
Tao Bao96daeeb2019-05-01 21:17:13 -07003844 sefcontext_compile \
Isaac Chen9e09d472019-07-05 17:30:41 +08003845 sgdisk \
Tao Bao96daeeb2019-05-01 21:17:13 -07003846 shflags \
Tao Baoc1966a82019-06-25 11:42:12 -07003847 sign_apex \
3848 sign_target_files_apks \
Tao Bao96daeeb2019-05-01 21:17:13 -07003849 signapk \
3850 simg2img \
3851 sload_f2fs \
3852 tune2fs \
Daniel Mentz30652b32020-01-04 15:18:09 -08003853 unpack_bootimg \
Tianjie Xu4e5591f2019-06-11 14:35:59 -07003854 update_host_simulator \
Tao Baoc1966a82019-06-25 11:42:12 -07003855 validate_target_files \
Tao Bao96daeeb2019-05-01 21:17:13 -07003856 verity_signer \
3857 verity_verifier \
3858 zipalign \
Tao Bao5e04c382017-02-22 16:38:19 -08003859
Tianjie Xueb8a0a02020-01-23 13:59:13 -08003860# Additional tools to unpack and repack the apex file.
3861INTERNAL_OTATOOLS_MODULES += \
3862 apexer \
3863 deapexer \
3864 debugfs_static \
3865 merge_zips \
3866 resize2fs \
3867 soong_zip \
3868
Anton Hansson8dab0a62019-03-28 15:45:40 +00003869ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Tao Bao96daeeb2019-05-01 21:17:13 -07003870INTERNAL_OTATOOLS_MODULES += \
3871 futility \
3872 vboot_signer
Tao Bao5e04c382017-02-22 16:38:19 -08003873endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08003874
Tao Bao96daeeb2019-05-01 21:17:13 -07003875INTERNAL_OTATOOLS_FILES := \
3876 $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08003877
Ying Wang06898662010-06-17 17:52:18 -07003878.PHONY: otatools
Tao Bao96daeeb2019-05-01 21:17:13 -07003879otatools: $(INTERNAL_OTATOOLS_FILES)
Ying Wang06898662010-06-17 17:52:18 -07003880
Tao Bao96daeeb2019-05-01 21:17:13 -07003881# For each module, recursively resolve its host shared library dependencies. Then we have a full
3882# list of modules whose installed files need to be packed.
3883INTERNAL_OTATOOLS_MODULES_WITH_DEPS := \
3884 $(sort $(INTERNAL_OTATOOLS_MODULES) \
3885 $(foreach m,$(INTERNAL_OTATOOLS_MODULES),$(call get-all-shared-libs-deps,$(m))))
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003886
Tao Bao96daeeb2019-05-01 21:17:13 -07003887INTERNAL_OTATOOLS_PACKAGE_FILES := \
3888 $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES_WITH_DEPS)))
3889
3890INTERNAL_OTATOOLS_PACKAGE_FILES += \
3891 $(sort $(shell find build/make/target/product/security -type f -name "*.x509.pem" -o \
3892 -name "*.pk8" -o -name verity_key))
Tao Bao93ab8442018-10-12 11:03:04 -07003893
3894ifneq (,$(wildcard device))
Tao Bao96daeeb2019-05-01 21:17:13 -07003895INTERNAL_OTATOOLS_PACKAGE_FILES += \
Dan Willemsen60c66442018-05-01 19:07:27 -07003896 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
Baligh Uddindf238b42019-07-29 21:12:37 -07003897 -name "*.pem" -o -name "oem*.prop" -o -name "*.avbpubkey"))
Tao Bao93ab8442018-10-12 11:03:04 -07003898endif
3899ifneq (,$(wildcard external/avb))
Tao Bao96daeeb2019-05-01 21:17:13 -07003900INTERNAL_OTATOOLS_PACKAGE_FILES += \
Tao Bao93ab8442018-10-12 11:03:04 -07003901 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
3902 -name "atx_metadata.bin"))
3903endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00003904ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Tao Bao96daeeb2019-05-01 21:17:13 -07003905INTERNAL_OTATOOLS_PACKAGE_FILES += \
Tao Bao5232f092018-02-10 04:03:32 +00003906 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003907endif
3908
Tao Bao96daeeb2019-05-01 21:17:13 -07003909INTERNAL_OTATOOLS_RELEASETOOLS := \
3910 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o \
3911 \( -type f -o -type l \) -print))
3912
3913BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
3914$(BUILT_OTATOOLS_PACKAGE): PRIVATE_ZIP_ROOT := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
3915$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_PACKAGE_FILES := $(INTERNAL_OTATOOLS_PACKAGE_FILES)
3916$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_RELEASETOOLS := $(INTERNAL_OTATOOLS_RELEASETOOLS)
3917$(BUILT_OTATOOLS_PACKAGE): $(INTERNAL_OTATOOLS_PACKAGE_FILES) $(INTERNAL_OTATOOLS_RELEASETOOLS)
Tao Bao57f8ed62019-08-14 23:08:18 -07003918$(BUILT_OTATOOLS_PACKAGE): $(SOONG_ZIP) $(ZIP2ZIP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003919 @echo "Package OTA tools: $@"
Tao Bao96daeeb2019-05-01 21:17:13 -07003920 rm -rf $@ $(PRIVATE_ZIP_ROOT)
3921 mkdir -p $(dir $@)
3922 $(call copy-files-with-structure,$(PRIVATE_OTATOOLS_PACKAGE_FILES),$(HOST_OUT)/,$(PRIVATE_ZIP_ROOT))
3923 $(call copy-files-with-structure,$(PRIVATE_OTATOOLS_RELEASETOOLS),build/make/tools/,$(PRIVATE_ZIP_ROOT))
Tianjie Xua25d76f2020-01-28 19:17:35 -08003924 cp $(SOONG_ZIP) $(ZIP2ZIP) $(MERGE_ZIPS) $(PRIVATE_ZIP_ROOT)/bin/
Tao Bao96daeeb2019-05-01 21:17:13 -07003925 $(SOONG_ZIP) -o $@ -C $(PRIVATE_ZIP_ROOT) -D $(PRIVATE_ZIP_ROOT)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003926
3927.PHONY: otatools-package
3928otatools-package: $(BUILT_OTATOOLS_PACKAGE)
3929
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003930endif # build_otatools_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003931
The Android Open Source Project88b60792009-03-03 19:28:42 -08003932# -----------------------------------------------------------------
Daniel Normane1e48082019-06-27 13:55:23 -07003933# misc_info.txt
3934
3935INSTALLED_MISC_INFO_TARGET := $(PRODUCT_OUT)/misc_info.txt
3936
3937ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
3938# default to common dir for device vendor
3939tool_extensions := $(TARGET_DEVICE_DIR)/../common
3940else
3941tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
3942endif
3943.KATI_READONLY := tool_extensions
3944
Steve Muckle903a1ca2020-05-07 17:32:10 -07003945# $1: boot image file name
3946define misc_boot_size
3947$(subst .img,_size,$(1))=$(BOARD_KERNEL$(call to-upper,$(subst boot,,$(subst .img,,$(1))))_BOOTIMAGE_PARTITION_SIZE)
3948endef
3949
Daniel Normane1e48082019-06-27 13:55:23 -07003950$(INSTALLED_MISC_INFO_TARGET):
3951 rm -f $@
3952 $(call pretty,"Target misc_info.txt: $@")
3953 $(hide) echo "recovery_api_version=$(RECOVERY_API_VERSION)" >> $@
3954 $(hide) echo "fstab_version=$(RECOVERY_FSTAB_VERSION)" >> $@
3955ifdef BOARD_FLASH_BLOCK_SIZE
3956 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $@
3957endif
Steve Muckle903a1ca2020-05-07 17:32:10 -07003958ifneq ($(strip $(BOARD_BOOTIMAGE_PARTITION_SIZE))$(strip $(BOARD_KERNEL_BINARIES)),)
3959 $(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),\
3960 echo "$(call misc_boot_size,$(notdir $(b)))" >> $@;)
Daniel Normane1e48082019-06-27 13:55:23 -07003961endif
3962ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
3963 $(hide) echo "no_boot=true" >> $@
Steve Muckle9793cf62020-04-08 18:27:00 -07003964else
3965 echo "boot_images=$(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(notdir $(b)))" >> $@
Daniel Normane1e48082019-06-27 13:55:23 -07003966endif
J. Avila98cd4cc2020-06-10 20:09:10 +00003967ifeq ($(BOARD_RAMDISK_USE_LZ4),true)
3968 echo "lz4_ramdisks=true" >> $@
3969endif
Steve Mucklee1b10862019-07-10 10:49:37 -07003970ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
3971 echo "vendor_boot=true" >> $@
3972 echo "vendor_boot_size=$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)" >> $@
3973endif
Daniel Normane1e48082019-06-27 13:55:23 -07003974ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3975 $(hide) echo "no_recovery=true" >> $@
3976endif
3977ifdef BOARD_INCLUDE_RECOVERY_DTBO
3978 $(hide) echo "include_recovery_dtbo=true" >> $@
3979endif
3980ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3981 $(hide) echo "include_recovery_acpio=true" >> $@
3982endif
3983ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
3984 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $@
3985endif
3986ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
3987 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
3988 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $@
3989else
3990 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $@
3991endif
3992 $(hide) echo "tool_extensions=$(tool_extensions)" >> $@
3993 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $@
3994ifdef PRODUCT_EXTRA_RECOVERY_KEYS
3995 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $@
3996endif
3997 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $@
Steve Mucklef84668e2020-03-16 19:13:46 -07003998 $(hide) echo 'recovery_mkbootimg_args=$(BOARD_RECOVERY_MKBOOTIMG_ARGS)' >> $@
Daniel Normane1e48082019-06-27 13:55:23 -07003999 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $@
4000 $(hide) echo "multistage_support=1" >> $@
4001 $(hide) echo "blockimgdiff_versions=3,4" >> $@
4002ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
4003 $(hide) echo "build_generic_ota_package=true" >> $@
4004endif
4005ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
4006 # OTA scripts are only interested in fingerprint related properties
4007 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $@
4008endif
4009ifneq (,$(filter address, $(SANITIZE_TARGET)))
4010 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
4011 $(hide) echo "userdata_img_with_data=true" >> $@
4012endif
4013ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
4014 $(hide) echo "full_recovery_image=true" >> $@
4015endif
Bill Peckhame868aec2019-09-17 17:06:47 -07004016ifdef BOARD_USES_VENDORIMAGE
4017 $(hide) echo "board_uses_vendorimage=true" >> $@
4018endif
Daniel Normane1e48082019-06-27 13:55:23 -07004019ifeq ($(BOARD_AVB_ENABLE),true)
4020 $(hide) echo "avb_enable=true" >> $@
4021 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $@
4022 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $@
4023 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $@
4024 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $@
4025ifdef BOARD_AVB_BOOT_KEY_PATH
4026 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $@
4027 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $@
4028 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $@
4029endif # BOARD_AVB_BOOT_KEY_PATH
Steve Mucklee1b10862019-07-10 10:49:37 -07004030 echo "avb_vendor_boot_add_hash_footer_args=$(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS)" >> $@
4031ifdef BOARD_AVB_VENDOR_BOOT_KEY_PATH
4032 echo "avb_vendor_boot_key_path=$(BOARD_AVB_VENDOR_BOOT_KEY_PATH)" >> $@
4033 echo "avb_vendor_boot_algorithm=$(BOARD_AVB_VENDOR_BOOT_ALGORITHM)" >> $@
4034 echo "avb_vendor_boot_rollback_index_location=$(BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX_LOCATION)" >> $@
4035endif # BOARD_AVB_VENDOR_BOOT_KEY_PATH
Daniel Normane1e48082019-06-27 13:55:23 -07004036 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $@
4037ifdef BOARD_AVB_RECOVERY_KEY_PATH
4038 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $@
4039 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $@
4040 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $@
4041endif # BOARD_AVB_RECOVERY_KEY_PATH
Hongguang Chenf23364d2020-04-27 18:36:36 -07004042ifneq (,$(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)))
4043 $(hide) echo "avb_custom_images_partition_list=$(BOARD_CUSTOMIMAGES_PARTITION_LIST)" >> $@
4044 $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
4045 echo "avb_$(partition)_key_path=$(BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH)" >> $@; \
4046 echo "avb_$(partition)_algorithm=$(BOARD_AVB_$(call to-upper,$(partition))_ALGORITHM)" >> $@; \
4047 echo "avb_$(partition)_add_hashtree_footer_args=$(BOARD_AVB_$(call to-upper,$(partition))_ADD_HASHTREE_FOOTER_ARGS)" >> $@; \
4048 echo "avb_$(partition)_rollback_index_location=$(BOARD_AVB_$(call to-upper,$(partition))_ROLLBACK_INDEX_LOCATION)" >> $@; \
4049 echo "avb_$(partition)_partition_size=$(BOARD_AVB_$(call to-upper,$(partition))_PARTITION_SIZE)" >> $@; \
4050 echo "avb_$(partition)_image_list=$(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST),$(notdir $(image)))" >> $@;)
4051endif # BOARD_CUSTOMIMAGES_PARTITION_LIST
Daniel Normane1e48082019-06-27 13:55:23 -07004052ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
4053 $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $@
4054 $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $@
4055 $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $@
4056 $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $@
4057 $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $@
4058endif # BOARD_AVB_VBMETA_SYSTEM
4059ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
4060 $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $@
4061 $(hide) echo "avb_vbmeta_vendor_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $@
4062 $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $@
4063 $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $@
4064 $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $@
4065endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
4066endif # BOARD_AVB_ENABLE
4067ifdef BOARD_BPT_INPUT_FILES
4068 $(hide) echo "board_bpt_enable=true" >> $@
4069 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $@
4070 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $@
4071endif
4072ifdef BOARD_BPT_DISK_SIZE
4073 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $@
4074endif
4075 $(call generate-userimage-prop-dictionary, $@)
4076ifeq ($(AB_OTA_UPDATER),true)
4077 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
4078 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $@
4079 $(hide) echo "ab_update=true" >> $@
4080endif
Yifan Hong65afc072020-04-17 10:08:10 -07004081ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
4082 $(hide) echo "allow_non_ab=true" >> $@
4083endif
Daniel Normane1e48082019-06-27 13:55:23 -07004084ifdef BOARD_PREBUILT_DTBOIMAGE
4085 $(hide) echo "has_dtbo=true" >> $@
4086ifeq ($(BOARD_AVB_ENABLE),true)
4087 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $@
4088 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $@
4089ifdef BOARD_AVB_DTBO_KEY_PATH
4090 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $@
4091 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $@
4092 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" >> $@
4093endif # BOARD_AVB_DTBO_KEY_PATH
4094endif # BOARD_AVB_ENABLE
4095endif # BOARD_PREBUILT_DTBOIMAGE
4096 $(call dump-dynamic-partitions-info,$@)
Yifan Honge3ba82c2019-08-21 13:29:30 -07004097 @# VINTF checks
4098ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true)
4099 $(hide) echo "vintf_enforce=true" >> $@
4100endif
4101ifdef ODM_MANIFEST_SKUS
4102 $(hide) echo "vintf_odm_manifest_skus=$(ODM_MANIFEST_SKUS)" >> $@
4103endif
Yifan Hong28ffd732020-03-13 13:11:10 -07004104ifdef ODM_MANIFEST_FILES
4105 $(hide) echo "vintf_include_empty_odm_sku=true" >> $@
4106endif
4107ifdef DEVICE_MANIFEST_SKUS
4108 $(hide) echo "vintf_vendor_manifest_skus=$(DEVICE_MANIFEST_SKUS)" >> $@
4109endif
4110ifdef DEVICE_MANIFEST_FILE
4111 $(hide) echo "vintf_include_empty_vendor_sku=true" >> $@
4112endif
Daniel Normane1e48082019-06-27 13:55:23 -07004113
4114.PHONY: misc_info
4115misc_info: $(INSTALLED_MISC_INFO_TARGET)
4116
4117droidcore: $(INSTALLED_MISC_INFO_TARGET)
4118
4119# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004120# A zip of the directories that map to the target filesystem.
4121# This zip can be used to create an OTA package or filesystem image
4122# as a post-build step.
4123#
4124name := $(TARGET_PRODUCT)
4125ifeq ($(TARGET_BUILD_TYPE),debug)
4126 name := $(name)_debug
4127endif
4128name := $(name)-target_files-$(FILE_NAME_TAG)
4129
4130intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
4131BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
4132$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
4133$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00004134 zip_root := $(intermediates)/$(name)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004135
4136# $(1): Directory to copy
4137# $(2): Location to copy it to
4138# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
4139define package_files-copy-root
4140 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
4141 mkdir -p $(2) && \
4142 $(ACP) -rd $(strip $(1))/* $(2); \
4143 fi
4144endef
4145
Tao Baoa04fca32015-11-30 12:22:24 -08004146built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07004147
4148# We can't build static executables when SANITIZE_TARGET=address
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08004149ifeq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wange6e544e2015-06-22 18:35:35 -07004150built_ota_tools += \
Elliott Hughes9b824d52020-04-17 15:46:55 -07004151 $(call intermediates-dir-for,EXECUTABLES,updater)/updater
Ying Wange6e544e2015-06-22 18:35:35 -07004152endif
4153
The Android Open Source Project88b60792009-03-03 19:28:42 -08004154$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
4155
Dan Willemsen653bea92017-03-21 15:47:37 -07004156tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
Dan Willemsen653bea92017-03-21 15:47:37 -07004157$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07004158
Sen Jiang4438fd92016-03-07 16:51:01 -08004159ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08004160updater_dep := system/update_engine/update_engine.conf
Yifan Hong65afc072020-04-17 10:08:10 -07004161endif
4162
4163# Build OTA tools if non-A/B is allowed
4164ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09004165updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07004166endif
Yifan Hong65afc072020-04-17 10:08:10 -07004167
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09004168$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07004169
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08004170# If we are using recovery as boot, output recovery files to BOOT/.
4171ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
4172$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
4173else
4174$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
4175endif
4176
Dan Willemsen653bea92017-03-21 15:47:37 -07004177ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07004178 ifdef OSRELEASED_DIRECTORY
4179 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
4180 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
4181 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
4182 endif
Tao Baoa835f382019-07-18 15:55:30 -07004183
4184 # Not checking in board_config.mk, since AB_OTA_PARTITIONS may be updated in Android.mk (e.g. to
4185 # additionally include radio or bootloader partitions).
4186 ifeq ($(AB_OTA_PARTITIONS),)
4187 $(error AB_OTA_PARTITIONS must be defined when using AB_OTA_UPDATER)
4188 endif
4189endif
4190
4191ifneq ($(AB_OTA_PARTITIONS),)
4192 ifneq ($(AB_OTA_UPDATER),true)
4193 $(error AB_OTA_UPDATER must be true when defining AB_OTA_PARTITIONS)
4194 endif
Dan Willemsen653bea92017-03-21 15:47:37 -07004195endif
4196
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004197# Run fs_config while creating the target files package
4198# $1: root directory
4199# $2: add prefix
4200define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08004201(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 -08004202endef
4203
Yifan Hong60bfcc42019-11-01 11:39:45 -07004204# Filter out vendor from the list for AOSP targets.
4205# $(1): list
4206define filter-out-missing-vendor
4207$(if $(INSTALLED_VENDORIMAGE_TARGET),$(1),$(filter-out vendor,$(1)))
4208endef
4209
4210# Information related to dynamic partitions and virtual A/B. This information
4211# is needed for building the super image (see dump-super-image-info) and
4212# building OTA packages.
Yifan Hong2b891ac2018-11-29 12:06:31 -08004213# $(1): file
4214define dump-dynamic-partitions-info
4215 $(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \
4216 echo "use_dynamic_partitions=true" >> $(1))
4217 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
4218 echo "dynamic_partition_retrofit=true" >> $(1))
Yifan Hong055e6cf2018-11-29 13:51:48 -08004219 echo "lpmake=$(notdir $(LPMAKE))" >> $(1)
4220 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \
4221 echo "build_super_partition=true" >> $(1)))
Tao Bao519d1822018-12-27 12:47:23 -08004222 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \
4223 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08004224 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1)
4225 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
4226 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1))
4227 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
4228 echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
4229 $(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
Luca Stefanic158e422020-05-12 20:36:31 +02004230 echo "dynamic_partition_list=$(call filter-out-missing-vendor,$(BOARD_SUPER_PARTITION_PARTITION_LIST))" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08004231 $(if $(BOARD_SUPER_PARTITION_GROUPS),
4232 echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
4233 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
4234 echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
4235 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
Luca Stefanic158e422020-05-12 20:36:31 +02004236 echo "super_$(group)_partition_list=$(call filter-out-missing-vendor,$(BOARD_$(call to-upper,$(group))_PARTITION_LIST))" >> $(1);))
Yifan Hongcb35bd92019-04-02 16:29:59 -07004237 $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)), \
4238 echo "build_non_sparse_super_partition=true" >> $(1))
Alistair Delva91238cc2019-10-16 10:53:41 -07004239 $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)), \
4240 echo "build_non_sparse_super_partition=true" >> $(1))
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004241 $(if $(filter true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE)), \
4242 echo "super_image_in_update_package=true" >> $(1))
Yifan Hong3a7c2ef2019-11-01 18:23:19 +00004243 $(if $(BOARD_SUPER_PARTITION_SIZE), \
4244 echo "super_partition_size=$(BOARD_SUPER_PARTITION_SIZE)" >> $(1))
4245 $(if $(BOARD_SUPER_PARTITION_ALIGNMENT), \
4246 echo "super_partition_alignment=$(BOARD_SUPER_PARTITION_ALIGNMENT)" >> $(1))
4247 $(if $(BOARD_SUPER_PARTITION_WARN_LIMIT), \
4248 echo "super_partition_warn_limit=$(BOARD_SUPER_PARTITION_WARN_LIMIT)" >> $(1))
4249 $(if $(BOARD_SUPER_PARTITION_ERROR_LIMIT), \
4250 echo "super_partition_error_limit=$(BOARD_SUPER_PARTITION_ERROR_LIMIT)" >> $(1))
Yifan Hongcb8e2752019-11-01 17:03:57 -07004251 $(if $(filter true,$(PRODUCT_VIRTUAL_AB_OTA)), \
4252 echo "virtual_ab=true" >> $(1))
4253 $(if $(filter true,$(PRODUCT_VIRTUAL_AB_OTA_RETROFIT)), \
4254 echo "virtual_ab_retrofit=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08004255endef
4256
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07004257# By conditionally including the dependency of the target files package on the
4258# full system image deps, we speed up builds that do not build the system
4259# image.
4260ifdef BUILDING_SYSTEM_IMAGE
4261$(BUILT_TARGET_FILES_PACKAGE): $(FULL_SYSTEMIMAGE_DEPS)
4262endif
4263
Isaac Chen9e09d472019-07-05 17:30:41 +08004264ifeq ($(BUILD_QEMU_IMAGES),true)
4265MK_VBMETA_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_vbmeta_boot_params.sh
4266$(BUILT_TARGET_FILES_PACKAGE): $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH)
4267endif
4268
The Android Open Source Project88b60792009-03-03 19:28:42 -08004269# Depending on the various images guarantees that the underlying
4270# directories are up-to-date.
4271$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00004272 $(INSTALLED_RAMDISK_TARGET) \
4273 $(INSTALLED_BOOTIMAGE_TARGET) \
Steve Mucklee1b10862019-07-10 10:49:37 -07004274 $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004275 $(INSTALLED_RADIOIMAGE_TARGET) \
4276 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004277 $(INSTALLED_USERDATAIMAGE_TARGET) \
4278 $(INSTALLED_CACHEIMAGE_TARGET) \
4279 $(INSTALLED_VENDORIMAGE_TARGET) \
4280 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Justin Yun6151e3f2019-06-25 15:58:13 +09004281 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004282 $(INSTALLED_VBMETAIMAGE_TARGET) \
4283 $(INSTALLED_ODMIMAGE_TARGET) \
Yifan Hongcfb917a2020-05-07 14:58:20 -07004284 $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004285 $(INSTALLED_DTBOIMAGE_TARGET) \
Hongguang Chenf23364d2020-04-27 18:36:36 -07004286 $(INSTALLED_CUSTOMIMAGES_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004287 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
4288 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
4289 $(INSTALLED_KERNEL_TARGET) \
Hridya Valsaraju59eaef02019-05-20 11:10:24 -07004290 $(INSTALLED_DTBIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004291 $(INSTALLED_2NDBOOTLOADER_TARGET) \
4292 $(BOARD_PREBUILT_DTBOIMAGE) \
Hridya Valsarajua9418992019-02-04 10:35:25 -08004293 $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08004294 $(BOARD_RECOVERY_ACPIO) \
Anton Hansson8dab0a62019-03-28 15:45:40 +00004295 $(PRODUCT_SYSTEM_BASE_FS_PATH) \
4296 $(PRODUCT_VENDOR_BASE_FS_PATH) \
4297 $(PRODUCT_PRODUCT_BASE_FS_PATH) \
Justin Yun6151e3f2019-06-25 15:58:13 +09004298 $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \
Anton Hansson8dab0a62019-03-28 15:45:40 +00004299 $(PRODUCT_ODM_BASE_FS_PATH) \
Yifan Hongcfb917a2020-05-07 14:58:20 -07004300 $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH) \
Anton Hansson6d814982018-11-26 18:12:05 +00004301 $(LPMAKE) \
4302 $(SELINUX_FC) \
Daniel Normane1e48082019-06-27 13:55:23 -07004303 $(INSTALLED_MISC_INFO_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004304 $(APKCERTS_FILE) \
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09004305 $(SOONG_APEX_KEYS_FILE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004306 $(SOONG_ZIP) \
4307 $(HOST_OUT_EXECUTABLES)/fs_config \
Tao Baoc1966a82019-06-25 11:42:12 -07004308 $(ADD_IMG_TO_TARGET_FILES) \
Tao Baoe11a4602019-08-06 23:21:23 -07004309 $(MAKE_RECOVERY_PATCH) \
Yifan Honge3ba82c2019-08-21 13:29:30 -07004310 $(BUILT_KERNEL_CONFIGS_FILE) \
4311 $(BUILT_KERNEL_VERSION_FILE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004312 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004313 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07004314 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004315 $(call create-system-product-symlink)
Justin Yun6151e3f2019-06-25 15:58:13 +09004316 $(call create-system-system_ext-symlink)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004317 $(call create-vendor-odm-symlink)
Yifan Honge51dff22020-06-23 17:26:57 -07004318 $(call create-vendor-vendor_dlkm-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004319 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004320 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08004321ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08004322 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08004323 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004324 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004325 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004326ifdef INSTALLED_KERNEL_TARGET
Steve Muckleb3dda772020-03-11 16:03:07 -07004327 cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/
The Android Open Source Project88b60792009-03-03 19:28:42 -08004328endif
Steve Mucklef84668e2020-03-16 19:13:46 -07004329ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER)))
Steve Mucklee1b10862019-07-10 10:49:37 -07004330 echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
Steve Mucklef84668e2020-03-16 19:13:46 -07004331else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004332ifdef INSTALLED_2NDBOOTLOADER_TARGET
Steve Mucklee1b10862019-07-10 10:49:37 -07004333 cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08004334endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07004335ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08004336ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
Steve Mucklee1b10862019-07-10 10:49:37 -07004337 cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
Hridya Valsarajua9418992019-02-04 10:35:25 -08004338else
Steve Mucklee1b10862019-07-10 10:49:37 -07004339 cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07004340endif
Steve Mucklee1b10862019-07-10 10:49:37 -07004341endif # BOARD_INCLUDE_RECOVERY_DTBO
Chen, ZhiminX752439b2018-09-23 22:10:47 +08004342ifdef BOARD_INCLUDE_RECOVERY_ACPIO
Steve Mucklee1b10862019-07-10 10:49:37 -07004343 cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
Chen, ZhiminX752439b2018-09-23 22:10:47 +08004344endif
Hridya Valsaraju59eaef02019-05-20 11:10:24 -07004345ifdef INSTALLED_DTBIMAGE_TARGET
Steve Mucklee1b10862019-07-10 10:49:37 -07004346 cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08004347endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07004348ifdef INTERNAL_KERNEL_CMDLINE
Steve Mucklee1b10862019-07-10 10:49:37 -07004349 echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08004350endif
Doug Zongker38a649f2009-06-17 09:07:09 -07004351ifdef BOARD_KERNEL_BASE
Steve Mucklee1b10862019-07-10 10:49:37 -07004352 echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07004353endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07004354ifdef BOARD_KERNEL_PAGESIZE
Steve Mucklee1b10862019-07-10 10:49:37 -07004355 echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07004356endif
Steve Mucklee1b10862019-07-10 10:49:37 -07004357endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08004358endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08004359 @# Components of the boot image
4360 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07004361 $(hide) mkdir -p $(zip_root)/ROOT
4362 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004363 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
Tom Cherry3871f0f2018-11-06 14:23:44 -08004364 @# If we are using recovery as boot, this is already done when processing recovery.
4365ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherryd14b8952018-08-09 14:26:00 -07004366ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004367 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004368 $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07004369endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004370ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07004371 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08004372endif
Steve Mucklee1b10862019-07-10 10:49:37 -07004373ifndef INSTALLED_VENDOR_BOOTIMAGE_TARGET
The Android Open Source Project88b60792009-03-03 19:28:42 -08004374ifdef INSTALLED_2NDBOOTLOADER_TARGET
Steve Mucklee1b10862019-07-10 10:49:37 -07004375 cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08004376endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08004377ifdef INSTALLED_DTBIMAGE_TARGET
Steve Mucklee1b10862019-07-10 10:49:37 -07004378 cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08004379endif
Steve Mucklee1b10862019-07-10 10:49:37 -07004380 echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
Doug Zongker38a649f2009-06-17 09:07:09 -07004381ifdef BOARD_KERNEL_BASE
Steve Mucklee1b10862019-07-10 10:49:37 -07004382 echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
Doug Zongker38a649f2009-06-17 09:07:09 -07004383endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07004384ifdef BOARD_KERNEL_PAGESIZE
Steve Mucklee1b10862019-07-10 10:49:37 -07004385 echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07004386endif
Steve Mucklee1b10862019-07-10 10:49:37 -07004387else # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
4388 echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
4389endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
4390endif # BOARD_USES_RECOVERY_AS_BOOT not true
Doug Zongkere01100c2009-06-19 17:12:18 -07004391 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
4392 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07004393 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
Steve Mucklee1b10862019-07-10 10:49:37 -07004394ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
4395 mkdir -p $(zip_root)/VENDOR_BOOT
4396 $(call package_files-copy-root, \
4397 $(TARGET_VENDOR_RAMDISK_OUT),$(zip_root)/VENDOR_BOOT/RAMDISK)
4398ifdef INSTALLED_DTBIMAGE_TARGET
4399 cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/VENDOR_BOOT/dtb
4400endif
4401ifdef BOARD_KERNEL_BASE
4402 echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/VENDOR_BOOT/base
4403endif
4404ifdef BOARD_KERNEL_PAGESIZE
4405 echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/VENDOR_BOOT/pagesize
4406endif
4407 echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/VENDOR_BOOT/vendor_cmdline
4408endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
Dan Willemsen67495202019-01-16 12:42:05 -08004409ifdef BUILDING_SYSTEM_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08004410 @# Contents of the system image
4411 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004412 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
Dan Willemsen67495202019-01-16 12:42:05 -08004413endif
4414ifdef BUILDING_USERDATA_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08004415 @# Contents of the data image
4416 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004417 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Dan Willemsen67495202019-01-16 12:42:05 -08004418endif
4419ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07004420 @# Contents of the vendor image
4421 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004422 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
Ying Wanga0febe52013-03-20 11:02:05 -07004423endif
Dan Willemsen67495202019-01-16 12:42:05 -08004424ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004425 @# Contents of the product image
4426 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004427 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004428endif
Justin Yun6151e3f2019-06-25 15:58:13 +09004429ifdef BUILDING_SYSTEM_EXT_IMAGE
4430 @# Contents of the system_ext image
Dario Freni5f681e12018-05-29 13:09:01 +01004431 $(hide) $(call package_files-copy-root, \
Justin Yun6151e3f2019-06-25 15:58:13 +09004432 $(TARGET_OUT_SYSTEM_EXT),$(zip_root)/SYSTEM_EXT)
Dario Freni5f681e12018-05-29 13:09:01 +01004433endif
Dan Willemsen67495202019-01-16 12:42:05 -08004434ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004435 @# Contents of the odm image
4436 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004437 $(TARGET_OUT_ODM),$(zip_root)/ODM)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004438endif
Yifan Hongcfb917a2020-05-07 14:58:20 -07004439ifdef BUILDING_VENDOR_DLKM_IMAGE
4440 @# Contents of the vendor_dlkm image
4441 $(hide) $(call package_files-copy-root, \
4442 $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM)
4443endif
Dan Willemsen67495202019-01-16 12:42:05 -08004444ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07004445 @# Contents of the system_other image
4446 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00004447 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
Alex Light4e358ab2016-06-16 14:47:10 -07004448endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004449 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07004450 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07004451 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Yifan Hong65afc072020-04-17 10:08:10 -07004452ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08004453ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07004454 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07004455 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07004456endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08004457endif
Doug Zongker8678df42009-06-15 14:30:14 -07004458 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08004459 @# build them.
4460 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07004461 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09004462 $(hide) cp $(SOONG_APEX_KEYS_FILE) $(zip_root)/META/apexkeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07004463ifneq ($(tool_extension),)
4464 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
4465endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07004466 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07004467 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Daniel Normane1e48082019-06-27 13:55:23 -07004468 $(hide) cp $(INSTALLED_MISC_INFO_TARGET) $(zip_root)/META/misc_info.txt
Anton Hansson8dab0a62019-03-28 15:45:40 +00004469ifneq ($(PRODUCT_SYSTEM_BASE_FS_PATH),)
4470 $(hide) cp $(PRODUCT_SYSTEM_BASE_FS_PATH) \
4471 $(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_BASE_FS_PATH))
Tao Baof54216f2016-03-29 15:12:37 -07004472endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004473ifneq ($(PRODUCT_VENDOR_BASE_FS_PATH),)
4474 $(hide) cp $(PRODUCT_VENDOR_BASE_FS_PATH) \
4475 $(zip_root)/META/$(notdir $(PRODUCT_VENDOR_BASE_FS_PATH))
Tao Baof54216f2016-03-29 15:12:37 -07004476endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004477ifneq ($(PRODUCT_PRODUCT_BASE_FS_PATH),)
4478 $(hide) cp $(PRODUCT_PRODUCT_BASE_FS_PATH) \
4479 $(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_BASE_FS_PATH))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004480endif
Justin Yun6151e3f2019-06-25 15:58:13 +09004481ifneq ($(PRODUCT_SYSTEM_EXT_BASE_FS_PATH),)
4482 $(hide) cp $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \
4483 $(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH))
Dario Freni5f681e12018-05-29 13:09:01 +01004484endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004485ifneq ($(PRODUCT_ODM_BASE_FS_PATH),)
4486 $(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \
4487 $(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004488endif
Yifan Hongcfb917a2020-05-07 14:58:20 -07004489ifneq ($(PRODUCT_VENDOR_DLKM_BASE_FS_PATH),)
4490 $(hide) cp $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH) \
4491 $(zip_root)/META/$(notdir $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH))
4492endif
Yifan Hong65afc072020-04-17 10:08:10 -07004493ifeq ($(TARGET_OTA_ALLOW_NON_AB),true)
Tao Baocbc6dc22015-08-18 18:03:56 -07004494ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Baocf821fc2019-06-24 12:39:10 -07004495 $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Tao Baoe11a4602019-08-06 23:21:23 -07004496 $(MAKE_RECOVERY_PATCH) $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07004497endif
Bill Peckhamc0f413f2019-11-07 11:27:02 -08004498endif
Alex Deymo70067ac2015-09-29 19:05:37 -07004499ifeq ($(AB_OTA_UPDATER),true)
4500 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07004501 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07004502 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07004503 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
4504 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08004505 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
4506 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
4507 done
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07004508ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07004509 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
4510 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
4511 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07004512endif
Alex Deymo70067ac2015-09-29 19:05:37 -07004513endif
Steve Fungdfbab492015-09-24 18:12:33 -07004514ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07004515 @# If breakpad symbols have been generated, add them to the zip.
Dan Willemsen288bedf2019-05-28 15:36:47 -07004516 $(hide) cp -R $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
Steve Fungdfbab492015-09-24 18:12:33 -07004517endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07004518ifdef BOARD_PREBUILT_VENDORIMAGE
4519 $(hide) mkdir -p $(zip_root)/IMAGES
4520 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
4521endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004522ifdef BOARD_PREBUILT_PRODUCTIMAGE
4523 $(hide) mkdir -p $(zip_root)/IMAGES
4524 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
4525endif
Justin Yun6151e3f2019-06-25 15:58:13 +09004526ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
Dario Freni5f681e12018-05-29 13:09:01 +01004527 $(hide) mkdir -p $(zip_root)/IMAGES
Justin Yun6151e3f2019-06-25 15:58:13 +09004528 $(hide) cp $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(zip_root)/IMAGES/
Dario Freni5f681e12018-05-29 13:09:01 +01004529endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07004530ifdef BOARD_PREBUILT_BOOTIMAGE
4531 $(hide) mkdir -p $(zip_root)/IMAGES
4532 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
4533endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004534ifdef BOARD_PREBUILT_ODMIMAGE
4535 $(hide) mkdir -p $(zip_root)/IMAGES
4536 $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/
4537endif
Yifan Hongcfb917a2020-05-07 14:58:20 -07004538ifdef BOARD_PREBUILT_VENDOR_DLKIMMAGE
4539 $(hide) mkdir -p $(zip_root)/IMAGES
4540 $(hide) cp $(INSTALLED_VENDOR_DLKIMMAGE_TARGET) $(zip_root)/IMAGES/
4541endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07004542ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07004543 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
4544 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004545endif # BOARD_PREBUILT_DTBOIMAGE
Hongguang Chenf23364d2020-04-27 18:36:36 -07004546ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),)
4547 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
4548 $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \
4549 $(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST),cp $(image) $(zip_root)/PREBUILT_IMAGES/;))
4550endif # BOARD_CUSTOMIMAGES_PARTITION_LIST
Tao Bao95a95c32017-06-16 15:30:23 -07004551 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
4552 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
4553 @# INSTALLED_RADIOIMAGE_TARGET.
4554 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
4555 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004556 @# Run fs_config on all the system, vendor, boot ramdisk,
4557 @# and recovery ramdisk files in the zip, and save the output
Dan Willemsen67495202019-01-16 12:42:05 -08004558ifdef BUILDING_SYSTEM_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004559 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
Dan Willemsen67495202019-01-16 12:42:05 -08004560endif
4561ifdef BUILDING_VENDOR_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004562 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
4563endif
Dan Willemsen67495202019-01-16 12:42:05 -08004564ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004565 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
4566endif
Justin Yun6151e3f2019-06-25 15:58:13 +09004567ifdef BUILDING_SYSTEM_EXT_IMAGE
4568 $(hide) $(call fs_config,$(zip_root)/SYSTEM_EXT,system_ext/) > $(zip_root)/META/system_ext_filesystem_config.txt
Dario Freni5f681e12018-05-29 13:09:01 +01004569endif
Dan Willemsen67495202019-01-16 12:42:05 -08004570ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004571 $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
4572endif
Yifan Hongcfb917a2020-05-07 14:58:20 -07004573ifdef BUILDING_VENDOR_DLKM_IMAGE
4574 $(hide) $(call fs_config,$(zip_root)/VENDOR_DLKM,vendor_dlkm/) > $(zip_root)/META/vendor_dlkm_filesystem_config.txt
4575endif
Tom Cherryd14b8952018-08-09 14:26:00 -07004576 @# ROOT always contains the files for the root under normal boot.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004577 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004578ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherry2929cad2018-09-20 11:04:37 -07004579 @# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004580 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004581endif
Steve Mucklee1b10862019-07-10 10:49:37 -07004582ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
4583 $(call fs_config,$(zip_root)/VENDOR_BOOT/RAMDISK,) > $(zip_root)/META/vendor_boot_filesystem_config.txt
4584endif
Tom Cherry2929cad2018-09-20 11:04:37 -07004585ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
4586 @# 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 -08004587 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
4588endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004589ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
4590 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
4591endif
Dan Willemsen67495202019-01-16 12:42:05 -08004592ifdef BUILDING_SYSTEM_OTHER_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004593 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
4594endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004595 @# Metadata for compatibility verification.
Yifan Honge3ba82c2019-08-21 13:29:30 -07004596ifdef BUILT_KERNEL_CONFIGS_FILE
4597 $(hide) cp $(BUILT_KERNEL_CONFIGS_FILE) $(zip_root)/META/kernel_configs.txt
4598endif
4599ifdef BUILT_KERNEL_VERSION_FILE
4600 $(hide) cp $(BUILT_KERNEL_VERSION_FILE) $(zip_root)/META/kernel_version.txt
4601endif
Yifan Hongcb8e2752019-11-01 17:03:57 -07004602 rm -rf $(zip_root)/META/dynamic_partitions_info.txt
4603ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
4604 $(call dump-dynamic-partitions-info, $(zip_root)/META/dynamic_partitions_info.txt)
4605endif
Tao Baocbd6d492019-10-07 22:46:02 -07004606 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
4607 $(ADD_IMG_TO_TARGET_FILES) -a -v -p $(HOST_OUT) $(zip_root)
Isaac Chen9e09d472019-07-05 17:30:41 +08004608ifeq ($(BUILD_QEMU_IMAGES),true)
4609 $(hide) AVBTOOL=$(AVBTOOL) $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(zip_root)/IMAGES/vbmeta.img \
4610 $(zip_root)/IMAGES/system.img $(zip_root)/IMAGES/VerifiedBootParams.textproto
4611endif
Alex Deymo92cfd6f2016-01-26 18:47:44 -08004612 @# Zip everything up, preserving symlinks and placing META/ files first to
4613 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004614 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07004615 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004616 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07004617
Ying Wanga0febe52013-03-20 11:02:05 -07004618.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08004619target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
4620
Ying Wang4709d7c2014-04-14 17:25:43 -07004621ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
4622$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
4623endif
Doug Zongker367910f2009-06-15 18:56:51 -07004624
Dan Albert4d323332016-10-14 13:23:06 -07004625# -----------------------------------------------------------------
4626# NDK Sysroot Package
4627NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07004628$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07004629 @echo Package NDK sysroot...
4630 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
4631
4632$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
4633
Ying Wang09c4b682015-08-11 11:24:19 -07004634ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07004635# -----------------------------------------------------------------
4636# OTA update package
4637
Yifan Hong50e79542018-11-08 17:44:12 -08004638# $(1): output file
4639# $(2): additional args
4640define build-ota-package-target
Tao Baoc9315472019-06-25 12:17:08 -07004641PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
Tao Bao8821d642019-08-05 12:05:45 -07004642 $(OTA_FROM_TARGET_FILES) \
4643 --verbose \
4644 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
4645 --path $(HOST_OUT) \
4646 $(if $(OEM_OTA_CONFIG), --oem_settings $(OEM_OTA_CONFIG)) \
4647 $(2) \
4648 $(BUILT_TARGET_FILES_PACKAGE) $(1)
Yifan Hong50e79542018-11-08 17:44:12 -08004649endef
4650
Doug Zongker8678df42009-06-15 14:30:14 -07004651name := $(TARGET_PRODUCT)
4652ifeq ($(TARGET_BUILD_TYPE),debug)
4653 name := $(name)_debug
4654endif
4655name := $(name)-ota-$(FILE_NAME_TAG)
4656
4657INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
xunchang3b548b02019-02-19 14:52:33 -08004658INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata
4659
Doug Zongker8678df42009-06-15 14:30:14 -07004660$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
xunchang3b548b02019-02-19 14:52:33 -08004661$(INTERNAL_OTA_PACKAGE_TARGET): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_OTA_METADATA)
Tao Bao8821d642019-08-05 12:05:45 -07004662$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTA_FROM_TARGET_FILES)
Doug Zongker8678df42009-06-15 14:30:14 -07004663 @echo "Package OTA: $@"
xunchang3b548b02019-02-19 14:52:33 -08004664 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --output_metadata_path $(INTERNAL_OTA_METADATA))
Doug Zongker8678df42009-06-15 14:30:14 -07004665
4666.PHONY: otapackage
4667otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
4668
Tao Bao519d1822018-12-27 12:47:23 -08004669ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true)
Yifan Hong50e79542018-11-08 17:44:12 -08004670name := $(TARGET_PRODUCT)
4671ifeq ($(TARGET_BUILD_TYPE),debug)
4672 name := $(name)_debug
4673endif
4674name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
4675
4676INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
Yifan Hong50e79542018-11-08 17:44:12 -08004677$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Tao Bao8821d642019-08-05 12:05:45 -07004678$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): \
4679 $(BUILT_TARGET_FILES_PACKAGE) \
4680 $(OTA_FROM_TARGET_FILES)
Yifan Hong50e79542018-11-08 17:44:12 -08004681 @echo "Package OTA (retrofit dynamic partitions): $@"
4682 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
4683
4684.PHONY: otardppackage
4685
4686otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
4687
Tao Bao519d1822018-12-27 12:47:23 -08004688endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
Yifan Hong50e79542018-11-08 17:44:12 -08004689
Ying Wang09c4b682015-08-11 11:24:19 -07004690endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07004691
Ying Wang09a00a62010-10-20 14:01:09 -07004692# -----------------------------------------------------------------
Dario Frenid1011272018-07-23 20:20:15 +01004693# A zip of the appcompat directory containing logs
4694APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip
4695# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01004696ifeq (,$(TARGET_BUILD_UNBUNDLED))
Tao Baoe9d61b02018-08-20 21:09:07 -07004697$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004698 $(INSTALLED_RAMDISK_TARGET) \
4699 $(INSTALLED_BOOTIMAGE_TARGET) \
4700 $(INSTALLED_USERDATAIMAGE_TARGET) \
4701 $(INSTALLED_VENDORIMAGE_TARGET) \
4702 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Justin Yun6151e3f2019-06-25 15:58:13 +09004703 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)
Dario Frenid1011272018-07-23 20:20:15 +01004704endif
4705$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
4706$(APPCOMPAT_ZIP): $(SOONG_ZIP)
4707 @echo "appcompat logs: $@"
4708 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4709 $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/appcompat $(dir $(PRIVATE_LIST_FILE))
4710 $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE)
4711 $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE)
4712
Dario Frenid1011272018-07-23 20:20:15 +01004713# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004714# A zip of the symbols directory. Keep the full paths to make it
4715# more obvious where these files came from.
4716#
4717name := $(TARGET_PRODUCT)
4718ifeq ($(TARGET_BUILD_TYPE),debug)
4719 name := $(name)_debug
4720endif
4721name := $(name)-symbols-$(FILE_NAME_TAG)
4722
4723SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004724# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01004725ifeq (,$(TARGET_BUILD_UNBUNDLED))
Tao Baoe9d61b02018-08-20 21:09:07 -07004726$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004727 $(INSTALLED_RAMDISK_TARGET) \
4728 $(INSTALLED_BOOTIMAGE_TARGET) \
4729 $(INSTALLED_USERDATAIMAGE_TARGET) \
4730 $(INSTALLED_VENDORIMAGE_TARGET) \
4731 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Justin Yun6151e3f2019-06-25 15:58:13 +09004732 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004733 $(INSTALLED_ODMIMAGE_TARGET) \
Yifan Hongcfb917a2020-05-07 14:58:20 -07004734 $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004735 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07004736endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004737$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
4738$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004739 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004740 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4741 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
Jiyong Park88e09802019-03-21 15:19:16 +09004742 $(hide) find -L $(TARGET_OUT_UNSTRIPPED) -type f | sort >$(PRIVATE_LIST_FILE)
Colin Cross8d342442019-05-07 11:47:13 -07004743 $(hide) $(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004744# -----------------------------------------------------------------
4745# A zip of the coverage directory.
4746#
Oliver Nguyene91ab232019-04-30 15:14:44 -07004747name := gcov-report-files-all
Ryan Campbell81c9d292016-09-12 13:56:50 -07004748ifeq ($(TARGET_BUILD_TYPE),debug)
4749name := $(name)_debug
4750endif
Ryan Campbell81c9d292016-09-12 13:56:50 -07004751COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01004752ifeq (,$(TARGET_BUILD_UNBUNDLED))
Tao Baoe9d61b02018-08-20 21:09:07 -07004753$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004754 $(INSTALLED_RAMDISK_TARGET) \
4755 $(INSTALLED_BOOTIMAGE_TARGET) \
4756 $(INSTALLED_USERDATAIMAGE_TARGET) \
4757 $(INSTALLED_VENDORIMAGE_TARGET) \
4758 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Justin Yun6151e3f2019-06-25 15:58:13 +09004759 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
Yifan Hongcfb917a2020-05-07 14:58:20 -07004760 $(INSTALLED_ODMIMAGE_TARGET) \
4761 $(INSTALLED_VENDOR_DLKMIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004762endif
4763$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
4764$(COVERAGE_ZIP): $(SOONG_ZIP)
4765 @echo "Package coverage: $@"
4766 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4767 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
4768 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
4769 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004770
Oliver Nguyenb02f7db2019-12-11 14:55:52 -08004771#------------------------------------------------------------------
4772# Export the LLVM profile data tool and dependencies for Clang coverage processing
4773#
4774ifeq (true,$(CLANG_COVERAGE))
4775 LLVM_PROFDATA := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/bin/llvm-profdata
4776 LIBCXX := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/lib64/libc++.so.1
4777 PROFDATA_ZIP := $(PRODUCT_OUT)/llvm-profdata.zip
4778 $(PROFDATA_ZIP): $(SOONG_ZIP)
4779 $(hide) $(SOONG_ZIP) -d -o $@ -C $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION) -f $(LLVM_PROFDATA) -f $(LIBCXX)
4780
4781 $(call dist-for-goals,droidcore,$(PROFDATA_ZIP))
4782endif
4783
The Android Open Source Project88b60792009-03-03 19:28:42 -08004784# -----------------------------------------------------------------
4785# A zip of the Android Apps. Not keeping full path so that we don't
4786# include product names when distributing
4787#
4788name := $(TARGET_PRODUCT)
4789ifeq ($(TARGET_BUILD_TYPE),debug)
4790 name := $(name)_debug
4791endif
4792name := $(name)-apps-$(FILE_NAME_TAG)
4793
4794APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Tao Baoe9d61b02018-08-20 21:09:07 -07004795$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004796 @echo "Package apps: $@"
4797 $(hide) rm -rf $@
4798 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004799 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
4800 if [ -z "$$apps_to_zip" ]; then \
Anton Hansson6d814982018-11-26 18:12:05 +00004801 echo "No apps to zip up. Generating empty apps archive." ; \
4802 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004803 else \
Anton Hansson6d814982018-11-26 18:12:05 +00004804 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004805 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07004806
Ying Wangbc415dd2012-08-15 12:22:44 -07004807ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07004808#------------------------------------------------------------------
4809# An archive of classes for use in generating code-coverage reports
4810# These are the uninstrumented versions of any classes that were
4811# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07004812# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004813
Colin Crossa6bc3a82017-09-27 14:28:41 -07004814JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004815$(JACOCO_REPORT_CLASSES_ALL) :
4816 @echo "Collecting uninstrumented classes"
Colin Crossd81f4b32020-02-12 14:14:27 -08004817 find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" 2>/dev/null | sort > $@.list
4818 $(SOONG_ZIP) -o $@ -L 0 -C $(OUT_DIR) -P out -l $@.list
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004819
Ying Wangbc415dd2012-08-15 12:22:44 -07004820endif # EMMA_INSTRUMENT=true
4821
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004822
Ying Wangae9115a2013-08-22 20:52:47 -07004823#------------------------------------------------------------------
4824# A zip of Proguard obfuscation dictionary files.
Ying Wangae9115a2013-08-22 20:52:47 -07004825#
Ying Wangc62c92c2013-08-28 18:38:25 -07004826PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross114e8df2019-09-05 17:19:35 -07004827# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Martin Stjernholm7a430fd2020-06-04 15:16:39 +01004828ifeq (,$(TARGET_BUILD_UNBUNDLED))
Colin Cross114e8df2019-09-05 17:19:35 -07004829$(PROGUARD_DICT_ZIP): \
4830 $(INSTALLED_SYSTEMIMAGE_TARGET) \
4831 $(INSTALLED_RAMDISK_TARGET) \
4832 $(INSTALLED_BOOTIMAGE_TARGET) \
4833 $(INSTALLED_USERDATAIMAGE_TARGET) \
4834 $(INSTALLED_VENDORIMAGE_TARGET) \
4835 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4836 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
4837 $(INSTALLED_ODMIMAGE_TARGET) \
Yifan Hongcfb917a2020-05-07 14:58:20 -07004838 $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \
Colin Cross114e8df2019-09-05 17:19:35 -07004839 $(updater_dep)
4840endif
4841$(PROGUARD_DICT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard)/filelist
4842$(PROGUARD_DICT_ZIP): $(SOONG_ZIP)
Ying Wangae9115a2013-08-22 20:52:47 -07004843 @echo "Packaging Proguard obfuscation dictionary files."
Colin Cross114e8df2019-09-05 17:19:35 -07004844 mkdir -p $(dir $@) $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS $(dir $(PRIVATE_LIST_FILE))
4845 find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary | \
4846 sed -e 's/\(.*\)\/proguard_dictionary/\0\n\1\/classes.jar/' > $(PRIVATE_LIST_FILE)
4847 $(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ying Wangae9115a2013-08-22 20:52:47 -07004848
Tao Bao48a2feb2019-06-28 11:00:05 -07004849
4850ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
4851
4852# Dump variables used by build_super_image.py (for building super.img and super_empty.img).
4853# $(1): output file
4854define dump-super-image-info
4855 $(call dump-dynamic-partitions-info,$(1))
4856 $(if $(filter true,$(AB_OTA_UPDATER)), \
4857 echo "ab_update=true" >> $(1))
4858endef
4859
4860endif # PRODUCT_USE_DYNAMIC_PARTITIONS
4861
The Android Open Source Project88b60792009-03-03 19:28:42 -08004862# -----------------------------------------------------------------
Yifan Hongacd862a2019-04-16 15:44:30 -07004863# super partition image (dist)
Yifan Hong2b891ac2018-11-29 12:06:31 -08004864
4865ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4866
4867# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
4868ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4869
4870ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
Yifan Hongacd862a2019-04-16 15:44:30 -07004871
4872# For real devices and for dist builds, build super image from target files to an intermediate directory.
4873INTERNAL_SUPERIMAGE_DIST_TARGET := $(call intermediates-dir-for,PACKAGING,super.img)/super.img
4874$(INTERNAL_SUPERIMAGE_DIST_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
4875$(INTERNAL_SUPERIMAGE_DIST_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
4876 $(call pretty,"Target super fs image from target files: $@")
Tao Bao403a2f92018-12-13 10:45:46 -08004877 PATH=$(dir $(LPMAKE)):$$PATH \
4878 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
Yifan Hong69e0d612019-03-11 15:55:33 -07004879
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004880# Skip packing it in dist package because it is in update package.
4881ifneq (true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE))
Yifan Hongacd862a2019-04-16 15:44:30 -07004882$(call dist-for-goals,dist_files,$(INTERNAL_SUPERIMAGE_DIST_TARGET))
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004883endif
Yifan Hongacd862a2019-04-16 15:44:30 -07004884
4885.PHONY: superimage_dist
4886superimage_dist: $(INTERNAL_SUPERIMAGE_DIST_TARGET)
Yifan Hong69e0d612019-03-11 15:55:33 -07004887
4888endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true"
Yifan Hongacd862a2019-04-16 15:44:30 -07004889endif # BOARD_SUPER_PARTITION_SIZE != ""
4890endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
Yifan Hong2b891ac2018-11-29 12:06:31 -08004891
Yifan Hongacd862a2019-04-16 15:44:30 -07004892# -----------------------------------------------------------------
4893# super partition image for development
4894
4895ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4896ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4897ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
4898
4899# Build super.img by using $(INSTALLED_*IMAGE_TARGET) to $(1)
4900# $(1): built image path
4901# $(2): misc_info.txt path; its contents should match expectation of build_super_image.py
4902define build-superimage-target
4903 mkdir -p $(dir $(2))
4904 rm -rf $(2)
4905 $(call dump-super-image-info,$(2))
4906 $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
4907 echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(2);)
changho.shina8f9f112019-10-15 13:26:19 +09004908 $(if $(BUILDING_SYSTEM_OTHER_IMAGE), $(if $(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)), \
4909 echo "system_other_image=$(INSTALLED_SYSTEMOTHERIMAGE_TARGET)" >> $(2);))
Yifan Hongacd862a2019-04-16 15:44:30 -07004910 mkdir -p $(dir $(1))
4911 PATH=$(dir $(LPMAKE)):$$PATH \
4912 $(BUILD_SUPER_IMAGE) -v $(2) $(1)
4913endef
4914
4915INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
4916INSTALLED_SUPERIMAGE_DEPENDENCIES := $(LPMAKE) $(BUILD_SUPER_IMAGE) \
4917 $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET))
4918
changho.shina8f9f112019-10-15 13:26:19 +09004919ifdef BUILDING_SYSTEM_OTHER_IMAGE
4920ifneq ($(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
4921INSTALLED_SUPERIMAGE_DEPENDENCIES += $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
4922endif
4923endif
4924
Yifan Hongacd862a2019-04-16 15:44:30 -07004925# If BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT is set, super.img is built from images in the
4926# $(PRODUCT_OUT) directory, and is built to $(PRODUCT_OUT)/super.img. Also, it will
4927# be built for non-dist builds. This is useful for devices that uses super.img directly, e.g.
4928# virtual devices.
4929ifeq (true,$(BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT))
4930$(INSTALLED_SUPERIMAGE_TARGET): $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
4931 $(call pretty,"Target super fs image for debug: $@")
4932 $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
Isaac Chen52cc60c2019-08-14 18:52:13 +08004933 $(call intermediates-dir-for,PACKAGING,superimage_debug)/misc_info.txt)
Yifan Hongacd862a2019-04-16 15:44:30 -07004934
4935droidcore: $(INSTALLED_SUPERIMAGE_TARGET)
4936
4937# For devices that uses super image directly, the superimage target points to the file in $(PRODUCT_OUT).
4938.PHONY: superimage
4939superimage: $(INSTALLED_SUPERIMAGE_TARGET)
Isaac Chen52cc60c2019-08-14 18:52:13 +08004940
4941$(call dist-for-goals,dist_files,$(INSTALLED_MISC_INFO_TARGET):super_misc_info.txt)
Yifan Hongacd862a2019-04-16 15:44:30 -07004942endif # BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT
4943
4944# Build $(PRODUCT_OUT)/super.img without dependencies.
4945.PHONY: superimage-nodeps supernod
4946superimage-nodeps supernod: intermediates :=
4947superimage-nodeps supernod: | $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
4948 $(call pretty,"make $(INSTALLED_SUPERIMAGE_TARGET): ignoring dependencies")
4949 $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
4950 $(call intermediates-dir-for,PACKAGING,superimage-nodeps)/misc_info.txt)
4951
4952endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true"
4953endif # BOARD_SUPER_PARTITION_SIZE != ""
4954endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
4955
4956# -----------------------------------------------------------------
4957# super empty image
4958
Tao Bao48a2feb2019-06-28 11:00:05 -07004959ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
Yifan Hongacd862a2019-04-16 15:44:30 -07004960ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
Yifan Hong2b891ac2018-11-29 12:06:31 -08004961
Yifan Hong8b79d162018-11-29 12:32:00 -08004962INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
4963$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty)
4964$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE)
4965 $(call pretty,"Target empty super fs image: $@")
4966 mkdir -p $(intermediates)
4967 rm -rf $(intermediates)/misc_info.txt
Yifan Hong69e0d612019-03-11 15:55:33 -07004968 $(call dump-super-image-info,$(intermediates)/misc_info.txt)
Tao Bao403a2f92018-12-13 10:45:46 -08004969 PATH=$(dir $(LPMAKE)):$$PATH \
4970 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@
Yifan Hong8b79d162018-11-29 12:32:00 -08004971
4972$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
4973
Yifan Hong2b891ac2018-11-29 12:06:31 -08004974endif # BOARD_SUPER_PARTITION_SIZE != ""
Tao Bao48a2feb2019-06-28 11:00:05 -07004975endif # PRODUCT_USE_DYNAMIC_PARTITIONS == "true"
Yifan Hong2b891ac2018-11-29 12:06:31 -08004976
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004977
4978# -----------------------------------------------------------------
4979# The update package
4980
4981name := $(TARGET_PRODUCT)
4982ifeq ($(TARGET_BUILD_TYPE),debug)
4983 name := $(name)_debug
4984endif
4985name := $(name)-img-$(FILE_NAME_TAG)
4986
4987INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4988
Tao Bao57f8ed62019-08-14 23:08:18 -07004989$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(IMG_FROM_TARGET_FILES)
4990 $(call pretty,"Package: $@")
4991 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$(dir $(ZIP2ZIP)):$$PATH \
4992 $(IMG_FROM_TARGET_FILES) \
4993 --additional IMAGES/VerifiedBootParams.textproto:VerifiedBootParams.textproto \
4994 $(BUILT_TARGET_FILES_PACKAGE) $@
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004995
4996.PHONY: updatepackage
4997updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
Dan Willemsen9ae64952019-08-05 14:45:11 -07004998$(call dist-for-goals,updatepackage,$(INTERNAL_UPDATE_PACKAGE_TARGET))
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004999
5000
Yifan Hong2b891ac2018-11-29 12:06:31 -08005001# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08005002# dalvik something
5003.PHONY: dalvikfiles
5004dalvikfiles: $(INTERNAL_DALVIK_MODULES)
5005
Bo Huf0d50bb2017-08-01 19:02:09 +00005006ifeq ($(BUILD_QEMU_IMAGES),true)
Bo Huf0d50bb2017-08-01 19:02:09 +00005007MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
Isaac Chen9e09d472019-07-05 17:30:41 +08005008MK_COMBINE_QEMU_IMAGE := $(HOST_OUT_EXECUTABLES)/mk_combined_img
Bo Huf0d50bb2017-08-01 19:02:09 +00005009SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
Roman Kiryanove64998f2019-02-14 16:45:33 -08005010
5011ifdef INSTALLED_SYSTEMIMAGE_TARGET
5012INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
bohu9492ee32019-03-07 10:03:41 -08005013INSTALLED_SYSTEM_QEMU_CONFIG := $(PRODUCT_OUT)/system-qemu-config.txt
5014$(INSTALLED_SYSTEM_QEMU_CONFIG): $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_VBMETAIMAGE_TARGET)
5015 @echo "$(PRODUCT_OUT)/vbmeta.img vbmeta 1" > $@
5016 @echo "$(INSTALLED_SUPERIMAGE_TARGET) super 2" >> $@
Isaac Chen9e09d472019-07-05 17:30:41 +08005017$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_VBMETAIMAGE_TARGET) $(MK_COMBINE_QEMU_IMAGE) $(SGDISK_HOST) $(SIMG2IMG) \
bohu9492ee32019-03-07 10:03:41 -08005018 $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SYSTEM_QEMU_CONFIG)
5019 @echo Create system-qemu.img now
5020 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); \
Isaac Chen9e09d472019-07-05 17:30:41 +08005021 $(MK_COMBINE_QEMU_IMAGE) -i $(INSTALLED_SYSTEM_QEMU_CONFIG) -o $@)
Bo Huf0d50bb2017-08-01 19:02:09 +00005022
5023systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
5024droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
Roman Kiryanove64998f2019-02-14 16:45:33 -08005025endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00005026ifdef INSTALLED_VENDORIMAGE_TARGET
Bo Huf0d50bb2017-08-01 19:02:09 +00005027INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00005028$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00005029 @echo Create vendor-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08005030 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00005031
5032vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
5033droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
5034endif
bohu8fd437c2020-03-30 20:16:13 -07005035
5036ifdef INSTALLED_RAMDISK_TARGET
5037ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET
5038ifdef INTERNAL_VENDOR_RAMDISK_TARGET
5039INSTALLED_QEMU_RAMDISKIMAGE := $(PRODUCT_OUT)/ramdisk-qemu.img
5040$(INSTALLED_QEMU_RAMDISKIMAGE): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_RAMDISK_TARGET)
5041 @echo Create ramdisk-qemu.img
5042 (cat $(INSTALLED_RAMDISK_TARGET) $(INTERNAL_VENDOR_RAMDISK_TARGET) > $(INSTALLED_QEMU_RAMDISKIMAGE))
5043
5044droidcore: $(INSTALLED_QEMU_RAMDISKIMAGE)
5045endif
5046endif
5047endif
5048
Anton Hansson32c76fe2018-12-13 14:34:18 +00005049ifdef INSTALLED_PRODUCTIMAGE_TARGET
Jaekyun Seokb7735d82017-11-27 17:04:47 +09005050INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00005051$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09005052 @echo Create product-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08005053 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09005054
5055productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
5056droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
5057endif
Justin Yun6151e3f2019-06-25 15:58:13 +09005058ifdef INSTALLED_SYSTEM_EXTIMAGE_TARGET
5059INSTALLED_QEMU_SYSTEM_EXTIMAGE := $(PRODUCT_OUT)/system_ext-qemu.img
5060$(INSTALLED_QEMU_SYSTEM_EXTIMAGE): $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
5061 @echo Create system_ext-qemu.img
5062 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEM_EXTIMAGE_TARGET))
Dario Freni5f681e12018-05-29 13:09:01 +01005063
Justin Yun6151e3f2019-06-25 15:58:13 +09005064systemextimage: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE)
5065droidcore: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE)
Dario Freni5f681e12018-05-29 13:09:01 +01005066endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00005067ifdef INSTALLED_ODMIMAGE_TARGET
Bowgo Tsaid624fa62017-11-14 23:42:30 +08005068INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
5069$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
5070 @echo Create odm-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08005071 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08005072
5073odmimage: $(INSTALLED_QEMU_ODMIMAGE)
5074droidcore: $(INSTALLED_QEMU_ODMIMAGE)
5075endif
Matt Wachowski9e4d5152018-08-07 16:29:22 -07005076
Yifan Hongcfb917a2020-05-07 14:58:20 -07005077ifdef INSTALLED_VENDOR_DLKMIMAGE_TARGET
5078INSTALLED_QEMU_VENDOR_DLKMIMAGE := $(PRODUCT_OUT)/vendor_dlkm-qemu.img
5079$(INSTALLED_QEMU_VENDOR_DLKMIMAGE): $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
5080 @echo Create vendor_dlkm-qemu.img
5081 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDOR_DLKMIMAGE_TARGET))
5082
5083vendor_dlkmimage: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE)
5084droidcore: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE)
5085endif
5086
5087
Matt Wachowski9e4d5152018-08-07 16:29:22 -07005088QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
bohu9492ee32019-03-07 10:03:41 -08005089$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \
5090 $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(AVBTOOL)
Matt Wachowski9e4d5152018-08-07 16:29:22 -07005091 @echo Creating $@
bohu9492ee32019-03-07 10:03:41 -08005092 (export AVBTOOL=$(AVBTOOL); $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) \
5093 $(INSTALLED_SYSTEMIMAGE_TARGET) $(QEMU_VERIFIED_BOOT_PARAMS))
Matt Wachowski9e4d5152018-08-07 16:29:22 -07005094
5095systemimage: $(QEMU_VERIFIED_BOOT_PARAMS)
5096droidcore: $(QEMU_VERIFIED_BOOT_PARAMS)
bohu9492ee32019-03-07 10:03:41 -08005097
Bo Huf0d50bb2017-08-01 19:02:09 +00005098endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08005099# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08005100# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07005101ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005102INTERNAL_EMULATOR_PACKAGE_FILES += \
5103 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08005104 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08005105 $(INSTALLED_RAMDISK_TARGET) \
Tao Baoe9d61b02018-08-20 21:09:07 -07005106 $(INSTALLED_SYSTEMIMAGE_TARGET) \
5107 $(INSTALLED_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005108
5109name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
5110
5111INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
5112
Ying Wang5d887702015-11-04 10:06:25 -08005113$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005114 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07005115 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005116
Ying Wang7d8c5352012-07-26 10:15:21 -07005117endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08005118# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08005119# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08005120# The pdk package (Platform Development Kit)
5121
Keun young Park7fc7aad2012-02-27 15:49:23 -08005122#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
5123# include development/pdk/Pdk.mk
5124#endif
5125
The Android Open Source Project88b60792009-03-03 19:28:42 -08005126
5127# -----------------------------------------------------------------
5128# The SDK
5129
The Android Open Source Project88b60792009-03-03 19:28:42 -08005130# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07005131sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005132
5133# Build a name that looks like:
5134#
5135# linux-x86 --> android-sdk_12345_linux-x86
5136# darwin-x86 --> android-sdk_12345_mac-x86
5137# windows-x86 --> android-sdk_12345_windows
5138#
5139sdk_name := android-sdk_$(FILE_NAME_TAG)
5140ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07005141 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08005142else
Joe Onorato03fbe402009-04-13 08:31:16 -07005143 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005144endif
5145ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07005146 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005147endif
Joe Onorato03fbe402009-04-13 08:31:16 -07005148sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005149
5150sdk_dep_file := $(sdk_dir)/sdk_deps.mk
5151
5152ATREE_FILES :=
5153-include $(sdk_dep_file)
5154
5155# if we don't have a real list, then use "everything"
5156ifeq ($(strip $(ATREE_FILES)),)
5157ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08005158 $(ALL_DEFAULT_INSTALLED_MODULES) \
5159 $(INSTALLED_RAMDISK_TARGET) \
5160 $(ALL_DOCS) \
5161 $(ALL_SDK_FILES)
5162endif
5163
5164atree_dir := development/build
5165
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01005166
The Android Open Source Project88b60792009-03-03 19:28:42 -08005167sdk_atree_files := \
5168 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07005169 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08005170
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02005171# development/build/sdk-android-<abi>.atree is used to differentiate
5172# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
5173# files like the kernel image. We use TARGET_CPU_ABI because we don't
5174# have a better way to distinguish between CPU models.
5175ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
5176 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
5177endif
5178
Anton Hansson8dab0a62019-03-28 15:45:40 +00005179ifneq ($(PRODUCT_SDK_ATREE_FILES),)
5180sdk_atree_files += $(PRODUCT_SDK_ATREE_FILES)
Griff Hazen433febb2014-02-28 08:45:59 -08005181else
5182sdk_atree_files += $(atree_dir)/sdk.atree
5183endif
5184
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07005185include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07005186
The Android Open Source Project88b60792009-03-03 19:28:42 -08005187deps := \
5188 $(target_notice_file_txt) \
5189 $(tools_notice_file_txt) \
5190 $(OUT_DOCS)/offline-sdk-timestamp \
Jerome Gaillarda0171af2019-10-10 19:35:08 +01005191 $(SDK_METADATA_FILES) \
Ying Wang139e3322010-03-31 17:29:04 -07005192 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07005193 $(COVERAGE_ZIP) \
Dario Frenid1011272018-07-23 20:20:15 +01005194 $(APPCOMPAT_ZIP) \
Tao Baoe9d61b02018-08-20 21:09:07 -07005195 $(INSTALLED_SYSTEMIMAGE_TARGET) \
Bo Huf0d50bb2017-08-01 19:02:09 +00005196 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu8fd437c2020-03-30 20:16:13 -07005197 $(INSTALLED_QEMU_RAMDISKIMAGE) \
bohu18d18682017-08-14 14:52:20 -07005198 $(INSTALLED_QEMU_VENDORIMAGE) \
Matt Wachowski9e4d5152018-08-07 16:29:22 -07005199 $(QEMU_VERIFIED_BOOT_PARAMS) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07005200 $(INSTALLED_USERDATAIMAGE_TARGET) \
5201 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08005202 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07005203 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08005204 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08005205 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08005206 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07005207 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07005208 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005209
5210INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
5211$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
5212$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
5213$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
5214$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
5215
5216# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
5217#
5218#SDK_GNU_ERROR := true
5219
Ying Wang5d887702015-11-04 10:06:25 -08005220$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005221 @echo "Package SDK: $@"
5222 $(hide) rm -rf $(PRIVATE_DIR) $@
5223 $(hide) for f in $(target_gnu_MODULES); do \
5224 if [ -f $$f ]; then \
5225 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
5226 including GNU target $$f >&2; \
5227 FAIL=$(SDK_GNU_ERROR); \
5228 fi; \
5229 done; \
5230 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07005231 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08005232 $(hide) ( \
Anton Hansson6d814982018-11-26 18:12:05 +00005233 ATREE_STRIP="$(HOST_STRIP) -x" \
5234 $(HOST_OUT_EXECUTABLES)/atree \
5235 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
5236 -m $(PRIVATE_DEP_FILE) \
5237 -I . \
5238 -I $(PRODUCT_OUT) \
5239 -I $(HOST_OUT) \
5240 -I $(TARGET_COMMON_OUT_ROOT) \
5241 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
5242 -v "OUT_DIR=$(OUT_DIR)" \
5243 -v "HOST_OUT=$(HOST_OUT)" \
5244 -v "TARGET_ARCH=$(TARGET_ARCH)" \
5245 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
5246 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
5247 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
5248 -o $(PRIVATE_DIR) && \
5249 cp -f $(target_notice_file_txt) \
5250 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
5251 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
5252 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
5253 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
5254 chmod -R ug+rwX $(PRIVATE_DIR) && \
5255 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08005256 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
5257
Raphael3d224a02010-04-16 17:50:09 -07005258
5259# Is a Windows SDK requested? If so, we need some definitions from here
5260# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08005261MAIN_SDK_NAME := $(sdk_name)
5262MAIN_SDK_DIR := $(sdk_dir)
5263MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08005264ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07005265include $(TOPDIR)development/build/tools/windows_sdk.mk
5266endif
5267
The Android Open Source Project88b60792009-03-03 19:28:42 -08005268# -----------------------------------------------------------------
5269# Findbugs
5270INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
5271INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
5272$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
5273 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09005274 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08005275 > $@
5276$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
5277 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09005278 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07005279 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08005280
5281# -----------------------------------------------------------------
5282# Findbugs
5283
5284# -----------------------------------------------------------------
5285# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07005286ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08005287include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01005288-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07005289-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07005290-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07005291# Also the project-specific tasks
5292-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
5293-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07005294-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07005295# Also add test specifc tasks
5296include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07005297include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07005298endif
Raphaelc4d47312011-02-15 16:09:36 -08005299
Ying Wang67132ba2015-10-28 16:42:39 -07005300include $(BUILD_SYSTEM)/product-graph.mk
5301
Raphaelc4d47312011-02-15 16:09:36 -08005302# -----------------------------------------------------------------
5303# Create SDK repository packages. Must be done after tasks/* since
5304# we need the addon rules defined.
5305ifneq ($(sdk_repo_goal),)
5306include $(TOPDIR)development/build/tools/sdk_repo.mk
5307endif
Mitch Phillipsceefc442019-09-26 16:37:59 -07005308
5309# -----------------------------------------------------------------
Mitch Phillips3adbcb32019-10-17 19:24:46 -07005310# Soong generates the list of all shared libraries that are depended on by fuzz
5311# targets. It saves this list as a source:destination pair to
5312# FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS, where the source is the path to the
5313# build of the unstripped shared library, and the destination is the
5314# /data/fuzz/$ARCH/lib (for device) or /fuzz/$ARCH/lib (for host) directory
5315# where fuzz target shared libraries are to be "reinstalled". The
5316# copy-many-files below generates the rules to copy the unstripped shared
5317# libraries to the device or host "reinstallation" directory. These rules are
5318# depended on by each module in soong_cc_prebuilt.mk, where the module will have
5319# a dependency on each shared library that it needs to be "reinstalled".
5320FUZZ_SHARED_DEPS := $(call copy-many-files,$(strip $(FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS)))
5321
5322# -----------------------------------------------------------------
Mitch Phillipsceefc442019-09-26 16:37:59 -07005323# The rule to build all fuzz targets, and package them.
5324# Note: The packages are created in Soong, and in a perfect world,
5325# we'd be able to create the phony rule there. But, if we want to
5326# have dist goals for the fuzz target, we need to have the PHONY
5327# target defined in make. MakeVarsContext.DistForGoal doesn't take
5328# into account that a PHONY rule create by Soong won't be available
5329# during make, and such will fail with `writing to readonly
Kris Alder8c8c2b92019-11-26 12:03:39 -08005330# directory`, because kati will see 'haiku' as being a file, not a
Mitch Phillipsceefc442019-09-26 16:37:59 -07005331# phony target.
Kris Alder8c8c2b92019-11-26 12:03:39 -08005332.PHONY: haiku
5333haiku: $(SOONG_FUZZ_PACKAGING_ARCH_MODULES) $(ALL_FUZZ_TARGETS)
5334$(call dist-for-goals,haiku,$(SOONG_FUZZ_PACKAGING_ARCH_MODULES))
Kyriakos Ispoglouf00a0db2020-02-06 16:41:49 -08005335
5336# -----------------------------------------------------------------
5337# The makefile for haiku line coverage.
5338include $(BUILD_SYSTEM)/line_coverage.mk