blob: e90b3ac7424a0a0f8c6b0ff42bb714a57170ee91 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Put some miscellaneous rules here
2
Ying Wang3bbfddd2014-03-01 15:32:04 -08003# HACK: clear LOCAL_PATH from including last build target before calling
4# intermedites-dir-for
5LOCAL_PATH := $(BUILD_SYSTEM)
6
The Android Open Source Project88b60792009-03-03 19:28:42 -08007# -----------------------------------------------------------------
8# Define rules to copy PRODUCT_COPY_FILES defined by the product.
Ying Wang4b0486b2012-09-20 16:35:36 -07009# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
The Android Open Source Project88b60792009-03-03 19:28:42 -080010# <dest file> is relative to $(PRODUCT_OUT), so it should look like,
11# e.g., "system/etc/file.xml".
Jean-Baptiste Queru518ce572010-03-01 16:18:59 -080012# The filter part means "only eval the copy-one-file rule if this
Ying Wang462d26b2010-11-02 21:31:47 -070013# src:dest pair is the first one to match the same dest"
Ying Wang68864102011-09-29 13:23:25 -070014#$(1): the src:dest pair
Dan Willemsen7d957c92018-04-30 16:01:33 -070015#$(2): the dest
Ying Wang68864102011-09-29 13:23:25 -070016define check-product-copy-files
Dan Willemsen7d957c92018-04-30 16:01:33 -070017$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
18 $(if $(filter %.apk, $(2)),$(error \
19 Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
Ying Wang68864102011-09-29 13:23:25 -070020endef
Ying Wang619fccf2012-09-05 18:08:29 -070021# filter out the duplicate <source file>:<dest file> pairs.
22unique_product_copy_files_pairs :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080023$(foreach cf,$(PRODUCT_COPY_FILES), \
Ying Wang619fccf2012-09-05 18:08:29 -070024 $(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\
25 $(eval unique_product_copy_files_pairs += $(cf))))
26unique_product_copy_files_destinations :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080027product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070028$(foreach cf,$(unique_product_copy_files_pairs), \
Ying Wang462d26b2010-11-02 21:31:47 -070029 $(eval _src := $(call word-colon,1,$(cf))) \
30 $(eval _dest := $(call word-colon,2,$(cf))) \
Dan Willemsen7d957c92018-04-30 16:01:33 -070031 $(call check-product-copy-files,$(cf),$(_dest)) \
Ying Wang193010c2011-12-16 11:54:25 -080032 $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
Dan Willemsen403b98a2017-11-15 11:13:23 -080033 $(eval product_copy_files_ignored += $(cf)), \
Ying Wang462d26b2010-11-02 21:31:47 -070034 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
Ying Wang3ceecfa2012-05-14 14:39:00 -070035 $(if $(filter %.xml,$(_dest)),\
36 $(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
Nicolas Geoffraya95fbd12017-09-19 13:10:31 +010037 $(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\
38 $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
Tom Cherryfc977642018-06-13 14:51:05 -070039 $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
40 $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
41 $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \
Ying Wang7e8d4422011-06-17 17:05:35 -070042 $(eval unique_product_copy_files_destinations += $(_dest))))
Dan Willemsen403b98a2017-11-15 11:13:23 -080043
44# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
Dan Willemsen7537fd02018-10-16 23:15:08 -070045pcf_ignored_file := $(PRODUCT_OUT)/product_copy_files_ignored.txt
46$(pcf_ignored_file): PRIVATE_IGNORED := $(sort $(product_copy_files_ignored))
47$(pcf_ignored_file):
48 echo "$(PRIVATE_IGNORED)" | tr " " "\n" >$@
Dan Willemsen403b98a2017-11-15 11:13:23 -080049
Dan Willemsen7537fd02018-10-16 23:15:08 -070050$(call dist-for-goals,droidcore,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file)))
51
52pcf_ignored_file :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080053product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070054unique_product_copy_files_pairs :=
Ying Wang7e8d4422011-06-17 17:05:35 -070055unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080056
57# -----------------------------------------------------------------
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +080058# Returns the max allowed size for an image suitable for hash verification
59# (e.g., boot.img, recovery.img, etc).
60# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL).
61# $(1): partition size to flash the image
62define get-hash-image-max-size
63$(if $(1), \
64 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
65 $(eval _hash_meta_size := 69632), \
66 $(eval _hash_meta_size := 0)) \
67 $(1)-$(_hash_meta_size))
68endef
69
70# -----------------------------------------------------------------
Dan Willemsen6f60f022016-02-23 13:40:07 -080071# Define rules to copy headers defined in copy_headers.mk
72# If more than one makefile declared a header, print a warning,
73# then copy the last one defined. This matches the previous make
74# behavior.
Dan Willemsen7f9bd562018-08-15 14:28:01 -070075has_dup_copy_headers :=
Dan Willemsen6f60f022016-02-23 13:40:07 -080076$(foreach dest,$(ALL_COPIED_HEADERS), \
77 $(eval _srcs := $(ALL_COPIED_HEADERS.$(dest).SRC)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -080078 $(eval _src := $(lastword $(_srcs))) \
Dan Willemsen6f60f022016-02-23 13:40:07 -080079 $(if $(call streq,$(_src),$(_srcs)),, \
80 $(warning Duplicate header copy: $(dest)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -080081 $(warning _ Using $(_src)) \
82 $(warning __ from $(lastword $(ALL_COPIED_HEADERS.$(dest).MAKEFILE))) \
83 $(eval _makefiles := $$(wordlist 1,$(call int_subtract,$(words $(ALL_COPIED_HEADERS.$(dest).MAKEFILE)),1),$$(ALL_COPIED_HEADERS.$$(dest).MAKEFILE))) \
84 $(foreach src,$(wordlist 1,$(call int_subtract,$(words $(_srcs)),1),$(_srcs)), \
85 $(warning _ Ignoring $(src)) \
86 $(warning __ from $(firstword $(_makefiles))) \
87 $(eval _makefiles := $$(wordlist 2,9999,$$(_makefiles)))) \
88 $(eval has_dup_copy_headers := true)) \
Dan Willemsen6f60f022016-02-23 13:40:07 -080089 $(eval $(call copy-one-header,$(_src),$(dest))))
90all_copied_headers: $(ALL_COPIED_HEADERS)
91
Dan Willemsen7f9bd562018-08-15 14:28:01 -070092ifdef has_dup_copy_headers
93 has_dup_copy_headers :=
94 ifneq ($(BUILD_BROKEN_DUP_COPY_HEADERS),true)
95 $(error duplicate header copies are no longer allowed. For more information about headers, see: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers)
96 endif
97endif
98
Dan Willemsen6f60f022016-02-23 13:40:07 -080099# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800100# docs/index.html
Ying Wang3f45b3c2012-04-02 18:21:36 -0700101ifeq (,$(TARGET_BUILD_APPS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800102gen := $(OUT_DOCS)/index.html
103ALL_DOCS += $(gen)
104$(gen): frameworks/base/docs/docs-redirect-index.html
105 @mkdir -p $(dir $@)
106 @cp -f $< $@
Ying Wang3f45b3c2012-04-02 18:21:36 -0700107endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800108
Dan Albert303e6032017-10-04 10:20:20 -0700109ndk_doxygen_out := $(OUT_NDK_DOCS)
110ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include
111ndk_docs_src_dir := frameworks/native/docs
112ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile
113ifneq ($(wildcard $(ndk_docs_src_dir)),)
114ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\
115 $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.))
116$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp
117 @mkdir -p $(ndk_doxygen_out)
118 @echo "Generating NDK docs to $(ndk_doxygen_out)"
119 @( cat $(ndk_doxyfile); \
120 echo "INPUT=$(ndk_headers)"; \
121 echo "HTML_OUTPUT=$(ndk_doxygen_out)" \
122 ) | doxygen -
123
124# Note: Not a part of the docs target because we don't have doxygen available.
125# You can run this target locally if you have doxygen installed.
126ndk-docs: $(ndk_doxygen_out)/index.html
127.PHONY: ndk-docs
128endif
129
The Android Open Source Project88b60792009-03-03 19:28:42 -0800130# -----------------------------------------------------------------
Dan Willemsenad6a1542018-12-14 01:04:19 -0800131# generate preview API fingerprint
132api_fingerprint := $(call intermediates-dir-for,PACKAGING,api_fingerprint)/api_fingerprint.txt
133.KATI_READONLY := api_fingerprint
134
135ifeq (REL,$(PLATFORM_VERSION_CODENAME))
136 $(api_fingerprint):
137 echo REL >$@
138else ifneq ($(TARGET_BUILD_APPS),)
139 # TODO: use a prebuilt api_fingerprint.txt from prebuilts/sdk/current.txt once we have one
140 #$(eval $(call copy-one-file,prebuilts/sdk/current/api_fingerprint.txt,$(api_fingerprint)))
141 $(api_fingerprint):
142 echo $(PLATFORM_PREVIEW_SDK_VERSION) >$@
143else ifneq ($(TARGET_BUILD_PDK),)
144 $(eval $(call copy-one-file,$(_pdk_fusion_intermediates)/api_fingerprint.txt,$(api_fingerprint)))
145else
146 ifeq ($(HOST_OS),darwin)
147 $(api_fingerprint): PRIVATE_HASH := md5
148 else
149 $(api_fingerprint): PRIVATE_HASH := md5sum
150 endif
151 $(api_fingerprint): $(sort $(wildcard frameworks/base/api/*current.txt))
152 cat $^ | $(PRIVATE_HASH) | cut -d' ' -f1 >$@
153
154 $(call dist-for-goals,sdk,$(api_fingerprint))
155endif
156
157# -----------------------------------------------------------------
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900158# property_overrides_split_enabled
159property_overrides_split_enabled :=
160ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
161 property_overrides_split_enabled := true
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900162endif
163
164# -----------------------------------------------------------------
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900165# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if
166# property_overrides_split_enabled is true. Otherwise it will be installed in
167# ROOT/default.prop.
168ifdef BOARD_VNDK_VERSION
169 ifeq ($(BOARD_VNDK_VERSION),current)
170 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
171 else
172 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
173 endif
Logan Chiend73b94c2018-05-04 19:33:17 +0800174 ifdef BOARD_VNDK_RUNTIME_DISABLE
175 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
176 endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900177else
Logan Chiend73b94c2018-05-04 19:33:17 +0800178 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
179 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900180endif
181FINAL_VENDOR_DEFAULT_PROPERTIES += \
182 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
Tao Bao5f999232018-09-04 11:42:53 -0700183
Anton Hansson30851f22019-02-21 11:51:26 +0000184# Add cpu properties for bionic and ART.
Haibo Huangee0531d2018-11-04 09:20:09 -0800185FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000186FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME)
Haibo Huangee0531d2018-11-04 09:20:09 -0800187FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000188FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME)
Haibo Huangee0531d2018-11-04 09:20:09 -0800189
Anton Hansson30851f22019-02-21 11:51:26 +0000190FINAL_VENDOR_DEFAULT_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000191FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
Anton Hansson30851f22019-02-21 11:51:26 +0000192ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
193 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
194endif
195
196ifdef TARGET_2ND_ARCH
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000197 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
Anton Hansson30851f22019-02-21 11:51:26 +0000198 ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
199 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
200 endif
201endif
202
Tao Bao5f999232018-09-04 11:42:53 -0700203# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
204# mode (via libminui).
205ifdef TARGET_RECOVERY_DEFAULT_ROTATION
206FINAL_VENDOR_DEFAULT_PROPERTIES += \
207 ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
208endif
209ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
210FINAL_VENDOR_DEFAULT_PROPERTIES += \
211 ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
212endif
213ifdef TARGET_RECOVERY_PIXEL_FORMAT
214FINAL_VENDOR_DEFAULT_PROPERTIES += \
215 ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
216endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900217FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
218 $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
219
220# -----------------------------------------------------------------
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800221# prop.default
Anton Hansson1f8729e2018-08-15 12:11:55 +0100222
223BUILDINFO_SH := build/make/tools/buildinfo.sh
224BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
Anton Hanssonee4c9702018-12-21 15:36:00 +0000225
226# Generates a set of sysprops common to all partitions to a file.
Anton Hansson1f8729e2018-08-15 12:11:55 +0100227# $(1): Partition name
228# $(2): Output file name
229define generate-common-build-props
Anton Hanssonee4c9702018-12-21 15:36:00 +0000230 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
231 PRODUCT_DEVICE="$(TARGET_DEVICE)" \
232 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
233 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
234 PRODUCT_NAME="$(TARGET_PRODUCT)" \
235 $(call generate-common-build-props-with-product-vars-set,$(1),$(2))
236endef
237
238# Like the above macro, but requiring the relevant PRODUCT_ environment
239# variables to be set when called.
240define generate-common-build-props-with-product-vars-set
Anton Hansson1f8729e2018-08-15 12:11:55 +0100241 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
242 BUILD_ID="$(BUILD_ID)" \
243 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
244 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
245 DATE="$(DATE_FROM_FILE)" \
246 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
247 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
Anton Hansson1f8729e2018-08-15 12:11:55 +0100248 TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson1f8729e2018-08-15 12:11:55 +0100249 bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
250endef
251
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800252ifdef property_overrides_split_enabled
253INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800254INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
255ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
256$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800257else
258# legacy path
The Android Open Source Project88b60792009-03-03 19:28:42 -0800259INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800260endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800261ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900262FINAL_DEFAULT_PROPERTIES := \
Jaekyun Seokb31b9ba2017-11-03 15:18:55 +0900263 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
264 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900265ifndef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900266 FINAL_DEFAULT_PROPERTIES += \
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900267 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900268endif
Jaekyun Seok294286d2017-01-20 13:17:12 +0900269FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
270 $(FINAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800271
Andres Moralesb8876e12015-05-06 20:44:22 -0700272intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
273
Anton Hansson1f8729e2018-08-15 12:11:55 +0100274$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800275 @echo Target buildinfo: $@
276 @mkdir -p $(dir $@)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800277 @rm -f $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800278 $(hide) echo "#" > $@; \
279 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
280 echo "#" >> $@;
Jaekyun Seok294286d2017-01-20 13:17:12 +0900281 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000282 echo "$(line)" >> $@;)
Andres Moralesb8876e12015-05-06 20:44:22 -0700283 $(hide) echo "#" >> $@; \
284 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
285 echo "#" >> $@;
Anton Hansson1f8729e2018-08-15 12:11:55 +0100286 $(hide) $(call generate-common-build-props,bootimage,$@)
Colin Crossfdea8932017-12-06 14:38:40 -0800287 $(hide) build/make/tools/post_process_props.py $@
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800288ifdef property_overrides_split_enabled
289 $(hide) mkdir -p $(TARGET_ROOT_OUT)
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800290 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800291endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800292
293# -----------------------------------------------------------------
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900294# vendor default.prop
295INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900296ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900297INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
298ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
299
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900300$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
301 @echo Target buildinfo: $@
302 @mkdir -p $(dir $@)
303 $(hide) echo "#" > $@; \
304 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
305 echo "#" >> $@;
306 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000307 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800308 $(hide) build/make/tools/post_process_props.py $@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900309
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900310endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900311
312# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800313# build.prop
314INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
315ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900316FINAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -0700317 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
Jaekyun Seok294286d2017-01-20 13:17:12 +0900318FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
319 $(FINAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800320
321# A list of arbitrary tags describing the build configuration.
322# Force ":=" so we can use +=
323BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
324ifeq ($(TARGET_BUILD_TYPE),debug)
325 BUILD_VERSION_TAGS += debug
326endif
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700327# The "test-keys" tag marks builds signed with the old test keys,
328# which are available in the SDK. "dev-keys" marks builds signed with
329# non-default dev keys (usually private keys from a vendor directory).
330# Both of these tags will be removed and replaced with "release-keys"
331# when the target-files is signed in a post-build step.
332ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/target/product/security/testkey)
Doug Zongkera8608a72013-07-23 11:51:04 -0700333BUILD_KEYS := test-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700334else
Doug Zongkera8608a72013-07-23 11:51:04 -0700335BUILD_KEYS := dev-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700336endif
Doug Zongkera8608a72013-07-23 11:51:04 -0700337BUILD_VERSION_TAGS += $(BUILD_KEYS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800338BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
339
340# A human-readable string that descibes this build in detail.
Colin Crossf37b4552015-07-16 17:15:19 -0700341build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
Andres Moralesb8876e12015-05-06 20:44:22 -0700342$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800343
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700344# The string used to uniquely identify the combined build and product; used by the OTA server.
The Android Open Source Project88b60792009-03-03 19:28:42 -0800345ifeq (,$(strip $(BUILD_FINGERPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800346 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Dan Willemsen63e48db2019-01-02 12:27:43 -0800347 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
Ying Wang50367cc2014-06-12 18:42:53 -0700348 else
Nan Zhang0abdb582018-02-20 17:00:39 -0800349 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
Ying Wang50367cc2014-06-12 18:42:53 -0700350 endif
351 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800352endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800353# unset it for safety.
354BF_BUILD_NUMBER :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800355
Nan Zhang0abdb582018-02-20 17:00:39 -0800356BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
357ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
358 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
359endif
360BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
361# unset it for safety.
362BUILD_FINGERPRINT :=
Colin Crossf37b4552015-07-16 17:15:19 -0700363
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700364# The string used to uniquely identify the system build; used by the OTA server.
365# This purposefully excludes any product-specific variables.
366ifeq (,$(strip $(BUILD_THUMBPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800367 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700368endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800369
370BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
371ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
372 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700373endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800374BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
375# unset it for safety.
376BUILD_THUMBPRINT :=
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700377
Ying Wange24e17a2014-10-07 18:42:11 -0700378KNOWN_OEM_THUMBPRINT_PROPERTIES := \
379 ro.product.brand \
380 ro.product.name \
381 ro.product.device
382OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
383 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES))
384
Sriram Raman7b641242009-03-24 22:40:59 -0700385# Display parameters shown under Settings -> About Phone
386ifeq ($(TARGET_BUILD_VARIANT),user)
387 # User builds should show:
388 # release build number or branch.buld_number non-release builds
389
390 # Dev. branches should have DISPLAY_BUILD_NUMBER set
Colin Cross63fe36a2017-02-21 17:23:02 -0800391 ifeq (true,$(DISPLAY_BUILD_NUMBER))
Colin Crossf37b4552015-07-16 17:15:19 -0700392 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700393 else
Doug Zongkera8608a72013-07-23 11:51:04 -0700394 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700395 endif
396else
397 # Non-user builds should show detailed build information
398 BUILD_DISPLAY_ID := $(build_desc)
399endif
400
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000401# Accepts a whitespace separated list of product locales such as
402# (en_US en_AU en_GB...) and returns the first locale in the list with
403# underscores replaced with hyphens. In the example above, this will
404# return "en-US".
405define get-default-product-locale
406$(strip $(subst _,-, $(firstword $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800407endef
408
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700409# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
410# harness to distinguish builds. Only add _asan for a sanitized build
411# if it isn't already a part of the flavor (via a dedicated lunch
412# config for example).
Ying Wang21ec03d2015-10-28 18:45:03 -0700413TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
Ivan Lozano0f71db32017-08-14 07:57:37 -0700414ifneq (, $(filter address, $(SANITIZE_TARGET)))
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700415ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
Ying Wang21ec03d2015-10-28 18:45:03 -0700416TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
417endif
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700418endif
Ying Wang21ec03d2015-10-28 18:45:03 -0700419
Andrew Boiefa61ff02012-09-28 09:33:45 -0700420ifdef TARGET_SYSTEM_PROP
421system_prop_file := $(TARGET_SYSTEM_PROP)
422else
423system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
424endif
Dan Willemsenad6a1542018-12-14 01:04:19 -0800425$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(api_fingerprint)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800426 @echo Target buildinfo: $@
427 @mkdir -p $(dir $@)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700428 $(hide) echo > $@
429ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES),)
430 $(hide) echo "#" >> $@; \
431 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700432 echo "#" >> $@;
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700433 $(hide) $(foreach prop,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000434 echo "import /oem/oem.prop $(prop)" >> $@;)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700435endif
Anton Hanssonee4c9702018-12-21 15:36:00 +0000436 $(hide) PRODUCT_BRAND="$(PRODUCT_SYSTEM_BRAND)" \
437 PRODUCT_MANUFACTURER="$(PRODUCT_SYSTEM_MANUFACTURER)" \
438 PRODUCT_MODEL="$(PRODUCT_SYSTEM_MODEL)" \
439 PRODUCT_NAME="$(PRODUCT_SYSTEM_NAME)" \
440 PRODUCT_DEVICE="$(PRODUCT_SYSTEM_DEVICE)" \
441 $(call generate-common-build-props-with-product-vars-set,system,$@)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800442 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000443 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
444 TARGET_DEVICE="$(TARGET_DEVICE)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000445 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
446 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000447 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
448 BUILD_ID="$(BUILD_ID)" \
449 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
450 DATE="$(DATE_FROM_FILE)" \
Dan Willemsen63e48db2019-01-02 12:27:43 -0800451 BUILD_USERNAME="$(BUILD_USERNAME)" \
452 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000453 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
454 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
455 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
456 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
457 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
458 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
459 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
460 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
Dan Willemsenad6a1542018-12-14 01:04:19 -0800461 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(api_fingerprint))" \
Anton Hansson6d814982018-11-26 18:12:05 +0000462 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
463 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
464 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
465 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000466 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
467 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
468 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
469 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
470 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
471 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700472 bash $(BUILDINFO_SH) >> $@
Johan Redestig674a27d2012-04-12 17:00:58 +0200473 $(hide) $(foreach file,$(system_prop_file), \
Anton Hansson6d814982018-11-26 18:12:05 +0000474 if [ -f "$(file)" ]; then \
475 echo Target buildinfo from: "$(file)"; \
476 echo "" >> $@; \
477 echo "#" >> $@; \
478 echo "# from $(file)" >> $@; \
479 echo "#" >> $@; \
480 cat $(file) >> $@; \
481 echo "# end of $(file)" >> $@; \
482 fi;)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900483 $(if $(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000484 $(hide) echo >> $@; \
485 echo "#" >> $@; \
486 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
487 echo "#" >> $@; )
Jaekyun Seok294286d2017-01-20 13:17:12 +0900488 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000489 echo "$(line)" >> $@;)
Andres Morales085a0ce2015-02-06 10:12:55 -0800490 $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
Colin Crossfdea8932017-12-06 14:38:40 -0800491 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800492
493build_desc :=
494
Andres Moralesb8876e12015-05-06 20:44:22 -0700495ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
496INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
497else
498INSTALLED_RECOVERYIMAGE_TARGET :=
499endif
500
501$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
502 @echo "Target build info: $@"
Steven Morelandec082652017-10-22 02:11:47 -0700503 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
Andres Moralesb8876e12015-05-06 20:44:22 -0700504
The Android Open Source Project88b60792009-03-03 19:28:42 -0800505# -----------------------------------------------------------------
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700506# vendor build.prop
507#
Alex Naidis47e24e92016-01-10 14:18:54 +0000508# For verifying that the vendor build is what we think it is
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700509INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
510ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900511
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900512ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900513FINAL_VENDOR_BUILD_PROPERTIES += \
514 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
515FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
516 $(FINAL_VENDOR_BUILD_PROPERTIES),=)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900517endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900518
Anton Hansson1f8729e2018-08-15 12:11:55 +0100519$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700520 @echo Target vendor buildinfo: $@
521 @mkdir -p $(dir $@)
522 $(hide) echo > $@
Sandeep Patil127f5012017-10-23 19:47:43 -0700523 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
Max Biresa1749982018-03-28 15:48:13 -0700524 $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
Isaac Chen8d11feb2018-01-31 14:27:37 +0800525 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
526 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
527 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100528 $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
529 $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
530 $(hide) $(call generate-common-build-props,vendor,$@)
Jaekyun Seokf9af5fa2017-10-25 12:08:32 +0900531ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900532 $(hide) echo "#" >> $@; \
533 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
534 echo "#" >> $@;
535 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000536 echo "$(line)" >> $@;)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900537endif # property_overrides_split_enabled
Ivan Podogovd5726322018-03-29 15:22:33 +0100538 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_PROPERTY_BLACKLIST)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700539
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900540# -----------------------------------------------------------------
541# product build.prop
542INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
543ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
544
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000545ifdef TARGET_PRODUCT_PROP
546product_prop_files := $(TARGET_PRODUCT_PROP)
547else
548product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
549endif
550
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900551FINAL_PRODUCT_PROPERTIES += \
Yifan Hongaf9e7f02018-07-27 13:11:50 -0700552 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900553FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
554 $(FINAL_PRODUCT_PROPERTIES),=)
555
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000556$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900557 @echo Target product buildinfo: $@
558 @mkdir -p $(dir $@)
559 $(hide) echo > $@
560ifdef BOARD_USES_PRODUCTIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100561 $(hide) $(call generate-common-build-props,product,$@)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900562endif # BOARD_USES_PRODUCTIMAGE
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000563 $(hide) $(foreach file,$(product_prop_files), \
Anton Hansson6d814982018-11-26 18:12:05 +0000564 if [ -f "$(file)" ]; then \
565 echo Target product properties from: "$(file)"; \
566 echo "" >> $@; \
567 echo "#" >> $@; \
568 echo "# from $(file)" >> $@; \
569 echo "#" >> $@; \
570 cat $(file) >> $@; \
571 echo "# end of $(file)" >> $@; \
572 fi;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900573 $(hide) echo "#" >> $@; \
574 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
Anton Hansson5ac408b2018-11-05 17:29:28 +0000575 echo "#" >> $@; \
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000576 echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900577 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000578 echo "$(line)" >> $@;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900579 $(hide) build/make/tools/post_process_props.py $@
580
Andres Morales9c820f82015-01-13 15:30:34 -0800581# ----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800582# odm build.prop
583INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop
584ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
585
586FINAL_ODM_BUILD_PROPERTIES += \
587 $(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES))
588FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
589 $(FINAL_ODM_BUILD_PROPERTIES),=)
590
Anton Hansson1f8729e2018-08-15 12:11:55 +0100591$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800592 @echo Target odm buildinfo: $@
593 @mkdir -p $(dir $@)
594 $(hide) echo > $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800595 $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
596 $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
597 $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100598 $(hide) $(call generate-common-build-props,odm,$@)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800599 $(hide) echo "#" >> $@; \
600 echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
601 echo "#" >> $@;
602 $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000603 echo "$(line)" >> $@;)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800604 $(hide) build/make/tools/post_process_props.py $@
Andres Morales9c820f82015-01-13 15:30:34 -0800605
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700606# -----------------------------------------------------------------
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000607# product_services build.prop (unless it's merged into /product)
608ifdef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
609 ifneq (,$(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
610 $(error PRODUCT_PRODUCT_SERVICES_PROPERTIES is not supported in this build.)
611 endif
612else
Dario Freni5f681e12018-05-29 13:09:01 +0100613INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
614ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
615
616FINAL_PRODUCT_SERVICES_PROPERTIES += \
617 $(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
618FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
619 $(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
Anton Hansson1f8729e2018-08-15 12:11:55 +0100620$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Dario Freni924af7d2018-08-17 00:56:14 +0100621 @echo Target product_services buildinfo: $@
Dario Freni5f681e12018-05-29 13:09:01 +0100622 @mkdir -p $(dir $@)
623 $(hide) echo > $@
624ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100625 $(hide) $(call generate-common-build-props,product_services,$@)
Dario Freni5f681e12018-05-29 13:09:01 +0100626endif # BOARD_USES_PRODUCT_SERVICESIMAGE
627 $(hide) echo "#" >> $@; \
628 echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
629 echo "#" >> $@;
630 $(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000631 echo "$(line)" >> $@;)
Dario Freni5f681e12018-05-29 13:09:01 +0100632 $(hide) build/make/tools/post_process_props.py $@
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000633endif # MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Dario Freni5f681e12018-05-29 13:09:01 +0100634
635# ----------------------------------------------------------------
636
637# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800638# sdk-build.prop
639#
640# There are certain things in build.prop that we don't want to
641# ship with the sdk; remove them.
642
643# This must be a list of entire property keys followed by
644# "=" characters, without any internal spaces.
645sdk_build_prop_remove := \
646 ro.build.user= \
647 ro.build.host= \
648 ro.product.brand= \
649 ro.product.manufacturer= \
650 ro.product.device=
651# TODO: Remove this soon-to-be obsolete property
652sdk_build_prop_remove += ro.build.product=
653INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
654$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
655 @echo SDK buildinfo: $@
656 @mkdir -p $(dir $@)
657 $(hide) grep -v "$(subst $(space),\|,$(strip \
Anton Hansson6d814982018-11-26 18:12:05 +0000658 $(sdk_build_prop_remove)))" $< > $@.tmp
The Android Open Source Project88b60792009-03-03 19:28:42 -0800659 $(hide) for x in $(sdk_build_prop_remove); do \
Anton Hansson6d814982018-11-26 18:12:05 +0000660 echo "$$x"generic >> $@.tmp; done
The Android Open Source Project88b60792009-03-03 19:28:42 -0800661 $(hide) mv $@.tmp $@
662
663# -----------------------------------------------------------------
664# package stats
665PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
666PACKAGES_TO_STAT := \
667 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
668 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
669$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
670 @echo Package stats: $@
671 @mkdir -p $(dir $@)
672 $(hide) rm -f $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700673ifeq ($(PACKAGES_TO_STAT),)
674# Create empty package stats file if target builds no jar(s) or apk(s).
675 $(hide) touch $@
676else
Colin Crossfdea8932017-12-06 14:38:40 -0800677 $(hide) build/make/tools/dump-package-stats $^ > $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700678endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800679
680.PHONY: package-stats
681package-stats: $(PACKAGE_STATS_FILE)
682
683# -----------------------------------------------------------------
684# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700685# Use a macro to add newline to each echo command
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100686define _apkcerts_write_line
687$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
688$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
689$(hide) echo '' >> $5
Ying Wangd9a88d52012-10-26 09:21:28 -0700690
691endef
692
The Android Open Source Project88b60792009-03-03 19:28:42 -0800693name := $(TARGET_PRODUCT)
694ifeq ($(TARGET_BUILD_TYPE),debug)
695 name := $(name)_debug
696endif
697name := $(name)-apkcerts-$(FILE_NAME_TAG)
698intermediates := \
699 $(call intermediates-dir-for,PACKAGING,apkcerts)
700APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800701# We don't need to really build all the modules.
702# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700703$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800704 @echo APK certs list: $@
705 @mkdir -p $(dir $@)
706 @rm -f $@
Ying Wangd9a88d52012-10-26 09:21:28 -0700707 $(foreach p,$(PACKAGES),\
708 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100709 $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
710 $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
Ying Wangd9a88d52012-10-26 09:21:28 -0700711 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700712 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800713
714.PHONY: apkcerts-list
715apkcerts-list: $(APKCERTS_FILE)
716
Ying Wang15e487a2011-02-15 10:56:18 -0800717ifneq (,$(TARGET_BUILD_APPS))
718 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900719 $(call dist-for-goals, apps_only, $(SOONG_APEX_KEYS_FILE):apexkeys.txt)
Ying Wang15e487a2011-02-15 10:56:18 -0800720endif
Ying Wangefb21682010-07-23 16:42:13 -0700721
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900722
The Android Open Source Project88b60792009-03-03 19:28:42 -0800723# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700724# build system stats
725BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
726$(BUILD_SYSTEM_STATS):
727 @rm -f $@
728 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
729 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
730$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700731
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700732# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700733# Modules ready to be converted to Soong, ordered by how many
734# modules depend on them.
735SOONG_CONV := $(sort $(SOONG_CONV))
736SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
737$(SOONG_CONV_DATA):
738 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800739 @$(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 -0700740
Colin Crossfdea8932017-12-06 14:38:40 -0800741SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700742SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
743$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
744 @rm -f $@
745 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
746$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
747
748# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800749# Modules use -Wno-error, or added default -Wall -Werror
750WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
751$(WALL_WERROR):
752 @rm -f $@
753 echo "# Modules using -Wno-error" >> $@
754 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 -0800755 echo "# Modules added default -Wall" >> $@
756 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
757
758$(call dist-for-goals,droidcore,$(WALL_WERROR))
759
760# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800761# Modules missing profile files
762PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
763$(PGO_PROFILE_MISSING):
764 @rm -f $@
765 echo "# Modules missing PGO profile files" >> $@
766 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
767
768$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
769
770# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700771# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700772# for future OTA packages installed by this system. Actual product
773# deliverables will be re-signed by hand. We expect this file to
774# exist with the suffixes ".x509.pem" and ".pk8".
Colin Cross21122f92018-09-14 21:51:11 -0700775DEFAULT_KEY_CERT_PAIR := $(strip $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
Doug Zongker8678df42009-06-15 14:30:14 -0700776
777
Jeff Browne33ba4c2011-07-11 22:11:46 -0700778# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800779# if they don't do anything.
780.PHONY: systemimage
781systemimage:
782
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800783# -----------------------------------------------------------------
784
785.PHONY: event-log-tags
786
Joe Onoratob7510532010-07-14 10:22:54 -0700787# Produce an event logs tag file for everything we know about, in order
788# to properly allocate numbers. Then produce a file that's filtered
789# for what's going to be installed.
790
791all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
792
Colin Crossdc8f8e42012-04-12 13:25:54 -0700793event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
794
Joe Onoratob7510532010-07-14 10:22:54 -0700795# Include tags from all packages that we know about
796all_event_log_tags_src := \
797 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
798
Colin Crossdc8f8e42012-04-12 13:25:54 -0700799# PDK builds will already have a full list of tags that needs to get merged
800# in with the ones from source
801pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
802
803$(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 -0800804$(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 -0700805 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900806 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700807
Doug Zongkera34fa952011-02-23 12:17:29 -0800808# Include tags from all packages included in this product, plus all
809# tags that are part of the system (ie, not in a vendor/ or device/
810# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800811event_log_tags_src := \
812 $(sort $(foreach m,\
813 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
814 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800815 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
816 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800817
Colin Crossdc8f8e42012-04-12 13:25:54 -0700818$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700819$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800820$(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 -0800821 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900822 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800823
824event-log-tags: $(event_log_tags_file)
825
826ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
827
Joe Onoratob7510532010-07-14 10:22:54 -0700828
The Android Open Source Project88b60792009-03-03 19:28:42 -0800829# #################################################################
830# Targets for boot/OS images
831# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800832ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
833 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
834 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
835 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
836 else
837 INSTALLED_2NDBOOTLOADER_TARGET :=
838 endif
839else
840 INSTALLED_BOOTLOADER_MODULE :=
841 INSTALLED_2NDBOOTLOADER_TARGET :=
842endif # TARGET_NO_BOOTLOADER
843ifneq ($(strip $(TARGET_NO_KERNEL)),true)
844 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
845else
846 INSTALLED_KERNEL_TARGET :=
847endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800848
849# -----------------------------------------------------------------
Tom Cherryd14b8952018-08-09 14:26:00 -0700850# the root dir
851INTERNAL_ROOT_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800852 $(ALL_GENERATED_SOURCES) \
853 $(ALL_DEFAULT_INSTALLED_MODULES))
854
Luis Hector Chavezff489932018-07-03 15:41:40 -0700855INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
856INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
857$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700858$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700859 @echo Installed file list: $@
860 @mkdir -p $(dir $@)
861 @rm -f $@
862 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
863 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
864
865$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
866
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800867#------------------------------------------------------------------
868# dtb
869
870ifdef BOARD_PREBUILT_DTBIMAGE_DIR
871INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Hridya Valsarajuc63a7442019-02-07 11:38:18 -0800872$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb))
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800873 cat $^ > $@
874endif
875
Tom Cherryd14b8952018-08-09 14:26:00 -0700876# -----------------------------------------------------------------
877# the ramdisk
Dan Willemsen67495202019-01-16 12:42:05 -0800878ifdef BUILDING_RAMDISK_IMAGE
Tom Cherryd14b8952018-08-09 14:26:00 -0700879INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \
880 $(ALL_GENERATED_SOURCES) \
881 $(ALL_DEFAULT_INSTALLED_MODULES))
882
883INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt
884INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json)
885$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK)
886$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
887 @echo Installed file list: $@
888 @mkdir -p $(dir $@)
889 @rm -f $@
890 $(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json)
891 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
892
893$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
Joe Onorato64d85d02009-04-09 19:31:12 -0700894BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
895
896# We just build this directly to the install location.
897INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Tom Cherryd14b8952018-08-09 14:26:00 -0700898$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800899 $(call pretty,"Target ram disk: $@")
Tom Cherryd14b8952018-08-09 14:26:00 -0700900 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800901
Ying Wangad7fd292013-08-08 16:34:29 -0700902.PHONY: ramdisk-nodeps
903ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
904 @echo "make $@: ignoring dependencies"
Tom Cherryd14b8952018-08-09 14:26:00 -0700905 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800906
Dan Willemsen67495202019-01-16 12:42:05 -0800907endif # BUILDING_RAMDISK_IMAGE
908
909
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700910INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
911
The Android Open Source Project88b60792009-03-03 19:28:42 -0800912ifneq ($(strip $(TARGET_NO_KERNEL)),true)
913
914# -----------------------------------------------------------------
915# the boot image, which is a collection of other images.
916INTERNAL_BOOTIMAGE_ARGS := \
917 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700918 --kernel $(INSTALLED_KERNEL_TARGET)
919
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800920ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
921 INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
922endif
923
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700924ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
925INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
926endif
927
The Android Open Source Project88b60792009-03-03 19:28:42 -0800928INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
929
Dima Zavin1e0847c2009-05-07 19:43:08 -0700930ifdef BOARD_KERNEL_BASE
931 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
932endif
933
Ying Wangffff0022010-08-23 12:56:25 -0700934ifdef BOARD_KERNEL_PAGESIZE
935 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
936endif
937
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700938ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
939ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
940VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
941 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
942endif
943endif
944
Anton Hansson72e36f02019-02-26 17:36:30 +0000945INTERNAL_KERNEL_CMDLINE := $(strip $(INTERNAL_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700946ifdef INTERNAL_KERNEL_CMDLINE
947INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700948endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700949
Sami Tolvanen3303d902016-03-15 16:49:30 +0000950INTERNAL_MKBOOTIMG_VERSION_ARGS := \
951 --os_version $(PLATFORM_VERSION) \
952 --os_patch_level $(PLATFORM_SECURITY_PATCH)
953
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800954# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
955ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800956ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800957$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400958
959else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
960
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800961$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400962 $(call pretty,"Target boot image: $@")
963 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800964 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400965 $(hide) $(AVBTOOL) add_hash_footer \
966 --image $@ \
967 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800968 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400969 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
970
971.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800972bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400973 @echo "make $@: ignoring dependencies"
974 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800975 $(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 -0400976 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800977 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400978 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800979 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400980 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
981
982else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700983
984$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
985 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000986 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800987 $(BOOT_SIGNER) /boot $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $@
Geremy Condra740b6632014-07-08 20:07:41 -0700988 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
989
990.PHONY: bootimage-nodeps
991bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
992 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000993 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800994 $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET)
Geremy Condra740b6632014-07-08 20:07:41 -0700995 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
996
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +0100997else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -0800998
Tao Bao4b577412017-02-22 22:54:39 -0800999$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -08001000 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001001 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001002 $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
David Riley17be3d32015-03-03 08:54:11 -08001003 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1004
1005.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -08001006bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -08001007 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001008 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001009 $(VBOOT_SIGNER) $(FUTILITY) $(INSTALLED_BOOTIMAGE_TARGET).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(INSTALLED_BOOTIMAGE_TARGET).keyblock $(INSTALLED_BOOTIMAGE_TARGET)
David Riley17be3d32015-03-03 08:54:11 -08001010 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1011
1012else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -08001013
1014$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
1015 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001016 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001017 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001018
1019.PHONY: bootimage-nodeps
1020bootimage-nodeps: $(MKBOOTIMG)
1021 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001022 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001023 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001024
The Android Open Source Project88b60792009-03-03 19:28:42 -08001025endif # TARGET_BOOTIMAGE_USE_EXT2
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001026endif # BOARD_USES_RECOVERY_AS_BOOT
The Android Open Source Project88b60792009-03-03 19:28:42 -08001027
Tao Baob1a2e352018-08-14 16:17:12 -07001028else # TARGET_NO_KERNEL == "true"
Michael Schwartz0dc6f212017-07-18 10:05:13 -07001029ifdef BOARD_PREBUILT_BOOTIMAGE
1030ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
1031# Remove when b/63676296 is resolved.
1032$(error Prebuilt bootimage is only supported for AB targets)
1033endif
1034$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
Tao Baob1a2e352018-08-14 16:17:12 -07001035else # BOARD_PREBUILT_BOOTIMAGE not defined
Tao Baob1a2e352018-08-14 16:17:12 -07001036INSTALLED_BOOTIMAGE_TARGET :=
1037endif # BOARD_PREBUILT_BOOTIMAGE
1038endif # TARGET_NO_KERNEL
The Android Open Source Project88b60792009-03-03 19:28:42 -08001039
1040# -----------------------------------------------------------------
1041# NOTICE files
1042#
Steve Blockd14d3b42012-03-01 11:34:41 +00001043# We are required to publish the licenses for all code under BSD, GPL and
1044# Apache licenses (and possibly other more exotic ones as well). We err on the
1045# side of caution, so the licenses for other third-party code are included here
1046# too.
1047#
The Android Open Source Project88b60792009-03-03 19:28:42 -08001048# This needs to be before the systemimage rules, because it adds to
1049# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
1050# go into the systemimage.
1051
Steve Block495e5852012-02-29 19:18:08 +00001052.PHONY: notice_files
1053
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001054# Create the rule to combine the files into text and html/xml forms
Dario Freniadc972d2018-07-09 18:38:38 +01001055# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001056# $(2) - Plain text output file
1057# $(3) - HTML/XML output file
1058# $(4) - File title
1059# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -08001060# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001061# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -08001062#
1063# The algorithm here is that we go collect a hash for each of the notice
1064# files and write the names of the files that match that hash. Then
1065# to generate the real files, we go print out all of the files and their
1066# hashes.
1067#
1068# These rules are fairly complex, so they depend on this makefile so if
1069# it changes, they'll run again.
1070#
1071# TODO: We could clean this up so that we just record the locations of the
1072# original notice files instead of making rules to copy them somwehere.
1073# Then we could traverse that without quite as much bash drama.
1074define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001075$(2) $(3): PRIVATE_MESSAGE := $(4)
1076$(2) $(3): PRIVATE_DIR := $(5)
1077$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -08001078$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
1079 build/make/tools/generate-notice-files.py --text-output $(2) \
Anton Hansson6d814982018-11-26 18:12:05 +00001080 $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e product_services --xml-output, \
1081 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
1082 $(if $(filter $(1),xml_product),-i product --xml-output, \
1083 $(if $(filter $(1),xml_product_services),-i product_services --xml-output, \
1084 --html-output)))) $(3) \
1085 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001086notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001087endef
1088
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001089# Notice file logic isn't relevant for TARGET_BUILD_APPS
1090ifndef TARGET_BUILD_APPS
1091
The Android Open Source Project88b60792009-03-03 19:28:42 -08001092# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
1093# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
1094# the src subdirectory.
Steve Block495e5852012-02-29 19:18:08 +00001095target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Steve Block495e5852012-02-29 19:18:08 +00001096tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08001097tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001098kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
1099winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
1100pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001101
Steven Morelandae69e572017-12-15 14:49:55 -08001102# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001103ifneq ($(PRODUCT_NOTICE_SPLIT),true)
1104target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
1105target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
1106installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
1107$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001108 $(target_notice_file_txt), \
1109 $(target_notice_file_html), \
1110 "Notices for files contained in the filesystem images in this directory:", \
1111 $(TARGET_OUT_NOTICE_FILES), \
1112 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001113$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
1114 $(hide) $(MINIGZIP) -9 < $< > $@
1115$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
1116 $(copy-file-to-target)
1117else
1118target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
1119target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001120installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
1121
1122target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
1123target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
1124target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
1125installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
Dario Freniadc972d2018-07-09 18:38:38 +01001126
1127target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
1128target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
1129target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
1130installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
Dario Frenicbca1132018-08-28 18:04:03 +01001131
1132target_product_services_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.txt
1133target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml
1134target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz
1135installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001136
Anton Hansson6ad6f6c2018-11-12 23:33:47 +00001137# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
1138# being built. A notice xml file must depend on all modules that could potentially
1139# install a license file relevant to it.
1140license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
1141# Phonys/fakes don't have notice files (though their deps might)
1142license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
1143license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
1144license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
1145license_modules_product_services := $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(license_modules))
1146license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_product_services)
1147license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001148
Dario Frenicbca1132018-08-28 18:04:03 +01001149$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
Anton Hansson6d814982018-11-26 18:12:05 +00001150 $(target_notice_file_txt), \
1151 $(target_notice_file_xml), \
1152 "Notices for files contained in the filesystem images in this directory:", \
1153 $(TARGET_OUT_NOTICE_FILES), \
1154 $(license_modules_rest)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001155$(eval $(call combine-notice-files, xml_vendor, \
Anton Hansson6d814982018-11-26 18:12:05 +00001156 $(target_vendor_notice_file_txt), \
1157 $(target_vendor_notice_file_xml), \
1158 "Notices for files contained in the vendor filesystem image in this directory:", \
1159 $(TARGET_OUT_NOTICE_FILES), \
1160 $(license_modules_vendor)))
Dario Freniadc972d2018-07-09 18:38:38 +01001161$(eval $(call combine-notice-files, xml_product, \
Anton Hansson6d814982018-11-26 18:12:05 +00001162 $(target_product_notice_file_txt), \
1163 $(target_product_notice_file_xml), \
1164 "Notices for files contained in the product filesystem image in this directory:", \
1165 $(TARGET_OUT_NOTICE_FILES), \
1166 $(license_modules_product)))
Dario Frenicbca1132018-08-28 18:04:03 +01001167$(eval $(call combine-notice-files, xml_product_services, \
Anton Hansson6d814982018-11-26 18:12:05 +00001168 $(target_product_services_notice_file_txt), \
1169 $(target_product_services_notice_file_xml), \
1170 "Notices for files contained in the product_services filesystem image in this directory:", \
1171 $(TARGET_OUT_NOTICE_FILES), \
1172 $(license_modules_product_services)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001173
1174$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
1175 $(hide) $(MINIGZIP) -9 < $< > $@
1176$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
1177 $(hide) $(MINIGZIP) -9 < $< > $@
1178$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
1179 $(hide) $(MINIGZIP) -9 < $< > $@
1180$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
1181 $(hide) $(MINIGZIP) -9 < $< > $@
1182$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
1183 $(copy-file-to-target)
1184$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
1185 $(copy-file-to-target)
1186$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
1187 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001188
1189# No notice file for product_services if its contents are merged into /product.
1190# The notices will be part of the /product notice file.
1191ifndef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001192$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
1193 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001194endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001195
1196# if we've been run my mm, mmm, etc, don't reinstall this every time
1197ifeq ($(ONE_SHOT_MAKEFILE),)
1198 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
1199 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
1200 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
1201 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
Dario Frenicbca1132018-08-28 18:04:03 +01001202endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001203endif # PRODUCT_NOTICE_SPLIT
1204
1205ifeq ($(ONE_SHOT_MAKEFILE),)
1206 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001207endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001208
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001209$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001210 $(tools_notice_file_txt), \
1211 $(tools_notice_file_html), \
1212 "Notices for files contained in the tools directory:", \
1213 $(HOST_OUT_NOTICE_FILES), \
1214 $(ALL_DEFAULT_INSTALLED_MODULES) \
1215 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001216
Ying Wang62c81f82013-08-22 20:02:03 -07001217endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -08001218
1219# The kernel isn't really a module, so to get its module file in there, we
1220# make the target NOTICE files depend on this particular file too, which will
1221# then be in the right directory for the find in combine-notice-files to work.
1222$(kernel_notice_file): \
Lee Campbellb463fcd2015-11-08 16:28:15 -08001223 $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001224 | $(ACP)
1225 @echo Copying: $@
1226 $(hide) mkdir -p $(dir $@)
1227 $(hide) $(ACP) $< $@
1228
Josh Gao4d9268e2017-02-23 13:17:46 -08001229$(winpthreads_notice_file): \
1230 $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
1231 | $(ACP)
1232 @echo Copying: $@
1233 $(hide) mkdir -p $(dir $@)
1234 $(hide) $(ACP) $< $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08001235
Doug Zongker8678df42009-06-15 14:30:14 -07001236# -----------------------------------------------------------------
1237# Build a keystore with the authorized keys in it, used to verify the
1238# authenticity of downloaded OTA packages.
1239#
1240# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
1241# before the rules that use that variable to build the image.
Dan Willemsenb589ae42015-10-29 21:26:18 +00001242ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
Colin Cross21122f92018-09-14 21:51:11 -07001243$(TARGET_OUT_ETC)/security/otacerts.zip: PRIVATE_CERT := $(DEFAULT_KEY_CERT_PAIR).x509.pem
1244$(TARGET_OUT_ETC)/security/otacerts.zip: $(SOONG_ZIP)
1245$(TARGET_OUT_ETC)/security/otacerts.zip: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Doug Zongker8678df42009-06-15 14:30:14 -07001246 $(hide) rm -f $@
1247 $(hide) mkdir -p $(dir $@)
Colin Cross21122f92018-09-14 21:51:11 -07001248 $(hide) $(SOONG_ZIP) -o $@ -C $(dir $(PRIVATE_CERT)) -f $(PRIVATE_CERT)
Doug Zongker8678df42009-06-15 14:30:14 -07001249
Alex Deymocec578c2017-03-28 20:48:18 -07001250# Carry the public key for update_engine if it's a non-IoT target that
Tao Bao38812d62016-01-20 20:58:20 -08001251# uses the AB updater. We use the same key as otacerts but in RSA public key
1252# format.
1253ifeq ($(AB_OTA_UPDATER),true)
Alex Deymocec578c2017-03-28 20:48:18 -07001254ifneq ($(PRODUCT_IOT),true)
Tao Bao23c3db92016-01-21 14:28:50 -08001255ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Colin Cross21122f92018-09-14 21:51:11 -07001256$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Tao Bao38812d62016-01-20 20:58:20 -08001257 $(hide) rm -f $@
1258 $(hide) mkdir -p $(dir $@)
1259 $(hide) openssl x509 -pubkey -noout -in $< > $@
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001260
Tao Bao696bb332018-08-17 16:27:01 -07001261ALL_DEFAULT_INSTALLED_MODULES += \
1262 $(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem
1263$(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem: \
Anton Hansson6d814982018-11-26 18:12:05 +00001264 $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001265 $(hide) cp -f $< $@
Tao Bao38812d62016-01-20 20:58:20 -08001266endif
1267endif
1268
Doug Zongker8678df42009-06-15 14:30:14 -07001269.PHONY: otacerts
1270otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
1271
1272
The Android Open Source Project88b60792009-03-03 19:28:42 -08001273# #################################################################
1274# Targets for user images
1275# #################################################################
1276
Ying Wang933abf12010-06-16 14:31:34 -07001277INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001278ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001279INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1280else
1281ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001282INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1283else
1284ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001285INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1286endif
1287endif
1288endif
1289
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001290# These options tell the recovery updater/installer how to mount the partitions writebale.
1291# <fstype>=<fstype_opts>[|<fstype_opts>]...
1292# fstype_opts := <opt>[,<opt>]...
1293# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001294# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1295DEFAULT_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 -07001296
Ying Wang542903a2010-11-17 15:40:38 -08001297ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1298 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1299endif
1300
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001301INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
Mark Salyzyn780f5952018-10-19 13:44:36 -07001302INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK) $(TUNE2FS)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001303ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1304INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1305endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001306
Chris Friesdf0387d2017-06-21 15:51:46 -05001307ifeq ($(BOARD_AVB_ENABLE),true)
1308INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1309endif
1310
Todd Poynorb2a555e2015-12-15 18:00:14 -08001311ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1312 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1313endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001314ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE) $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
Mohamad Ayyash353265b2015-06-24 15:42:19 -07001315INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001316endif
1317
Ying Wang178ef922011-10-31 18:13:30 -07001318INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001319
Colin Cross8a30f722014-04-28 16:27:32 -07001320ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001321INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001322ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC))
1323INTERNAL_USERIMAGES_DEPS += $(FEC)
1324endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001325endif
1326
Alex Klyubin092c9022017-03-13 13:28:34 -07001327SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001328INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1329
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001330INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1331
Jin Qianabcec5e2017-03-10 16:53:45 -08001332INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
Jin Qianabcec5e2017-03-10 16:53:45 -08001333
Yifan Hongc5c01242018-11-09 10:27:23 -08001334ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001335
1336ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
1337 $(error vboot 1.0 doesn't support logical partition)
1338endif
1339
1340# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1341# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1342
Yifan Hongc5c01242018-11-09 10:27:23 -08001343endif # PRODUCT_USE_DYNAMIC_PARTITIONS
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001344
Ying Wangbd93d422011-10-28 17:02:30 -07001345# $(1): the path of the output dictionary file
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001346# $(2): a subset of "system vendor cache userdata product product_services oem odm"
Yifan Hong760d3c02018-05-30 11:16:46 -07001347# $(3): additional "key=value" pairs to append to the dictionary file.
1348define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001349$(if $(filter $(2),system),\
1350 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
Bowgo Tsai867ab662019-01-29 13:30:18 +08001351 $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001352 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1353 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1354 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1355 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1356 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1357 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1358 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1359 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1360 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1361 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001362 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001363)
Yifan Hong760d3c02018-05-30 11:16:46 -07001364$(if $(filter $(2),userdata),\
1365 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1366 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
1367)
Yifan Hong760d3c02018-05-30 11:16:46 -07001368$(if $(filter $(2),cache),\
1369 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1370 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
1371)
1372$(if $(filter $(2),vendor),\
1373 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1374 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1375 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1376 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1377 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1378 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1379 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1380 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1381 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1382 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
Yifan Hong749062d2018-06-19 16:23:16 -07001383 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001384)
1385$(if $(filter $(2),product),\
1386 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1387 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1388 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1389 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1390 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1391 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1392 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1393 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1394 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1395 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
Yifan Hong56a6c3b2018-07-20 15:19:34 -07001396 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001397)
Yifan Hongebc041a2018-07-26 16:02:52 -07001398$(if $(filter $(2),product_services),\
1399 $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_services_fs_type=$(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1400 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_services_extfs_inode_count=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1401 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_services_extfs_rsv_pct=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT)" >> $(1))
1402 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),$(hide) echo "product_services_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)" >> $(1))
1403 $(if $(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE),$(hide) echo "product_services_journal_size=$(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE)" >> $(1))
1404 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_services_squashfs_compressor=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1405 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_services_squashfs_compressor_opt=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1406 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_services_squashfs_block_size=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1407 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_services_squashfs_disable_4k_align=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1408 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_services_reserved_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001409)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001410$(if $(filter $(2),odm),\
1411 $(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1412 $(if $(BOARD_ODMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_extfs_inode_count=$(BOARD_ODMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1413 $(if $(BOARD_ODMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_extfs_rsv_pct=$(BOARD_ODMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1414 $(if $(BOARD_ODMIMAGE_PARTITION_SIZE),$(hide) echo "odm_size=$(BOARD_ODMIMAGE_PARTITION_SIZE)" >> $(1))
1415 $(if $(BOARD_ODMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_journal_size=$(BOARD_ODMIMAGE_JOURNAL_SIZE)" >> $(1))
1416 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_squashfs_compressor=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1417 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_squashfs_compressor_opt=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1418 $(if $(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_squashfs_block_size=$(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1419 $(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1420 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH)" >> $(1))
1421 $(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
1422)
Yifan Hong760d3c02018-05-30 11:16:46 -07001423$(if $(filter $(2),oem),\
1424 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1425 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1426 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1427 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1428)
Tao Bao3602eca2018-07-10 10:53:55 -07001429$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001430
Tao Bao3602eca2018-07-10 10:53:55 -07001431$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001432$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001433$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001434$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1435$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1436$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001437$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001438$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001439$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
Paul Lawrencea37b2bb2014-11-13 17:54:30 -08001440$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
Claes Elgemarkec996042015-06-02 11:03:27 +02001441$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001442$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1))
Bowgo Tsai6ceeb1a2017-10-11 16:21:48 +08001443$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001444$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1445$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001446$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
Yifan Hongebc041a2018-07-26 16:02:52 -07001447$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION),$(hide) echo "product_services_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION)" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001448$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1449$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001450$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
Tao Bao9b524ef2017-02-23 11:03:45 -08001451$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001452$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001453$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001454$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1455$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1456$(if $(BOARD_AVB_ENABLE),\
1457 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1458 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1459 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1460 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08001461$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1462$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1463$(if $(BOARD_AVB_ENABLE),\
1464 $(if $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH),\
1465 $(hide) echo "avb_system_other_key_path=$(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)" >> $(1)
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08001466 $(hide) echo "avb_system_other_algorithm=$(BOARD_AVB_SYSTEM_OTHER_ALGORITHM)" >> $(1)
1467 $(hide) echo "avb_system_extract_system_other_key=true" >> $(1)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001468$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1469$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1470$(if $(BOARD_AVB_ENABLE),\
1471 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1472 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1473 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1474 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001475$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1476$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1477$(if $(BOARD_AVB_ENABLE),\
1478 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1479 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1480 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1481 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Tao Bao1ebda8d2018-08-01 17:21:14 -07001482$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_services_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1483$(if $(BOARD_AVB_ENABLE),\
1484 $(hide) echo "avb_product_services_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001485$(if $(BOARD_AVB_ENABLE),\
1486 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
Yifan Hongebc041a2018-07-26 16:02:52 -07001487 $(hide) echo "avb_product_services_key_path=$(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH)" >> $(1)
1488 $(hide) echo "avb_product_services_algorithm=$(BOARD_AVB_PRODUCT_SERVICES_ALGORITHM)" >> $(1)
1489 $(hide) echo "avb_product_services_rollback_index_location=$(BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001490$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1491$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1492$(if $(BOARD_AVB_ENABLE),\
1493 $(if $(BOARD_AVB_ODM_KEY_PATH),\
1494 $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1)
1495 $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1)
1496 $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001497$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1498 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001499$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Tom Cherryd14b8952018-08-09 14:26:00 -07001500 $(hide) echo "system_root_image=true" >> $(1))
1501$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
Yifan Hong2dae5722018-07-31 12:47:27 -07001502$(if $(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),$(hide) echo "use_dynamic_partition_size=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001503$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1504endef
1505
1506# $(1): the path of the output dictionary file
1507# $(2): additional "key=value" pairs to append to the dictionary file.
1508define generate-userimage-prop-dictionary
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001509$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product product_services oem odm,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001510endef
1511
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001512# $(1): the path of the input dictionary file, where each line has the format key=value
1513# $(2): the key to look up
1514define read-image-prop-dictionary
1515$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1516endef
1517
Xu Chao2b04bf42017-07-06 14:34:31 +08001518# $(1): modules list
1519# $(2): output dir
1520# $(3): mount point
1521# $(4): staging dir
1522# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1523define build-image-kernel-modules
1524 $(hide) rm -rf $(2)/lib/modules
1525 $(hide) mkdir -p $(2)/lib/modules
1526 $(hide) cp $(1) $(2)/lib/modules/
1527 $(hide) rm -rf $(4)
1528 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1529 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1530 $(hide) $(DEPMOD) -b $(4) 0.0
1531 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1532 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1533endef
1534
The Android Open Source Project88b60792009-03-03 19:28:42 -08001535# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001536# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001537
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001538# Recovery image exists if we are building recovery, or building recovery as boot.
1539ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001540
Ying Wang37526142015-03-10 12:02:57 -07001541INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1542 $(ALL_DEFAULT_INSTALLED_MODULES))
1543
Tao Bao10fc9492018-08-14 12:17:48 -07001544INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
1545INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
1546
1547# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other
1548# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in
1549# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with
1550# the call to FILELIST.
1551ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
1552$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET)
1553else
1554$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET)
1555endif
1556
1557$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY)
1558$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST)
1559 @echo Installed file list: $@
1560 @mkdir -p $(dir $@)
1561 @rm -f $@
1562 $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
1563 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
1564
Doug Zongker4647f122009-07-02 09:00:54 -07001565recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001566recovery_sepolicy := \
1567 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001568 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001569 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001570 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001571 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts \
Bowgo Tsai99671252017-11-30 22:15:17 +08001572 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001573 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts \
1574 $(TARGET_RECOVERY_ROOT_OUT)/product_file_contexts \
1575 $(TARGET_RECOVERY_ROOT_OUT)/product_property_contexts
Bowgo Tsai99671252017-11-30 22:15:17 +08001576
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001577# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1578# SELinux files
1579IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1580
Doug Zongker4647f122009-07-02 09:00:54 -07001581recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1582recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Doug Zongker4647f122009-07-02 09:00:54 -07001583recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001584
Tao Baoe1e829e2018-08-29 20:36:00 -07001585# Set recovery_density to a density bucket based on PRODUCT_AAPT_PREF_CONFIG if set. Otherwise use
1586# the default medium density.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001587ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001588# If PRODUCT_AAPT_PREF_CONFIG includes a non-numeric dpi bucket, always perfer that value.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001589recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001590ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density)))
1591recovery_density_value := $(patsubst %dpi,%,$(recovery_density))
1592# Map the numeric dpi value to a bucket. We roughly use the medium point between the primary
1593# densities to split buckets.
1594# ------160------240------320----------480------------640------
1595# mdpi hdpi xhdpi xxhdpi xxxhdpi
1596recovery_density := $(strip \
1597 $(or $(if $(filter $(shell echo $$(($(recovery_density_value) >= 560))),1),xxxhdpi),\
1598 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 400))),1),xxhdpi),\
1599 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
1600 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
Doug Zongker8eaeea92014-05-12 15:32:20 -07001601endif
Tao Baoe1e829e2018-08-29 20:36:00 -07001602else # PRODUCT_AAPT_PREF_CONFIG is empty
1603recovery_density := mdpi
1604endif # PRODUCT_AAPT_PREF_CONFIG
Doug Zongker8eaeea92014-05-12 15:32:20 -07001605
1606ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1607recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1608else
Doug Zongker25d55f82014-04-04 13:51:15 -07001609recovery_resources_common := $(recovery_resources_common)-xhdpi
1610endif
1611
Tao Baoe1e829e2018-08-29 20:36:00 -07001612# Select the 18x32 font on high-density devices (xhdpi and up); and the 12x22 font on other devices.
1613# Note that the font selected here can be overridden for a particular device by putting a font.png
1614# in its private recovery resources.
1615ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001616recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1617else
1618recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1619endif
1620
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001621
1622# We will only generate the recovery background text images if the variable
1623# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the
1624# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for
1625# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their
1626# BoardConfig in order to use this feature.
1627ifeq ($(recovery_density),xxxhdpi)
1628TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440
1629else ifeq ($(recovery_density),xxhdpi)
1630TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080
1631endif
1632
1633ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),)
1634# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative.
1635ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
1636 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10))
1637else
1638 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10))
1639endif
1640
1641
1642RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png
1643RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
1644RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
1645RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
1646RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
1647
xunchangcc57d312018-12-07 12:12:17 -08001648RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
1649RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
1650RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
1651RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
1652RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
1653
1654generated_recovery_text_files := \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001655 $(RECOVERY_INSTALLING_TEXT_FILE) \
1656 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
1657 $(RECOVERY_ERASING_TEXT_FILE) \
1658 $(RECOVERY_ERROR_TEXT_FILE) \
xunchangcc57d312018-12-07 12:12:17 -08001659 $(RECOVERY_NO_COMMAND_TEXT_FILE) \
1660 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
1661 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
1662 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
1663 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
1664 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001665
1666resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
1667image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
xunchangcc57d312018-12-07 12:12:17 -08001668zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001669$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
1670$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
1671$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
1672$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
xunchangcc57d312018-12-07 12:12:17 -08001673$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001674$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
xunchangdbe55e12018-12-19 17:15:14 -08001675$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001676 recovery_installing \
1677 recovery_installing_security \
1678 recovery_erasing \
1679 recovery_error \
xunchangdbe55e12018-12-19 17:15:14 -08001680 recovery_no_command
1681$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001682 recovery_cancel_wipe_data \
1683 recovery_factory_data_reset \
1684 recovery_try_again \
1685 recovery_wipe_data_menu_header \
1686 recovery_wipe_data_confirmation
1687$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
1688$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001689 # Prepares the font directory.
1690 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1691 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
xunchangcc57d312018-12-07 12:12:17 -08001692 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001693 @rm -rf $(dir $@)
1694 @mkdir -p $(dir $@)
xunchangdbe55e12018-12-19 17:15:14 -08001695 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
xunchangcc57d312018-12-07 12:12:17 -08001696 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
xunchangdbe55e12018-12-19 17:15:14 -08001697 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001698 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
1699 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
1700 --text_name $(text_name) \
1701 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
1702 --resource_dir $(PRIVATE_RESOURCE_DIR) \
xunchangdbe55e12018-12-19 17:15:14 -08001703 --output_file $(output_file) $(center_alignment) && \
xunchangcc57d312018-12-07 12:12:17 -08001704 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001705else
1706RECOVERY_INSTALLING_TEXT_FILE :=
1707RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
1708RECOVERY_ERASING_TEXT_FILE :=
1709RECOVERY_ERROR_TEXT_FILE :=
1710RECOVERY_NO_COMMAND_TEXT_FILE :=
xunchangcc57d312018-12-07 12:12:17 -08001711RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
1712RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
1713RECOVERY_TRY_AGAIN_TEXT_FILE :=
1714RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
1715RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001716endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
1717
Ying Wang9a175682015-08-06 11:47:47 -07001718ifndef TARGET_PRIVATE_RES_DIRS
1719TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1720endif
Doug Zongker4647f122009-07-02 09:00:54 -07001721recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001722 $(TARGET_PRIVATE_RES_DIRS) -type f)
xunchangcc57d312018-12-07 12:12:17 -08001723recovery_resource_deps += $(generated_recovery_text_files)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001724
1725
Andrew Boiefa61ff02012-09-28 09:33:45 -07001726ifdef TARGET_RECOVERY_FSTAB
1727recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1728else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001729recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001730endif
Tao Baoc3c17532016-06-10 10:11:54 -07001731ifdef TARGET_RECOVERY_WIPE
1732recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001733else
Tao Baoc3c17532016-06-10 10:11:54 -07001734recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001735endif
Tao Bao8beab692015-07-22 12:33:18 -07001736
Tao Bao6d5d6232018-03-09 17:04:42 -08001737# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001738# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001739# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1740# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001741#
1742# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001743# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001744# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001745# b) We build a single image that contains boot and recovery both - no recovery image to install
1746# (BOARD_USES_RECOVERY_AS_BOOT = true);
Tom Cherry2929cad2018-09-20 11:04:37 -07001747# c) We mount the system image as / and therefore do not have a ramdisk in boot.img
Tao Bao6d5d6232018-03-09 17:04:42 -08001748# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001749# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1750# do bsdiff because boot and recovery will contain different number of entries
1751# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001752# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
1753# do bsdiff because boot and recovery will contain different number of entries
1754# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001755
Tom Cherry2929cad2018-09-20 11:04:37 -07001756ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001757 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Doug Zongker56588872012-08-20 15:38:58 -07001758# Named '.dat' so we don't attempt to use imgdiff for patching it.
1759RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001760else
Tao Bao8beab692015-07-22 12:33:18 -07001761RECOVERY_RESOURCE_ZIP :=
1762endif
Doug Zongker4647f122009-07-02 09:00:54 -07001763
Tao Bao139c7272018-07-31 13:26:54 -07001764INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1765
1766$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \
Tao Bao139c7272018-07-31 13:26:54 -07001767 TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \
1768 TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \
1769 TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \
1770 TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \
1771 TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE:progress_bar_baseline \
1772 TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD:touch_low_threshold \
1773 TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD:touch_high_threshold \
1774 TARGET_RECOVERY_UI_VR_STEREO_OFFSET:vr_stereo_offset
1775
1776# Parses the given list of build variables and writes their values as build properties if defined.
1777# For example, if a target defines `TARGET_RECOVERY_UI_MARGIN_HEIGHT := 100`,
1778# `ro.recovery.ui.margin_height=100` will be appended to the given output file.
1779# $(1): Map from the build variable names to property names
1780# $(2): Output file
1781define append-recovery-ui-properties
1782echo "#" >> $(2)
1783echo "# RECOVERY UI BUILD PROPERTIES" >> $(2)
1784echo "#" >> $(2)
1785$(foreach prop,$(1), \
1786 $(eval _varname := $(call word-colon,1,$(prop))) \
1787 $(eval _propname := $(call word-colon,2,$(prop))) \
1788 $(eval _value := $($(_varname))) \
1789 $(if $(_value), \
1790 echo ro.recovery.ui.$(_propname)=$(_value) >> $(2) &&)) true
1791endef
1792
1793$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00001794 $(INSTALLED_DEFAULT_PROP_TARGET) \
1795 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1796 $(intermediate_system_build_prop) \
1797 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
1798 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
1799 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
1800 $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
Tao Bao1edaca12018-09-18 10:22:54 -07001801 @echo "Target recovery buildinfo: $@"
Tao Bao139c7272018-07-31 13:26:54 -07001802 $(hide) mkdir -p $(dir $@)
1803 $(hide) rm -f $@
1804 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@
1805 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@
Tao Bao6eb1a992018-08-06 07:33:45 -07001806 $(hide) cat $(intermediate_system_build_prop) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001807 $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001808 $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001809 $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
1810 $(hide) cat $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET) >> $@
1811 $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
1812
Doug Zongker4647f122009-07-02 09:00:54 -07001813INTERNAL_RECOVERYIMAGE_ARGS := \
1814 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1815 --kernel $(recovery_kernel) \
1816 --ramdisk $(recovery_ramdisk)
1817
1818# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001819ifdef INTERNAL_KERNEL_CMDLINE
1820 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001821endif
1822ifdef BOARD_KERNEL_BASE
1823 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1824endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001825ifdef BOARD_KERNEL_PAGESIZE
1826 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1827endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001828ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001829ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1830 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1831else
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001832 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1833endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001834endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001835ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1836 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
1837endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001838ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1839 INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
1840endif
Doug Zongker4647f122009-07-02 09:00:54 -07001841
1842# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001843# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001844# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001845OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001846
1847# Generate a file containing the keys that will be read by the
1848# recovery binary.
1849RECOVERY_INSTALL_OTA_KEYS := \
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001850 $(call intermediates-dir-for,PACKAGING,ota_keys)/otacerts.zip
Doug Zongker4647f122009-07-02 09:00:54 -07001851$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001852$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001853$(RECOVERY_INSTALL_OTA_KEYS): $(SOONG_ZIP) $(OTA_PUBLIC_KEYS) $(extra_keys)
1854 $(hide) rm -f $@
1855 $(hide) mkdir -p $(dir $@)
1856 $(hide) $(SOONG_ZIP) -o $@ $(foreach key_file, $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys), -C $(dir $(key_file)) -f $(key_file))
Doug Zongker4647f122009-07-02 09:00:54 -07001857
Andres Moralesb8876e12015-05-06 20:44:22 -07001858RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001859
Ying Wang747b9f12015-01-30 14:05:22 -08001860# $(1): output file
1861define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001862 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001863 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao696bb332018-08-17 16:27:01 -07001864 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001865 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001866 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
Tao Bao696bb332018-08-17 16:27:01 -07001867 $(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001868 # Modifying ramdisk contents...
Tom Cherry3871f0f2018-11-06 14:23:44 -08001869 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
1870 $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
Howard Chen1756f8d2017-02-22 17:27:10 +08001871 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1872 $(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
Bowgo Tsaib5b3bc62017-09-25 17:50:41 +08001873 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1874 $(hide) find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f
Ying Wang747b9f12015-01-30 14:05:22 -08001875 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Tao Baocf8853b2018-08-13 14:27:32 -07001876 $(hide) cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ 2> /dev/null || true # Ignore error when the src file doesn't exist.
Ying Wang747b9f12015-01-30 14:05:22 -08001877 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1878 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1879 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
xunchangcc57d312018-12-07 12:12:17 -08001880 $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
1881 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
Ying Wang747b9f12015-01-30 14:05:22 -08001882 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001883 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1884 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001885 $(hide) $(foreach item,$(recovery_fstab), \
Tao Bao696bb332018-08-17 16:27:01 -07001886 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001887 $(if $(strip $(recovery_wipe)), \
Tao Bao696bb332018-08-17 16:27:01 -07001888 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001889 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security
1890 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security/otacerts.zip
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001891 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001892 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001893 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Tao Baod95e9fd2015-03-29 23:07:41 -07001894 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001895 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1896 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1) --id > $(RECOVERYIMAGE_ID_FILE))
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001897 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001898 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1899 $(BOOT_SIGNER) /boot $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1900 $(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
1901 )\
1902 )
Tao Baod95e9fd2015-03-29 23:07:41 -07001903 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001904 $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001905 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1906 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1907 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001908 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1909 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1910 $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\
1911 $(hide) $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(BOARD_RECOVERYIMAGE_PARTITION_SIZE) --partition_name recovery $(INTERNAL_AVB_RECOVERY_SIGNING_ARGS) $(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)))
Ying Wang747b9f12015-01-30 14:05:22 -08001912endef
1913
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001914ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Ying Wangbd07ad02016-03-10 12:57:33 -08001915ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
1916$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1917endif
1918ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
1919$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1920endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001921ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001922$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001923endif
Tao Baof4866c72018-08-22 14:35:09 -07001924ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001925ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1926$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1927else
Tao Baof4866c72018-08-22 14:35:09 -07001928$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
1929endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001930endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001931ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1932$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1933endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001934ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1935$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1936endif
Tao Baof4866c72018-08-22 14:35:09 -07001937
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001938$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001939 $(INTERNAL_ROOT_FILES) \
1940 $(INSTALLED_RAMDISK_TARGET) \
1941 $(INTERNAL_RECOVERYIMAGE_FILES) \
1942 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1943 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1944 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1945 $(recovery_resource_deps) \
1946 $(recovery_fstab) \
1947 $(RECOVERY_INSTALL_OTA_KEYS) \
1948 $(BOARD_RECOVERY_KERNEL_MODULES) \
1949 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001950 $(call pretty,"Target boot image from recovery: $@")
1951 $(call build-recoveryimage-target, $@)
1952endif # BOARD_USES_RECOVERY_AS_BOOT
1953
1954ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001955ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1956$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1957else
Tao Baof4866c72018-08-22 14:35:09 -07001958$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001959endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001960endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001961ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1962$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1963endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001964ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1965$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1966endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001967
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001968$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001969 $(INTERNAL_ROOT_FILES) \
1970 $(INSTALLED_RAMDISK_TARGET) \
1971 $(INSTALLED_BOOTIMAGE_TARGET) \
1972 $(INTERNAL_RECOVERYIMAGE_FILES) \
1973 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1974 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1975 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1976 $(recovery_resource_deps) \
1977 $(recovery_fstab) \
1978 $(RECOVERY_INSTALL_OTA_KEYS) \
1979 $(BOARD_RECOVERY_KERNEL_MODULES) \
1980 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001981 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001982
Tao Bao4594d0e2015-12-22 09:47:46 -08001983ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001984$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001985 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001986 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1987 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001988endif
Doug Zongker56588872012-08-20 15:38:58 -07001989
Ying Wang747b9f12015-01-30 14:05:22 -08001990.PHONY: recoveryimage-nodeps
1991recoveryimage-nodeps:
1992 @echo "make $@: ignoring dependencies"
1993 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1994
Tao Bao8beab692015-07-22 12:33:18 -07001995else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07001996RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07001997endif
1998
1999.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07002000recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07002001
Jiyong Park03eb0612017-10-04 21:22:41 +09002002ifneq ($(BOARD_NAND_PAGE_SIZE),)
2003$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08002004endif
2005
Jiyong Park03eb0612017-10-04 21:22:41 +09002006ifneq ($(BOARD_NAND_SPARE_SIZE),)
2007$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07002008endif
2009
Doug Zongker4647f122009-07-02 09:00:54 -07002010# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07002011# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08002012#
Ying Wang9c649a72012-08-08 15:27:00 -07002013# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
2014PDK_FUSION_SYSIMG_FILES := \
2015 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
2016 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002017
Dan Willemsen37a19862018-10-31 16:31:46 -07002018INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07002019 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07002020 $(ALL_DEFAULT_INSTALLED_MODULES) \
2021 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08002022 $(RECOVERY_RESOURCE_ZIP)) \
Dan Willemsen37a19862018-10-31 16:31:46 -07002023 $(PDK_FUSION_SYMLINK_STAMP))
Ying Wang160b6702012-03-13 18:58:27 -07002024
Ying Wang82cceba2012-08-13 15:03:00 -07002025FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002026
2027# ASAN libraries in the system image - add dependency.
2028ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
Evgenii Stepanov8841a7f2018-07-27 11:54:32 -07002029ifneq (,$(filter address, $(SANITIZE_TARGET)))
Andreas Gampe039b5c72017-03-24 16:06:31 -07002030 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
2031 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
2032 endif
2033endif
2034
Tom Cherryd14b8952018-08-09 14:26:00 -07002035FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
Luis Hector Chavezff489932018-07-03 15:41:40 -07002036
Ying Wange5e8c5f2011-09-09 16:35:53 -07002037# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07002038# Final System VINTF manifest including fragments. This is not assembled
2039# on the device because it depends on everything in a given device
2040# image which defines a vintf_fragment.
2041
2042BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
2043$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2044$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
2045$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
2046$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
2047 @echo "Verifying system VINTF manifest."
2048 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2049 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Anton Hansson6d814982018-11-26 18:12:05 +00002050 -c $(BUILT_VENDOR_MATRIX) \
2051 -i $(BUILT_SYSTEM_MANIFEST) \
2052 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
2053 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
2054 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002055
2056# -----------------------------------------------------------------
Dan Willemsen67495202019-01-16 12:42:05 -08002057ifdef BUILDING_SYSTEM_IMAGE
2058
Ying Wange5e8c5f2011-09-09 16:35:53 -07002059# installed file list
2060# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
2061# We put installed-files.txt ahead of image itself in the dependency graph
2062# so that we can get the size stat even if the build fails due to too large
2063# system image.
2064INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07002065INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
2066$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002067$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002068 @echo Installed file list: $@
2069 @mkdir -p $(dir $@)
2070 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002071 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002072 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07002073
2074.PHONY: installed-file-list
2075installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08002076
2077$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07002078
2079systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002080 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002081BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
2082
Ying Wang23898df2014-06-18 20:26:24 -07002083# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002084ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07002085define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07002086$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
2087 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
2088 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
2089 exit 1; \
2090fi
Ying Wang23898df2014-06-18 20:26:24 -07002091$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
2092endef
2093else
2094define create-system-vendor-symlink
2095endef
2096endif
2097
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002098# Create symlink /system/product to /product if necessary.
2099ifdef BOARD_USES_PRODUCTIMAGE
2100define create-system-product-symlink
2101$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
2102 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
2103 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
2104 exit 1; \
2105fi
2106$(hide) ln -sf /product $(TARGET_OUT)/product
2107endef
2108else
2109define create-system-product-symlink
2110endef
2111endif
2112
Dario Freni924af7d2018-08-17 00:56:14 +01002113# Create symlink /system/product_services to /product_services if necessary.
Dario Freni5f681e12018-05-29 13:09:01 +01002114ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002115define create-system-product_services-symlink
2116$(hide) if [ -d $(TARGET_OUT)/product_services ] && [ ! -h $(TARGET_OUT)/product_services ]; then \
2117 echo 'Non-symlink $(TARGET_OUT)/product_services detected!' 1>&2; \
2118 echo 'You cannot install files to $(TARGET_OUT)/product_services while building a separate product_services.img!' 1>&2; \
Dario Freni5f681e12018-05-29 13:09:01 +01002119 exit 1; \
2120fi
Dario Freni924af7d2018-08-17 00:56:14 +01002121$(hide) ln -sf /product_services $(TARGET_OUT)/product_services
Dario Freni5f681e12018-05-29 13:09:01 +01002122endef
2123else
Dario Freni924af7d2018-08-17 00:56:14 +01002124define create-system-product_services-symlink
Dario Freni5f681e12018-05-29 13:09:01 +01002125endef
2126endif
2127
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002128# Create symlink /vendor/odm to /odm if necessary.
2129ifdef BOARD_USES_ODMIMAGE
2130define create-vendor-odm-symlink
2131$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
2132 echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
2133 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
2134 exit 1; \
2135fi
2136$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
2137endef
2138else
2139define create-vendor-odm-symlink
2140endef
2141endif
2142
The Android Open Source Project88b60792009-03-03 19:28:42 -08002143# $(1): output file
2144define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07002145 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07002146 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002147 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002148 $(call create-system-product_services-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07002149 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002150 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07002151 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002152 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002153 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002154 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002155 $(systemimage_intermediates)/generated_system_image_info.txt \
Dan Willemsen3e8eb372018-10-20 21:37:44 -07002156 || ( mkdir -p $${DIST_DIR}; cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07002157 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08002158endef
2159
Steven Moreland627debe2018-05-01 09:54:21 -07002160$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002161$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002162 $(call build-systemimage-target,$@)
2163
Tao Baoe9d61b02018-08-20 21:09:07 -07002164INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07002165SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002166
Tao Baoe9d61b02018-08-20 21:09:07 -07002167# INSTALLED_SYSTEMIMAGE_TARGET used to be named INSTALLED_SYSTEMIMAGE. Create an alias for backward
2168# compatibility, in case device-specific Makefiles still refer to the old name.
2169INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
2170
Doug Zongker73ef8252009-07-23 15:12:53 -07002171# The system partition needs room for the recovery image as well. We
2172# now store the recovery image as a binary patch using the boot image
2173# as the source (since they are very similar). Generate the patch so
2174# we can see how big it's going to be, and include that in the system
2175# image size check calculation.
Tao Baob1a2e352018-08-14 16:17:12 -07002176ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
Sriram Raman1e96ac82009-07-24 13:52:32 -07002177ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07002178ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Chen, ZhiminX752439b2018-09-23 22:10:47 +08002179ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08002180diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
2181else
2182diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
2183endif
Doug Zongker73ef8252009-07-23 15:12:53 -07002184intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
2185RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08002186$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
2187$(RECOVERY_FROM_BOOT_PATCH): \
Anton Hansson6d814982018-11-26 18:12:05 +00002188 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2189 $(INSTALLED_BOOTIMAGE_TARGET) \
2190 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07002191 @echo "Construct recovery from boot"
2192 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08002193 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07002194else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
2195RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
Tao Baob1a2e352018-08-14 16:17:12 -07002196endif # BOARD_USES_FULL_RECOVERY_IMAGE
2197endif # INSTALLED_RECOVERYIMAGE_TARGET
2198endif # INSTALLED_BOOTIMAGE_TARGET
Doug Zongker73ef8252009-07-23 15:12:53 -07002199
Tao Baoe9d61b02018-08-20 21:09:07 -07002200$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002201 @echo "Install system fs image: $@"
2202 $(copy-file-to-target)
Yifan Hongaccf09b2019-02-19 15:42:45 -08002203ifdef RECOVERY_FROM_BOOT_PATCH
2204ifeq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true)
2205ifeq ($(BOARD_SYSTEMIMAGE_PARTITION_SIZE),)
2206 # system image size is dynamic, hence system_size in generated_system_image_info.txt does not
2207 # have room for recovery from boot patch. Increase system_size so that check-all-partition-sizes
2208 # accounts for the size of the patch.
2209 sed -i'.bak' -e 's/^system_size=.*$$/system_size='"$$(( \
2210 $(call read-image-prop-dictionary,$(systemimage_intermediates)/generated_system_image_info.txt,system_size) + \
2211 $$($(call get-file-size,$(RECOVERY_FROM_BOOT_PATCH))) ))"'/' \
2212 $(systemimage_intermediates)/generated_system_image_info.txt
2213endif
2214endif
2215endif
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002216 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
Anton Hansson6d814982018-11-26 18:12:05 +00002217 $(call read-image-prop-dictionary,\
2218 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002219
Tao Baoe9d61b02018-08-20 21:09:07 -07002220systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002221
2222.PHONY: systemimage-nodeps snod
2223systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07002224 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002225 @echo "make $@: ignoring dependencies"
Tao Baoe9d61b02018-08-20 21:09:07 -07002226 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
2227 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),\
Anton Hansson6d814982018-11-26 18:12:05 +00002228 $(call read-image-prop-dictionary,\
2229 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002230
Ying Wangacf01ec2012-02-24 11:05:48 -08002231ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
2232ifeq (true,$(WITH_DEXPREOPT))
2233$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
2234endif
2235endif
2236
Dan Willemsen67495202019-01-16 12:42:05 -08002237endif # BUILDING_SYSTEM_IMAGE
2238
Anton Hansson30e061b2018-11-12 13:36:46 +00002239.PHONY: sync syncsys
2240sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
Colin Cross91a52272017-06-20 16:57:52 -07002241
The Android Open Source Project88b60792009-03-03 19:28:42 -08002242#######
2243## system tarball
2244define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07002245 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
2246 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002247 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002248 $(call create-system-product_services-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07002249 $(MKTARBALL) $(FS_GET_STATS) \
2250 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002251 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002252endef
2253
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002254ifndef SYSTEM_TARBALL_FORMAT
2255 SYSTEM_TARBALL_FORMAT := bz2
2256endif
2257
The Android Open Source Project88b60792009-03-03 19:28:42 -08002258system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002259INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002260$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
2261$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
2262 $(build-systemtarball-target)
2263
2264.PHONY: systemtarball-nodeps
2265systemtarball-nodeps: $(FS_GET_STATS) \
2266 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
2267 $(build-systemtarball-target)
2268
2269.PHONY: stnod
2270stnod: systemtarball-nodeps
2271
Ying Wang3a61eeb2016-03-11 10:32:01 -08002272# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07002273## platform.zip: system, plus other files to be used in PDK fusion build,
2274## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07002275##
2276## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
2277## The variable will be typically set from BoardConfig.mk.
2278## Files under out dir will be rejected to prevent possible conflicts with other rules.
Colin Cross53c8f972018-09-28 16:19:42 -07002279ifneq (,$(BUILD_PLATFORM_ZIP))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002280pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002281 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002282pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002283 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002284pdk_classes_dex := $(strip \
2285 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
2286 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
2287
2288pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
2289$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
2290$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
2291$(pdk_odex_config_mk) :
2292 @echo "PDK odex config makefile: $@"
2293 $(hide) mkdir -p $(dir $@)
2294 $(hide) echo "# Auto-generated. Do not modify." > $@
2295 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
2296 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
2297 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
2298 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
2299 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2300 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2301 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2302 )
2303 $(foreach m,$(PRIVATE_APPS),\
2304 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
2305 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2306 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2307 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2308 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07002309 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08002310 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
2311 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
2312 )
2313
keunyoungc0178062013-07-22 14:54:58 -07002314PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07002315INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08002316
2317$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
2318$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
Colin Cross7363cde2018-09-14 21:51:11 -07002319$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP)
2320# dependencies for the other partitions are defined below after their file lists
2321# are known
Dan Willemsenad6a1542018-12-14 01:04:19 -08002322$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(api_fingerprint)
Keun young Park816b9fd2012-05-16 10:32:41 -07002323 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Colin Cross7363cde2018-09-14 21:51:11 -07002324 rm -f $@ $@.lst
2325 echo "-C $(PRODUCT_OUT)" >> $@.lst
2326 echo "-D $(TARGET_OUT)" >> $@.lst
2327 echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst
2328 echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst
Dan Willemsen67495202019-01-16 12:42:05 -08002329ifdef BUILDING_VENDOR_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002330 echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst
Ying Wangcff38622014-07-16 17:46:35 -07002331endif
Dan Willemsen67495202019-01-16 12:42:05 -08002332ifdef BUILDING_PRODUCT_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002333 echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002334endif
Dan Willemsen67495202019-01-16 12:42:05 -08002335ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002336 echo "-D $(TARGET_OUT_PRODUCT_SERVICES)" >> $@.lst
Dario Freni5f681e12018-05-29 13:09:01 +01002337endif
Dan Willemsen67495202019-01-16 12:42:05 -08002338ifdef BUILDING_ODM_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002339 echo "-D $(TARGET_OUT_ODM)" >> $@.lst
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002340endif
Colin Crossc451a372013-12-18 19:36:44 -08002341ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Colin Cross7363cde2018-09-14 21:51:11 -07002342 echo "-C $(OUT_DIR)" >> $@.lst
2343 for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \
2344 if [ -e $$f ]; then \
2345 echo "-f $$f"; \
2346 fi \
2347 done >> $@.lst
Keun young Park816b9fd2012-05-16 10:32:41 -07002348endif
keunyoungc0178062013-07-22 14:54:58 -07002349ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Colin Cross7363cde2018-09-14 21:51:11 -07002350 echo "-C . $(addprefix -f ,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))" >> $@.lst
keunyoungc0178062013-07-22 14:54:58 -07002351endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08002352 @# Add dex-preopt files and config.
Colin Cross7363cde2018-09-14 21:51:11 -07002353 $(if $(PRIVATE_DEX_FILES),\
2354 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst
Dan Willemsenad6a1542018-12-14 01:04:19 -08002355 echo "-C $(dir $(api_fingerprint)) -f $(api_fingerprint)" >> $@.lst
Colin Cross7363cde2018-09-14 21:51:11 -07002356 touch $(PRODUCT_OUT)/pdk.mk
2357 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst
2358 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst
Ying Wang4c289e52012-03-30 13:52:54 -07002359
2360.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07002361platform: $(INSTALLED_PLATFORM_ZIP)
2362
2363.PHONY: platform-java
2364platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07002365
2366# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07002367ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
2368$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07002369endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002370
Colin Cross53c8f972018-09-28 16:19:42 -07002371endif # BUILD_PLATFORM_ZIP
2372
Ying Wang3a61eeb2016-03-11 10:32:01 -08002373# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07002374## boot tarball
2375define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07002376 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07002377 $(hide) mkdir -p $(PRODUCT_OUT)/boot
2378 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002379 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07002380 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
2381 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002382 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07002383endef
2384
2385ifndef BOOT_TARBALL_FORMAT
2386 BOOT_TARBALL_FORMAT := bz2
2387endif
2388
2389boot_tar := $(PRODUCT_OUT)/boot.tar
2390INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
2391$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
2392$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
2393 $(build-boottarball-target)
2394
2395.PHONY: boottarball-nodeps btnod
2396boottarball-nodeps btnod: $(FS_GET_STATS) \
2397 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
2398 $(build-boottarball-target)
2399
2400
The Android Open Source Project88b60792009-03-03 19:28:42 -08002401# -----------------------------------------------------------------
2402# data partition image
2403INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002404 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002405
Dan Willemsen67495202019-01-16 12:42:05 -08002406ifdef BUILDING_USERDATA_IMAGE
Ying Wangbd93d422011-10-28 17:02:30 -07002407userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002408 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07002409BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
2410
Ying Wangbd93d422011-10-28 17:02:30 -07002411define build-userdataimage-target
2412 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
2413 @mkdir -p $(TARGET_OUT_DATA)
2414 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002415 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002416 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002417 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002418 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002419 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07002420endef
2421
Joe Onorato64d85d02009-04-09 19:31:12 -07002422# We just build this directly to the install location.
2423INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002424INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
2425 $(INTERNAL_USERIMAGES_DEPS) \
2426 $(INTERNAL_USERDATAIMAGE_FILES) \
2427 $(BUILD_IMAGE_SRCS)
2428$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002429 $(build-userdataimage-target)
2430
2431.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07002432userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002433 $(build-userdataimage-target)
2434
Dan Willemsen67495202019-01-16 12:42:05 -08002435endif # BUILDING_USERDATA_IMAGE
Ying Wange215ed52012-10-15 14:36:22 -07002436
Andreas Gampe039b5c72017-03-24 16:06:31 -07002437# ASAN libraries in the system image - build rule.
2438ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
2439 $(TARGET_OUT_SHARED_LIBRARIES) \
2440 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
2441 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
2442 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07002443# Extra options: Enforce the system user for the files to avoid having to change ownership.
2444ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07002445# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
2446# enough space.
2447$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07002448 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 -07002449
The Android Open Source Project88b60792009-03-03 19:28:42 -08002450#######
2451## data partition tarball
2452define build-userdatatarball-target
2453 $(call pretty,"Target userdata fs tarball: " \
2454 "$(INSTALLED_USERDATATARBALL_TARGET)")
2455 $(MKTARBALL) $(FS_GET_STATS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002456 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
2457 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002458endef
2459
2460userdata_tar := $(PRODUCT_OUT)/userdata.tar
2461INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
2462$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
2463$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
2464 $(build-userdatatarball-target)
2465
Dan Willemsen69af2e42016-08-16 16:36:05 -07002466$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
2467
The Android Open Source Project88b60792009-03-03 19:28:42 -08002468.PHONY: userdatatarball-nodeps
2469userdatatarball-nodeps: $(FS_GET_STATS)
2470 $(build-userdatatarball-target)
2471
2472
The Android Open Source Project88b60792009-03-03 19:28:42 -08002473# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04002474# partition table image
2475ifdef BOARD_BPT_INPUT_FILES
2476
2477BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002478BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04002479
2480INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
2481 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002482 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04002483 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
2484
2485ifdef BOARD_BPT_DISK_SIZE
2486INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
2487endif
2488
2489define build-bptimage-target
2490 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
2491 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
2492endef
2493
2494INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002495$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
2496 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
2497
David Zeuthen25328622016-04-08 15:08:03 -04002498$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
2499 $(build-bptimage-target)
2500
2501.PHONY: bptimage-nodeps
2502bptimage-nodeps:
2503 $(build-bptimage-target)
2504
2505endif # BOARD_BPT_INPUT_FILES
2506
2507# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07002508# cache partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002509ifdef BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002510INTERNAL_CACHEIMAGE_FILES := \
2511 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
2512
2513cacheimage_intermediates := \
2514 $(call intermediates-dir-for,PACKAGING,cache)
2515BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
2516
2517define build-cacheimage-target
2518 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
2519 @mkdir -p $(TARGET_OUT_CACHE)
2520 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002521 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002522 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002523 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002524 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002525 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07002526endef
2527
2528# We just build this directly to the install location.
2529INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002530$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002531 $(build-cacheimage-target)
2532
2533.PHONY: cacheimage-nodeps
2534cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2535 $(build-cacheimage-target)
2536
Dan Willemsen67495202019-01-16 12:42:05 -08002537else # BUILDING_CACHE_IMAGE
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07002538# we need to ignore the broken cache link when doing the rsync
2539IGNORE_CACHE_LINK := --exclude=cache
Dan Willemsen67495202019-01-16 12:42:05 -08002540endif # BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002541
David Zeuthen0eb10972016-09-28 17:55:27 -04002542# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07002543# system_other partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002544ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002545ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
Alex Light4e358ab2016-06-16 14:47:10 -07002546# Marker file to identify that odex files are installed
2547INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2548ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2549$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2550 $(hide) touch $@
2551endif
2552
Alex Light4e358ab2016-06-16 14:47:10 -07002553INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2554 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2555 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002556 $(ALL_PDK_FUSION_FILES)) \
2557 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002558
Colin Cross6db5b0e2018-11-16 21:26:33 -08002559# system_other dex files are installed as a side-effect of installing system image files
2560INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES)
2561
Alex Light4e358ab2016-06-16 14:47:10 -07002562INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002563INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2564$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002565$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07002566 @echo Installed file list: $@
2567 @mkdir -p $(dir $@)
2568 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002569 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002570 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002571
Bowgo Tsai867ab662019-01-29 13:30:18 +08002572# Determines partition size for system_other.img.
2573ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
2574ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
2575INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE)
2576endif
2577endif
2578
2579ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE
2580INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE)
2581endif
2582
Alex Light4e358ab2016-06-16 14:47:10 -07002583systemotherimage_intermediates := \
2584 $(call intermediates-dir-for,PACKAGING,system_other)
2585BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2586
2587# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2588define build-systemotherimage-target
2589 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2590 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2591 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002592 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002593 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002594 build/make/tools/releasetools/build_image.py \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002595 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
2596 $(systemotherimage_intermediates)/generated_system_other_image_info.txt
2597 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
2598 $(call read-image-prop-dictionary,\
Bowgo Tsai867ab662019-01-29 13:30:18 +08002599 $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_other_size))
Alex Light4e358ab2016-06-16 14:47:10 -07002600endef
2601
2602# We just build this directly to the install location.
2603INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002604ifneq (true,$(SANITIZE_LITE))
2605# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002606$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2607 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002608endif
Alex Light4e358ab2016-06-16 14:47:10 -07002609
2610.PHONY: systemotherimage-nodeps
2611systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2612 $(build-systemotherimage-target)
2613
Dan Willemsen67495202019-01-16 12:42:05 -08002614endif # BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002615
2616
2617# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002618# vendor partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002619ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07002620INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002621 $(filter $(TARGET_OUT_VENDOR)/%,\
2622 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002623 $(ALL_PDK_FUSION_FILES)) \
2624 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002625
Steven Moreland627debe2018-05-01 09:54:21 -07002626# Final Vendor VINTF manifest including fragments. This is not assembled
2627# on the device because it depends on everything in a given device
2628# image which defines a vintf_fragment.
2629ifdef BUILT_VENDOR_MANIFEST
2630BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
2631ifeq (true,$(strip $(PRODUCT_ENFORCE_VINTF_MANIFEST)))
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002632ifneq ($(strip $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)),)
Steven Moreland627debe2018-05-01 09:54:21 -07002633$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002634endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
Steven Moreland627debe2018-05-01 09:54:21 -07002635endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2636$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2637$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2638$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2639$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
Yifan Hong770ab052018-11-02 13:43:30 -07002640
2641$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS :=
2642
2643# -- Kernel version and configurations.
2644ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
2645
2646# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
2647# from INSTALLED_KERNEL_TARGET.
2648ifdef BOARD_KERNEL_CONFIG_FILE
2649ifdef BOARD_KERNEL_VERSION
2650$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BOARD_KERNEL_CONFIG_FILE)
2651$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $(BOARD_KERNEL_VERSION):$(BOARD_KERNEL_CONFIG_FILE)
2652my_board_extracted_kernel := true
2653endif # BOARD_KERNEL_VERSION
2654endif # BOARD_KERNEL_CONFIG_FILE
2655
2656ifneq ($(my_board_extracted_kernel),true)
2657ifndef INSTALLED_KERNEL_TARGET
2658$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2659 is true. Information about the updated kernel cannot be built into OTA update package. \
2660 You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
2661 to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
2662 or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
2663 BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2664 manually.)
2665else
2666intermediates := $(call intermediates-dir-for,ETC,$(notdir $(BUILT_ASSEMBLED_VENDOR_MANIFEST)))
2667
2668# Tools for decompression that is not in PATH.
2669# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
2670# Algorithms that are in the script but not in this list will be found in PATH.
2671my_decompress_tools := \
2672 lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
2673
2674my_kernel_configs := $(intermediates)/kernel_configs.txt
2675my_kernel_version := $(intermediates)/kernel_version.txt
2676$(my_kernel_configs): .KATI_IMPLICIT_OUTPUTS := $(my_kernel_version)
2677$(my_kernel_configs): PRIVATE_KERNEL_VERSION_FILE := $(my_kernel_version)
2678$(my_kernel_configs): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
2679$(my_kernel_configs): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
2680$(my_kernel_configs): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
2681 $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
2682 --output-configs $@ \
2683 --output-version $(PRIVATE_KERNEL_VERSION_FILE)
2684
2685$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(my_kernel_configs) $(my_kernel_version)
2686$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $$(cat $(my_kernel_version)):$(my_kernel_configs)
2687
2688intermediates :=
2689my_kernel_configs :=
2690my_kernel_version :=
2691my_decompress_tools :=
2692
2693endif # my_board_extracted_kernel
2694my_board_extracted_kernel :=
2695
2696endif # INSTALLED_KERNEL_TARGET
2697endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
2698
2699$(BUILT_ASSEMBLED_VENDOR_MANIFEST):
Steven Moreland627debe2018-05-01 09:54:21 -07002700 @echo "Verifying vendor VINTF manifest."
2701 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2702 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2703 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Yifan Hong770ab052018-11-02 13:43:30 -07002704 $(PRIVATE_FLAGS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002705 -c $(BUILT_SYSTEM_MATRIX) \
2706 -i $(BUILT_VENDOR_MANIFEST) \
2707 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2708 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2709 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002710endif # BUILT_VENDOR_MANIFEST
2711
Ying Wangcff38622014-07-16 17:46:35 -07002712# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2713$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002714
Ying Wang8da19e32015-09-15 14:22:12 -07002715INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002716INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2717$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002718$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002719 @echo Installed file list: $@
2720 @mkdir -p $(dir $@)
2721 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002722 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002723 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002724
Ying Wanga0febe52013-03-20 11:02:05 -07002725vendorimage_intermediates := \
2726 $(call intermediates-dir-for,PACKAGING,vendor)
2727BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002728define build-vendorimage-target
2729 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2730 @mkdir -p $(TARGET_OUT_VENDOR)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002731 $(call create-vendor-odm-symlink)
Ying Wanga0febe52013-03-20 11:02:05 -07002732 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002733 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002734 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2735 $(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor/,$(call intermediates-dir-for,PACKAGING,depmod_vendor)))
Ying Wanga0febe52013-03-20 11:02:05 -07002736 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002737 build/make/tools/releasetools/build_image.py \
Yifan Hong749062d2018-06-19 16:23:16 -07002738 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
2739 $(vendorimage_intermediates)/generated_vendor_image_info.txt
2740 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
2741 $(call read-image-prop-dictionary,\
2742 $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
Ying Wanga0febe52013-03-20 11:02:05 -07002743endef
2744
2745# We just build this directly to the install location.
2746INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002747ifdef BUILT_VENDOR_MANIFEST
2748$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2749endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002750$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_VENDOR_KERNEL_MODULES)
Ying Wanga0febe52013-03-20 11:02:05 -07002751 $(build-vendorimage-target)
2752
Steven Morelanda2e734d2017-03-07 12:10:09 -08002753.PHONY: vendorimage-nodeps vnod
2754vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002755 $(build-vendorimage-target)
2756
Colin Cross91a52272017-06-20 16:57:52 -07002757sync: $(INTERNAL_VENDORIMAGE_FILES)
2758
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002759else ifdef BOARD_PREBUILT_VENDORIMAGE
2760INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2761$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2762endif
Ying Wanga0febe52013-03-20 11:02:05 -07002763
Ying Wang9f8e8db2011-11-04 11:37:01 -07002764# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002765# product partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002766ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002767INTERNAL_PRODUCTIMAGE_FILES := \
2768 $(filter $(TARGET_OUT_PRODUCT)/%,\
2769 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002770 $(ALL_PDK_FUSION_FILES)) \
2771 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002772
2773# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2774$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2775
2776INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002777INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2778$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002779$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2780 @echo Installed file list: $@
2781 @mkdir -p $(dir $@)
2782 @rm -f $@
2783 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2784 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2785
2786productimage_intermediates := \
2787 $(call intermediates-dir-for,PACKAGING,product)
2788BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2789define build-productimage-target
2790 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2791 @mkdir -p $(TARGET_OUT_PRODUCT)
2792 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002793 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002794 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2795 ./build/tools/releasetools/build_image.py \
Yifan Hong56a6c3b2018-07-20 15:19:34 -07002796 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT) \
2797 $(productimage_intermediates)/generated_product_image_info.txt
2798 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),\
2799 $(call read-image-prop-dictionary,\
2800 $(productimage_intermediates)/generated_product_image_info.txt,product_size))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002801endef
2802
2803# We just build this directly to the install location.
2804INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2805$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2806 $(build-productimage-target)
2807
2808.PHONY: productimage-nodeps pnod
2809productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2810 $(build-productimage-target)
2811
2812sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2813
2814else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2815INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2816$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2817endif
2818
2819# -----------------------------------------------------------------
Dario Freni924af7d2018-08-17 00:56:14 +01002820# product_services partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002821ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni5f681e12018-05-29 13:09:01 +01002822INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
2823 $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
2824 $(ALL_DEFAULT_INSTALLED_MODULES)\
2825 $(ALL_PDK_FUSION_FILES)) \
2826 $(PDK_FUSION_SYMLINK_STAMP)
2827
2828# platform.zip depends on $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES).
2829$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2830
Dario Freni924af7d2018-08-17 00:56:14 +01002831INSTALLED_FILES_FILE_PRODUCT_SERVICES := $(PRODUCT_OUT)/installed-files-product_services.txt
Dario Freni5f681e12018-05-29 13:09:01 +01002832INSTALLED_FILES_JSON_PRODUCT_SERVICES := $(INSTALLED_FILES_FILE_PRODUCT_SERVICES:.txt=.json)
2833$(INSTALLED_FILES_FILE_PRODUCT_SERVICES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT_SERVICES)
2834$(INSTALLED_FILES_FILE_PRODUCT_SERVICES) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(FILESLIST)
2835 @echo Installed file list: $@
2836 @mkdir -p $(dir $@)
2837 @rm -f $@
2838 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT_SERVICES) > $(@:.txt=.json)
2839 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2840
Yifan Hongebc041a2018-07-26 16:02:52 -07002841product_servicesimage_intermediates := \
2842 $(call intermediates-dir-for,PACKAGING,product_services)
Dario Freni924af7d2018-08-17 00:56:14 +01002843BUILT_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
2844define build-product_servicesimage-target
2845 $(call pretty,"Target product_services fs image: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)")
Dario Freni5f681e12018-05-29 13:09:01 +01002846 @mkdir -p $(TARGET_OUT_PRODUCT_SERVICES)
Yifan Hongebc041a2018-07-26 16:02:52 -07002847 @mkdir -p $(product_servicesimage_intermediates) && rm -rf $(product_servicesimage_intermediates)/product_services_image_info.txt
2848 $(call generate-image-prop-dictionary, $(product_servicesimage_intermediates)/product_services_image_info.txt,product_services, skip_fsck=true)
Dario Freni5f681e12018-05-29 13:09:01 +01002849 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2850 ./build/tools/releasetools/build_image.py \
Yifan Hongebc041a2018-07-26 16:02:52 -07002851 $(TARGET_OUT_PRODUCT_SERVICES) $(product_servicesimage_intermediates)/product_services_image_info.txt $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(TARGET_OUT) \
2852 $(product_servicesimage_intermediates)/generated_product_services_image_info.txt
Yifan Hong9c35a022018-07-20 15:33:47 -07002853 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),\
2854 $(call read-image-prop-dictionary,\
Yifan Hongebc041a2018-07-26 16:02:52 -07002855 $(product_servicesimage_intermediates)/generated_product_services_image_info.txt,product_services_size))
Dario Freni5f681e12018-05-29 13:09:01 +01002856endef
2857
2858# We just build this directly to the install location.
2859INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(BUILT_PRODUCT_SERVICESIMAGE_TARGET)
2860$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT_SERVICES) $(BUILD_IMAGE_SRCS)
Dario Freni924af7d2018-08-17 00:56:14 +01002861 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002862
2863.PHONY: productservicesimage-nodeps psnod
2864productservicesimage-nodeps psnod: | $(INTERNAL_USERIMAGES_DEPS)
Dario Freni924af7d2018-08-17 00:56:14 +01002865 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002866
2867sync: $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2868
2869else ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002870INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
Dario Freni5f681e12018-05-29 13:09:01 +01002871$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCT_SERVICESIMAGE),$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)))
2872endif
2873
2874# -----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002875# odm partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002876ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002877INTERNAL_ODMIMAGE_FILES := \
2878 $(filter $(TARGET_OUT_ODM)/%,\
2879 $(ALL_DEFAULT_INSTALLED_MODULES)\
2880 $(ALL_PDK_FUSION_FILES)) \
2881 $(PDK_FUSION_SYMLINK_STAMP)
2882# platform.zip depends on $(INTERNAL_ODMIMAGE_FILES).
2883$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODMIMAGE_FILES)
2884
2885INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt
2886INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json)
2887$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM)
2888$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST)
2889 @echo Installed file list: $@
2890 @mkdir -p $(dir $@)
2891 @rm -f $@
2892 $(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json)
2893 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2894
2895odmimage_intermediates := \
2896 $(call intermediates-dir-for,PACKAGING,odm)
2897BUILT_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2898define build-odmimage-target
2899 $(call pretty,"Target odm fs image: $(INSTALLED_ODMIMAGE_TARGET)")
2900 @mkdir -p $(TARGET_OUT_ODM)
2901 @mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt
2902 $(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true)
2903 $(if $(BOARD_ODM_KERNEL_MODULES), \
2904 $(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm/,$(call intermediates-dir-for,PACKAGING,depmod_odm)))
2905 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2906 ./build/tools/releasetools/build_image.py \
2907 $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT) \
2908 $(odmimage_intermediates)/generated_odm_image_info.txt
2909 $(hide) $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),\
2910 $(call read-image-prop-dictionary,\
2911 $(odmimage_intermediates)/generated_odm_image_info.txt,odm_size))
2912endef
2913
2914# We just build this directly to the install location.
2915INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET)
2916$(INSTALLED_ODMIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_ODMIMAGE_FILES) $(INSTALLED_FILES_FILE_ODM) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_ODM_KERNEL_MODULES)
2917 $(build-odmimage-target)
2918
2919.PHONY: odmimage-nodeps onod
2920odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
2921 $(build-odmimage-target)
2922
2923sync: $(INTERNAL_ODMIMAGE_FILES)
2924
2925else ifdef BOARD_PREBUILT_ODMIMAGE
2926INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2927$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET)))
2928endif
2929
2930# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07002931# dtbo image
2932ifdef BOARD_PREBUILT_DTBOIMAGE
2933INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
2934
2935ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002936$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002937 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2938 $(AVBTOOL) add_hash_footer \
Anton Hansson6d814982018-11-26 18:12:05 +00002939 --image $@ \
2940 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
2941 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
2942 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002943else
2944$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
2945 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2946endif
2947
Tao Bao0da43472018-08-22 22:53:41 -07002948endif # BOARD_PREBUILT_DTBOIMAGE
2949
2950# Returns a list of image targets corresponding to the given list of partitions. For example, it
2951# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET)
2952# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor".
2953# (1): list of partitions like "system", "vendor" or "system product product_services".
2954define images-for-partitions
2955$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))
2956endef
Yueyao Zhu211c9012017-04-27 00:34:50 -07002957
2958# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002959# vbmeta image
2960ifeq ($(BOARD_AVB_ENABLE),true)
2961
2962BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002963AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002964
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002965ifdef BOARD_AVB_KEY_PATH
2966$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
2967else
2968# If key path isn't specified, use the 4096-bit test key.
2969BOARD_AVB_ALGORITHM := SHA256_RSA4096
2970BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
2971endif
2972
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08002973# AVB signing for system_other.img.
2974ifdef BUILDING_SYSTEM_OTHER_IMAGE
2975ifdef BOARD_AVB_SYSTEM_OTHER_KEY_PATH
2976$(if $(BOARD_AVB_SYSTEM_OTHER_ALGORITHM),,$(error BOARD_AVB_SYSTEM_OTHER_ALGORITHM is not defined))
2977else
2978# If key path isn't specified, use the same key as BOARD_AVB_KEY_PATH.
2979BOARD_AVB_SYSTEM_OTHER_KEY_PATH := $(BOARD_AVB_KEY_PATH)
2980BOARD_AVB_SYSTEM_OTHER_ALGORITHM := $(BOARD_AVB_ALGORITHM)
2981endif
2982
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08002983# To extract the public key of SYSTEM_OTHER_KEY_PATH will into system.img:
2984# /system/etc/security/avb/system_other.avbpubkey.
2985FULL_SYSTEMIMAGE_DEPS += $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)
2986
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08002987ifndef BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX
2988BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
2989endif
2990
2991BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX)
2992endif # end of AVB for BUILDING_SYSTEM_OTHER_IMAGE
2993
Tao Bao744c4c72018-08-20 21:09:07 -07002994INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \
David Anderson7709ab22018-10-15 14:41:34 -07002995 $(BOARD_AVB_VBMETA_SYSTEM) \
Tao Bao744c4c72018-08-20 21:09:07 -07002996 $(BOARD_AVB_VBMETA_VENDOR)
2997
2998# Not allowing the same partition to appear in multiple groups.
2999ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
David Anderson7709ab22018-10-15 14:41:34 -07003000 $(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates)
Tao Bao744c4c72018-08-20 21:09:07 -07003001endif
3002
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003003# Appends security patch level as a AVB property descriptor
3004
3005BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
3006 --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
3007
3008BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
3009 --prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
3010
3011BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS += \
3012 --prop com.android.build.product_services.security_patch:$(PLATFORM_SECURITY_PATCH)
3013
3014# The following vendor- and odm-specific images needs explicitly set per board.
3015ifdef BOOT_SECURITY_PATCH
3016BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
3017 --prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH)
3018endif
3019
3020ifdef VENDOR_SECURITY_PATCH
3021BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
3022 --prop com.android.build.vendor.security_patch:$(VENDOR_SECURITY_PATCH)
3023endif
3024
3025ifdef ODM_SECURITY_PATCH
3026BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
3027 --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH)
3028endif
3029
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003030BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
3031DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
3032SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
3033VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05003034RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003035PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Dario Freni5f681e12018-05-29 13:09:01 +01003036PRODUCT_SERVICES_FOOTER_ARGS := BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003037ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003038
Tao Bao0da43472018-08-22 22:53:41 -07003039# Helper function that checks and sets required build variables for an AVB chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003040# $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system.
Tao Bao0da43472018-08-22 22:53:41 -07003041define _check-and-set-avb-chain-args
3042$(eval part := $(1))
3043$(eval PART=$(call to-upper,$(part)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003044
3045$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
3046$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
3047$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
3048$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
3049$(if $($(_key_path)),,$(error $(_key_path) is not defined))
3050$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
3051$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
3052$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
3053
3054# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
3055$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
3056$(eval $(_signing_args) := \
3057 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
3058
3059$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3060 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
3061
Tao Bao744c4c72018-08-20 21:09:07 -07003062# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up
David Anderson7709ab22018-10-15 14:41:34 -07003063# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX).
Tao Bao744c4c72018-08-20 21:09:07 -07003064$(if $(filter $(part),$(part:vbmeta_%=%)),\
3065 $(eval _footer_args := $(PART)_FOOTER_ARGS) \
3066 $(eval $($(_footer_args)) += --rollback_index $($(_rollback_index))))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003067endef
3068
Tao Bao0da43472018-08-22 22:53:41 -07003069# Checks and sets the required build variables for an AVB partition. The partition will be
3070# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the
Tao Bao744c4c72018-08-20 21:09:07 -07003071# image descriptor will be included into vbmeta.img, unless it has been already added to any chained
3072# VBMeta image.
Tao Bao0da43472018-08-22 22:53:41 -07003073# $(1): Partition name, e.g. boot or system.
3074define check-and-set-avb-args
Tao Bao744c4c72018-08-20 21:09:07 -07003075$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
Tao Bao0da43472018-08-22 22:53:41 -07003076$(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\
Tao Bao744c4c72018-08-20 21:09:07 -07003077 $(if $(_in_chained_vbmeta),\
3078 $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \
Tao Bao0da43472018-08-22 22:53:41 -07003079 $(call _check-and-set-avb-chain-args,$(1)),\
Tao Bao744c4c72018-08-20 21:09:07 -07003080 $(if $(_in_chained_vbmeta),,\
3081 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3082 --include_descriptors_from_image $(call images-for-partitions,$(1)))))
Tao Bao0da43472018-08-22 22:53:41 -07003083endef
3084
Tao Baob1a2e352018-08-14 16:17:12 -07003085ifdef INSTALLED_BOOTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003086$(eval $(call check-and-set-avb-args,boot))
Tao Baob1a2e352018-08-14 16:17:12 -07003087endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003088
Tao Bao0da43472018-08-22 22:53:41 -07003089$(eval $(call check-and-set-avb-args,system))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003090
3091ifdef INSTALLED_VENDORIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003092$(eval $(call check-and-set-avb-args,vendor))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003093endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003094
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003095ifdef INSTALLED_PRODUCTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003096$(eval $(call check-and-set-avb-args,product))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003097endif
3098
Tao Baocee6d042018-08-22 23:39:03 -07003099ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003100$(eval $(call check-and-set-avb-args,product_services))
Tao Baocee6d042018-08-22 23:39:03 -07003101endif
3102
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003103ifdef INSTALLED_ODMIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003104$(eval $(call check-and-set-avb-args,odm))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003105endif
3106
Yueyao Zhu211c9012017-04-27 00:34:50 -07003107ifdef INSTALLED_DTBOIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003108$(eval $(call check-and-set-avb-args,dtbo))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003109endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07003110
David Zeuthen8fecb282017-12-01 16:24:01 -05003111ifdef INSTALLED_RECOVERYIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003112$(eval $(call check-and-set-avb-args,recovery))
David Zeuthen8fecb282017-12-01 16:24:01 -05003113endif
Bowgo Tsai53cf9992017-06-13 11:27:06 +08003114
David Anderson7709ab22018-10-15 14:41:34 -07003115# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet.
3116ifdef BOARD_AVB_VBMETA_SYSTEM
3117$(eval $(call check-and-set-avb-args,vbmeta_system))
Tao Bao744c4c72018-08-20 21:09:07 -07003118endif
3119
3120ifdef BOARD_AVB_VBMETA_VENDOR
3121$(eval $(call check-and-set-avb-args,vbmeta_vendor))
3122endif
3123
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003124# Add kernel cmdline descriptor for kernel to mount system.img as root with
3125# dm-verity. This works when system.img is either chained or not-chained:
3126# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
3127# cmdline descriptor to system.img
3128# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
3129# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08003130ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
David Anderson8916a2a2018-09-18 15:46:59 -07003131ifeq ($(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003132BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08003133endif
David Anderson8916a2a2018-09-18 15:46:59 -07003134endif
Bowgo Tsai9b377602017-04-14 18:50:11 +08003135
Tao Bao0da43472018-08-22 22:53:41 -07003136BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
David Anderson7709ab22018-10-15 14:41:34 -07003137BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += --padding_size 4096
Tao Bao744c4c72018-08-20 21:09:07 -07003138BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += --padding_size 4096
3139
3140ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
Tao Bao240dcb82018-10-22 13:02:53 -07003141# We only need the flag in top-level vbmeta.img.
Tao Bao744c4c72018-08-20 21:09:07 -07003142BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
Tao Bao744c4c72018-08-20 21:09:07 -07003143endif
Tao Bao0da43472018-08-22 22:53:41 -07003144
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003145ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003146BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003147endif
3148
David Anderson7709ab22018-10-15 14:41:34 -07003149ifdef BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX
3150BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += \
3151 --rollback_index $(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX)
Tao Bao744c4c72018-08-20 21:09:07 -07003152endif
3153
3154ifdef BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX
3155BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += \
3156 --rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX)
John Reck0588b432018-05-03 13:20:01 -07003157endif
3158
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003159# $(1): the directory to extract public keys to
3160define extract-avb-chain-public-keys
3161 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
3162 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
3163 --output $(1)/boot.avbpubkey)
3164 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
3165 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
3166 --output $(1)/system.avbpubkey)
3167 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
3168 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
3169 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003170 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
3171 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
3172 --output $(1)/product.avbpubkey)
Dario Freni5f681e12018-05-29 13:09:01 +01003173 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
3174 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH) \
Dario Freni924af7d2018-08-17 00:56:14 +01003175 --output $(1)/product_services.avbpubkey)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003176 $(if $(BOARD_AVB_ODM_KEY_PATH),\
3177 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \
3178 --output $(1)/odm.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003179 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
3180 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
3181 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05003182 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
3183 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
3184 --output $(1)/recovery.avbpubkey)
David Anderson7709ab22018-10-15 14:41:34 -07003185 $(if $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH),\
3186 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3187 --output $(1)/vbmeta_system.avbpubkey)
Tao Bao744c4c72018-08-20 21:09:07 -07003188 $(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\
3189 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3190 --output $(1)/vbmeta_vendor.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003191endef
3192
Tao Bao744c4c72018-08-20 21:09:07 -07003193# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
3194# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level
David Anderson7709ab22018-10-15 14:41:34 -07003195# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM
3196# := system product_services`, `vbmeta_system.img` will be created that includes the descriptors
3197# for `system.img` and `product_services.img`. `vbmeta_system.img` itself will be included into
Tao Bao744c4c72018-08-20 21:09:07 -07003198# `vbmeta.img` as a chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003199# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
Tao Bao744c4c72018-08-20 21:09:07 -07003200# $(2): Output filename.
3201define build-chained-vbmeta-image
3202 $(call pretty,"Target chained vbmeta image: $@")
3203 $(hide) $(AVBTOOL) make_vbmeta_image \
3204 $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
3205 $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
3206 $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
3207 --include_descriptors_from_image $(call images-for-partitions,$(image))) \
3208 --output $@
3209endef
3210
David Anderson7709ab22018-10-15 14:41:34 -07003211ifdef BOARD_AVB_VBMETA_SYSTEM
3212INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img
3213$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003214 $(AVBTOOL) \
3215 $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
3216 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
David Anderson7709ab22018-10-15 14:41:34 -07003217 $(call build-chained-vbmeta-image,vbmeta_system)
Tao Bao744c4c72018-08-20 21:09:07 -07003218endif
3219
3220ifdef BOARD_AVB_VBMETA_VENDOR
3221INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img
3222$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003223 $(AVBTOOL) \
3224 $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
3225 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
Tao Bao744c4c72018-08-20 21:09:07 -07003226 $(call build-chained-vbmeta-image,vbmeta_vendor)
3227endif
3228
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003229define build-vbmetaimage-target
3230 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003231 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
3232 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003233 $(hide) $(AVBTOOL) make_vbmeta_image \
3234 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
Tao Bao0da43472018-08-22 22:53:41 -07003235 $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003236 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
3237 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003238 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003239endef
3240
3241INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
Tao Bao0da43472018-08-22 22:53:41 -07003242$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
3243 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
3244
David Zeuthen8fecb282017-12-01 16:24:01 -05003245$(INSTALLED_VBMETAIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003246 $(AVBTOOL) \
3247 $(INSTALLED_BOOTIMAGE_TARGET) \
3248 $(INSTALLED_SYSTEMIMAGE_TARGET) \
3249 $(INSTALLED_VENDORIMAGE_TARGET) \
3250 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3251 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3252 $(INSTALLED_ODMIMAGE_TARGET) \
3253 $(INSTALLED_DTBOIMAGE_TARGET) \
3254 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3255 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
3256 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
3257 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3258 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3259 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003260 $(build-vbmetaimage-target)
3261
3262.PHONY: vbmetaimage-nodeps
3263vbmetaimage-nodeps:
3264 $(build-vbmetaimage-target)
3265
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003266endif # BOARD_AVB_ENABLE
3267
3268# -----------------------------------------------------------------
Yifan Hong055e6cf2018-11-29 13:51:48 -08003269# Check image sizes <= size of super partition
3270
3271ifeq (,$(TARGET_BUILD_APPS))
3272# Do not check for apps-only build
3273
3274ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003275
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003276# (1): list of items like "system", "vendor", "product", "product_services"
3277# return: map each item into a command ( wrapped in $$() ) that reads the size
3278define read-size-of-partitions
3279$(foreach p,$(1),$(call read-image-prop-dictionary,$($(p)image_intermediates)/generated_$(p)_image_info.txt,$(p)_size))
3280endef
3281
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003282# round result to BOARD_SUPER_PARTITION_ALIGNMENT
3283#$(1): the calculated size
3284ifeq (,$(BOARD_SUPER_PARTITION_ALIGNMENT))
3285define round-partition-size
3286$(1)
3287endef
3288else
3289define round-partition-size
3290$$((($(1)+$(BOARD_SUPER_PARTITION_ALIGNMENT)-1)/$(BOARD_SUPER_PARTITION_ALIGNMENT)*$(BOARD_SUPER_PARTITION_ALIGNMENT)))
3291endef
3292endif
3293
David Anderson619fe2d2018-10-30 18:47:59 -07003294define super-slot-suffix
3295$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
3296endef
David Anderson1ef03e22018-08-30 13:11:47 -07003297
Yifan Hongb43012f2018-10-01 17:30:01 -07003298droid_targets: check-all-partition-sizes
Yifan Hong17dd45d2018-07-20 16:45:57 -07003299
Yifan Hongb43012f2018-10-01 17:30:01 -07003300.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
Yifan Hong17dd45d2018-07-20 16:45:57 -07003301
Yifan Hong17dd45d2018-07-20 16:45:57 -07003302# Add image dependencies so that generated_*_image_info.txt are written before checking.
Yifan Hongb43012f2018-10-01 17:30:01 -07003303check-all-partition-sizes: $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
Yifan Hong17dd45d2018-07-20 16:45:57 -07003304
David Anderson619fe2d2018-10-30 18:47:59 -07003305ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
Yifan Hongf39d8af2018-11-19 14:22:43 -08003306# Check sum(super partition block devices) == super partition
David Anderson619fe2d2018-10-30 18:47:59 -07003307# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
3308define check-super-partition-size
3309 size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
3310 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003311 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003312 if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003313 echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003314 echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
3315 exit 1; \
3316 else \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003317 echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003318 echo $${sum_sizes_expr} '==' $${max_size_expr}; \
3319 fi
3320endef
3321endif
3322
Yifan Hongb43012f2018-10-01 17:30:01 -07003323# $(1): human-readable max size string
3324# $(2): max size expression
3325# $(3): list of partition names
3326define check-sum-of-partition-sizes
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003327 partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
3328 echo $(call round-partition-size,$${i}); \
3329 done)"; \
3330 sum_sizes_expr=$$(tr '\n' '+' <<< "$${partition_size_list}" | sed 's/+$$//'); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003331 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \
3332 echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \
3333 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
3334 exit 1; \
3335 else \
3336 echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
3337 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
Yifan Hongd58e70b2019-01-11 13:20:52 -08003338 fi;
Yifan Hongb43012f2018-10-01 17:30:01 -07003339endef
Yifan Hong17dd45d2018-07-20 16:45:57 -07003340
Yifan Hongb43012f2018-10-01 17:30:01 -07003341define check-all-partition-sizes-target
Yifan Hongf39d8af2018-11-19 14:22:43 -08003342 # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003343 $(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003344 $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
3345 $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
Yifan Hongb43012f2018-10-01 17:30:01 -07003346
3347 # For each group, check sum(partitions in group) <= group size
3348 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
3349 $(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
3350 $(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
3351
Yifan Hongf39d8af2018-11-19 14:22:43 -08003352 # Check sum(all group sizes) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003353 if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
3354 group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
3355 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003356 max_size_tail=$(if $(call super-slot-suffix)," / 2"); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003357 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
3358 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
3359 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3360 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3361 exit 1; \
3362 else \
3363 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3364 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3365 fi \
3366 fi
3367endef
3368
3369check-all-partition-sizes check-all-partition-sizes-nodeps:
3370 $(call check-all-partition-sizes-target)
David Anderson619fe2d2018-10-30 18:47:59 -07003371 $(call check-super-partition-size)
Yifan Hongb43012f2018-10-01 17:30:01 -07003372
Yifan Hong2dae5722018-07-31 12:47:27 -07003373endif # PRODUCT_BUILD_SUPER_PARTITION
Yifan Hong17dd45d2018-07-20 16:45:57 -07003374
3375endif # TARGET_BUILD_APPS
3376
3377# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08003378# bring in the installer image generation defines if necessary
3379ifeq ($(TARGET_USE_DISKINSTALLER),true)
3380include bootable/diskinstaller/config.mk
3381endif
3382
3383# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07003384# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08003385
Ying Wangbd2d0242015-09-22 11:17:52 -07003386ifeq ($(BUILD_OS),darwin)
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003387 build_ota_package := false
3388 build_otatools_package := false
3389else
3390 # set build_ota_package, and allow opt-out below
3391 build_ota_package := true
3392 ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
3393 build_ota_package := false
3394 endif
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003395 ifneq (,$(filter address, $(SANITIZE_TARGET)))
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003396 build_ota_package := false
3397 endif
3398 ifeq ($(TARGET_PRODUCT),sdk)
3399 build_ota_package := false
3400 endif
3401 ifneq ($(filter generic%,$(TARGET_DEVICE)),)
3402 build_ota_package := false
3403 endif
3404 ifeq ($(TARGET_NO_KERNEL),true)
3405 build_ota_package := false
3406 endif
3407 ifeq ($(recovery_fstab),)
3408 build_ota_package := false
3409 endif
3410 ifeq ($(TARGET_BUILD_PDK),true)
3411 build_ota_package := false
3412 endif
3413
3414 # set build_otatools_package, and allow opt-out below
3415 build_otatools_package := true
3416 ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
3417 build_otatools_package := false
3418 endif
Colin Cross481cc5a2016-02-04 15:09:23 -08003419endif
Ying Wangbd2d0242015-09-22 11:17:52 -07003420
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003421ifeq ($(build_otatools_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07003422OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
3423 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08003424 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07003425 $(HOST_OUT_EXECUTABLES)/mkbootfs \
3426 $(HOST_OUT_EXECUTABLES)/mkbootimg \
3427 $(HOST_OUT_EXECUTABLES)/fs_config \
3428 $(HOST_OUT_EXECUTABLES)/zipalign \
3429 $(HOST_OUT_EXECUTABLES)/bsdiff \
3430 $(HOST_OUT_EXECUTABLES)/imgdiff \
Ying Wangc45a47b2015-04-08 12:24:37 -07003431 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
3432 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003433 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08003434 $(HOST_OUT_EXECUTABLES)/mke2fs \
Tianjie Xu57332222018-08-15 16:16:21 -07003435 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs \
Tao Baobcc31092017-01-06 14:24:18 -08003436 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Mark Salyzyn780f5952018-10-19 13:44:36 -07003437 $(HOST_OUT_EXECUTABLES)/tune2fs \
Tao Baocffaf732016-04-14 12:11:36 -07003438 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
3439 $(HOST_OUT_EXECUTABLES)/mksquashfs \
3440 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
3441 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08003442 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07003443 $(HOST_OUT_EXECUTABLES)/simg2img \
3444 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003445 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07003446 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08003447 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07003448 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07003449 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01003450 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003451 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08003452 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
3453 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07003454 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tianjie Xuccbae482018-08-15 14:28:27 -07003455 $(HOST_OUT_EXECUTABLES)/care_map_generator \
Bill Peckhamf753e152019-02-19 18:02:46 -08003456 $(HOST_OUT_EXECUTABLES)/fc_sort \
3457 $(HOST_OUT_EXECUTABLES)/sefcontext_compile \
David Anderson1ef03e22018-08-30 13:11:47 -07003458 $(LPMAKE) \
Tao Bao3cba3742017-05-16 16:27:25 -07003459 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003460 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07003461 $(BROTLI) \
3462 $(BUILD_VERITY_METADATA) \
3463 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08003464
3465ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
3466OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08003467 $(FUTILITY) \
3468 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08003469endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08003470
Ying Wangc45a47b2015-04-08 12:24:37 -07003471# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07003472OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07003473 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
3474 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
3475 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003476 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003477 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003478 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003479 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
3480 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
3481 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
3482 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08003483 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003484 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
3485 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08003486 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003487 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
3488 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
3489 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003490 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
3491 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00003492 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08003493 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003494 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01003495 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08003496 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01003497 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003498 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
David Anderson1ef03e22018-08-30 13:11:47 -07003499 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) \
3500 $(HOST_LIBRARY_PATH)/liblp$(HOST_SHLIB_SUFFIX) \
Tao Baoa19f8e92019-01-02 23:22:42 -08003501 $(HOST_LIBRARY_PATH)/libext4_utils$(HOST_SHLIB_SUFFIX) \
Tao Baobeea6c02019-01-03 12:18:24 -08003502 $(HOST_LIBRARY_PATH)/libfec$(HOST_SHLIB_SUFFIX) \
3503 $(HOST_LIBRARY_PATH)/libsquashfs_utils$(HOST_SHLIB_SUFFIX)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003504
The Android Open Source Project88b60792009-03-03 19:28:42 -08003505
Ying Wang06898662010-06-17 17:52:18 -07003506.PHONY: otatools
3507otatools: $(OTATOOLS)
3508
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003509BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07003510$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003511
Tao Baoe8ef8f702017-05-17 11:41:50 -07003512OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003513 system/extras/ext4_utils/mke2fs.conf \
Dan Willemsen60c66442018-05-01 19:07:27 -07003514 $(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Tao Bao93ab8442018-10-12 11:03:04 -07003515 -name verity_key))
3516
3517ifneq (,$(wildcard device))
3518OTATOOLS_DEPS += \
Dan Willemsen60c66442018-05-01 19:07:27 -07003519 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
3520 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Bao93ab8442018-10-12 11:03:04 -07003521endif
3522ifneq (,$(wildcard external/avb))
3523OTATOOLS_DEPS += \
3524 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
3525 -name "atx_metadata.bin"))
3526endif
3527ifneq (,$(wildcard system/update_engine))
3528OTATOOLS_DEPS += \
3529 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print))
3530endif
Tao Baoe8ef8f702017-05-17 11:41:50 -07003531
3532OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07003533 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003534
3535ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
3536OTATOOLS_DEPS += \
Tao Bao5232f092018-02-10 04:03:32 +00003537 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003538endif
3539
Colin Cross21122f92018-09-14 21:51:11 -07003540$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) $(SOONG_ZIP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003541 @echo "Package OTA tools: $@"
3542 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07003543 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07003544 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Bill Peckhameabb7132019-02-15 11:25:34 -08003545 $(hide) cp $(SOONG_ZIP) $(zip_root)/bin/
Colin Cross21122f92018-09-14 21:51:11 -07003546 $(hide) cp -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003547 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Colin Cross21122f92018-09-14 21:51:11 -07003548 $(hide) $(SOONG_ZIP) -o $@ -C $(zip_root) -D $(zip_root) \
3549 -C . $(addprefix -f ,$(OTATOOLS_DEPS))
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003550
3551.PHONY: otatools-package
3552otatools-package: $(BUILT_OTATOOLS_PACKAGE)
3553
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003554endif # build_otatools_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003555
The Android Open Source Project88b60792009-03-03 19:28:42 -08003556# -----------------------------------------------------------------
3557# A zip of the directories that map to the target filesystem.
3558# This zip can be used to create an OTA package or filesystem image
3559# as a post-build step.
3560#
3561name := $(TARGET_PRODUCT)
3562ifeq ($(TARGET_BUILD_TYPE),debug)
3563 name := $(name)_debug
3564endif
3565name := $(name)-target_files-$(FILE_NAME_TAG)
3566
3567intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
3568BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
3569$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
3570$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003571 zip_root := $(intermediates)/$(name)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003572
3573# $(1): Directory to copy
3574# $(2): Location to copy it to
3575# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
3576define package_files-copy-root
3577 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
3578 mkdir -p $(2) && \
3579 $(ACP) -rd $(strip $(1))/* $(2); \
3580 fi
3581endef
3582
Tao Baoa04fca32015-11-30 12:22:24 -08003583built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07003584
3585# We can't build static executables when SANITIZE_TARGET=address
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003586ifeq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wange6e544e2015-06-22 18:35:35 -07003587built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07003588 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
3589endif
3590
The Android Open Source Project88b60792009-03-03 19:28:42 -08003591$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
3592
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003593$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003594$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003595
Doug Zongkerc18736b2009-09-30 09:20:32 -07003596ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
3597# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07003598tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07003599else
Dan Willemsen653bea92017-03-21 15:47:37 -07003600tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003601endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003602tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
3603$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
3604$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003605
Sen Jiang4438fd92016-03-07 16:51:01 -08003606ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08003607updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08003608else
Steve Fung48e49f52015-10-01 23:53:31 -07003609# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003610updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07003611endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003612$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07003613
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003614# If we are using recovery as boot, output recovery files to BOOT/.
3615ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
3616$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
3617else
3618$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
3619endif
3620
Dan Willemsen653bea92017-03-21 15:47:37 -07003621ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07003622 ifdef OSRELEASED_DIRECTORY
3623 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
3624 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
3625 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
3626 endif
3627endif
3628
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003629# Run fs_config while creating the target files package
3630# $1: root directory
3631# $2: add prefix
3632define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08003633(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 -08003634endef
3635
Yifan Hong2b891ac2018-11-29 12:06:31 -08003636# $(1): file
3637define dump-dynamic-partitions-info
3638 $(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \
3639 echo "use_dynamic_partitions=true" >> $(1))
3640 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
3641 echo "dynamic_partition_retrofit=true" >> $(1))
Yifan Hong055e6cf2018-11-29 13:51:48 -08003642 echo "lpmake=$(notdir $(LPMAKE))" >> $(1)
3643 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \
3644 echo "build_super_partition=true" >> $(1)))
Tao Bao519d1822018-12-27 12:47:23 -08003645 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \
3646 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08003647 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1)
3648 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3649 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1))
3650 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3651 echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
3652 $(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
3653 echo "dynamic_partition_list=$(BOARD_SUPER_PARTITION_PARTITION_LIST)" >> $(1))
3654 $(if $(BOARD_SUPER_PARTITION_GROUPS),
3655 echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
3656 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
3657 echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
3658 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
3659 echo "super_$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(1);))
3660endef
3661
The Android Open Source Project88b60792009-03-03 19:28:42 -08003662# Depending on the various images guarantees that the underlying
3663# directories are up-to-date.
3664$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003665 $(INSTALLED_RAMDISK_TARGET) \
3666 $(INSTALLED_BOOTIMAGE_TARGET) \
3667 $(INSTALLED_RADIOIMAGE_TARGET) \
3668 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3669 $(FULL_SYSTEMIMAGE_DEPS) \
3670 $(INSTALLED_USERDATAIMAGE_TARGET) \
3671 $(INSTALLED_CACHEIMAGE_TARGET) \
3672 $(INSTALLED_VENDORIMAGE_TARGET) \
3673 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3674 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3675 $(INSTALLED_VBMETAIMAGE_TARGET) \
3676 $(INSTALLED_ODMIMAGE_TARGET) \
3677 $(INSTALLED_DTBOIMAGE_TARGET) \
3678 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
3679 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
3680 $(INSTALLED_KERNEL_TARGET) \
3681 $(INSTALLED_2NDBOOTLOADER_TARGET) \
3682 $(BOARD_PREBUILT_DTBOIMAGE) \
Hridya Valsarajua9418992019-02-04 10:35:25 -08003683 $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003684 $(BOARD_RECOVERY_ACPIO) \
Anton Hansson6d814982018-11-26 18:12:05 +00003685 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
3686 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
3687 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
3688 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3689 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
3690 $(LPMAKE) \
3691 $(SELINUX_FC) \
3692 $(APKCERTS_FILE) \
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003693 $(SOONG_APEX_KEYS_FILE) \
Anton Hansson6d814982018-11-26 18:12:05 +00003694 $(SOONG_ZIP) \
3695 $(HOST_OUT_EXECUTABLES)/fs_config \
3696 $(HOST_OUT_EXECUTABLES)/imgdiff \
3697 $(HOST_OUT_EXECUTABLES)/bsdiff \
3698 $(HOST_OUT_EXECUTABLES)/care_map_generator \
3699 $(BUILD_IMAGE_SRCS) \
3700 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
3701 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
3702 $(BUILT_SYSTEM_MATRIX) \
3703 $(BUILT_VENDOR_MATRIX) \
3704 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003705 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07003706 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003707 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01003708 $(call create-system-product_services-symlink)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003709 $(call create-vendor-odm-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003710 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003711 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003712ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08003713 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003714 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003715 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003716 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003717ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003718 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003719endif
3720ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003721 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003722endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003723ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08003724ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
3725 $(hide) cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
3726else
cfig28687402018-08-22 16:21:41 +08003727 $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003728endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08003729endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003730ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3731 $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
3732endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003733ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
3734 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
3735endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003736ifdef INTERNAL_KERNEL_CMDLINE
3737 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003738endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003739ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003740 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07003741endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003742ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003743 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07003744endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003745endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08003746 @# Components of the boot image
3747 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07003748 $(hide) mkdir -p $(zip_root)/ROOT
3749 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003750 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
Tom Cherry3871f0f2018-11-06 14:23:44 -08003751 @# If we are using recovery as boot, this is already done when processing recovery.
3752ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherryd14b8952018-08-09 14:26:00 -07003753ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003754 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003755 $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07003756endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003757ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003758 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003759endif
3760ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003761 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003762endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003763ifdef INSTALLED_DTBIMAGE_TARGET
3764 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
3765endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003766ifdef INTERNAL_KERNEL_CMDLINE
3767 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003768endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003769ifdef BOARD_KERNEL_BASE
3770 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
3771endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003772ifdef BOARD_KERNEL_PAGESIZE
3773 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
3774endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003775endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07003776 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
3777 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07003778 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
Dan Willemsen67495202019-01-16 12:42:05 -08003779ifdef BUILDING_SYSTEM_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003780 @# Contents of the system image
3781 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003782 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
Dan Willemsen67495202019-01-16 12:42:05 -08003783endif
3784ifdef BUILDING_USERDATA_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003785 @# Contents of the data image
3786 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003787 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Dan Willemsen67495202019-01-16 12:42:05 -08003788endif
3789ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07003790 @# Contents of the vendor image
3791 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003792 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
Ying Wanga0febe52013-03-20 11:02:05 -07003793endif
Dan Willemsen67495202019-01-16 12:42:05 -08003794ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003795 @# Contents of the product image
3796 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003797 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003798endif
Dan Willemsen67495202019-01-16 12:42:05 -08003799ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01003800 @# Contents of the product_services image
Dario Freni5f681e12018-05-29 13:09:01 +01003801 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003802 $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
Dario Freni5f681e12018-05-29 13:09:01 +01003803endif
Dan Willemsen67495202019-01-16 12:42:05 -08003804ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003805 @# Contents of the odm image
3806 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003807 $(TARGET_OUT_ODM),$(zip_root)/ODM)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003808endif
Dan Willemsen67495202019-01-16 12:42:05 -08003809ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07003810 @# Contents of the system_other image
3811 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003812 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
Alex Light4e358ab2016-06-16 14:47:10 -07003813endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003814 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07003815 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07003816 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07003817ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08003818ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07003819 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07003820 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07003821endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08003822endif
Doug Zongker8678df42009-06-15 14:30:14 -07003823 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08003824 @# build them.
3825 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07003826 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003827 $(hide) cp $(SOONG_APEX_KEYS_FILE) $(zip_root)/META/apexkeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003828ifneq ($(tool_extension),)
3829 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
3830endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07003831 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003832 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07003833 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003834 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003835ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07003836 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003837endif
3838ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003839 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003840endif
Tao Baodb45efa2015-10-27 19:25:18 -07003841ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3842 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
3843endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003844ifdef BOARD_INCLUDE_RECOVERY_DTBO
3845 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
3846endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003847ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3848 $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
3849endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003850ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003851 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003852endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07003853ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
3854 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
3855 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3856else
3857 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3858endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003859 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07003860 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07003861ifdef PRODUCT_EXTRA_RECOVERY_KEYS
3862 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08003863endif
Jianxun Zhang09849492013-04-17 15:19:19 -07003864 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00003865 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08003866 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08003867 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Ying Wange24e17a2014-10-07 18:42:11 -07003868ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07003869 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07003870 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07003871endif
Tao Baof54216f2016-03-29 15:12:37 -07003872ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003873 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003874 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH))
3875endif
3876ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003877 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003878 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
3879endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003880ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
3881 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
3882 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
3883endif
Dario Freni5f681e12018-05-29 13:09:01 +01003884ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH),)
3885 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3886 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH))
3887endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003888ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH),)
3889 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
3890 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH))
3891endif
Evgenii Stepanov60beecc2019-01-18 13:53:52 -08003892ifneq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wang2a048392015-06-25 13:56:53 -07003893 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
3894 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
3895endif
Tao Bao8beab692015-07-22 12:33:18 -07003896ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
3897 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
3898endif
David Zeuthen0eb10972016-09-28 17:55:27 -04003899ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003900 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
3901 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3902 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3903 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3904 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3905ifdef BOARD_AVB_BOOT_KEY_PATH
3906 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3907 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3908 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3909endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05003910 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3911ifdef BOARD_AVB_RECOVERY_KEY_PATH
3912 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3913 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3914 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3915endif # BOARD_AVB_RECOVERY_KEY_PATH
David Anderson7709ab22018-10-15 14:41:34 -07003916ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
3917 $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $(zip_root)/META/misc_info.txt
3918 $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3919 $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3920 $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3921 $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3922endif # BOARD_AVB_VBMETA_SYSTEM
Tao Bao744c4c72018-08-20 21:09:07 -07003923ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
3924 $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $(zip_root)/META/misc_info.txt
David Anderson7709ab22018-10-15 14:41:34 -07003925 $(hide) echo "avb_vbmeta_vendor_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
Tao Bao744c4c72018-08-20 21:09:07 -07003926 $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3927 $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3928 $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3929endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003930endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04003931ifdef BOARD_BPT_INPUT_FILES
3932 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
3933 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
3934 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
3935endif
3936ifdef BOARD_BPT_DISK_SIZE
3937 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
3938endif
Ying Wangbd93d422011-10-28 17:02:30 -07003939 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07003940ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Per Astrandcab66992015-03-25 14:06:30 +01003941 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08003942 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07003943endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003944ifeq ($(AB_OTA_UPDATER),true)
3945 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07003946 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07003947 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07003948 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
3949 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08003950 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
3951 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
3952 done
Steve Fung4044b382015-11-05 02:04:04 -08003953 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
3954 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003955 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003956ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07003957 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
3958 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
3959 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003960endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003961endif
Steve Fungdfbab492015-09-24 18:12:33 -07003962ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07003963 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07003964 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
3965endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07003966ifdef BOARD_PREBUILT_VENDORIMAGE
3967 $(hide) mkdir -p $(zip_root)/IMAGES
3968 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
3969endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003970ifdef BOARD_PREBUILT_PRODUCTIMAGE
3971 $(hide) mkdir -p $(zip_root)/IMAGES
3972 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
3973endif
Dario Freni5f681e12018-05-29 13:09:01 +01003974ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
3975 $(hide) mkdir -p $(zip_root)/IMAGES
3976 $(hide) cp $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(zip_root)/IMAGES/
3977endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07003978ifdef BOARD_PREBUILT_BOOTIMAGE
3979 $(hide) mkdir -p $(zip_root)/IMAGES
3980 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
3981endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003982ifdef BOARD_PREBUILT_ODMIMAGE
3983 $(hide) mkdir -p $(zip_root)/IMAGES
3984 $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/
3985endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07003986ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07003987 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
3988 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
3989 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
3990ifeq ($(BOARD_AVB_ENABLE),true)
3991 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003992 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3993ifdef BOARD_AVB_DTBO_KEY_PATH
3994 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3995 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3996 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07003997 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003998endif # BOARD_AVB_DTBO_KEY_PATH
3999endif # BOARD_AVB_ENABLE
4000endif # BOARD_PREBUILT_DTBOIMAGE
Yifan Hong2b891ac2018-11-29 12:06:31 -08004001 $(call dump-dynamic-partitions-info,$(zip_root)/META/misc_info.txt)
Tao Bao95a95c32017-06-16 15:30:23 -07004002 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
4003 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
4004 @# INSTALLED_RADIOIMAGE_TARGET.
4005 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
4006 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004007 @# Run fs_config on all the system, vendor, boot ramdisk,
4008 @# and recovery ramdisk files in the zip, and save the output
Dan Willemsen67495202019-01-16 12:42:05 -08004009ifdef BUILDING_SYSTEM_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004010 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
Dan Willemsen67495202019-01-16 12:42:05 -08004011endif
4012ifdef BUILDING_VENDOR_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004013 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
4014endif
Dan Willemsen67495202019-01-16 12:42:05 -08004015ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004016 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
4017endif
Dan Willemsen67495202019-01-16 12:42:05 -08004018ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01004019 $(hide) $(call fs_config,$(zip_root)/PRODUCT_SERVICES,product_services/) > $(zip_root)/META/product_services_filesystem_config.txt
Dario Freni5f681e12018-05-29 13:09:01 +01004020endif
Dan Willemsen67495202019-01-16 12:42:05 -08004021ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004022 $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
4023endif
Tom Cherryd14b8952018-08-09 14:26:00 -07004024 @# ROOT always contains the files for the root under normal boot.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004025 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004026ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherry2929cad2018-09-20 11:04:37 -07004027 @# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004028 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004029endif
Tom Cherry2929cad2018-09-20 11:04:37 -07004030ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
4031 @# 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 -08004032 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
4033endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004034ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
4035 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
4036endif
Dan Willemsen67495202019-01-16 12:42:05 -08004037ifdef BUILDING_SYSTEM_OTHER_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004038 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
4039endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004040 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07004041 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Steven Moreland627debe2018-05-01 09:54:21 -07004042 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
4043ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
4044 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004045endif
Yifan Hongaa212212017-04-14 00:00:46 -07004046ifdef BUILT_VENDOR_MATRIX
4047 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004048endif
Yifan Hong07d3d792018-10-16 15:55:25 -07004049ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
4050 $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
Tao Bao943fa4c2018-12-19 10:39:34 -08004051 @# Remove 'vendor' from the group partition list if the image is not available. This should only
4052 @# happen to AOSP targets built without vendor.img. We can't remove the partition from the
4053 @# BoardConfig file, as it's still needed elsewhere (e.g. when creating super_empty.img).
Yifan Hong07d3d792018-10-16 15:55:25 -07004054 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
Tao Bao943fa4c2018-12-19 10:39:34 -08004055 $(eval _group_partition_list := $(BOARD_$(call to-upper,$(group))_PARTITION_LIST)) \
4056 $(if $(INSTALLED_VENDORIMAGE_TARGET),,$(eval _group_partition_list := $(filter-out vendor,$(_group_partition_list)))) \
Yifan Hong07d3d792018-10-16 15:55:25 -07004057 echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \
Tao Bao943fa4c2018-12-19 10:39:34 -08004058 $(if $(_group_partition_list), \
4059 echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
4060endif # BOARD_SUPER_PARTITION_GROUPS
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004061 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08004062 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08004063 @# Zip everything up, preserving symlinks and placing META/ files first to
4064 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004065 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07004066 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004067 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07004068
Ying Wanga0febe52013-03-20 11:02:05 -07004069.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08004070target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
4071
Ying Wang4709d7c2014-04-14 17:25:43 -07004072ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
4073$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
4074endif
Doug Zongker367910f2009-06-15 18:56:51 -07004075
Dan Albert4d323332016-10-14 13:23:06 -07004076# -----------------------------------------------------------------
4077# NDK Sysroot Package
4078NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07004079$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07004080 @echo Package NDK sysroot...
4081 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
4082
4083$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
4084
Ying Wang09c4b682015-08-11 11:24:19 -07004085ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07004086# -----------------------------------------------------------------
4087# OTA update package
4088
Yifan Hong50e79542018-11-08 17:44:12 -08004089# $(1): output file
4090# $(2): additional args
4091define build-ota-package-target
4092PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
4093 build/make/tools/releasetools/ota_from_target_files -v \
4094 --block \
4095 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
4096 -p $(HOST_OUT) \
4097 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
4098 $(2) \
4099 $(BUILT_TARGET_FILES_PACKAGE) $(1)
4100endef
4101
Doug Zongker8678df42009-06-15 14:30:14 -07004102name := $(TARGET_PRODUCT)
4103ifeq ($(TARGET_BUILD_TYPE),debug)
4104 name := $(name)_debug
4105endif
4106name := $(name)-ota-$(FILE_NAME_TAG)
4107
4108INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4109
xunchang3b548b02019-02-19 14:52:33 -08004110INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata
4111
Doug Zongker8678df42009-06-15 14:30:14 -07004112$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4113
Tao Baoe53c6e72017-04-19 15:54:22 -07004114ifeq ($(AB_OTA_UPDATER),true)
4115$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07004116else
Alex Deymob10e07a2017-11-09 23:53:42 +01004117$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07004118endif
4119
xunchang3b548b02019-02-19 14:52:33 -08004120$(INTERNAL_OTA_PACKAGE_TARGET): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_OTA_METADATA)
4121
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09004122$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004123 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07004124 @echo "Package OTA: $@"
xunchang3b548b02019-02-19 14:52:33 -08004125 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --output_metadata_path $(INTERNAL_OTA_METADATA))
Doug Zongker8678df42009-06-15 14:30:14 -07004126
4127.PHONY: otapackage
4128otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
4129
Tao Bao519d1822018-12-27 12:47:23 -08004130ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true)
Yifan Hong50e79542018-11-08 17:44:12 -08004131name := $(TARGET_PRODUCT)
4132ifeq ($(TARGET_BUILD_TYPE),debug)
4133 name := $(name)_debug
4134endif
4135name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
4136
4137INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4138
4139$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4140
4141ifeq ($(AB_OTA_UPDATER),true)
4142$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
4143else
4144$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BROTLI)
4145endif
4146
4147$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004148 build/make/tools/releasetools/ota_from_target_files
Yifan Hong50e79542018-11-08 17:44:12 -08004149 @echo "Package OTA (retrofit dynamic partitions): $@"
4150 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
4151
4152.PHONY: otardppackage
4153
4154otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
4155
Tao Bao519d1822018-12-27 12:47:23 -08004156endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
Yifan Hong50e79542018-11-08 17:44:12 -08004157
Ying Wang09c4b682015-08-11 11:24:19 -07004158endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07004159
Ying Wang09a00a62010-10-20 14:01:09 -07004160# -----------------------------------------------------------------
4161# The update package
4162
4163name := $(TARGET_PRODUCT)
4164ifeq ($(TARGET_BUILD_TYPE),debug)
4165 name := $(name)_debug
4166endif
4167name := $(name)-img-$(FILE_NAME_TAG)
4168
4169INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4170
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004171$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07004172 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004173 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
4174 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07004175
4176.PHONY: updatepackage
4177updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
4178
The Android Open Source Project88b60792009-03-03 19:28:42 -08004179# -----------------------------------------------------------------
Dario Frenid1011272018-07-23 20:20:15 +01004180# A zip of the appcompat directory containing logs
4181APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip
4182# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
4183ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004184$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004185 $(INSTALLED_RAMDISK_TARGET) \
4186 $(INSTALLED_BOOTIMAGE_TARGET) \
4187 $(INSTALLED_USERDATAIMAGE_TARGET) \
4188 $(INSTALLED_VENDORIMAGE_TARGET) \
4189 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4190 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
Dario Frenid1011272018-07-23 20:20:15 +01004191endif
4192$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
4193$(APPCOMPAT_ZIP): $(SOONG_ZIP)
4194 @echo "appcompat logs: $@"
4195 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4196 $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/appcompat $(dir $(PRIVATE_LIST_FILE))
4197 $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE)
4198 $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE)
4199
4200
4201# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004202# A zip of the symbols directory. Keep the full paths to make it
4203# more obvious where these files came from.
4204#
4205name := $(TARGET_PRODUCT)
4206ifeq ($(TARGET_BUILD_TYPE),debug)
4207 name := $(name)_debug
4208endif
4209name := $(name)-symbols-$(FILE_NAME_TAG)
4210
4211SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004212# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07004213ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004214$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004215 $(INSTALLED_RAMDISK_TARGET) \
4216 $(INSTALLED_BOOTIMAGE_TARGET) \
4217 $(INSTALLED_USERDATAIMAGE_TARGET) \
4218 $(INSTALLED_VENDORIMAGE_TARGET) \
4219 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4220 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4221 $(INSTALLED_ODMIMAGE_TARGET) \
4222 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07004223endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004224$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
4225$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004226 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004227 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4228 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
4229 $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08004230 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004231# -----------------------------------------------------------------
4232# A zip of the coverage directory.
4233#
4234name := $(TARGET_PRODUCT)
4235ifeq ($(TARGET_BUILD_TYPE),debug)
4236name := $(name)_debug
4237endif
4238name := $(name)-coverage-$(FILE_NAME_TAG)
4239COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
4240ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004241$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004242 $(INSTALLED_RAMDISK_TARGET) \
4243 $(INSTALLED_BOOTIMAGE_TARGET) \
4244 $(INSTALLED_USERDATAIMAGE_TARGET) \
4245 $(INSTALLED_VENDORIMAGE_TARGET) \
4246 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4247 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4248 $(INSTALLED_ODMIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004249endif
4250$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
4251$(COVERAGE_ZIP): $(SOONG_ZIP)
4252 @echo "Package coverage: $@"
4253 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4254 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
4255 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
4256 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004257
4258# -----------------------------------------------------------------
4259# A zip of the Android Apps. Not keeping full path so that we don't
4260# include product names when distributing
4261#
4262name := $(TARGET_PRODUCT)
4263ifeq ($(TARGET_BUILD_TYPE),debug)
4264 name := $(name)_debug
4265endif
4266name := $(name)-apps-$(FILE_NAME_TAG)
4267
4268APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Tao Baoe9d61b02018-08-20 21:09:07 -07004269$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004270 @echo "Package apps: $@"
4271 $(hide) rm -rf $@
4272 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004273 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
4274 if [ -z "$$apps_to_zip" ]; then \
Anton Hansson6d814982018-11-26 18:12:05 +00004275 echo "No apps to zip up. Generating empty apps archive." ; \
4276 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004277 else \
Anton Hansson6d814982018-11-26 18:12:05 +00004278 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004279 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07004280
Ying Wangbc415dd2012-08-15 12:22:44 -07004281ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07004282#------------------------------------------------------------------
4283# An archive of classes for use in generating code-coverage reports
4284# These are the uninstrumented versions of any classes that were
4285# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07004286# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004287
Colin Crossa6bc3a82017-09-27 14:28:41 -07004288JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004289$(JACOCO_REPORT_CLASSES_ALL) :
4290 @echo "Collecting uninstrumented classes"
4291 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
Anton Hansson6d814982018-11-26 18:12:05 +00004292 zip -@ -0 -q -X $@
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004293# Meaning of these options:
4294# -@ scan stdin for file paths to add to the zip
4295# -0 don't do any compression
4296# -q supress most output
4297# -X skip storing extended file attributes
4298
Ying Wangbc415dd2012-08-15 12:22:44 -07004299endif # EMMA_INSTRUMENT=true
4300
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004301
Ying Wangae9115a2013-08-22 20:52:47 -07004302#------------------------------------------------------------------
4303# A zip of Proguard obfuscation dictionary files.
4304# Only for apps_only build.
4305#
4306ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07004307PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004308# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07004309$(PROGUARD_DICT_ZIP) :
4310 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07004311 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Anton Hansson6d814982018-11-26 18:12:05 +00004312 if [ -n "$$dict_files" ]; then \
4313 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
4314 zip -qX $@ $$dict_files $$unobfuscated_jars; \
4315 else \
4316 touch $(dir $@)/zipdummy; \
4317 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
4318 zip -qd $@ zipdummy; \
4319 rm $(dir $@)/zipdummy; \
4320 fi
Ying Wangae9115a2013-08-22 20:52:47 -07004321
4322endif # TARGET_BUILD_APPS
4323
The Android Open Source Project88b60792009-03-03 19:28:42 -08004324# -----------------------------------------------------------------
Yifan Hong2b891ac2018-11-29 12:06:31 -08004325# super partition image
4326
4327ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4328
4329# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
4330ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4331
4332ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
4333INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
4334$(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
4335$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
4336 $(call pretty,"Target super fs image: $@")
Tao Bao403a2f92018-12-13 10:45:46 -08004337 PATH=$(dir $(LPMAKE)):$$PATH \
4338 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
Yifan Hong2b891ac2018-11-29 12:06:31 -08004339endif
4340
4341$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
4342
Yifan Hong8b79d162018-11-29 12:32:00 -08004343INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
4344$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty)
4345$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE)
4346 $(call pretty,"Target empty super fs image: $@")
4347 mkdir -p $(intermediates)
4348 rm -rf $(intermediates)/misc_info.txt
4349 $(call dump-dynamic-partitions-info,$(intermediates)/misc_info.txt)
4350ifeq ($(AB_OTA_UPDATER),true)
Tao Bao403a2f92018-12-13 10:45:46 -08004351 echo "ab_update=true" >> $(intermediates)/misc_info.txt
Yifan Hong8b79d162018-11-29 12:32:00 -08004352endif
Tao Bao403a2f92018-12-13 10:45:46 -08004353 PATH=$(dir $(LPMAKE)):$$PATH \
4354 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@
Yifan Hong8b79d162018-11-29 12:32:00 -08004355
4356$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
4357
Yifan Hong2b891ac2018-11-29 12:06:31 -08004358endif # BOARD_SUPER_PARTITION_SIZE != ""
4359endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
4360
4361# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004362# dalvik something
4363.PHONY: dalvikfiles
4364dalvikfiles: $(INTERNAL_DALVIK_MODULES)
4365
Bo Huf0d50bb2017-08-01 19:02:09 +00004366ifeq ($(BUILD_QEMU_IMAGES),true)
Bo Huf0d50bb2017-08-01 19:02:09 +00004367MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
4368SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
Roman Kiryanove64998f2019-02-14 16:45:33 -08004369
4370ifdef INSTALLED_SYSTEMIMAGE_TARGET
4371INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
Tao Baoe9d61b02018-08-20 21:09:07 -07004372$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004373 @echo Create system-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004374 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEMIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004375
4376systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
4377droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
Roman Kiryanove64998f2019-02-14 16:45:33 -08004378endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004379ifdef INSTALLED_VENDORIMAGE_TARGET
Bo Huf0d50bb2017-08-01 19:02:09 +00004380INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004381$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004382 @echo Create vendor-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004383 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004384
4385vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
4386droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
4387endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004388ifdef INSTALLED_PRODUCTIMAGE_TARGET
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004389INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004390$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004391 @echo Create product-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004392 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004393
4394productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
4395droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
4396endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004397ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Dario Freni924af7d2018-08-17 00:56:14 +01004398INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004399$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Dario Freni924af7d2018-08-17 00:56:14 +01004400 @echo Create product_services-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004401 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET))
Dario Freni5f681e12018-05-29 13:09:01 +01004402
4403productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4404droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4405endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004406ifdef INSTALLED_ODMIMAGE_TARGET
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004407INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
4408$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
4409 @echo Create odm-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004410 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004411
4412odmimage: $(INSTALLED_QEMU_ODMIMAGE)
4413droidcore: $(INSTALLED_QEMU_ODMIMAGE)
4414endif
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004415
4416ifeq ($(BOARD_AVB_ENABLE),true)
4417QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
4418MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_verified_boot_params.sh
4419$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_QEMU_SYSTEMIMAGE) $(MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) $(SGDISK_HOST) $(AVBTOOL)
4420 @echo Creating $@
Matt Wachowski40afa812018-09-27 12:49:18 -07004421 (export SGDISK=$(SGDISK_HOST) AVBTOOL=$(AVBTOOL); $(MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_QEMU_SYSTEMIMAGE) $(QEMU_VERIFIED_BOOT_PARAMS))
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004422
4423
4424systemimage: $(QEMU_VERIFIED_BOOT_PARAMS)
4425droidcore: $(QEMU_VERIFIED_BOOT_PARAMS)
4426endif
Bo Huf0d50bb2017-08-01 19:02:09 +00004427endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004428# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004429# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07004430ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004431INTERNAL_EMULATOR_PACKAGE_FILES += \
4432 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08004433 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004434 $(INSTALLED_RAMDISK_TARGET) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004435 $(INSTALLED_SYSTEMIMAGE_TARGET) \
4436 $(INSTALLED_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004437
4438name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
4439
4440INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4441
Ying Wang5d887702015-11-04 10:06:25 -08004442$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004443 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07004444 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004445
Ying Wang7d8c5352012-07-26 10:15:21 -07004446endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004447# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08004448# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08004449# The pdk package (Platform Development Kit)
4450
Keun young Park7fc7aad2012-02-27 15:49:23 -08004451#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
4452# include development/pdk/Pdk.mk
4453#endif
4454
The Android Open Source Project88b60792009-03-03 19:28:42 -08004455
4456# -----------------------------------------------------------------
4457# The SDK
4458
The Android Open Source Project88b60792009-03-03 19:28:42 -08004459# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07004460sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004461
4462# Build a name that looks like:
4463#
4464# linux-x86 --> android-sdk_12345_linux-x86
4465# darwin-x86 --> android-sdk_12345_mac-x86
4466# windows-x86 --> android-sdk_12345_windows
4467#
4468sdk_name := android-sdk_$(FILE_NAME_TAG)
4469ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07004470 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08004471else
Joe Onorato03fbe402009-04-13 08:31:16 -07004472 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004473endif
4474ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07004475 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004476endif
Joe Onorato03fbe402009-04-13 08:31:16 -07004477sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004478
4479sdk_dep_file := $(sdk_dir)/sdk_deps.mk
4480
4481ATREE_FILES :=
4482-include $(sdk_dep_file)
4483
4484# if we don't have a real list, then use "everything"
4485ifeq ($(strip $(ATREE_FILES)),)
4486ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004487 $(ALL_DEFAULT_INSTALLED_MODULES) \
4488 $(INSTALLED_RAMDISK_TARGET) \
4489 $(ALL_DOCS) \
Nan Zhangcb0a6882018-08-07 15:26:32 -07004490 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api-stubs-docs_annotations.zip \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004491 $(ALL_SDK_FILES)
4492endif
4493
4494atree_dir := development/build
4495
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01004496
The Android Open Source Project88b60792009-03-03 19:28:42 -08004497sdk_atree_files := \
4498 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07004499 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08004500
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02004501# development/build/sdk-android-<abi>.atree is used to differentiate
4502# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
4503# files like the kernel image. We use TARGET_CPU_ABI because we don't
4504# have a better way to distinguish between CPU models.
4505ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
4506 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
4507endif
4508
Griff Hazen433febb2014-02-28 08:45:59 -08004509ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES),)
4510sdk_atree_files += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES)
4511else
4512sdk_atree_files += $(atree_dir)/sdk.atree
4513endif
4514
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004515include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004516
The Android Open Source Project88b60792009-03-03 19:28:42 -08004517deps := \
4518 $(target_notice_file_txt) \
4519 $(tools_notice_file_txt) \
4520 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07004521 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07004522 $(COVERAGE_ZIP) \
Dario Frenid1011272018-07-23 20:20:15 +01004523 $(APPCOMPAT_ZIP) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004524 $(INSTALLED_SYSTEMIMAGE_TARGET) \
Bo Huf0d50bb2017-08-01 19:02:09 +00004525 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07004526 $(INSTALLED_QEMU_VENDORIMAGE) \
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004527 $(QEMU_VERIFIED_BOOT_PARAMS) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07004528 $(INSTALLED_USERDATAIMAGE_TARGET) \
4529 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004530 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07004531 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004532 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08004533 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004534 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004535 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004536 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004537
4538INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
4539$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
4540$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
4541$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
4542$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
4543
4544# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
4545#
4546#SDK_GNU_ERROR := true
4547
Ying Wang5d887702015-11-04 10:06:25 -08004548$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004549 @echo "Package SDK: $@"
4550 $(hide) rm -rf $(PRIVATE_DIR) $@
4551 $(hide) for f in $(target_gnu_MODULES); do \
4552 if [ -f $$f ]; then \
4553 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
4554 including GNU target $$f >&2; \
4555 FAIL=$(SDK_GNU_ERROR); \
4556 fi; \
4557 done; \
4558 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07004559 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08004560 $(hide) ( \
Anton Hansson6d814982018-11-26 18:12:05 +00004561 ATREE_STRIP="$(HOST_STRIP) -x" \
4562 $(HOST_OUT_EXECUTABLES)/atree \
4563 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
4564 -m $(PRIVATE_DEP_FILE) \
4565 -I . \
4566 -I $(PRODUCT_OUT) \
4567 -I $(HOST_OUT) \
4568 -I $(TARGET_COMMON_OUT_ROOT) \
4569 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
4570 -v "OUT_DIR=$(OUT_DIR)" \
4571 -v "HOST_OUT=$(HOST_OUT)" \
4572 -v "TARGET_ARCH=$(TARGET_ARCH)" \
4573 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
4574 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
4575 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
4576 -o $(PRIVATE_DIR) && \
4577 cp -f $(target_notice_file_txt) \
4578 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
4579 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
4580 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
4581 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
4582 chmod -R ug+rwX $(PRIVATE_DIR) && \
4583 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004584 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
4585
Raphael3d224a02010-04-16 17:50:09 -07004586
4587# Is a Windows SDK requested? If so, we need some definitions from here
4588# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08004589MAIN_SDK_NAME := $(sdk_name)
4590MAIN_SDK_DIR := $(sdk_dir)
4591MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08004592ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07004593include $(TOPDIR)development/build/tools/windows_sdk.mk
4594endif
4595
The Android Open Source Project88b60792009-03-03 19:28:42 -08004596# -----------------------------------------------------------------
4597# Findbugs
4598INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
4599INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
4600$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
4601 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004602 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004603 > $@
4604$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
4605 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004606 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07004607 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08004608
4609# -----------------------------------------------------------------
4610# Findbugs
4611
4612# -----------------------------------------------------------------
4613# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07004614ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004615include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01004616-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07004617-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004618-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07004619# Also the project-specific tasks
4620-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
4621-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004622-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07004623# Also add test specifc tasks
4624include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07004625include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07004626endif
Raphaelc4d47312011-02-15 16:09:36 -08004627
Ying Wang67132ba2015-10-28 16:42:39 -07004628include $(BUILD_SYSTEM)/product-graph.mk
4629
Raphaelc4d47312011-02-15 16:09:36 -08004630# -----------------------------------------------------------------
4631# Create SDK repository packages. Must be done after tasks/* since
4632# we need the addon rules defined.
4633ifneq ($(sdk_repo_goal),)
4634include $(TOPDIR)development/build/tools/sdk_repo.mk
4635endif