blob: cfa042c0e1393abc4d3979dde2c52083b971686b [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
225# Generates a set of common build system properties to a file.
226# $(1): Partition name
227# $(2): Output file name
228define generate-common-build-props
229 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
230 BUILD_ID="$(BUILD_ID)" \
231 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
232 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
233 DATE="$(DATE_FROM_FILE)" \
234 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
235 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
236 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
237 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
238 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
239 PRODUCT_NAME="$(TARGET_PRODUCT)" \
240 TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
241 TARGET_DEVICE="$(TARGET_DEVICE)" \
242 bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
243endef
244
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800245ifdef property_overrides_split_enabled
246INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800247INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
248ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
249$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800250else
251# legacy path
The Android Open Source Project88b60792009-03-03 19:28:42 -0800252INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800253endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800254ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900255FINAL_DEFAULT_PROPERTIES := \
Jaekyun Seokb31b9ba2017-11-03 15:18:55 +0900256 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
257 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900258ifndef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900259 FINAL_DEFAULT_PROPERTIES += \
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900260 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900261endif
Jaekyun Seok294286d2017-01-20 13:17:12 +0900262FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
263 $(FINAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800264
Andres Moralesb8876e12015-05-06 20:44:22 -0700265intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
266
Anton Hansson1f8729e2018-08-15 12:11:55 +0100267$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800268 @echo Target buildinfo: $@
269 @mkdir -p $(dir $@)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800270 @rm -f $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800271 $(hide) echo "#" > $@; \
272 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
273 echo "#" >> $@;
Jaekyun Seok294286d2017-01-20 13:17:12 +0900274 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000275 echo "$(line)" >> $@;)
Andres Moralesb8876e12015-05-06 20:44:22 -0700276 $(hide) echo "#" >> $@; \
277 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
278 echo "#" >> $@;
Anton Hansson1f8729e2018-08-15 12:11:55 +0100279 $(hide) $(call generate-common-build-props,bootimage,$@)
Colin Crossfdea8932017-12-06 14:38:40 -0800280 $(hide) build/make/tools/post_process_props.py $@
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800281ifdef property_overrides_split_enabled
282 $(hide) mkdir -p $(TARGET_ROOT_OUT)
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800283 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800284endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800285
286# -----------------------------------------------------------------
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900287# vendor default.prop
288INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900289ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900290INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
291ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
292
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900293$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
294 @echo Target buildinfo: $@
295 @mkdir -p $(dir $@)
296 $(hide) echo "#" > $@; \
297 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
298 echo "#" >> $@;
299 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000300 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800301 $(hide) build/make/tools/post_process_props.py $@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900302
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900303endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900304
305# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800306# build.prop
307INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
308ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900309FINAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -0700310 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
Jaekyun Seok294286d2017-01-20 13:17:12 +0900311FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
312 $(FINAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800313
314# A list of arbitrary tags describing the build configuration.
315# Force ":=" so we can use +=
316BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
317ifeq ($(TARGET_BUILD_TYPE),debug)
318 BUILD_VERSION_TAGS += debug
319endif
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700320# The "test-keys" tag marks builds signed with the old test keys,
321# which are available in the SDK. "dev-keys" marks builds signed with
322# non-default dev keys (usually private keys from a vendor directory).
323# Both of these tags will be removed and replaced with "release-keys"
324# when the target-files is signed in a post-build step.
325ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/target/product/security/testkey)
Doug Zongkera8608a72013-07-23 11:51:04 -0700326BUILD_KEYS := test-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700327else
Doug Zongkera8608a72013-07-23 11:51:04 -0700328BUILD_KEYS := dev-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700329endif
Doug Zongkera8608a72013-07-23 11:51:04 -0700330BUILD_VERSION_TAGS += $(BUILD_KEYS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800331BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
332
333# A human-readable string that descibes this build in detail.
Colin Crossf37b4552015-07-16 17:15:19 -0700334build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
Andres Moralesb8876e12015-05-06 20:44:22 -0700335$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800336
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700337# 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 -0800338ifeq (,$(strip $(BUILD_FINGERPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800339 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Dan Willemsen63e48db2019-01-02 12:27:43 -0800340 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
Ying Wang50367cc2014-06-12 18:42:53 -0700341 else
Nan Zhang0abdb582018-02-20 17:00:39 -0800342 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
Ying Wang50367cc2014-06-12 18:42:53 -0700343 endif
344 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 -0800345endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800346# unset it for safety.
347BF_BUILD_NUMBER :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800348
Nan Zhang0abdb582018-02-20 17:00:39 -0800349BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
350ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
351 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
352endif
353BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
354# unset it for safety.
355BUILD_FINGERPRINT :=
Colin Crossf37b4552015-07-16 17:15:19 -0700356
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700357# The string used to uniquely identify the system build; used by the OTA server.
358# This purposefully excludes any product-specific variables.
359ifeq (,$(strip $(BUILD_THUMBPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800360 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700361endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800362
363BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
364ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
365 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700366endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800367BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
368# unset it for safety.
369BUILD_THUMBPRINT :=
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700370
Ying Wange24e17a2014-10-07 18:42:11 -0700371KNOWN_OEM_THUMBPRINT_PROPERTIES := \
372 ro.product.brand \
373 ro.product.name \
374 ro.product.device
375OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
376 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES))
377
Sriram Raman7b641242009-03-24 22:40:59 -0700378# Display parameters shown under Settings -> About Phone
379ifeq ($(TARGET_BUILD_VARIANT),user)
380 # User builds should show:
381 # release build number or branch.buld_number non-release builds
382
383 # Dev. branches should have DISPLAY_BUILD_NUMBER set
Colin Cross63fe36a2017-02-21 17:23:02 -0800384 ifeq (true,$(DISPLAY_BUILD_NUMBER))
Colin Crossf37b4552015-07-16 17:15:19 -0700385 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700386 else
Doug Zongkera8608a72013-07-23 11:51:04 -0700387 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700388 endif
389else
390 # Non-user builds should show detailed build information
391 BUILD_DISPLAY_ID := $(build_desc)
392endif
393
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000394# Accepts a whitespace separated list of product locales such as
395# (en_US en_AU en_GB...) and returns the first locale in the list with
396# underscores replaced with hyphens. In the example above, this will
397# return "en-US".
398define get-default-product-locale
399$(strip $(subst _,-, $(firstword $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800400endef
401
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700402# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
403# harness to distinguish builds. Only add _asan for a sanitized build
404# if it isn't already a part of the flavor (via a dedicated lunch
405# config for example).
Ying Wang21ec03d2015-10-28 18:45:03 -0700406TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
Ivan Lozano0f71db32017-08-14 07:57:37 -0700407ifneq (, $(filter address, $(SANITIZE_TARGET)))
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700408ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
Ying Wang21ec03d2015-10-28 18:45:03 -0700409TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
410endif
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700411endif
Ying Wang21ec03d2015-10-28 18:45:03 -0700412
Andrew Boiefa61ff02012-09-28 09:33:45 -0700413ifdef TARGET_SYSTEM_PROP
414system_prop_file := $(TARGET_SYSTEM_PROP)
415else
416system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
417endif
Dan Willemsenad6a1542018-12-14 01:04:19 -0800418$(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 -0800419 @echo Target buildinfo: $@
420 @mkdir -p $(dir $@)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700421 $(hide) echo > $@
422ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES),)
423 $(hide) echo "#" >> $@; \
424 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700425 echo "#" >> $@;
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700426 $(hide) $(foreach prop,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000427 echo "import /oem/oem.prop $(prop)" >> $@;)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700428endif
Anton Hansson1f8729e2018-08-15 12:11:55 +0100429 $(hide) $(call generate-common-build-props,system,$@)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800430 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000431 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
432 TARGET_DEVICE="$(TARGET_DEVICE)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000433 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
434 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000435 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
436 BUILD_ID="$(BUILD_ID)" \
437 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
438 DATE="$(DATE_FROM_FILE)" \
Dan Willemsen63e48db2019-01-02 12:27:43 -0800439 BUILD_USERNAME="$(BUILD_USERNAME)" \
440 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000441 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
442 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
443 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
444 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
445 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
446 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
447 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
448 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
Dan Willemsenad6a1542018-12-14 01:04:19 -0800449 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(api_fingerprint))" \
Anton Hansson6d814982018-11-26 18:12:05 +0000450 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
451 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
452 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
453 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000454 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
455 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
456 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
457 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
458 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
459 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700460 bash $(BUILDINFO_SH) >> $@
Johan Redestig674a27d2012-04-12 17:00:58 +0200461 $(hide) $(foreach file,$(system_prop_file), \
Anton Hansson6d814982018-11-26 18:12:05 +0000462 if [ -f "$(file)" ]; then \
463 echo Target buildinfo from: "$(file)"; \
464 echo "" >> $@; \
465 echo "#" >> $@; \
466 echo "# from $(file)" >> $@; \
467 echo "#" >> $@; \
468 cat $(file) >> $@; \
469 echo "# end of $(file)" >> $@; \
470 fi;)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900471 $(if $(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000472 $(hide) echo >> $@; \
473 echo "#" >> $@; \
474 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
475 echo "#" >> $@; )
Jaekyun Seok294286d2017-01-20 13:17:12 +0900476 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000477 echo "$(line)" >> $@;)
Andres Morales085a0ce2015-02-06 10:12:55 -0800478 $(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 -0800479 $(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 -0800480
481build_desc :=
482
Andres Moralesb8876e12015-05-06 20:44:22 -0700483ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
484INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
485else
486INSTALLED_RECOVERYIMAGE_TARGET :=
487endif
488
489$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
490 @echo "Target build info: $@"
Steven Morelandec082652017-10-22 02:11:47 -0700491 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
Andres Moralesb8876e12015-05-06 20:44:22 -0700492
The Android Open Source Project88b60792009-03-03 19:28:42 -0800493# -----------------------------------------------------------------
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700494# vendor build.prop
495#
Alex Naidis47e24e92016-01-10 14:18:54 +0000496# For verifying that the vendor build is what we think it is
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700497INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
498ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900499
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900500ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900501FINAL_VENDOR_BUILD_PROPERTIES += \
502 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
503FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
504 $(FINAL_VENDOR_BUILD_PROPERTIES),=)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900505endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900506
Anton Hansson1f8729e2018-08-15 12:11:55 +0100507$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700508 @echo Target vendor buildinfo: $@
509 @mkdir -p $(dir $@)
510 $(hide) echo > $@
Sandeep Patil127f5012017-10-23 19:47:43 -0700511 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
Max Biresa1749982018-03-28 15:48:13 -0700512 $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
Isaac Chen8d11feb2018-01-31 14:27:37 +0800513 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
514 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
515 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100516 $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
517 $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
518 $(hide) $(call generate-common-build-props,vendor,$@)
Jaekyun Seokf9af5fa2017-10-25 12:08:32 +0900519ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900520 $(hide) echo "#" >> $@; \
521 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
522 echo "#" >> $@;
523 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000524 echo "$(line)" >> $@;)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900525endif # property_overrides_split_enabled
Ivan Podogovd5726322018-03-29 15:22:33 +0100526 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_PROPERTY_BLACKLIST)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700527
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900528# -----------------------------------------------------------------
529# product build.prop
530INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
531ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
532
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000533ifdef TARGET_PRODUCT_PROP
534product_prop_files := $(TARGET_PRODUCT_PROP)
535else
536product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
537endif
538
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900539FINAL_PRODUCT_PROPERTIES += \
Yifan Hongaf9e7f02018-07-27 13:11:50 -0700540 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900541FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
542 $(FINAL_PRODUCT_PROPERTIES),=)
543
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000544$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900545 @echo Target product buildinfo: $@
546 @mkdir -p $(dir $@)
547 $(hide) echo > $@
548ifdef BOARD_USES_PRODUCTIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100549 $(hide) $(call generate-common-build-props,product,$@)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900550endif # BOARD_USES_PRODUCTIMAGE
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000551 $(hide) $(foreach file,$(product_prop_files), \
Anton Hansson6d814982018-11-26 18:12:05 +0000552 if [ -f "$(file)" ]; then \
553 echo Target product properties from: "$(file)"; \
554 echo "" >> $@; \
555 echo "#" >> $@; \
556 echo "# from $(file)" >> $@; \
557 echo "#" >> $@; \
558 cat $(file) >> $@; \
559 echo "# end of $(file)" >> $@; \
560 fi;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900561 $(hide) echo "#" >> $@; \
562 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
Anton Hansson5ac408b2018-11-05 17:29:28 +0000563 echo "#" >> $@; \
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000564 echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900565 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000566 echo "$(line)" >> $@;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900567 $(hide) build/make/tools/post_process_props.py $@
568
Andres Morales9c820f82015-01-13 15:30:34 -0800569# ----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800570# odm build.prop
571INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop
572ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
573
574FINAL_ODM_BUILD_PROPERTIES += \
575 $(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES))
576FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
577 $(FINAL_ODM_BUILD_PROPERTIES),=)
578
Anton Hansson1f8729e2018-08-15 12:11:55 +0100579$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800580 @echo Target odm buildinfo: $@
581 @mkdir -p $(dir $@)
582 $(hide) echo > $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800583 $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
584 $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
585 $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100586 $(hide) $(call generate-common-build-props,odm,$@)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800587 $(hide) echo "#" >> $@; \
588 echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
589 echo "#" >> $@;
590 $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000591 echo "$(line)" >> $@;)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800592 $(hide) build/make/tools/post_process_props.py $@
Andres Morales9c820f82015-01-13 15:30:34 -0800593
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700594# -----------------------------------------------------------------
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000595# product_services build.prop (unless it's merged into /product)
596ifdef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
597 ifneq (,$(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
598 $(error PRODUCT_PRODUCT_SERVICES_PROPERTIES is not supported in this build.)
599 endif
600else
Dario Freni5f681e12018-05-29 13:09:01 +0100601INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
602ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
603
604FINAL_PRODUCT_SERVICES_PROPERTIES += \
605 $(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
606FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
607 $(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
Anton Hansson1f8729e2018-08-15 12:11:55 +0100608$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Dario Freni924af7d2018-08-17 00:56:14 +0100609 @echo Target product_services buildinfo: $@
Dario Freni5f681e12018-05-29 13:09:01 +0100610 @mkdir -p $(dir $@)
611 $(hide) echo > $@
612ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100613 $(hide) $(call generate-common-build-props,product_services,$@)
Dario Freni5f681e12018-05-29 13:09:01 +0100614endif # BOARD_USES_PRODUCT_SERVICESIMAGE
615 $(hide) echo "#" >> $@; \
616 echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
617 echo "#" >> $@;
618 $(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000619 echo "$(line)" >> $@;)
Dario Freni5f681e12018-05-29 13:09:01 +0100620 $(hide) build/make/tools/post_process_props.py $@
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000621endif # MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Dario Freni5f681e12018-05-29 13:09:01 +0100622
623# ----------------------------------------------------------------
624
625# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800626# sdk-build.prop
627#
628# There are certain things in build.prop that we don't want to
629# ship with the sdk; remove them.
630
631# This must be a list of entire property keys followed by
632# "=" characters, without any internal spaces.
633sdk_build_prop_remove := \
634 ro.build.user= \
635 ro.build.host= \
636 ro.product.brand= \
637 ro.product.manufacturer= \
638 ro.product.device=
639# TODO: Remove this soon-to-be obsolete property
640sdk_build_prop_remove += ro.build.product=
641INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
642$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
643 @echo SDK buildinfo: $@
644 @mkdir -p $(dir $@)
645 $(hide) grep -v "$(subst $(space),\|,$(strip \
Anton Hansson6d814982018-11-26 18:12:05 +0000646 $(sdk_build_prop_remove)))" $< > $@.tmp
The Android Open Source Project88b60792009-03-03 19:28:42 -0800647 $(hide) for x in $(sdk_build_prop_remove); do \
Anton Hansson6d814982018-11-26 18:12:05 +0000648 echo "$$x"generic >> $@.tmp; done
The Android Open Source Project88b60792009-03-03 19:28:42 -0800649 $(hide) mv $@.tmp $@
650
651# -----------------------------------------------------------------
652# package stats
653PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
654PACKAGES_TO_STAT := \
655 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
656 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
657$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
658 @echo Package stats: $@
659 @mkdir -p $(dir $@)
660 $(hide) rm -f $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700661ifeq ($(PACKAGES_TO_STAT),)
662# Create empty package stats file if target builds no jar(s) or apk(s).
663 $(hide) touch $@
664else
Colin Crossfdea8932017-12-06 14:38:40 -0800665 $(hide) build/make/tools/dump-package-stats $^ > $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700666endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800667
668.PHONY: package-stats
669package-stats: $(PACKAGE_STATS_FILE)
670
671# -----------------------------------------------------------------
672# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700673# Use a macro to add newline to each echo command
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100674define _apkcerts_write_line
675$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
676$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
677$(hide) echo '' >> $5
Ying Wangd9a88d52012-10-26 09:21:28 -0700678
679endef
680
The Android Open Source Project88b60792009-03-03 19:28:42 -0800681name := $(TARGET_PRODUCT)
682ifeq ($(TARGET_BUILD_TYPE),debug)
683 name := $(name)_debug
684endif
685name := $(name)-apkcerts-$(FILE_NAME_TAG)
686intermediates := \
687 $(call intermediates-dir-for,PACKAGING,apkcerts)
688APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800689# We don't need to really build all the modules.
690# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700691$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800692 @echo APK certs list: $@
693 @mkdir -p $(dir $@)
694 @rm -f $@
Ying Wangd9a88d52012-10-26 09:21:28 -0700695 $(foreach p,$(PACKAGES),\
696 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100697 $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
698 $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
Ying Wangd9a88d52012-10-26 09:21:28 -0700699 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700700 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800701
702.PHONY: apkcerts-list
703apkcerts-list: $(APKCERTS_FILE)
704
Ying Wang15e487a2011-02-15 10:56:18 -0800705ifneq (,$(TARGET_BUILD_APPS))
706 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
707endif
Ying Wangefb21682010-07-23 16:42:13 -0700708
The Android Open Source Project88b60792009-03-03 19:28:42 -0800709# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700710# build system stats
711BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
712$(BUILD_SYSTEM_STATS):
713 @rm -f $@
714 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
715 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
716$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700717
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700718# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700719# Modules ready to be converted to Soong, ordered by how many
720# modules depend on them.
721SOONG_CONV := $(sort $(SOONG_CONV))
722SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
723$(SOONG_CONV_DATA):
724 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800725 @$(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 -0700726
Colin Crossfdea8932017-12-06 14:38:40 -0800727SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700728SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
729$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
730 @rm -f $@
731 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
732$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
733
734# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800735# Modules use -Wno-error, or added default -Wall -Werror
736WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
737$(WALL_WERROR):
738 @rm -f $@
739 echo "# Modules using -Wno-error" >> $@
740 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 -0800741 echo "# Modules added default -Wall" >> $@
742 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
743
744$(call dist-for-goals,droidcore,$(WALL_WERROR))
745
746# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800747# Modules missing profile files
748PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
749$(PGO_PROFILE_MISSING):
750 @rm -f $@
751 echo "# Modules missing PGO profile files" >> $@
752 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
753
754$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
755
756# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700757# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700758# for future OTA packages installed by this system. Actual product
759# deliverables will be re-signed by hand. We expect this file to
760# exist with the suffixes ".x509.pem" and ".pk8".
Colin Cross21122f92018-09-14 21:51:11 -0700761DEFAULT_KEY_CERT_PAIR := $(strip $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
Doug Zongker8678df42009-06-15 14:30:14 -0700762
763
Jeff Browne33ba4c2011-07-11 22:11:46 -0700764# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800765# if they don't do anything.
766.PHONY: systemimage
767systemimage:
768
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800769# -----------------------------------------------------------------
770
771.PHONY: event-log-tags
772
Joe Onoratob7510532010-07-14 10:22:54 -0700773# Produce an event logs tag file for everything we know about, in order
774# to properly allocate numbers. Then produce a file that's filtered
775# for what's going to be installed.
776
777all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
778
Colin Crossdc8f8e42012-04-12 13:25:54 -0700779event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
780
Joe Onoratob7510532010-07-14 10:22:54 -0700781# Include tags from all packages that we know about
782all_event_log_tags_src := \
783 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
784
Colin Crossdc8f8e42012-04-12 13:25:54 -0700785# PDK builds will already have a full list of tags that needs to get merged
786# in with the ones from source
787pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
788
789$(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 -0800790$(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 -0700791 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900792 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700793
Doug Zongkera34fa952011-02-23 12:17:29 -0800794# Include tags from all packages included in this product, plus all
795# tags that are part of the system (ie, not in a vendor/ or device/
796# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800797event_log_tags_src := \
798 $(sort $(foreach m,\
799 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
800 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800801 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
802 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800803
Colin Crossdc8f8e42012-04-12 13:25:54 -0700804$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700805$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800806$(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 -0800807 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900808 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800809
810event-log-tags: $(event_log_tags_file)
811
812ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
813
Joe Onoratob7510532010-07-14 10:22:54 -0700814
The Android Open Source Project88b60792009-03-03 19:28:42 -0800815# #################################################################
816# Targets for boot/OS images
817# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800818ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
819 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
820 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
821 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
822 else
823 INSTALLED_2NDBOOTLOADER_TARGET :=
824 endif
825else
826 INSTALLED_BOOTLOADER_MODULE :=
827 INSTALLED_2NDBOOTLOADER_TARGET :=
828endif # TARGET_NO_BOOTLOADER
829ifneq ($(strip $(TARGET_NO_KERNEL)),true)
830 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
831else
832 INSTALLED_KERNEL_TARGET :=
833endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800834
835# -----------------------------------------------------------------
Tom Cherryd14b8952018-08-09 14:26:00 -0700836# the root dir
837INTERNAL_ROOT_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800838 $(ALL_GENERATED_SOURCES) \
839 $(ALL_DEFAULT_INSTALLED_MODULES))
840
Luis Hector Chavezff489932018-07-03 15:41:40 -0700841INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
842INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
843$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700844$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700845 @echo Installed file list: $@
846 @mkdir -p $(dir $@)
847 @rm -f $@
848 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
849 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
850
851$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
852
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800853#------------------------------------------------------------------
854# dtb
855
856ifdef BOARD_PREBUILT_DTBIMAGE_DIR
857INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Hridya Valsarajuc63a7442019-02-07 11:38:18 -0800858$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb))
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800859 cat $^ > $@
860endif
861
Tom Cherryd14b8952018-08-09 14:26:00 -0700862# -----------------------------------------------------------------
863# the ramdisk
Dan Willemsen67495202019-01-16 12:42:05 -0800864ifdef BUILDING_RAMDISK_IMAGE
Tom Cherryd14b8952018-08-09 14:26:00 -0700865INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \
866 $(ALL_GENERATED_SOURCES) \
867 $(ALL_DEFAULT_INSTALLED_MODULES))
868
869INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt
870INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json)
871$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK)
872$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
873 @echo Installed file list: $@
874 @mkdir -p $(dir $@)
875 @rm -f $@
876 $(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json)
877 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
878
879$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
Joe Onorato64d85d02009-04-09 19:31:12 -0700880BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
881
882# We just build this directly to the install location.
883INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Tom Cherryd14b8952018-08-09 14:26:00 -0700884$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800885 $(call pretty,"Target ram disk: $@")
Tom Cherryd14b8952018-08-09 14:26:00 -0700886 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800887
Ying Wangad7fd292013-08-08 16:34:29 -0700888.PHONY: ramdisk-nodeps
889ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
890 @echo "make $@: ignoring dependencies"
Tom Cherryd14b8952018-08-09 14:26:00 -0700891 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800892
Dan Willemsen67495202019-01-16 12:42:05 -0800893endif # BUILDING_RAMDISK_IMAGE
894
895
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700896INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
897
The Android Open Source Project88b60792009-03-03 19:28:42 -0800898ifneq ($(strip $(TARGET_NO_KERNEL)),true)
899
900# -----------------------------------------------------------------
901# the boot image, which is a collection of other images.
902INTERNAL_BOOTIMAGE_ARGS := \
903 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700904 --kernel $(INSTALLED_KERNEL_TARGET)
905
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800906ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
907 INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
908endif
909
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700910ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
911INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
912endif
913
The Android Open Source Project88b60792009-03-03 19:28:42 -0800914INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
915
Dima Zavin1e0847c2009-05-07 19:43:08 -0700916ifdef BOARD_KERNEL_BASE
917 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
918endif
919
Ying Wangffff0022010-08-23 12:56:25 -0700920ifdef BOARD_KERNEL_PAGESIZE
921 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
922endif
923
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700924ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
925ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
926VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
927 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
928endif
929endif
930
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700931INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
932ifdef INTERNAL_KERNEL_CMDLINE
933INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700934endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700935
Sami Tolvanen3303d902016-03-15 16:49:30 +0000936INTERNAL_MKBOOTIMG_VERSION_ARGS := \
937 --os_version $(PLATFORM_VERSION) \
938 --os_patch_level $(PLATFORM_SECURITY_PATCH)
939
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800940# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
941ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800942ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800943$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400944
945else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
946
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800947$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400948 $(call pretty,"Target boot image: $@")
949 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800950 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400951 $(hide) $(AVBTOOL) add_hash_footer \
952 --image $@ \
953 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800954 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400955 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
956
957.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800958bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400959 @echo "make $@: ignoring dependencies"
960 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800961 $(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 -0400962 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800963 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400964 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800965 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400966 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
967
968else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700969
970$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
971 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000972 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800973 $(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 -0700974 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
975
976.PHONY: bootimage-nodeps
977bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
978 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000979 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800980 $(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 -0700981 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
982
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +0100983else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -0800984
Tao Bao4b577412017-02-22 22:54:39 -0800985$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800986 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000987 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700988 $(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 -0800989 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
990
991.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -0800992bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800993 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000994 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700995 $(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 -0800996 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
997
998else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800999
1000$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
1001 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001002 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001003 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001004
1005.PHONY: bootimage-nodeps
1006bootimage-nodeps: $(MKBOOTIMG)
1007 @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)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001009 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001010
The Android Open Source Project88b60792009-03-03 19:28:42 -08001011endif # TARGET_BOOTIMAGE_USE_EXT2
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001012endif # BOARD_USES_RECOVERY_AS_BOOT
The Android Open Source Project88b60792009-03-03 19:28:42 -08001013
Tao Baob1a2e352018-08-14 16:17:12 -07001014else # TARGET_NO_KERNEL == "true"
Michael Schwartz0dc6f212017-07-18 10:05:13 -07001015ifdef BOARD_PREBUILT_BOOTIMAGE
1016ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
1017# Remove when b/63676296 is resolved.
1018$(error Prebuilt bootimage is only supported for AB targets)
1019endif
1020$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
Tao Baob1a2e352018-08-14 16:17:12 -07001021else # BOARD_PREBUILT_BOOTIMAGE not defined
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001022INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
Tao Baob1a2e352018-08-14 16:17:12 -07001023INSTALLED_BOOTIMAGE_TARGET :=
1024endif # BOARD_PREBUILT_BOOTIMAGE
1025endif # TARGET_NO_KERNEL
The Android Open Source Project88b60792009-03-03 19:28:42 -08001026
1027# -----------------------------------------------------------------
1028# NOTICE files
1029#
Steve Blockd14d3b42012-03-01 11:34:41 +00001030# We are required to publish the licenses for all code under BSD, GPL and
1031# Apache licenses (and possibly other more exotic ones as well). We err on the
1032# side of caution, so the licenses for other third-party code are included here
1033# too.
1034#
The Android Open Source Project88b60792009-03-03 19:28:42 -08001035# This needs to be before the systemimage rules, because it adds to
1036# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
1037# go into the systemimage.
1038
Steve Block495e5852012-02-29 19:18:08 +00001039.PHONY: notice_files
1040
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001041# Create the rule to combine the files into text and html/xml forms
Dario Freniadc972d2018-07-09 18:38:38 +01001042# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001043# $(2) - Plain text output file
1044# $(3) - HTML/XML output file
1045# $(4) - File title
1046# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -08001047# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001048# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -08001049#
1050# The algorithm here is that we go collect a hash for each of the notice
1051# files and write the names of the files that match that hash. Then
1052# to generate the real files, we go print out all of the files and their
1053# hashes.
1054#
1055# These rules are fairly complex, so they depend on this makefile so if
1056# it changes, they'll run again.
1057#
1058# TODO: We could clean this up so that we just record the locations of the
1059# original notice files instead of making rules to copy them somwehere.
1060# Then we could traverse that without quite as much bash drama.
1061define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001062$(2) $(3): PRIVATE_MESSAGE := $(4)
1063$(2) $(3): PRIVATE_DIR := $(5)
1064$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -08001065$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
1066 build/make/tools/generate-notice-files.py --text-output $(2) \
Anton Hansson6d814982018-11-26 18:12:05 +00001067 $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e product_services --xml-output, \
1068 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
1069 $(if $(filter $(1),xml_product),-i product --xml-output, \
1070 $(if $(filter $(1),xml_product_services),-i product_services --xml-output, \
1071 --html-output)))) $(3) \
1072 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001073notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001074endef
1075
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001076# Notice file logic isn't relevant for TARGET_BUILD_APPS
1077ifndef TARGET_BUILD_APPS
1078
The Android Open Source Project88b60792009-03-03 19:28:42 -08001079# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
1080# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
1081# the src subdirectory.
Steve Block495e5852012-02-29 19:18:08 +00001082target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Steve Block495e5852012-02-29 19:18:08 +00001083tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08001084tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001085kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
1086winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
1087pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001088
Steven Morelandae69e572017-12-15 14:49:55 -08001089# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001090ifneq ($(PRODUCT_NOTICE_SPLIT),true)
1091target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
1092target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
1093installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
1094$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001095 $(target_notice_file_txt), \
1096 $(target_notice_file_html), \
1097 "Notices for files contained in the filesystem images in this directory:", \
1098 $(TARGET_OUT_NOTICE_FILES), \
1099 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001100$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
1101 $(hide) $(MINIGZIP) -9 < $< > $@
1102$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
1103 $(copy-file-to-target)
1104else
1105target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
1106target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001107installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
1108
1109target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
1110target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
1111target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
1112installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
Dario Freniadc972d2018-07-09 18:38:38 +01001113
1114target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
1115target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
1116target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
1117installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
Dario Frenicbca1132018-08-28 18:04:03 +01001118
1119target_product_services_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.txt
1120target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml
1121target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz
1122installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001123
Anton Hansson6ad6f6c2018-11-12 23:33:47 +00001124# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
1125# being built. A notice xml file must depend on all modules that could potentially
1126# install a license file relevant to it.
1127license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
1128# Phonys/fakes don't have notice files (though their deps might)
1129license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
1130license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
1131license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
1132license_modules_product_services := $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(license_modules))
1133license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_product_services)
1134license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001135
Dario Frenicbca1132018-08-28 18:04:03 +01001136$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
Anton Hansson6d814982018-11-26 18:12:05 +00001137 $(target_notice_file_txt), \
1138 $(target_notice_file_xml), \
1139 "Notices for files contained in the filesystem images in this directory:", \
1140 $(TARGET_OUT_NOTICE_FILES), \
1141 $(license_modules_rest)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001142$(eval $(call combine-notice-files, xml_vendor, \
Anton Hansson6d814982018-11-26 18:12:05 +00001143 $(target_vendor_notice_file_txt), \
1144 $(target_vendor_notice_file_xml), \
1145 "Notices for files contained in the vendor filesystem image in this directory:", \
1146 $(TARGET_OUT_NOTICE_FILES), \
1147 $(license_modules_vendor)))
Dario Freniadc972d2018-07-09 18:38:38 +01001148$(eval $(call combine-notice-files, xml_product, \
Anton Hansson6d814982018-11-26 18:12:05 +00001149 $(target_product_notice_file_txt), \
1150 $(target_product_notice_file_xml), \
1151 "Notices for files contained in the product filesystem image in this directory:", \
1152 $(TARGET_OUT_NOTICE_FILES), \
1153 $(license_modules_product)))
Dario Frenicbca1132018-08-28 18:04:03 +01001154$(eval $(call combine-notice-files, xml_product_services, \
Anton Hansson6d814982018-11-26 18:12:05 +00001155 $(target_product_services_notice_file_txt), \
1156 $(target_product_services_notice_file_xml), \
1157 "Notices for files contained in the product_services filesystem image in this directory:", \
1158 $(TARGET_OUT_NOTICE_FILES), \
1159 $(license_modules_product_services)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001160
1161$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
1162 $(hide) $(MINIGZIP) -9 < $< > $@
1163$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
1164 $(hide) $(MINIGZIP) -9 < $< > $@
1165$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
1166 $(hide) $(MINIGZIP) -9 < $< > $@
1167$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
1168 $(hide) $(MINIGZIP) -9 < $< > $@
1169$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
1170 $(copy-file-to-target)
1171$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
1172 $(copy-file-to-target)
1173$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
1174 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001175
1176# No notice file for product_services if its contents are merged into /product.
1177# The notices will be part of the /product notice file.
1178ifndef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001179$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
1180 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001181endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001182
1183# if we've been run my mm, mmm, etc, don't reinstall this every time
1184ifeq ($(ONE_SHOT_MAKEFILE),)
1185 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
1186 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
1187 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
1188 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
Dario Frenicbca1132018-08-28 18:04:03 +01001189endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001190endif # PRODUCT_NOTICE_SPLIT
1191
1192ifeq ($(ONE_SHOT_MAKEFILE),)
1193 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001194endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001195
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001196$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001197 $(tools_notice_file_txt), \
1198 $(tools_notice_file_html), \
1199 "Notices for files contained in the tools directory:", \
1200 $(HOST_OUT_NOTICE_FILES), \
1201 $(ALL_DEFAULT_INSTALLED_MODULES) \
1202 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001203
Ying Wang62c81f82013-08-22 20:02:03 -07001204endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -08001205
1206# The kernel isn't really a module, so to get its module file in there, we
1207# make the target NOTICE files depend on this particular file too, which will
1208# then be in the right directory for the find in combine-notice-files to work.
1209$(kernel_notice_file): \
Lee Campbellb463fcd2015-11-08 16:28:15 -08001210 $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001211 | $(ACP)
1212 @echo Copying: $@
1213 $(hide) mkdir -p $(dir $@)
1214 $(hide) $(ACP) $< $@
1215
Josh Gao4d9268e2017-02-23 13:17:46 -08001216$(winpthreads_notice_file): \
1217 $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
1218 | $(ACP)
1219 @echo Copying: $@
1220 $(hide) mkdir -p $(dir $@)
1221 $(hide) $(ACP) $< $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08001222
Doug Zongker8678df42009-06-15 14:30:14 -07001223# -----------------------------------------------------------------
1224# Build a keystore with the authorized keys in it, used to verify the
1225# authenticity of downloaded OTA packages.
1226#
1227# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
1228# before the rules that use that variable to build the image.
Dan Willemsenb589ae42015-10-29 21:26:18 +00001229ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
Colin Cross21122f92018-09-14 21:51:11 -07001230$(TARGET_OUT_ETC)/security/otacerts.zip: PRIVATE_CERT := $(DEFAULT_KEY_CERT_PAIR).x509.pem
1231$(TARGET_OUT_ETC)/security/otacerts.zip: $(SOONG_ZIP)
1232$(TARGET_OUT_ETC)/security/otacerts.zip: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Doug Zongker8678df42009-06-15 14:30:14 -07001233 $(hide) rm -f $@
1234 $(hide) mkdir -p $(dir $@)
Colin Cross21122f92018-09-14 21:51:11 -07001235 $(hide) $(SOONG_ZIP) -o $@ -C $(dir $(PRIVATE_CERT)) -f $(PRIVATE_CERT)
Doug Zongker8678df42009-06-15 14:30:14 -07001236
Alex Deymocec578c2017-03-28 20:48:18 -07001237# Carry the public key for update_engine if it's a non-IoT target that
Tao Bao38812d62016-01-20 20:58:20 -08001238# uses the AB updater. We use the same key as otacerts but in RSA public key
1239# format.
1240ifeq ($(AB_OTA_UPDATER),true)
Alex Deymocec578c2017-03-28 20:48:18 -07001241ifneq ($(PRODUCT_IOT),true)
Tao Bao23c3db92016-01-21 14:28:50 -08001242ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Colin Cross21122f92018-09-14 21:51:11 -07001243$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(DEFAULT_KEY_CERT_PAIR).x509.pem
Tao Bao38812d62016-01-20 20:58:20 -08001244 $(hide) rm -f $@
1245 $(hide) mkdir -p $(dir $@)
1246 $(hide) openssl x509 -pubkey -noout -in $< > $@
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001247
Tao Bao696bb332018-08-17 16:27:01 -07001248ALL_DEFAULT_INSTALLED_MODULES += \
1249 $(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem
1250$(TARGET_RECOVERY_ROOT_OUT)/system/etc/update_engine/update-payload-key.pub.pem: \
Anton Hansson6d814982018-11-26 18:12:05 +00001251 $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001252 $(hide) cp -f $< $@
Tao Bao38812d62016-01-20 20:58:20 -08001253endif
1254endif
1255
Doug Zongker8678df42009-06-15 14:30:14 -07001256.PHONY: otacerts
1257otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
1258
1259
The Android Open Source Project88b60792009-03-03 19:28:42 -08001260# #################################################################
1261# Targets for user images
1262# #################################################################
1263
Ying Wang933abf12010-06-16 14:31:34 -07001264INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001265ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001266INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1267else
1268ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001269INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1270else
1271ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001272INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1273endif
1274endif
1275endif
1276
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001277# These options tell the recovery updater/installer how to mount the partitions writebale.
1278# <fstype>=<fstype_opts>[|<fstype_opts>]...
1279# fstype_opts := <opt>[,<opt>]...
1280# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001281# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1282DEFAULT_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 -07001283
Ying Wang542903a2010-11-17 15:40:38 -08001284ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1285 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1286endif
1287
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001288INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
Mark Salyzyn780f5952018-10-19 13:44:36 -07001289INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK) $(TUNE2FS)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001290ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1291INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1292endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001293
Chris Friesdf0387d2017-06-21 15:51:46 -05001294ifeq ($(BOARD_AVB_ENABLE),true)
1295INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1296endif
1297
Todd Poynorb2a555e2015-12-15 18:00:14 -08001298ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1299 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1300endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001301ifneq ($(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 -07001302INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001303endif
1304
Ying Wang178ef922011-10-31 18:13:30 -07001305INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001306
Colin Cross8a30f722014-04-28 16:27:32 -07001307ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001308INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001309ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC))
1310INTERNAL_USERIMAGES_DEPS += $(FEC)
1311endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001312endif
1313
Alex Klyubin092c9022017-03-13 13:28:34 -07001314SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001315INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1316
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001317INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1318
Jin Qianabcec5e2017-03-10 16:53:45 -08001319INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
Jin Qianabcec5e2017-03-10 16:53:45 -08001320
Yifan Hongc5c01242018-11-09 10:27:23 -08001321ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001322
1323ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
1324 $(error vboot 1.0 doesn't support logical partition)
1325endif
1326
1327# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1328# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1329
Yifan Hongc5c01242018-11-09 10:27:23 -08001330endif # PRODUCT_USE_DYNAMIC_PARTITIONS
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001331
Ying Wangbd93d422011-10-28 17:02:30 -07001332# $(1): the path of the output dictionary file
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001333# $(2): a subset of "system vendor cache userdata product product_services oem odm"
Yifan Hong760d3c02018-05-30 11:16:46 -07001334# $(3): additional "key=value" pairs to append to the dictionary file.
1335define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001336$(if $(filter $(2),system),\
1337 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
Bowgo Tsai867ab662019-01-29 13:30:18 +08001338 $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001339 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1340 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1341 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1342 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1343 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1344 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1345 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1346 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1347 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1348 $(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 -07001349 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001350)
Yifan Hong760d3c02018-05-30 11:16:46 -07001351$(if $(filter $(2),userdata),\
1352 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1353 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
1354)
Yifan Hong760d3c02018-05-30 11:16:46 -07001355$(if $(filter $(2),cache),\
1356 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1357 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
1358)
1359$(if $(filter $(2),vendor),\
1360 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1361 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1362 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1363 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1364 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1365 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1366 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1367 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1368 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1369 $(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 -07001370 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001371)
1372$(if $(filter $(2),product),\
1373 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1374 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1375 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1376 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1377 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1378 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1379 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1380 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1381 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1382 $(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 -07001383 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001384)
Yifan Hongebc041a2018-07-26 16:02:52 -07001385$(if $(filter $(2),product_services),\
1386 $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_services_fs_type=$(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1387 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_services_extfs_inode_count=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1388 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_services_extfs_rsv_pct=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT)" >> $(1))
1389 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),$(hide) echo "product_services_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)" >> $(1))
1390 $(if $(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE),$(hide) echo "product_services_journal_size=$(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE)" >> $(1))
1391 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_services_squashfs_compressor=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1392 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_services_squashfs_compressor_opt=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1393 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_services_squashfs_block_size=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1394 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_services_squashfs_disable_4k_align=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1395 $(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 +01001396)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001397$(if $(filter $(2),odm),\
1398 $(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1399 $(if $(BOARD_ODMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_extfs_inode_count=$(BOARD_ODMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1400 $(if $(BOARD_ODMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_extfs_rsv_pct=$(BOARD_ODMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1401 $(if $(BOARD_ODMIMAGE_PARTITION_SIZE),$(hide) echo "odm_size=$(BOARD_ODMIMAGE_PARTITION_SIZE)" >> $(1))
1402 $(if $(BOARD_ODMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_journal_size=$(BOARD_ODMIMAGE_JOURNAL_SIZE)" >> $(1))
1403 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_squashfs_compressor=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1404 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_squashfs_compressor_opt=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1405 $(if $(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_squashfs_block_size=$(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1406 $(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1407 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH)" >> $(1))
1408 $(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
1409)
Yifan Hong760d3c02018-05-30 11:16:46 -07001410$(if $(filter $(2),oem),\
1411 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1412 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1413 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1414 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1415)
Tao Bao3602eca2018-07-10 10:53:55 -07001416$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001417
Tao Bao3602eca2018-07-10 10:53:55 -07001418$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001419$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001420$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001421$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1422$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1423$(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 -08001424$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001425$(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 -07001426$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
Paul Lawrencea37b2bb2014-11-13 17:54:30 -08001427$(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 +02001428$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001429$(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 +08001430$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001431$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1432$(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 +09001433$(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 -07001434$(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 -07001435$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1436$(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 -07001437$(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 -08001438$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001439$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001440$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001441$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1442$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1443$(if $(BOARD_AVB_ENABLE),\
1444 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1445 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1446 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1447 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08001448$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1449$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1450$(if $(BOARD_AVB_ENABLE),\
1451 $(if $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH),\
1452 $(hide) echo "avb_system_other_key_path=$(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)" >> $(1)
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08001453 $(hide) echo "avb_system_other_algorithm=$(BOARD_AVB_SYSTEM_OTHER_ALGORITHM)" >> $(1)
1454 $(hide) echo "avb_system_extract_system_other_key=true" >> $(1)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001455$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1456$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1457$(if $(BOARD_AVB_ENABLE),\
1458 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1459 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1460 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1461 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001462$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1463$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1464$(if $(BOARD_AVB_ENABLE),\
1465 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1466 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1467 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1468 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Tao Bao1ebda8d2018-08-01 17:21:14 -07001469$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_services_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1470$(if $(BOARD_AVB_ENABLE),\
1471 $(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 +01001472$(if $(BOARD_AVB_ENABLE),\
1473 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
Yifan Hongebc041a2018-07-26 16:02:52 -07001474 $(hide) echo "avb_product_services_key_path=$(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH)" >> $(1)
1475 $(hide) echo "avb_product_services_algorithm=$(BOARD_AVB_PRODUCT_SERVICES_ALGORITHM)" >> $(1)
1476 $(hide) echo "avb_product_services_rollback_index_location=$(BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001477$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1478$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1479$(if $(BOARD_AVB_ENABLE),\
1480 $(if $(BOARD_AVB_ODM_KEY_PATH),\
1481 $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1)
1482 $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1)
1483 $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001484$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1485 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001486$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Tom Cherryd14b8952018-08-09 14:26:00 -07001487 $(hide) echo "system_root_image=true" >> $(1))
1488$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
Yifan Hong2dae5722018-07-31 12:47:27 -07001489$(if $(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),$(hide) echo "use_dynamic_partition_size=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001490$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1491endef
1492
1493# $(1): the path of the output dictionary file
1494# $(2): additional "key=value" pairs to append to the dictionary file.
1495define generate-userimage-prop-dictionary
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001496$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product product_services oem odm,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001497endef
1498
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001499# $(1): the path of the input dictionary file, where each line has the format key=value
1500# $(2): the key to look up
1501define read-image-prop-dictionary
1502$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1503endef
1504
Xu Chao2b04bf42017-07-06 14:34:31 +08001505# $(1): modules list
1506# $(2): output dir
1507# $(3): mount point
1508# $(4): staging dir
1509# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1510define build-image-kernel-modules
1511 $(hide) rm -rf $(2)/lib/modules
1512 $(hide) mkdir -p $(2)/lib/modules
1513 $(hide) cp $(1) $(2)/lib/modules/
1514 $(hide) rm -rf $(4)
1515 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1516 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1517 $(hide) $(DEPMOD) -b $(4) 0.0
1518 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1519 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1520endef
1521
The Android Open Source Project88b60792009-03-03 19:28:42 -08001522# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001523# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001524
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001525# Recovery image exists if we are building recovery, or building recovery as boot.
1526ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001527
Ying Wang37526142015-03-10 12:02:57 -07001528INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1529 $(ALL_DEFAULT_INSTALLED_MODULES))
1530
Tao Bao10fc9492018-08-14 12:17:48 -07001531INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
1532INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
1533
1534# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other
1535# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in
1536# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with
1537# the call to FILELIST.
1538ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
1539$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET)
1540else
1541$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET)
1542endif
1543
1544$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY)
1545$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST)
1546 @echo Installed file list: $@
1547 @mkdir -p $(dir $@)
1548 @rm -f $@
1549 $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
1550 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
1551
Doug Zongker4647f122009-07-02 09:00:54 -07001552recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001553recovery_sepolicy := \
1554 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001555 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001556 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001557 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001558 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts
1559
Bowgo Tsai99671252017-11-30 22:15:17 +08001560ifdef BOARD_ODM_SEPOLICY_DIRS
1561recovery_sepolicy += \
1562 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
1563 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts
1564endif
1565
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001566# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1567# SELinux files
1568IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1569
Doug Zongker4647f122009-07-02 09:00:54 -07001570recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1571recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Doug Zongker4647f122009-07-02 09:00:54 -07001572recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001573
Tao Baoe1e829e2018-08-29 20:36:00 -07001574# Set recovery_density to a density bucket based on PRODUCT_AAPT_PREF_CONFIG if set. Otherwise use
1575# the default medium density.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001576ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001577# If PRODUCT_AAPT_PREF_CONFIG includes a non-numeric dpi bucket, always perfer that value.
Doug Zongker8eaeea92014-05-12 15:32:20 -07001578recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Tao Baoe1e829e2018-08-29 20:36:00 -07001579ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density)))
1580recovery_density_value := $(patsubst %dpi,%,$(recovery_density))
1581# Map the numeric dpi value to a bucket. We roughly use the medium point between the primary
1582# densities to split buckets.
1583# ------160------240------320----------480------------640------
1584# mdpi hdpi xhdpi xxhdpi xxxhdpi
1585recovery_density := $(strip \
1586 $(or $(if $(filter $(shell echo $$(($(recovery_density_value) >= 560))),1),xxxhdpi),\
1587 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 400))),1),xxhdpi),\
1588 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
1589 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
Doug Zongker8eaeea92014-05-12 15:32:20 -07001590endif
Tao Baoe1e829e2018-08-29 20:36:00 -07001591else # PRODUCT_AAPT_PREF_CONFIG is empty
1592recovery_density := mdpi
1593endif # PRODUCT_AAPT_PREF_CONFIG
Doug Zongker8eaeea92014-05-12 15:32:20 -07001594
1595ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1596recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1597else
Doug Zongker25d55f82014-04-04 13:51:15 -07001598recovery_resources_common := $(recovery_resources_common)-xhdpi
1599endif
1600
Tao Baoe1e829e2018-08-29 20:36:00 -07001601# Select the 18x32 font on high-density devices (xhdpi and up); and the 12x22 font on other devices.
1602# Note that the font selected here can be overridden for a particular device by putting a font.png
1603# in its private recovery resources.
1604ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001605recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1606else
1607recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1608endif
1609
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001610
1611# We will only generate the recovery background text images if the variable
1612# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the
1613# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for
1614# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their
1615# BoardConfig in order to use this feature.
1616ifeq ($(recovery_density),xxxhdpi)
1617TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440
1618else ifeq ($(recovery_density),xxhdpi)
1619TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080
1620endif
1621
1622ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),)
1623# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative.
1624ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
1625 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10))
1626else
1627 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10))
1628endif
1629
1630
1631RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png
1632RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
1633RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
1634RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
1635RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
1636
xunchangcc57d312018-12-07 12:12:17 -08001637RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
1638RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
1639RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
1640RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
1641RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
1642
1643generated_recovery_text_files := \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001644 $(RECOVERY_INSTALLING_TEXT_FILE) \
1645 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
1646 $(RECOVERY_ERASING_TEXT_FILE) \
1647 $(RECOVERY_ERROR_TEXT_FILE) \
xunchangcc57d312018-12-07 12:12:17 -08001648 $(RECOVERY_NO_COMMAND_TEXT_FILE) \
1649 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
1650 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
1651 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
1652 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
1653 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001654
1655resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
1656image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
xunchangcc57d312018-12-07 12:12:17 -08001657zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001658$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
1659$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
1660$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
1661$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
xunchangcc57d312018-12-07 12:12:17 -08001662$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001663$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
xunchangdbe55e12018-12-19 17:15:14 -08001664$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001665 recovery_installing \
1666 recovery_installing_security \
1667 recovery_erasing \
1668 recovery_error \
xunchangdbe55e12018-12-19 17:15:14 -08001669 recovery_no_command
1670$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001671 recovery_cancel_wipe_data \
1672 recovery_factory_data_reset \
1673 recovery_try_again \
1674 recovery_wipe_data_menu_header \
1675 recovery_wipe_data_confirmation
1676$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
1677$(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 -08001678 # Prepares the font directory.
1679 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1680 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
xunchangcc57d312018-12-07 12:12:17 -08001681 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001682 @rm -rf $(dir $@)
1683 @mkdir -p $(dir $@)
xunchangdbe55e12018-12-19 17:15:14 -08001684 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
xunchangcc57d312018-12-07 12:12:17 -08001685 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
xunchangdbe55e12018-12-19 17:15:14 -08001686 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001687 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
1688 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
1689 --text_name $(text_name) \
1690 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
1691 --resource_dir $(PRIVATE_RESOURCE_DIR) \
xunchangdbe55e12018-12-19 17:15:14 -08001692 --output_file $(output_file) $(center_alignment) && \
xunchangcc57d312018-12-07 12:12:17 -08001693 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001694else
1695RECOVERY_INSTALLING_TEXT_FILE :=
1696RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
1697RECOVERY_ERASING_TEXT_FILE :=
1698RECOVERY_ERROR_TEXT_FILE :=
1699RECOVERY_NO_COMMAND_TEXT_FILE :=
xunchangcc57d312018-12-07 12:12:17 -08001700RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
1701RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
1702RECOVERY_TRY_AGAIN_TEXT_FILE :=
1703RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
1704RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001705endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
1706
Ying Wang9a175682015-08-06 11:47:47 -07001707ifndef TARGET_PRIVATE_RES_DIRS
1708TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1709endif
Doug Zongker4647f122009-07-02 09:00:54 -07001710recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001711 $(TARGET_PRIVATE_RES_DIRS) -type f)
xunchangcc57d312018-12-07 12:12:17 -08001712recovery_resource_deps += $(generated_recovery_text_files)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001713
1714
Andrew Boiefa61ff02012-09-28 09:33:45 -07001715ifdef TARGET_RECOVERY_FSTAB
1716recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1717else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001718recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001719endif
Tao Baoc3c17532016-06-10 10:11:54 -07001720ifdef TARGET_RECOVERY_WIPE
1721recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001722else
Tao Baoc3c17532016-06-10 10:11:54 -07001723recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001724endif
Tao Bao8beab692015-07-22 12:33:18 -07001725
Tao Bao6d5d6232018-03-09 17:04:42 -08001726# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001727# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001728# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1729# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001730#
1731# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001732# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001733# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001734# b) We build a single image that contains boot and recovery both - no recovery image to install
1735# (BOARD_USES_RECOVERY_AS_BOOT = true);
Tom Cherry2929cad2018-09-20 11:04:37 -07001736# c) We mount the system image as / and therefore do not have a ramdisk in boot.img
Tao Bao6d5d6232018-03-09 17:04:42 -08001737# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001738# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1739# do bsdiff because boot and recovery will contain different number of entries
1740# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001741# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
1742# do bsdiff because boot and recovery will contain different number of entries
1743# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001744
Tom Cherry2929cad2018-09-20 11:04:37 -07001745ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001746 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Doug Zongker56588872012-08-20 15:38:58 -07001747# Named '.dat' so we don't attempt to use imgdiff for patching it.
1748RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001749else
Tao Bao8beab692015-07-22 12:33:18 -07001750RECOVERY_RESOURCE_ZIP :=
1751endif
Doug Zongker4647f122009-07-02 09:00:54 -07001752
Tao Bao139c7272018-07-31 13:26:54 -07001753INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1754
1755$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \
Tao Bao139c7272018-07-31 13:26:54 -07001756 TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \
1757 TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \
1758 TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \
1759 TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \
1760 TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE:progress_bar_baseline \
1761 TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD:touch_low_threshold \
1762 TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD:touch_high_threshold \
1763 TARGET_RECOVERY_UI_VR_STEREO_OFFSET:vr_stereo_offset
1764
1765# Parses the given list of build variables and writes their values as build properties if defined.
1766# For example, if a target defines `TARGET_RECOVERY_UI_MARGIN_HEIGHT := 100`,
1767# `ro.recovery.ui.margin_height=100` will be appended to the given output file.
1768# $(1): Map from the build variable names to property names
1769# $(2): Output file
1770define append-recovery-ui-properties
1771echo "#" >> $(2)
1772echo "# RECOVERY UI BUILD PROPERTIES" >> $(2)
1773echo "#" >> $(2)
1774$(foreach prop,$(1), \
1775 $(eval _varname := $(call word-colon,1,$(prop))) \
1776 $(eval _propname := $(call word-colon,2,$(prop))) \
1777 $(eval _value := $($(_varname))) \
1778 $(if $(_value), \
1779 echo ro.recovery.ui.$(_propname)=$(_value) >> $(2) &&)) true
1780endef
1781
1782$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00001783 $(INSTALLED_DEFAULT_PROP_TARGET) \
1784 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1785 $(intermediate_system_build_prop) \
1786 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
1787 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
1788 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
1789 $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
Tao Bao1edaca12018-09-18 10:22:54 -07001790 @echo "Target recovery buildinfo: $@"
Tao Bao139c7272018-07-31 13:26:54 -07001791 $(hide) mkdir -p $(dir $@)
1792 $(hide) rm -f $@
1793 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@
1794 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@
Tao Bao6eb1a992018-08-06 07:33:45 -07001795 $(hide) cat $(intermediate_system_build_prop) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001796 $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001797 $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001798 $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
1799 $(hide) cat $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET) >> $@
1800 $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
1801
Doug Zongker4647f122009-07-02 09:00:54 -07001802INTERNAL_RECOVERYIMAGE_ARGS := \
1803 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1804 --kernel $(recovery_kernel) \
1805 --ramdisk $(recovery_ramdisk)
1806
1807# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001808ifdef INTERNAL_KERNEL_CMDLINE
1809 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001810endif
1811ifdef BOARD_KERNEL_BASE
1812 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1813endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001814ifdef BOARD_KERNEL_PAGESIZE
1815 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1816endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001817ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001818ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1819 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1820else
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001821 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1822endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001823endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001824ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1825 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
1826endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001827ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1828 INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
1829endif
Doug Zongker4647f122009-07-02 09:00:54 -07001830
1831# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001832# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001833# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001834OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001835
1836# Generate a file containing the keys that will be read by the
1837# recovery binary.
1838RECOVERY_INSTALL_OTA_KEYS := \
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001839 $(call intermediates-dir-for,PACKAGING,ota_keys)/otacerts.zip
Doug Zongker4647f122009-07-02 09:00:54 -07001840$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001841$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001842$(RECOVERY_INSTALL_OTA_KEYS): $(SOONG_ZIP) $(OTA_PUBLIC_KEYS) $(extra_keys)
1843 $(hide) rm -f $@
1844 $(hide) mkdir -p $(dir $@)
1845 $(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 -07001846
Andres Moralesb8876e12015-05-06 20:44:22 -07001847RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001848
Ying Wang747b9f12015-01-30 14:05:22 -08001849# $(1): output file
1850define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001851 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001852 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao696bb332018-08-17 16:27:01 -07001853 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001854 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001855 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
Tao Bao696bb332018-08-17 16:27:01 -07001856 $(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001857 # Modifying ramdisk contents...
Tom Cherry3871f0f2018-11-06 14:23:44 -08001858 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
1859 $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
Howard Chen1756f8d2017-02-22 17:27:10 +08001860 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1861 $(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 +08001862 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1863 $(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 -08001864 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Tao Baocf8853b2018-08-13 14:27:32 -07001865 $(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 -08001866 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1867 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1868 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
xunchangcc57d312018-12-07 12:12:17 -08001869 $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
1870 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
Ying Wang747b9f12015-01-30 14:05:22 -08001871 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001872 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1873 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001874 $(hide) $(foreach item,$(recovery_fstab), \
Tao Bao696bb332018-08-17 16:27:01 -07001875 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001876 $(if $(strip $(recovery_wipe)), \
Tao Bao696bb332018-08-17 16:27:01 -07001877 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
Tianjie Xuffbe6b92018-10-19 14:34:15 -07001878 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security
1879 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/security/otacerts.zip
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001880 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001881 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001882 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Tao Baod95e9fd2015-03-29 23:07:41 -07001883 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001884 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1885 $(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 +01001886 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001887 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1888 $(BOOT_SIGNER) /boot $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1889 $(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
1890 )\
1891 )
Tao Baod95e9fd2015-03-29 23:07:41 -07001892 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001893 $(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 +08001894 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1895 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1896 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001897 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1898 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1899 $(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),\
1900 $(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 -08001901endef
1902
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001903ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Ying Wangbd07ad02016-03-10 12:57:33 -08001904ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
1905$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1906endif
1907ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
1908$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1909endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001910ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001911$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001912endif
Tao Baof4866c72018-08-22 14:35:09 -07001913ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001914ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1915$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1916else
Tao Baof4866c72018-08-22 14:35:09 -07001917$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
1918endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001919endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001920ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1921$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1922endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001923ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1924$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1925endif
Tao Baof4866c72018-08-22 14:35:09 -07001926
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001927$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001928 $(INTERNAL_ROOT_FILES) \
1929 $(INSTALLED_RAMDISK_TARGET) \
1930 $(INTERNAL_RECOVERYIMAGE_FILES) \
1931 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1932 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1933 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1934 $(recovery_resource_deps) \
1935 $(recovery_fstab) \
1936 $(RECOVERY_INSTALL_OTA_KEYS) \
1937 $(BOARD_RECOVERY_KERNEL_MODULES) \
1938 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001939 $(call pretty,"Target boot image from recovery: $@")
1940 $(call build-recoveryimage-target, $@)
1941endif # BOARD_USES_RECOVERY_AS_BOOT
1942
1943ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001944ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1945$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1946else
Tao Baof4866c72018-08-22 14:35:09 -07001947$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001948endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001949endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001950ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1951$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1952endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001953ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1954$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1955endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001956
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001957$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001958 $(INTERNAL_ROOT_FILES) \
1959 $(INSTALLED_RAMDISK_TARGET) \
1960 $(INSTALLED_BOOTIMAGE_TARGET) \
1961 $(INTERNAL_RECOVERYIMAGE_FILES) \
1962 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1963 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1964 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1965 $(recovery_resource_deps) \
1966 $(recovery_fstab) \
1967 $(RECOVERY_INSTALL_OTA_KEYS) \
1968 $(BOARD_RECOVERY_KERNEL_MODULES) \
1969 $(DEPMOD)
Tao Baof4866c72018-08-22 14:35:09 -07001970 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001971
Tao Bao4594d0e2015-12-22 09:47:46 -08001972ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001973$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001974 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001975 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1976 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001977endif
Doug Zongker56588872012-08-20 15:38:58 -07001978
Ying Wang747b9f12015-01-30 14:05:22 -08001979.PHONY: recoveryimage-nodeps
1980recoveryimage-nodeps:
1981 @echo "make $@: ignoring dependencies"
1982 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1983
Tao Bao8beab692015-07-22 12:33:18 -07001984else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07001985RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07001986endif
1987
1988.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001989recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001990
Jiyong Park03eb0612017-10-04 21:22:41 +09001991ifneq ($(BOARD_NAND_PAGE_SIZE),)
1992$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001993endif
1994
Jiyong Park03eb0612017-10-04 21:22:41 +09001995ifneq ($(BOARD_NAND_SPARE_SIZE),)
1996$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001997endif
1998
Doug Zongker4647f122009-07-02 09:00:54 -07001999# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07002000# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08002001#
Ying Wang9c649a72012-08-08 15:27:00 -07002002# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
2003PDK_FUSION_SYSIMG_FILES := \
2004 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
2005 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002006
Dan Willemsen37a19862018-10-31 16:31:46 -07002007INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07002008 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07002009 $(ALL_DEFAULT_INSTALLED_MODULES) \
2010 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08002011 $(RECOVERY_RESOURCE_ZIP)) \
Dan Willemsen37a19862018-10-31 16:31:46 -07002012 $(PDK_FUSION_SYMLINK_STAMP))
Ying Wang160b6702012-03-13 18:58:27 -07002013
Ying Wang82cceba2012-08-13 15:03:00 -07002014FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002015
2016# ASAN libraries in the system image - add dependency.
2017ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
Evgenii Stepanov8841a7f2018-07-27 11:54:32 -07002018ifneq (,$(filter address, $(SANITIZE_TARGET)))
Andreas Gampe039b5c72017-03-24 16:06:31 -07002019 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
2020 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
2021 endif
2022endif
2023
Tom Cherryd14b8952018-08-09 14:26:00 -07002024FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
Luis Hector Chavezff489932018-07-03 15:41:40 -07002025
Ying Wange5e8c5f2011-09-09 16:35:53 -07002026# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07002027# Final System VINTF manifest including fragments. This is not assembled
2028# on the device because it depends on everything in a given device
2029# image which defines a vintf_fragment.
2030
2031BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
2032$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2033$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
2034$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
2035$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
2036 @echo "Verifying system VINTF manifest."
2037 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2038 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Anton Hansson6d814982018-11-26 18:12:05 +00002039 -c $(BUILT_VENDOR_MATRIX) \
2040 -i $(BUILT_SYSTEM_MANIFEST) \
2041 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
2042 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
2043 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002044
2045# -----------------------------------------------------------------
Dan Willemsen67495202019-01-16 12:42:05 -08002046ifdef BUILDING_SYSTEM_IMAGE
2047
Ying Wange5e8c5f2011-09-09 16:35:53 -07002048# installed file list
2049# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
2050# We put installed-files.txt ahead of image itself in the dependency graph
2051# so that we can get the size stat even if the build fails due to too large
2052# system image.
2053INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07002054INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
2055$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002056$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002057 @echo Installed file list: $@
2058 @mkdir -p $(dir $@)
2059 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002060 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002061 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07002062
2063.PHONY: installed-file-list
2064installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08002065
2066$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07002067
2068systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002069 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002070BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
2071
Ying Wang23898df2014-06-18 20:26:24 -07002072# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002073ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07002074define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07002075$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
2076 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
2077 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
2078 exit 1; \
2079fi
Ying Wang23898df2014-06-18 20:26:24 -07002080$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
2081endef
2082else
2083define create-system-vendor-symlink
2084endef
2085endif
2086
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002087# Create symlink /system/product to /product if necessary.
2088ifdef BOARD_USES_PRODUCTIMAGE
2089define create-system-product-symlink
2090$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
2091 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
2092 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
2093 exit 1; \
2094fi
2095$(hide) ln -sf /product $(TARGET_OUT)/product
2096endef
2097else
2098define create-system-product-symlink
2099endef
2100endif
2101
Dario Freni924af7d2018-08-17 00:56:14 +01002102# Create symlink /system/product_services to /product_services if necessary.
Dario Freni5f681e12018-05-29 13:09:01 +01002103ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002104define create-system-product_services-symlink
2105$(hide) if [ -d $(TARGET_OUT)/product_services ] && [ ! -h $(TARGET_OUT)/product_services ]; then \
2106 echo 'Non-symlink $(TARGET_OUT)/product_services detected!' 1>&2; \
2107 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 +01002108 exit 1; \
2109fi
Dario Freni924af7d2018-08-17 00:56:14 +01002110$(hide) ln -sf /product_services $(TARGET_OUT)/product_services
Dario Freni5f681e12018-05-29 13:09:01 +01002111endef
2112else
Dario Freni924af7d2018-08-17 00:56:14 +01002113define create-system-product_services-symlink
Dario Freni5f681e12018-05-29 13:09:01 +01002114endef
2115endif
2116
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002117# Create symlink /vendor/odm to /odm if necessary.
2118ifdef BOARD_USES_ODMIMAGE
2119define create-vendor-odm-symlink
2120$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
2121 echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
2122 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
2123 exit 1; \
2124fi
2125$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
2126endef
2127else
2128define create-vendor-odm-symlink
2129endef
2130endif
2131
The Android Open Source Project88b60792009-03-03 19:28:42 -08002132# $(1): output file
2133define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07002134 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07002135 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002136 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002137 $(call create-system-product_services-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07002138 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002139 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07002140 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002141 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002142 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002143 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002144 $(systemimage_intermediates)/generated_system_image_info.txt \
Dan Willemsen3e8eb372018-10-20 21:37:44 -07002145 || ( mkdir -p $${DIST_DIR}; cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07002146 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08002147endef
2148
Steven Moreland627debe2018-05-01 09:54:21 -07002149$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002150$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002151 $(call build-systemimage-target,$@)
2152
Tao Baoe9d61b02018-08-20 21:09:07 -07002153INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07002154SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002155
Tao Baoe9d61b02018-08-20 21:09:07 -07002156# INSTALLED_SYSTEMIMAGE_TARGET used to be named INSTALLED_SYSTEMIMAGE. Create an alias for backward
2157# compatibility, in case device-specific Makefiles still refer to the old name.
2158INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
2159
Doug Zongker73ef8252009-07-23 15:12:53 -07002160# The system partition needs room for the recovery image as well. We
2161# now store the recovery image as a binary patch using the boot image
2162# as the source (since they are very similar). Generate the patch so
2163# we can see how big it's going to be, and include that in the system
2164# image size check calculation.
Tao Baob1a2e352018-08-14 16:17:12 -07002165ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
Sriram Raman1e96ac82009-07-24 13:52:32 -07002166ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07002167ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Chen, ZhiminX752439b2018-09-23 22:10:47 +08002168ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08002169diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
2170else
2171diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
2172endif
Doug Zongker73ef8252009-07-23 15:12:53 -07002173intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
2174RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08002175$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
2176$(RECOVERY_FROM_BOOT_PATCH): \
Anton Hansson6d814982018-11-26 18:12:05 +00002177 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2178 $(INSTALLED_BOOTIMAGE_TARGET) \
2179 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07002180 @echo "Construct recovery from boot"
2181 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08002182 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07002183else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
2184RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
Tao Baob1a2e352018-08-14 16:17:12 -07002185endif # BOARD_USES_FULL_RECOVERY_IMAGE
2186endif # INSTALLED_RECOVERYIMAGE_TARGET
2187endif # INSTALLED_BOOTIMAGE_TARGET
Doug Zongker73ef8252009-07-23 15:12:53 -07002188
Tao Baoe9d61b02018-08-20 21:09:07 -07002189$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002190 @echo "Install system fs image: $@"
2191 $(copy-file-to-target)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002192 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
Anton Hansson6d814982018-11-26 18:12:05 +00002193 $(call read-image-prop-dictionary,\
2194 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002195
Tao Baoe9d61b02018-08-20 21:09:07 -07002196systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002197
2198.PHONY: systemimage-nodeps snod
2199systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07002200 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002201 @echo "make $@: ignoring dependencies"
Tao Baoe9d61b02018-08-20 21:09:07 -07002202 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
2203 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),\
Anton Hansson6d814982018-11-26 18:12:05 +00002204 $(call read-image-prop-dictionary,\
2205 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002206
Ying Wangacf01ec2012-02-24 11:05:48 -08002207ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
2208ifeq (true,$(WITH_DEXPREOPT))
2209$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
2210endif
2211endif
2212
Dan Willemsen67495202019-01-16 12:42:05 -08002213endif # BUILDING_SYSTEM_IMAGE
2214
Anton Hansson30e061b2018-11-12 13:36:46 +00002215.PHONY: sync syncsys
2216sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
Colin Cross91a52272017-06-20 16:57:52 -07002217
The Android Open Source Project88b60792009-03-03 19:28:42 -08002218#######
2219## system tarball
2220define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07002221 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
2222 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002223 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002224 $(call create-system-product_services-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07002225 $(MKTARBALL) $(FS_GET_STATS) \
2226 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002227 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002228endef
2229
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002230ifndef SYSTEM_TARBALL_FORMAT
2231 SYSTEM_TARBALL_FORMAT := bz2
2232endif
2233
The Android Open Source Project88b60792009-03-03 19:28:42 -08002234system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002235INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002236$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
2237$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
2238 $(build-systemtarball-target)
2239
2240.PHONY: systemtarball-nodeps
2241systemtarball-nodeps: $(FS_GET_STATS) \
2242 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
2243 $(build-systemtarball-target)
2244
2245.PHONY: stnod
2246stnod: systemtarball-nodeps
2247
Ying Wang3a61eeb2016-03-11 10:32:01 -08002248# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07002249## platform.zip: system, plus other files to be used in PDK fusion build,
2250## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07002251##
2252## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
2253## The variable will be typically set from BoardConfig.mk.
2254## Files under out dir will be rejected to prevent possible conflicts with other rules.
Colin Cross53c8f972018-09-28 16:19:42 -07002255ifneq (,$(BUILD_PLATFORM_ZIP))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002256pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002257 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002258pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002259 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002260pdk_classes_dex := $(strip \
2261 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
2262 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
2263
2264pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
2265$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
2266$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
2267$(pdk_odex_config_mk) :
2268 @echo "PDK odex config makefile: $@"
2269 $(hide) mkdir -p $(dir $@)
2270 $(hide) echo "# Auto-generated. Do not modify." > $@
2271 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
2272 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
2273 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
2274 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
2275 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2276 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2277 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2278 )
2279 $(foreach m,$(PRIVATE_APPS),\
2280 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
2281 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2282 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2283 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2284 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07002285 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08002286 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
2287 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
2288 )
2289
keunyoungc0178062013-07-22 14:54:58 -07002290PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07002291INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08002292
2293$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
2294$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
Colin Cross7363cde2018-09-14 21:51:11 -07002295$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP)
2296# dependencies for the other partitions are defined below after their file lists
2297# are known
Dan Willemsenad6a1542018-12-14 01:04:19 -08002298$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(api_fingerprint)
Keun young Park816b9fd2012-05-16 10:32:41 -07002299 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Colin Cross7363cde2018-09-14 21:51:11 -07002300 rm -f $@ $@.lst
2301 echo "-C $(PRODUCT_OUT)" >> $@.lst
2302 echo "-D $(TARGET_OUT)" >> $@.lst
2303 echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst
2304 echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst
Dan Willemsen67495202019-01-16 12:42:05 -08002305ifdef BUILDING_VENDOR_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002306 echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst
Ying Wangcff38622014-07-16 17:46:35 -07002307endif
Dan Willemsen67495202019-01-16 12:42:05 -08002308ifdef BUILDING_PRODUCT_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002309 echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002310endif
Dan Willemsen67495202019-01-16 12:42:05 -08002311ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002312 echo "-D $(TARGET_OUT_PRODUCT_SERVICES)" >> $@.lst
Dario Freni5f681e12018-05-29 13:09:01 +01002313endif
Dan Willemsen67495202019-01-16 12:42:05 -08002314ifdef BUILDING_ODM_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002315 echo "-D $(TARGET_OUT_ODM)" >> $@.lst
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002316endif
Colin Crossc451a372013-12-18 19:36:44 -08002317ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Colin Cross7363cde2018-09-14 21:51:11 -07002318 echo "-C $(OUT_DIR)" >> $@.lst
2319 for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \
2320 if [ -e $$f ]; then \
2321 echo "-f $$f"; \
2322 fi \
2323 done >> $@.lst
Keun young Park816b9fd2012-05-16 10:32:41 -07002324endif
keunyoungc0178062013-07-22 14:54:58 -07002325ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Colin Cross7363cde2018-09-14 21:51:11 -07002326 echo "-C . $(addprefix -f ,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))" >> $@.lst
keunyoungc0178062013-07-22 14:54:58 -07002327endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08002328 @# Add dex-preopt files and config.
Colin Cross7363cde2018-09-14 21:51:11 -07002329 $(if $(PRIVATE_DEX_FILES),\
2330 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst
Dan Willemsenad6a1542018-12-14 01:04:19 -08002331 echo "-C $(dir $(api_fingerprint)) -f $(api_fingerprint)" >> $@.lst
Colin Cross7363cde2018-09-14 21:51:11 -07002332 touch $(PRODUCT_OUT)/pdk.mk
2333 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst
2334 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst
Ying Wang4c289e52012-03-30 13:52:54 -07002335
2336.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07002337platform: $(INSTALLED_PLATFORM_ZIP)
2338
2339.PHONY: platform-java
2340platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07002341
2342# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07002343ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
2344$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07002345endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002346
Colin Cross53c8f972018-09-28 16:19:42 -07002347endif # BUILD_PLATFORM_ZIP
2348
Ying Wang3a61eeb2016-03-11 10:32:01 -08002349# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07002350## boot tarball
2351define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07002352 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07002353 $(hide) mkdir -p $(PRODUCT_OUT)/boot
2354 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002355 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07002356 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
2357 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002358 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07002359endef
2360
2361ifndef BOOT_TARBALL_FORMAT
2362 BOOT_TARBALL_FORMAT := bz2
2363endif
2364
2365boot_tar := $(PRODUCT_OUT)/boot.tar
2366INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
2367$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
2368$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
2369 $(build-boottarball-target)
2370
2371.PHONY: boottarball-nodeps btnod
2372boottarball-nodeps btnod: $(FS_GET_STATS) \
2373 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
2374 $(build-boottarball-target)
2375
2376
The Android Open Source Project88b60792009-03-03 19:28:42 -08002377# -----------------------------------------------------------------
2378# data partition image
2379INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002380 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002381
Dan Willemsen67495202019-01-16 12:42:05 -08002382ifdef BUILDING_USERDATA_IMAGE
Ying Wangbd93d422011-10-28 17:02:30 -07002383userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002384 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07002385BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
2386
Ying Wangbd93d422011-10-28 17:02:30 -07002387define build-userdataimage-target
2388 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
2389 @mkdir -p $(TARGET_OUT_DATA)
2390 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002391 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002392 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002393 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002394 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002395 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07002396endef
2397
Joe Onorato64d85d02009-04-09 19:31:12 -07002398# We just build this directly to the install location.
2399INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002400INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
2401 $(INTERNAL_USERIMAGES_DEPS) \
2402 $(INTERNAL_USERDATAIMAGE_FILES) \
2403 $(BUILD_IMAGE_SRCS)
2404$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002405 $(build-userdataimage-target)
2406
2407.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07002408userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002409 $(build-userdataimage-target)
2410
Dan Willemsen67495202019-01-16 12:42:05 -08002411endif # BUILDING_USERDATA_IMAGE
Ying Wange215ed52012-10-15 14:36:22 -07002412
Andreas Gampe039b5c72017-03-24 16:06:31 -07002413# ASAN libraries in the system image - build rule.
2414ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
2415 $(TARGET_OUT_SHARED_LIBRARIES) \
2416 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
2417 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
2418 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07002419# Extra options: Enforce the system user for the files to avoid having to change ownership.
2420ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07002421# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
2422# enough space.
2423$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07002424 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 -07002425
The Android Open Source Project88b60792009-03-03 19:28:42 -08002426#######
2427## data partition tarball
2428define build-userdatatarball-target
2429 $(call pretty,"Target userdata fs tarball: " \
2430 "$(INSTALLED_USERDATATARBALL_TARGET)")
2431 $(MKTARBALL) $(FS_GET_STATS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002432 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
2433 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002434endef
2435
2436userdata_tar := $(PRODUCT_OUT)/userdata.tar
2437INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
2438$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
2439$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
2440 $(build-userdatatarball-target)
2441
Dan Willemsen69af2e42016-08-16 16:36:05 -07002442$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
2443
The Android Open Source Project88b60792009-03-03 19:28:42 -08002444.PHONY: userdatatarball-nodeps
2445userdatatarball-nodeps: $(FS_GET_STATS)
2446 $(build-userdatatarball-target)
2447
2448
The Android Open Source Project88b60792009-03-03 19:28:42 -08002449# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04002450# partition table image
2451ifdef BOARD_BPT_INPUT_FILES
2452
2453BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002454BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04002455
2456INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
2457 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002458 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04002459 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
2460
2461ifdef BOARD_BPT_DISK_SIZE
2462INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
2463endif
2464
2465define build-bptimage-target
2466 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
2467 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
2468endef
2469
2470INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002471$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
2472 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
2473
David Zeuthen25328622016-04-08 15:08:03 -04002474$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
2475 $(build-bptimage-target)
2476
2477.PHONY: bptimage-nodeps
2478bptimage-nodeps:
2479 $(build-bptimage-target)
2480
2481endif # BOARD_BPT_INPUT_FILES
2482
2483# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07002484# cache partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002485ifdef BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002486INTERNAL_CACHEIMAGE_FILES := \
2487 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
2488
2489cacheimage_intermediates := \
2490 $(call intermediates-dir-for,PACKAGING,cache)
2491BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
2492
2493define build-cacheimage-target
2494 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
2495 @mkdir -p $(TARGET_OUT_CACHE)
2496 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002497 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002498 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002499 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002500 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002501 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07002502endef
2503
2504# We just build this directly to the install location.
2505INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002506$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002507 $(build-cacheimage-target)
2508
2509.PHONY: cacheimage-nodeps
2510cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2511 $(build-cacheimage-target)
2512
Dan Willemsen67495202019-01-16 12:42:05 -08002513else # BUILDING_CACHE_IMAGE
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07002514# we need to ignore the broken cache link when doing the rsync
2515IGNORE_CACHE_LINK := --exclude=cache
Dan Willemsen67495202019-01-16 12:42:05 -08002516endif # BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002517
David Zeuthen0eb10972016-09-28 17:55:27 -04002518# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07002519# system_other partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002520ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002521ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
Alex Light4e358ab2016-06-16 14:47:10 -07002522# Marker file to identify that odex files are installed
2523INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2524ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2525$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2526 $(hide) touch $@
2527endif
2528
Alex Light4e358ab2016-06-16 14:47:10 -07002529INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2530 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2531 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002532 $(ALL_PDK_FUSION_FILES)) \
2533 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002534
Colin Cross6db5b0e2018-11-16 21:26:33 -08002535# system_other dex files are installed as a side-effect of installing system image files
2536INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES)
2537
Alex Light4e358ab2016-06-16 14:47:10 -07002538INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002539INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2540$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002541$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07002542 @echo Installed file list: $@
2543 @mkdir -p $(dir $@)
2544 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002545 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002546 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002547
Bowgo Tsai867ab662019-01-29 13:30:18 +08002548# Determines partition size for system_other.img.
2549ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
2550ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
2551INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE)
2552endif
2553endif
2554
2555ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE
2556INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE)
2557endif
2558
Alex Light4e358ab2016-06-16 14:47:10 -07002559systemotherimage_intermediates := \
2560 $(call intermediates-dir-for,PACKAGING,system_other)
2561BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2562
2563# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2564define build-systemotherimage-target
2565 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2566 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2567 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002568 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002569 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002570 build/make/tools/releasetools/build_image.py \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002571 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
2572 $(systemotherimage_intermediates)/generated_system_other_image_info.txt
2573 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
2574 $(call read-image-prop-dictionary,\
Bowgo Tsai867ab662019-01-29 13:30:18 +08002575 $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_other_size))
Alex Light4e358ab2016-06-16 14:47:10 -07002576endef
2577
2578# We just build this directly to the install location.
2579INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002580ifneq (true,$(SANITIZE_LITE))
2581# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002582$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2583 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002584endif
Alex Light4e358ab2016-06-16 14:47:10 -07002585
2586.PHONY: systemotherimage-nodeps
2587systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2588 $(build-systemotherimage-target)
2589
Dan Willemsen67495202019-01-16 12:42:05 -08002590endif # BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002591
2592
2593# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002594# vendor partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002595ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07002596INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002597 $(filter $(TARGET_OUT_VENDOR)/%,\
2598 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002599 $(ALL_PDK_FUSION_FILES)) \
2600 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002601
Steven Moreland627debe2018-05-01 09:54:21 -07002602# Final Vendor VINTF manifest including fragments. This is not assembled
2603# on the device because it depends on everything in a given device
2604# image which defines a vintf_fragment.
2605ifdef BUILT_VENDOR_MANIFEST
2606BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
2607ifeq (true,$(strip $(PRODUCT_ENFORCE_VINTF_MANIFEST)))
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002608ifneq ($(strip $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)),)
Steven Moreland627debe2018-05-01 09:54:21 -07002609$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002610endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
Steven Moreland627debe2018-05-01 09:54:21 -07002611endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2612$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2613$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2614$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2615$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
Yifan Hong770ab052018-11-02 13:43:30 -07002616
2617$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS :=
2618
2619# -- Kernel version and configurations.
2620ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
2621
2622# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
2623# from INSTALLED_KERNEL_TARGET.
2624ifdef BOARD_KERNEL_CONFIG_FILE
2625ifdef BOARD_KERNEL_VERSION
2626$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BOARD_KERNEL_CONFIG_FILE)
2627$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $(BOARD_KERNEL_VERSION):$(BOARD_KERNEL_CONFIG_FILE)
2628my_board_extracted_kernel := true
2629endif # BOARD_KERNEL_VERSION
2630endif # BOARD_KERNEL_CONFIG_FILE
2631
2632ifneq ($(my_board_extracted_kernel),true)
2633ifndef INSTALLED_KERNEL_TARGET
2634$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2635 is true. Information about the updated kernel cannot be built into OTA update package. \
2636 You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
2637 to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
2638 or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
2639 BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2640 manually.)
2641else
2642intermediates := $(call intermediates-dir-for,ETC,$(notdir $(BUILT_ASSEMBLED_VENDOR_MANIFEST)))
2643
2644# Tools for decompression that is not in PATH.
2645# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
2646# Algorithms that are in the script but not in this list will be found in PATH.
2647my_decompress_tools := \
2648 lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
2649
2650my_kernel_configs := $(intermediates)/kernel_configs.txt
2651my_kernel_version := $(intermediates)/kernel_version.txt
2652$(my_kernel_configs): .KATI_IMPLICIT_OUTPUTS := $(my_kernel_version)
2653$(my_kernel_configs): PRIVATE_KERNEL_VERSION_FILE := $(my_kernel_version)
2654$(my_kernel_configs): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
2655$(my_kernel_configs): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
2656$(my_kernel_configs): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
2657 $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
2658 --output-configs $@ \
2659 --output-version $(PRIVATE_KERNEL_VERSION_FILE)
2660
2661$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(my_kernel_configs) $(my_kernel_version)
2662$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $$(cat $(my_kernel_version)):$(my_kernel_configs)
2663
2664intermediates :=
2665my_kernel_configs :=
2666my_kernel_version :=
2667my_decompress_tools :=
2668
2669endif # my_board_extracted_kernel
2670my_board_extracted_kernel :=
2671
2672endif # INSTALLED_KERNEL_TARGET
2673endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
2674
2675$(BUILT_ASSEMBLED_VENDOR_MANIFEST):
Steven Moreland627debe2018-05-01 09:54:21 -07002676 @echo "Verifying vendor VINTF manifest."
2677 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2678 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2679 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Yifan Hong770ab052018-11-02 13:43:30 -07002680 $(PRIVATE_FLAGS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002681 -c $(BUILT_SYSTEM_MATRIX) \
2682 -i $(BUILT_VENDOR_MANIFEST) \
2683 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2684 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2685 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002686endif # BUILT_VENDOR_MANIFEST
2687
Ying Wangcff38622014-07-16 17:46:35 -07002688# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2689$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002690
Ying Wang8da19e32015-09-15 14:22:12 -07002691INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002692INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2693$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002694$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002695 @echo Installed file list: $@
2696 @mkdir -p $(dir $@)
2697 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002698 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002699 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002700
Ying Wanga0febe52013-03-20 11:02:05 -07002701vendorimage_intermediates := \
2702 $(call intermediates-dir-for,PACKAGING,vendor)
2703BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002704define build-vendorimage-target
2705 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2706 @mkdir -p $(TARGET_OUT_VENDOR)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002707 $(call create-vendor-odm-symlink)
Ying Wanga0febe52013-03-20 11:02:05 -07002708 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002709 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002710 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2711 $(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 -07002712 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002713 build/make/tools/releasetools/build_image.py \
Yifan Hong749062d2018-06-19 16:23:16 -07002714 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
2715 $(vendorimage_intermediates)/generated_vendor_image_info.txt
2716 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
2717 $(call read-image-prop-dictionary,\
2718 $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
Ying Wanga0febe52013-03-20 11:02:05 -07002719endef
2720
2721# We just build this directly to the install location.
2722INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002723ifdef BUILT_VENDOR_MANIFEST
2724$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2725endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002726$(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 -07002727 $(build-vendorimage-target)
2728
Steven Morelanda2e734d2017-03-07 12:10:09 -08002729.PHONY: vendorimage-nodeps vnod
2730vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002731 $(build-vendorimage-target)
2732
Colin Cross91a52272017-06-20 16:57:52 -07002733sync: $(INTERNAL_VENDORIMAGE_FILES)
2734
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002735else ifdef BOARD_PREBUILT_VENDORIMAGE
2736INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2737$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2738endif
Ying Wanga0febe52013-03-20 11:02:05 -07002739
Ying Wang9f8e8db2011-11-04 11:37:01 -07002740# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002741# product partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002742ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002743INTERNAL_PRODUCTIMAGE_FILES := \
2744 $(filter $(TARGET_OUT_PRODUCT)/%,\
2745 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002746 $(ALL_PDK_FUSION_FILES)) \
2747 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002748
2749# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2750$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2751
2752INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002753INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2754$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002755$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2756 @echo Installed file list: $@
2757 @mkdir -p $(dir $@)
2758 @rm -f $@
2759 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2760 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2761
2762productimage_intermediates := \
2763 $(call intermediates-dir-for,PACKAGING,product)
2764BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2765define build-productimage-target
2766 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2767 @mkdir -p $(TARGET_OUT_PRODUCT)
2768 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002769 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002770 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2771 ./build/tools/releasetools/build_image.py \
Yifan Hong56a6c3b2018-07-20 15:19:34 -07002772 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT) \
2773 $(productimage_intermediates)/generated_product_image_info.txt
2774 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),\
2775 $(call read-image-prop-dictionary,\
2776 $(productimage_intermediates)/generated_product_image_info.txt,product_size))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002777endef
2778
2779# We just build this directly to the install location.
2780INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2781$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2782 $(build-productimage-target)
2783
2784.PHONY: productimage-nodeps pnod
2785productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2786 $(build-productimage-target)
2787
2788sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2789
2790else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2791INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2792$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2793endif
2794
2795# -----------------------------------------------------------------
Dario Freni924af7d2018-08-17 00:56:14 +01002796# product_services partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002797ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni5f681e12018-05-29 13:09:01 +01002798INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
2799 $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
2800 $(ALL_DEFAULT_INSTALLED_MODULES)\
2801 $(ALL_PDK_FUSION_FILES)) \
2802 $(PDK_FUSION_SYMLINK_STAMP)
2803
2804# platform.zip depends on $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES).
2805$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2806
Dario Freni924af7d2018-08-17 00:56:14 +01002807INSTALLED_FILES_FILE_PRODUCT_SERVICES := $(PRODUCT_OUT)/installed-files-product_services.txt
Dario Freni5f681e12018-05-29 13:09:01 +01002808INSTALLED_FILES_JSON_PRODUCT_SERVICES := $(INSTALLED_FILES_FILE_PRODUCT_SERVICES:.txt=.json)
2809$(INSTALLED_FILES_FILE_PRODUCT_SERVICES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT_SERVICES)
2810$(INSTALLED_FILES_FILE_PRODUCT_SERVICES) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(FILESLIST)
2811 @echo Installed file list: $@
2812 @mkdir -p $(dir $@)
2813 @rm -f $@
2814 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT_SERVICES) > $(@:.txt=.json)
2815 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2816
Yifan Hongebc041a2018-07-26 16:02:52 -07002817product_servicesimage_intermediates := \
2818 $(call intermediates-dir-for,PACKAGING,product_services)
Dario Freni924af7d2018-08-17 00:56:14 +01002819BUILT_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
2820define build-product_servicesimage-target
2821 $(call pretty,"Target product_services fs image: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)")
Dario Freni5f681e12018-05-29 13:09:01 +01002822 @mkdir -p $(TARGET_OUT_PRODUCT_SERVICES)
Yifan Hongebc041a2018-07-26 16:02:52 -07002823 @mkdir -p $(product_servicesimage_intermediates) && rm -rf $(product_servicesimage_intermediates)/product_services_image_info.txt
2824 $(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 +01002825 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2826 ./build/tools/releasetools/build_image.py \
Yifan Hongebc041a2018-07-26 16:02:52 -07002827 $(TARGET_OUT_PRODUCT_SERVICES) $(product_servicesimage_intermediates)/product_services_image_info.txt $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(TARGET_OUT) \
2828 $(product_servicesimage_intermediates)/generated_product_services_image_info.txt
Yifan Hong9c35a022018-07-20 15:33:47 -07002829 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),\
2830 $(call read-image-prop-dictionary,\
Yifan Hongebc041a2018-07-26 16:02:52 -07002831 $(product_servicesimage_intermediates)/generated_product_services_image_info.txt,product_services_size))
Dario Freni5f681e12018-05-29 13:09:01 +01002832endef
2833
2834# We just build this directly to the install location.
2835INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(BUILT_PRODUCT_SERVICESIMAGE_TARGET)
2836$(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 +01002837 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002838
2839.PHONY: productservicesimage-nodeps psnod
2840productservicesimage-nodeps psnod: | $(INTERNAL_USERIMAGES_DEPS)
Dario Freni924af7d2018-08-17 00:56:14 +01002841 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002842
2843sync: $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2844
2845else ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002846INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
Dario Freni5f681e12018-05-29 13:09:01 +01002847$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCT_SERVICESIMAGE),$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)))
2848endif
2849
2850# -----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002851# odm partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002852ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002853INTERNAL_ODMIMAGE_FILES := \
2854 $(filter $(TARGET_OUT_ODM)/%,\
2855 $(ALL_DEFAULT_INSTALLED_MODULES)\
2856 $(ALL_PDK_FUSION_FILES)) \
2857 $(PDK_FUSION_SYMLINK_STAMP)
2858# platform.zip depends on $(INTERNAL_ODMIMAGE_FILES).
2859$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODMIMAGE_FILES)
2860
2861INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt
2862INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json)
2863$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM)
2864$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST)
2865 @echo Installed file list: $@
2866 @mkdir -p $(dir $@)
2867 @rm -f $@
2868 $(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json)
2869 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2870
2871odmimage_intermediates := \
2872 $(call intermediates-dir-for,PACKAGING,odm)
2873BUILT_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2874define build-odmimage-target
2875 $(call pretty,"Target odm fs image: $(INSTALLED_ODMIMAGE_TARGET)")
2876 @mkdir -p $(TARGET_OUT_ODM)
2877 @mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt
2878 $(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true)
2879 $(if $(BOARD_ODM_KERNEL_MODULES), \
2880 $(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm/,$(call intermediates-dir-for,PACKAGING,depmod_odm)))
2881 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2882 ./build/tools/releasetools/build_image.py \
2883 $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT) \
2884 $(odmimage_intermediates)/generated_odm_image_info.txt
2885 $(hide) $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),\
2886 $(call read-image-prop-dictionary,\
2887 $(odmimage_intermediates)/generated_odm_image_info.txt,odm_size))
2888endef
2889
2890# We just build this directly to the install location.
2891INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET)
2892$(INSTALLED_ODMIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_ODMIMAGE_FILES) $(INSTALLED_FILES_FILE_ODM) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_ODM_KERNEL_MODULES)
2893 $(build-odmimage-target)
2894
2895.PHONY: odmimage-nodeps onod
2896odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
2897 $(build-odmimage-target)
2898
2899sync: $(INTERNAL_ODMIMAGE_FILES)
2900
2901else ifdef BOARD_PREBUILT_ODMIMAGE
2902INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
2903$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET)))
2904endif
2905
2906# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07002907# dtbo image
2908ifdef BOARD_PREBUILT_DTBOIMAGE
2909INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
2910
2911ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002912$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002913 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2914 $(AVBTOOL) add_hash_footer \
Anton Hansson6d814982018-11-26 18:12:05 +00002915 --image $@ \
2916 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
2917 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
2918 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002919else
2920$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
2921 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2922endif
2923
Tao Bao0da43472018-08-22 22:53:41 -07002924endif # BOARD_PREBUILT_DTBOIMAGE
2925
2926# Returns a list of image targets corresponding to the given list of partitions. For example, it
2927# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET)
2928# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor".
2929# (1): list of partitions like "system", "vendor" or "system product product_services".
2930define images-for-partitions
2931$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))
2932endef
Yueyao Zhu211c9012017-04-27 00:34:50 -07002933
2934# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002935# vbmeta image
2936ifeq ($(BOARD_AVB_ENABLE),true)
2937
2938BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002939AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002940
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002941ifdef BOARD_AVB_KEY_PATH
2942$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
2943else
2944# If key path isn't specified, use the 4096-bit test key.
2945BOARD_AVB_ALGORITHM := SHA256_RSA4096
2946BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
2947endif
2948
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08002949# AVB signing for system_other.img.
2950ifdef BUILDING_SYSTEM_OTHER_IMAGE
2951ifdef BOARD_AVB_SYSTEM_OTHER_KEY_PATH
2952$(if $(BOARD_AVB_SYSTEM_OTHER_ALGORITHM),,$(error BOARD_AVB_SYSTEM_OTHER_ALGORITHM is not defined))
2953else
2954# If key path isn't specified, use the same key as BOARD_AVB_KEY_PATH.
2955BOARD_AVB_SYSTEM_OTHER_KEY_PATH := $(BOARD_AVB_KEY_PATH)
2956BOARD_AVB_SYSTEM_OTHER_ALGORITHM := $(BOARD_AVB_ALGORITHM)
2957endif
2958
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08002959# To extract the public key of SYSTEM_OTHER_KEY_PATH will into system.img:
2960# /system/etc/security/avb/system_other.avbpubkey.
2961FULL_SYSTEMIMAGE_DEPS += $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)
2962
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08002963ifndef BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX
2964BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
2965endif
2966
2967BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX)
2968endif # end of AVB for BUILDING_SYSTEM_OTHER_IMAGE
2969
Tao Bao744c4c72018-08-20 21:09:07 -07002970INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \
David Anderson7709ab22018-10-15 14:41:34 -07002971 $(BOARD_AVB_VBMETA_SYSTEM) \
Tao Bao744c4c72018-08-20 21:09:07 -07002972 $(BOARD_AVB_VBMETA_VENDOR)
2973
2974# Not allowing the same partition to appear in multiple groups.
2975ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
David Anderson7709ab22018-10-15 14:41:34 -07002976 $(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates)
Tao Bao744c4c72018-08-20 21:09:07 -07002977endif
2978
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08002979# Appends security patch level as a AVB property descriptor
2980
2981BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
2982 --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
2983
2984BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
2985 --prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
2986
2987BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS += \
2988 --prop com.android.build.product_services.security_patch:$(PLATFORM_SECURITY_PATCH)
2989
2990# The following vendor- and odm-specific images needs explicitly set per board.
2991ifdef BOOT_SECURITY_PATCH
2992BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
2993 --prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH)
2994endif
2995
2996ifdef VENDOR_SECURITY_PATCH
2997BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
2998 --prop com.android.build.vendor.security_patch:$(VENDOR_SECURITY_PATCH)
2999endif
3000
3001ifdef ODM_SECURITY_PATCH
3002BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
3003 --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH)
3004endif
3005
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003006BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
3007DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
3008SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
3009VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05003010RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003011PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Dario Freni5f681e12018-05-29 13:09:01 +01003012PRODUCT_SERVICES_FOOTER_ARGS := BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003013ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003014
Tao Bao0da43472018-08-22 22:53:41 -07003015# Helper function that checks and sets required build variables for an AVB chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003016# $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system.
Tao Bao0da43472018-08-22 22:53:41 -07003017define _check-and-set-avb-chain-args
3018$(eval part := $(1))
3019$(eval PART=$(call to-upper,$(part)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003020
3021$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
3022$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
3023$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
3024$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
3025$(if $($(_key_path)),,$(error $(_key_path) is not defined))
3026$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
3027$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
3028$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
3029
3030# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
3031$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
3032$(eval $(_signing_args) := \
3033 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
3034
3035$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3036 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
3037
Tao Bao744c4c72018-08-20 21:09:07 -07003038# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up
David Anderson7709ab22018-10-15 14:41:34 -07003039# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX).
Tao Bao744c4c72018-08-20 21:09:07 -07003040$(if $(filter $(part),$(part:vbmeta_%=%)),\
3041 $(eval _footer_args := $(PART)_FOOTER_ARGS) \
3042 $(eval $($(_footer_args)) += --rollback_index $($(_rollback_index))))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003043endef
3044
Tao Bao0da43472018-08-22 22:53:41 -07003045# Checks and sets the required build variables for an AVB partition. The partition will be
3046# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the
Tao Bao744c4c72018-08-20 21:09:07 -07003047# image descriptor will be included into vbmeta.img, unless it has been already added to any chained
3048# VBMeta image.
Tao Bao0da43472018-08-22 22:53:41 -07003049# $(1): Partition name, e.g. boot or system.
3050define check-and-set-avb-args
Tao Bao744c4c72018-08-20 21:09:07 -07003051$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
Tao Bao0da43472018-08-22 22:53:41 -07003052$(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\
Tao Bao744c4c72018-08-20 21:09:07 -07003053 $(if $(_in_chained_vbmeta),\
3054 $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \
Tao Bao0da43472018-08-22 22:53:41 -07003055 $(call _check-and-set-avb-chain-args,$(1)),\
Tao Bao744c4c72018-08-20 21:09:07 -07003056 $(if $(_in_chained_vbmeta),,\
3057 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3058 --include_descriptors_from_image $(call images-for-partitions,$(1)))))
Tao Bao0da43472018-08-22 22:53:41 -07003059endef
3060
Tao Baob1a2e352018-08-14 16:17:12 -07003061ifdef INSTALLED_BOOTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003062$(eval $(call check-and-set-avb-args,boot))
Tao Baob1a2e352018-08-14 16:17:12 -07003063endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003064
Tao Bao0da43472018-08-22 22:53:41 -07003065$(eval $(call check-and-set-avb-args,system))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003066
3067ifdef INSTALLED_VENDORIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003068$(eval $(call check-and-set-avb-args,vendor))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003069endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003070
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003071ifdef INSTALLED_PRODUCTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003072$(eval $(call check-and-set-avb-args,product))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003073endif
3074
Tao Baocee6d042018-08-22 23:39:03 -07003075ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003076$(eval $(call check-and-set-avb-args,product_services))
Tao Baocee6d042018-08-22 23:39:03 -07003077endif
3078
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003079ifdef INSTALLED_ODMIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003080$(eval $(call check-and-set-avb-args,odm))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003081endif
3082
Yueyao Zhu211c9012017-04-27 00:34:50 -07003083ifdef INSTALLED_DTBOIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003084$(eval $(call check-and-set-avb-args,dtbo))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003085endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07003086
David Zeuthen8fecb282017-12-01 16:24:01 -05003087ifdef INSTALLED_RECOVERYIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003088$(eval $(call check-and-set-avb-args,recovery))
David Zeuthen8fecb282017-12-01 16:24:01 -05003089endif
Bowgo Tsai53cf9992017-06-13 11:27:06 +08003090
David Anderson7709ab22018-10-15 14:41:34 -07003091# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet.
3092ifdef BOARD_AVB_VBMETA_SYSTEM
3093$(eval $(call check-and-set-avb-args,vbmeta_system))
Tao Bao744c4c72018-08-20 21:09:07 -07003094endif
3095
3096ifdef BOARD_AVB_VBMETA_VENDOR
3097$(eval $(call check-and-set-avb-args,vbmeta_vendor))
3098endif
3099
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003100# Add kernel cmdline descriptor for kernel to mount system.img as root with
3101# dm-verity. This works when system.img is either chained or not-chained:
3102# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
3103# cmdline descriptor to system.img
3104# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
3105# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08003106ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
David Anderson8916a2a2018-09-18 15:46:59 -07003107ifeq ($(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003108BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08003109endif
David Anderson8916a2a2018-09-18 15:46:59 -07003110endif
Bowgo Tsai9b377602017-04-14 18:50:11 +08003111
Tao Bao0da43472018-08-22 22:53:41 -07003112BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
David Anderson7709ab22018-10-15 14:41:34 -07003113BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += --padding_size 4096
Tao Bao744c4c72018-08-20 21:09:07 -07003114BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += --padding_size 4096
3115
3116ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
Tao Bao240dcb82018-10-22 13:02:53 -07003117# We only need the flag in top-level vbmeta.img.
Tao Bao744c4c72018-08-20 21:09:07 -07003118BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
Tao Bao744c4c72018-08-20 21:09:07 -07003119endif
Tao Bao0da43472018-08-22 22:53:41 -07003120
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003121ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003122BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003123endif
3124
David Anderson7709ab22018-10-15 14:41:34 -07003125ifdef BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX
3126BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += \
3127 --rollback_index $(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX)
Tao Bao744c4c72018-08-20 21:09:07 -07003128endif
3129
3130ifdef BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX
3131BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += \
3132 --rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX)
John Reck0588b432018-05-03 13:20:01 -07003133endif
3134
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003135# $(1): the directory to extract public keys to
3136define extract-avb-chain-public-keys
3137 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
3138 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
3139 --output $(1)/boot.avbpubkey)
3140 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
3141 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
3142 --output $(1)/system.avbpubkey)
3143 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
3144 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
3145 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003146 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
3147 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
3148 --output $(1)/product.avbpubkey)
Dario Freni5f681e12018-05-29 13:09:01 +01003149 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
3150 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH) \
Dario Freni924af7d2018-08-17 00:56:14 +01003151 --output $(1)/product_services.avbpubkey)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003152 $(if $(BOARD_AVB_ODM_KEY_PATH),\
3153 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \
3154 --output $(1)/odm.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003155 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
3156 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
3157 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05003158 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
3159 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
3160 --output $(1)/recovery.avbpubkey)
David Anderson7709ab22018-10-15 14:41:34 -07003161 $(if $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH),\
3162 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3163 --output $(1)/vbmeta_system.avbpubkey)
Tao Bao744c4c72018-08-20 21:09:07 -07003164 $(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\
3165 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3166 --output $(1)/vbmeta_vendor.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003167endef
3168
Tao Bao744c4c72018-08-20 21:09:07 -07003169# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
3170# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level
David Anderson7709ab22018-10-15 14:41:34 -07003171# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM
3172# := system product_services`, `vbmeta_system.img` will be created that includes the descriptors
3173# for `system.img` and `product_services.img`. `vbmeta_system.img` itself will be included into
Tao Bao744c4c72018-08-20 21:09:07 -07003174# `vbmeta.img` as a chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003175# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
Tao Bao744c4c72018-08-20 21:09:07 -07003176# $(2): Output filename.
3177define build-chained-vbmeta-image
3178 $(call pretty,"Target chained vbmeta image: $@")
3179 $(hide) $(AVBTOOL) make_vbmeta_image \
3180 $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
3181 $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
3182 $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
3183 --include_descriptors_from_image $(call images-for-partitions,$(image))) \
3184 --output $@
3185endef
3186
David Anderson7709ab22018-10-15 14:41:34 -07003187ifdef BOARD_AVB_VBMETA_SYSTEM
3188INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img
3189$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003190 $(AVBTOOL) \
3191 $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
3192 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
David Anderson7709ab22018-10-15 14:41:34 -07003193 $(call build-chained-vbmeta-image,vbmeta_system)
Tao Bao744c4c72018-08-20 21:09:07 -07003194endif
3195
3196ifdef BOARD_AVB_VBMETA_VENDOR
3197INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img
3198$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003199 $(AVBTOOL) \
3200 $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
3201 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
Tao Bao744c4c72018-08-20 21:09:07 -07003202 $(call build-chained-vbmeta-image,vbmeta_vendor)
3203endif
3204
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003205define build-vbmetaimage-target
3206 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003207 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
3208 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003209 $(hide) $(AVBTOOL) make_vbmeta_image \
3210 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
Tao Bao0da43472018-08-22 22:53:41 -07003211 $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003212 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
3213 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003214 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003215endef
3216
3217INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
Tao Bao0da43472018-08-22 22:53:41 -07003218$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
3219 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
3220
David Zeuthen8fecb282017-12-01 16:24:01 -05003221$(INSTALLED_VBMETAIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003222 $(AVBTOOL) \
3223 $(INSTALLED_BOOTIMAGE_TARGET) \
3224 $(INSTALLED_SYSTEMIMAGE_TARGET) \
3225 $(INSTALLED_VENDORIMAGE_TARGET) \
3226 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3227 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3228 $(INSTALLED_ODMIMAGE_TARGET) \
3229 $(INSTALLED_DTBOIMAGE_TARGET) \
3230 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3231 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
3232 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
3233 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3234 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3235 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003236 $(build-vbmetaimage-target)
3237
3238.PHONY: vbmetaimage-nodeps
3239vbmetaimage-nodeps:
3240 $(build-vbmetaimage-target)
3241
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003242endif # BOARD_AVB_ENABLE
3243
3244# -----------------------------------------------------------------
Yifan Hong055e6cf2018-11-29 13:51:48 -08003245# Check image sizes <= size of super partition
3246
3247ifeq (,$(TARGET_BUILD_APPS))
3248# Do not check for apps-only build
3249
3250ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003251
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003252# (1): list of items like "system", "vendor", "product", "product_services"
3253# return: map each item into a command ( wrapped in $$() ) that reads the size
3254define read-size-of-partitions
3255$(foreach p,$(1),$(call read-image-prop-dictionary,$($(p)image_intermediates)/generated_$(p)_image_info.txt,$(p)_size))
3256endef
3257
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003258# round result to BOARD_SUPER_PARTITION_ALIGNMENT
3259#$(1): the calculated size
3260ifeq (,$(BOARD_SUPER_PARTITION_ALIGNMENT))
3261define round-partition-size
3262$(1)
3263endef
3264else
3265define round-partition-size
3266$$((($(1)+$(BOARD_SUPER_PARTITION_ALIGNMENT)-1)/$(BOARD_SUPER_PARTITION_ALIGNMENT)*$(BOARD_SUPER_PARTITION_ALIGNMENT)))
3267endef
3268endif
3269
David Anderson619fe2d2018-10-30 18:47:59 -07003270define super-slot-suffix
3271$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
3272endef
David Anderson1ef03e22018-08-30 13:11:47 -07003273
Yifan Hongb43012f2018-10-01 17:30:01 -07003274droid_targets: check-all-partition-sizes
Yifan Hong17dd45d2018-07-20 16:45:57 -07003275
Yifan Hongb43012f2018-10-01 17:30:01 -07003276.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
Yifan Hong17dd45d2018-07-20 16:45:57 -07003277
Yifan Hong17dd45d2018-07-20 16:45:57 -07003278# Add image dependencies so that generated_*_image_info.txt are written before checking.
Yifan Hongb43012f2018-10-01 17:30:01 -07003279check-all-partition-sizes: $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
Yifan Hong17dd45d2018-07-20 16:45:57 -07003280
David Anderson619fe2d2018-10-30 18:47:59 -07003281ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
Yifan Hongf39d8af2018-11-19 14:22:43 -08003282# Check sum(super partition block devices) == super partition
David Anderson619fe2d2018-10-30 18:47:59 -07003283# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
3284define check-super-partition-size
3285 size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
3286 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003287 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003288 if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003289 echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003290 echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
3291 exit 1; \
3292 else \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003293 echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003294 echo $${sum_sizes_expr} '==' $${max_size_expr}; \
3295 fi
3296endef
3297endif
3298
Yifan Hongb43012f2018-10-01 17:30:01 -07003299# $(1): human-readable max size string
3300# $(2): max size expression
3301# $(3): list of partition names
3302define check-sum-of-partition-sizes
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003303 partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
3304 echo $(call round-partition-size,$${i}); \
3305 done)"; \
3306 sum_sizes_expr=$$(tr '\n' '+' <<< "$${partition_size_list}" | sed 's/+$$//'); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003307 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \
3308 echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \
3309 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
3310 exit 1; \
3311 else \
3312 echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
3313 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
Yifan Hongd58e70b2019-01-11 13:20:52 -08003314 fi;
Yifan Hongb43012f2018-10-01 17:30:01 -07003315endef
Yifan Hong17dd45d2018-07-20 16:45:57 -07003316
Yifan Hongb43012f2018-10-01 17:30:01 -07003317define check-all-partition-sizes-target
Yifan Hongf39d8af2018-11-19 14:22:43 -08003318 # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003319 $(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003320 $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
3321 $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
Yifan Hongb43012f2018-10-01 17:30:01 -07003322
3323 # For each group, check sum(partitions in group) <= group size
3324 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
3325 $(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
3326 $(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
3327
Yifan Hongf39d8af2018-11-19 14:22:43 -08003328 # Check sum(all group sizes) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003329 if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
3330 group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
3331 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003332 max_size_tail=$(if $(call super-slot-suffix)," / 2"); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003333 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
3334 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
3335 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3336 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3337 exit 1; \
3338 else \
3339 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3340 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3341 fi \
3342 fi
3343endef
3344
3345check-all-partition-sizes check-all-partition-sizes-nodeps:
3346 $(call check-all-partition-sizes-target)
David Anderson619fe2d2018-10-30 18:47:59 -07003347 $(call check-super-partition-size)
Yifan Hongb43012f2018-10-01 17:30:01 -07003348
Yifan Hong2dae5722018-07-31 12:47:27 -07003349endif # PRODUCT_BUILD_SUPER_PARTITION
Yifan Hong17dd45d2018-07-20 16:45:57 -07003350
3351endif # TARGET_BUILD_APPS
3352
3353# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08003354# bring in the installer image generation defines if necessary
3355ifeq ($(TARGET_USE_DISKINSTALLER),true)
3356include bootable/diskinstaller/config.mk
3357endif
3358
3359# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07003360# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08003361
Ying Wangbd2d0242015-09-22 11:17:52 -07003362ifeq ($(BUILD_OS),darwin)
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003363 build_ota_package := false
3364 build_otatools_package := false
3365else
3366 # set build_ota_package, and allow opt-out below
3367 build_ota_package := true
3368 ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
3369 build_ota_package := false
3370 endif
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003371 ifneq (,$(filter address, $(SANITIZE_TARGET)))
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003372 build_ota_package := false
3373 endif
3374 ifeq ($(TARGET_PRODUCT),sdk)
3375 build_ota_package := false
3376 endif
3377 ifneq ($(filter generic%,$(TARGET_DEVICE)),)
3378 build_ota_package := false
3379 endif
3380 ifeq ($(TARGET_NO_KERNEL),true)
3381 build_ota_package := false
3382 endif
3383 ifeq ($(recovery_fstab),)
3384 build_ota_package := false
3385 endif
3386 ifeq ($(TARGET_BUILD_PDK),true)
3387 build_ota_package := false
3388 endif
3389
3390 # set build_otatools_package, and allow opt-out below
3391 build_otatools_package := true
3392 ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
3393 build_otatools_package := false
3394 endif
Colin Cross481cc5a2016-02-04 15:09:23 -08003395endif
Ying Wangbd2d0242015-09-22 11:17:52 -07003396
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003397ifeq ($(build_otatools_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07003398OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
3399 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08003400 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07003401 $(HOST_OUT_EXECUTABLES)/mkbootfs \
3402 $(HOST_OUT_EXECUTABLES)/mkbootimg \
3403 $(HOST_OUT_EXECUTABLES)/fs_config \
3404 $(HOST_OUT_EXECUTABLES)/zipalign \
3405 $(HOST_OUT_EXECUTABLES)/bsdiff \
3406 $(HOST_OUT_EXECUTABLES)/imgdiff \
Ying Wangc45a47b2015-04-08 12:24:37 -07003407 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
3408 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003409 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08003410 $(HOST_OUT_EXECUTABLES)/mke2fs \
Tianjie Xu57332222018-08-15 16:16:21 -07003411 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs \
Tao Baobcc31092017-01-06 14:24:18 -08003412 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Mark Salyzyn780f5952018-10-19 13:44:36 -07003413 $(HOST_OUT_EXECUTABLES)/tune2fs \
Tao Baocffaf732016-04-14 12:11:36 -07003414 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
3415 $(HOST_OUT_EXECUTABLES)/mksquashfs \
3416 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
3417 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08003418 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07003419 $(HOST_OUT_EXECUTABLES)/simg2img \
3420 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003421 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07003422 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08003423 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07003424 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07003425 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01003426 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003427 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08003428 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
3429 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07003430 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tianjie Xuccbae482018-08-15 14:28:27 -07003431 $(HOST_OUT_EXECUTABLES)/care_map_generator \
David Anderson1ef03e22018-08-30 13:11:47 -07003432 $(LPMAKE) \
Tao Bao3cba3742017-05-16 16:27:25 -07003433 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003434 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07003435 $(BROTLI) \
3436 $(BUILD_VERITY_METADATA) \
3437 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08003438
3439ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
3440OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08003441 $(FUTILITY) \
3442 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08003443endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08003444
Ying Wangc45a47b2015-04-08 12:24:37 -07003445# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07003446OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07003447 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
3448 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
3449 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003450 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08003451 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02003452 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003453 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
3454 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
3455 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
3456 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08003457 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08003458 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
3459 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08003460 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003461 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
3462 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
3463 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003464 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
3465 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00003466 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08003467 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08003468 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01003469 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08003470 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01003471 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003472 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
David Anderson1ef03e22018-08-30 13:11:47 -07003473 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX) \
3474 $(HOST_LIBRARY_PATH)/liblp$(HOST_SHLIB_SUFFIX) \
Tao Baoa19f8e92019-01-02 23:22:42 -08003475 $(HOST_LIBRARY_PATH)/libext4_utils$(HOST_SHLIB_SUFFIX) \
Tao Baobeea6c02019-01-03 12:18:24 -08003476 $(HOST_LIBRARY_PATH)/libfec$(HOST_SHLIB_SUFFIX) \
3477 $(HOST_LIBRARY_PATH)/libsquashfs_utils$(HOST_SHLIB_SUFFIX)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003478
The Android Open Source Project88b60792009-03-03 19:28:42 -08003479
Ying Wang06898662010-06-17 17:52:18 -07003480.PHONY: otatools
3481otatools: $(OTATOOLS)
3482
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003483BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07003484$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003485
Tao Baoe8ef8f702017-05-17 11:41:50 -07003486OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07003487 system/extras/ext4_utils/mke2fs.conf \
Dan Willemsen60c66442018-05-01 19:07:27 -07003488 $(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Tao Bao93ab8442018-10-12 11:03:04 -07003489 -name verity_key))
3490
3491ifneq (,$(wildcard device))
3492OTATOOLS_DEPS += \
Dan Willemsen60c66442018-05-01 19:07:27 -07003493 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
3494 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Bao93ab8442018-10-12 11:03:04 -07003495endif
3496ifneq (,$(wildcard external/avb))
3497OTATOOLS_DEPS += \
3498 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
3499 -name "atx_metadata.bin"))
3500endif
3501ifneq (,$(wildcard system/update_engine))
3502OTATOOLS_DEPS += \
3503 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print))
3504endif
Tao Baoe8ef8f702017-05-17 11:41:50 -07003505
3506OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07003507 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003508
3509ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
3510OTATOOLS_DEPS += \
Tao Bao5232f092018-02-10 04:03:32 +00003511 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003512endif
3513
Colin Cross21122f92018-09-14 21:51:11 -07003514$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) $(SOONG_ZIP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003515 @echo "Package OTA tools: $@"
3516 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07003517 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07003518 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Bill Peckhameabb7132019-02-15 11:25:34 -08003519 $(hide) cp $(SOONG_ZIP) $(zip_root)/bin/
Colin Cross21122f92018-09-14 21:51:11 -07003520 $(hide) cp -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003521 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Colin Cross21122f92018-09-14 21:51:11 -07003522 $(hide) $(SOONG_ZIP) -o $@ -C $(zip_root) -D $(zip_root) \
3523 -C . $(addprefix -f ,$(OTATOOLS_DEPS))
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003524
3525.PHONY: otatools-package
3526otatools-package: $(BUILT_OTATOOLS_PACKAGE)
3527
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003528endif # build_otatools_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003529
The Android Open Source Project88b60792009-03-03 19:28:42 -08003530# -----------------------------------------------------------------
3531# A zip of the directories that map to the target filesystem.
3532# This zip can be used to create an OTA package or filesystem image
3533# as a post-build step.
3534#
3535name := $(TARGET_PRODUCT)
3536ifeq ($(TARGET_BUILD_TYPE),debug)
3537 name := $(name)_debug
3538endif
3539name := $(name)-target_files-$(FILE_NAME_TAG)
3540
3541intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
3542BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
3543$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
3544$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003545 zip_root := $(intermediates)/$(name)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003546
3547# $(1): Directory to copy
3548# $(2): Location to copy it to
3549# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
3550define package_files-copy-root
3551 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
3552 mkdir -p $(2) && \
3553 $(ACP) -rd $(strip $(1))/* $(2); \
3554 fi
3555endef
3556
Tao Baoa04fca32015-11-30 12:22:24 -08003557built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07003558
3559# We can't build static executables when SANITIZE_TARGET=address
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003560ifeq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wange6e544e2015-06-22 18:35:35 -07003561built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07003562 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
3563endif
3564
The Android Open Source Project88b60792009-03-03 19:28:42 -08003565$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
3566
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003567$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003568$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003569
Doug Zongkerc18736b2009-09-30 09:20:32 -07003570ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
3571# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07003572tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07003573else
Dan Willemsen653bea92017-03-21 15:47:37 -07003574tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003575endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003576tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
3577$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
3578$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003579
Sen Jiang4438fd92016-03-07 16:51:01 -08003580ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08003581updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08003582else
Steve Fung48e49f52015-10-01 23:53:31 -07003583# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003584updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07003585endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003586$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07003587
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003588# If we are using recovery as boot, output recovery files to BOOT/.
3589ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
3590$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
3591else
3592$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
3593endif
3594
Dan Willemsen653bea92017-03-21 15:47:37 -07003595ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07003596 ifdef OSRELEASED_DIRECTORY
3597 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
3598 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
3599 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
3600 endif
3601endif
3602
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003603# Run fs_config while creating the target files package
3604# $1: root directory
3605# $2: add prefix
3606define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08003607(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 -08003608endef
3609
Yifan Hong2b891ac2018-11-29 12:06:31 -08003610# $(1): file
3611define dump-dynamic-partitions-info
3612 $(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \
3613 echo "use_dynamic_partitions=true" >> $(1))
3614 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
3615 echo "dynamic_partition_retrofit=true" >> $(1))
Yifan Hong055e6cf2018-11-29 13:51:48 -08003616 echo "lpmake=$(notdir $(LPMAKE))" >> $(1)
3617 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \
3618 echo "build_super_partition=true" >> $(1)))
Tao Bao519d1822018-12-27 12:47:23 -08003619 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \
3620 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08003621 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1)
3622 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3623 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1))
3624 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3625 echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
3626 $(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
3627 echo "dynamic_partition_list=$(BOARD_SUPER_PARTITION_PARTITION_LIST)" >> $(1))
3628 $(if $(BOARD_SUPER_PARTITION_GROUPS),
3629 echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
3630 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
3631 echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
3632 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
3633 echo "super_$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(1);))
3634endef
3635
The Android Open Source Project88b60792009-03-03 19:28:42 -08003636# Depending on the various images guarantees that the underlying
3637# directories are up-to-date.
3638$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003639 $(INSTALLED_RAMDISK_TARGET) \
3640 $(INSTALLED_BOOTIMAGE_TARGET) \
3641 $(INSTALLED_RADIOIMAGE_TARGET) \
3642 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3643 $(FULL_SYSTEMIMAGE_DEPS) \
3644 $(INSTALLED_USERDATAIMAGE_TARGET) \
3645 $(INSTALLED_CACHEIMAGE_TARGET) \
3646 $(INSTALLED_VENDORIMAGE_TARGET) \
3647 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3648 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3649 $(INSTALLED_VBMETAIMAGE_TARGET) \
3650 $(INSTALLED_ODMIMAGE_TARGET) \
3651 $(INSTALLED_DTBOIMAGE_TARGET) \
3652 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
3653 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
3654 $(INSTALLED_KERNEL_TARGET) \
3655 $(INSTALLED_2NDBOOTLOADER_TARGET) \
3656 $(BOARD_PREBUILT_DTBOIMAGE) \
Hridya Valsarajua9418992019-02-04 10:35:25 -08003657 $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003658 $(BOARD_RECOVERY_ACPIO) \
Anton Hansson6d814982018-11-26 18:12:05 +00003659 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
3660 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
3661 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
3662 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3663 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
3664 $(LPMAKE) \
3665 $(SELINUX_FC) \
3666 $(APKCERTS_FILE) \
3667 $(SOONG_ZIP) \
3668 $(HOST_OUT_EXECUTABLES)/fs_config \
3669 $(HOST_OUT_EXECUTABLES)/imgdiff \
3670 $(HOST_OUT_EXECUTABLES)/bsdiff \
3671 $(HOST_OUT_EXECUTABLES)/care_map_generator \
3672 $(BUILD_IMAGE_SRCS) \
3673 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
3674 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
3675 $(BUILT_SYSTEM_MATRIX) \
3676 $(BUILT_VENDOR_MATRIX) \
3677 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003678 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07003679 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003680 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01003681 $(call create-system-product_services-symlink)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003682 $(call create-vendor-odm-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003683 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003684 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003685ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08003686 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003687 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003688 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003689 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003690ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003691 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003692endif
3693ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003694 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003695endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003696ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08003697ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
3698 $(hide) cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
3699else
cfig28687402018-08-22 16:21:41 +08003700 $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003701endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08003702endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003703ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3704 $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
3705endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003706ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
3707 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
3708endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003709ifdef INTERNAL_KERNEL_CMDLINE
3710 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003711endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003712ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003713 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07003714endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003715ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003716 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07003717endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003718endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08003719 @# Components of the boot image
3720 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07003721 $(hide) mkdir -p $(zip_root)/ROOT
3722 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003723 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
Tom Cherry3871f0f2018-11-06 14:23:44 -08003724 @# If we are using recovery as boot, this is already done when processing recovery.
3725ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherryd14b8952018-08-09 14:26:00 -07003726ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003727 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003728 $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07003729endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003730ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003731 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003732endif
3733ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003734 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003735endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003736ifdef INSTALLED_DTBIMAGE_TARGET
3737 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
3738endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003739ifdef INTERNAL_KERNEL_CMDLINE
3740 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003741endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003742ifdef BOARD_KERNEL_BASE
3743 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
3744endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003745ifdef BOARD_KERNEL_PAGESIZE
3746 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
3747endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003748endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07003749 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
3750 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07003751 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
Dan Willemsen67495202019-01-16 12:42:05 -08003752ifdef BUILDING_SYSTEM_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003753 @# Contents of the system image
3754 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003755 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
Dan Willemsen67495202019-01-16 12:42:05 -08003756endif
3757ifdef BUILDING_USERDATA_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003758 @# Contents of the data image
3759 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003760 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Dan Willemsen67495202019-01-16 12:42:05 -08003761endif
3762ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07003763 @# Contents of the vendor image
3764 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003765 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
Ying Wanga0febe52013-03-20 11:02:05 -07003766endif
Dan Willemsen67495202019-01-16 12:42:05 -08003767ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003768 @# Contents of the product image
3769 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003770 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003771endif
Dan Willemsen67495202019-01-16 12:42:05 -08003772ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01003773 @# Contents of the product_services image
Dario Freni5f681e12018-05-29 13:09:01 +01003774 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003775 $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
Dario Freni5f681e12018-05-29 13:09:01 +01003776endif
Dan Willemsen67495202019-01-16 12:42:05 -08003777ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003778 @# Contents of the odm image
3779 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003780 $(TARGET_OUT_ODM),$(zip_root)/ODM)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003781endif
Dan Willemsen67495202019-01-16 12:42:05 -08003782ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07003783 @# Contents of the system_other image
3784 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003785 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
Alex Light4e358ab2016-06-16 14:47:10 -07003786endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003787 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07003788 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07003789 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07003790ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08003791ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07003792 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07003793 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07003794endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08003795endif
Doug Zongker8678df42009-06-15 14:30:14 -07003796 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08003797 @# build them.
3798 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07003799 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
3800ifneq ($(tool_extension),)
3801 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
3802endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07003803 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003804 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07003805 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003806 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003807ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07003808 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003809endif
3810ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003811 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003812endif
Tao Baodb45efa2015-10-27 19:25:18 -07003813ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3814 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
3815endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003816ifdef BOARD_INCLUDE_RECOVERY_DTBO
3817 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
3818endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003819ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3820 $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
3821endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003822ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003823 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003824endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07003825ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
3826 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
3827 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3828else
3829 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3830endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003831 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07003832 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07003833ifdef PRODUCT_EXTRA_RECOVERY_KEYS
3834 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08003835endif
Jianxun Zhang09849492013-04-17 15:19:19 -07003836 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00003837 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08003838 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08003839 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Ying Wange24e17a2014-10-07 18:42:11 -07003840ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07003841 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07003842 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07003843endif
Tao Baof54216f2016-03-29 15:12:37 -07003844ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003845 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003846 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH))
3847endif
3848ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003849 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003850 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
3851endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003852ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
3853 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
3854 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
3855endif
Dario Freni5f681e12018-05-29 13:09:01 +01003856ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH),)
3857 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3858 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH))
3859endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003860ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH),)
3861 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH) \
3862 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ODM_BASE_FS_PATH))
3863endif
Evgenii Stepanov60beecc2019-01-18 13:53:52 -08003864ifneq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wang2a048392015-06-25 13:56:53 -07003865 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
3866 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
3867endif
Tao Bao8beab692015-07-22 12:33:18 -07003868ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
3869 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
3870endif
David Zeuthen0eb10972016-09-28 17:55:27 -04003871ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003872 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
3873 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3874 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3875 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3876 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3877ifdef BOARD_AVB_BOOT_KEY_PATH
3878 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3879 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3880 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3881endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05003882 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3883ifdef BOARD_AVB_RECOVERY_KEY_PATH
3884 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3885 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3886 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3887endif # BOARD_AVB_RECOVERY_KEY_PATH
David Anderson7709ab22018-10-15 14:41:34 -07003888ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
3889 $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $(zip_root)/META/misc_info.txt
3890 $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3891 $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3892 $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3893 $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3894endif # BOARD_AVB_VBMETA_SYSTEM
Tao Bao744c4c72018-08-20 21:09:07 -07003895ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
3896 $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $(zip_root)/META/misc_info.txt
David Anderson7709ab22018-10-15 14:41:34 -07003897 $(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 -07003898 $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3899 $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3900 $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3901endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003902endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04003903ifdef BOARD_BPT_INPUT_FILES
3904 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
3905 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
3906 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
3907endif
3908ifdef BOARD_BPT_DISK_SIZE
3909 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
3910endif
Ying Wangbd93d422011-10-28 17:02:30 -07003911 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07003912ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Per Astrandcab66992015-03-25 14:06:30 +01003913 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08003914 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07003915endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003916ifeq ($(AB_OTA_UPDATER),true)
3917 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07003918 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07003919 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07003920 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
3921 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08003922 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
3923 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
3924 done
Steve Fung4044b382015-11-05 02:04:04 -08003925 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
3926 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003927 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003928ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07003929 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
3930 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
3931 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003932endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003933endif
Steve Fungdfbab492015-09-24 18:12:33 -07003934ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07003935 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07003936 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
3937endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07003938ifdef BOARD_PREBUILT_VENDORIMAGE
3939 $(hide) mkdir -p $(zip_root)/IMAGES
3940 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
3941endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003942ifdef BOARD_PREBUILT_PRODUCTIMAGE
3943 $(hide) mkdir -p $(zip_root)/IMAGES
3944 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
3945endif
Dario Freni5f681e12018-05-29 13:09:01 +01003946ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
3947 $(hide) mkdir -p $(zip_root)/IMAGES
3948 $(hide) cp $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(zip_root)/IMAGES/
3949endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07003950ifdef BOARD_PREBUILT_BOOTIMAGE
3951 $(hide) mkdir -p $(zip_root)/IMAGES
3952 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
3953endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003954ifdef BOARD_PREBUILT_ODMIMAGE
3955 $(hide) mkdir -p $(zip_root)/IMAGES
3956 $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/
3957endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07003958ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07003959 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
3960 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
3961 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
3962ifeq ($(BOARD_AVB_ENABLE),true)
3963 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003964 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3965ifdef BOARD_AVB_DTBO_KEY_PATH
3966 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3967 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3968 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07003969 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003970endif # BOARD_AVB_DTBO_KEY_PATH
3971endif # BOARD_AVB_ENABLE
3972endif # BOARD_PREBUILT_DTBOIMAGE
Yifan Hong2b891ac2018-11-29 12:06:31 -08003973 $(call dump-dynamic-partitions-info,$(zip_root)/META/misc_info.txt)
Tao Bao95a95c32017-06-16 15:30:23 -07003974 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
3975 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
3976 @# INSTALLED_RADIOIMAGE_TARGET.
3977 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
3978 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003979 @# Run fs_config on all the system, vendor, boot ramdisk,
3980 @# and recovery ramdisk files in the zip, and save the output
Dan Willemsen67495202019-01-16 12:42:05 -08003981ifdef BUILDING_SYSTEM_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003982 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
Dan Willemsen67495202019-01-16 12:42:05 -08003983endif
3984ifdef BUILDING_VENDOR_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003985 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
3986endif
Dan Willemsen67495202019-01-16 12:42:05 -08003987ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003988 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
3989endif
Dan Willemsen67495202019-01-16 12:42:05 -08003990ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01003991 $(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 +01003992endif
Dan Willemsen67495202019-01-16 12:42:05 -08003993ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003994 $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
3995endif
Tom Cherryd14b8952018-08-09 14:26:00 -07003996 @# ROOT always contains the files for the root under normal boot.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003997 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08003998ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherry2929cad2018-09-20 11:04:37 -07003999 @# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004000 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004001endif
Tom Cherry2929cad2018-09-20 11:04:37 -07004002ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
4003 @# 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 -08004004 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
4005endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004006ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
4007 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
4008endif
Dan Willemsen67495202019-01-16 12:42:05 -08004009ifdef BUILDING_SYSTEM_OTHER_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004010 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
4011endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004012 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07004013 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Steven Moreland627debe2018-05-01 09:54:21 -07004014 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
4015ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
4016 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004017endif
Yifan Hongaa212212017-04-14 00:00:46 -07004018ifdef BUILT_VENDOR_MATRIX
4019 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004020endif
Yifan Hong07d3d792018-10-16 15:55:25 -07004021ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
4022 $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
Tao Bao943fa4c2018-12-19 10:39:34 -08004023 @# Remove 'vendor' from the group partition list if the image is not available. This should only
4024 @# happen to AOSP targets built without vendor.img. We can't remove the partition from the
4025 @# BoardConfig file, as it's still needed elsewhere (e.g. when creating super_empty.img).
Yifan Hong07d3d792018-10-16 15:55:25 -07004026 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
Tao Bao943fa4c2018-12-19 10:39:34 -08004027 $(eval _group_partition_list := $(BOARD_$(call to-upper,$(group))_PARTITION_LIST)) \
4028 $(if $(INSTALLED_VENDORIMAGE_TARGET),,$(eval _group_partition_list := $(filter-out vendor,$(_group_partition_list)))) \
Yifan Hong07d3d792018-10-16 15:55:25 -07004029 echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \
Tao Bao943fa4c2018-12-19 10:39:34 -08004030 $(if $(_group_partition_list), \
4031 echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
4032endif # BOARD_SUPER_PARTITION_GROUPS
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004033 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08004034 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08004035 @# Zip everything up, preserving symlinks and placing META/ files first to
4036 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004037 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07004038 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004039 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07004040
Ying Wanga0febe52013-03-20 11:02:05 -07004041.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08004042target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
4043
Ying Wang4709d7c2014-04-14 17:25:43 -07004044ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
4045$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
4046endif
Doug Zongker367910f2009-06-15 18:56:51 -07004047
Dan Albert4d323332016-10-14 13:23:06 -07004048# -----------------------------------------------------------------
4049# NDK Sysroot Package
4050NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07004051$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07004052 @echo Package NDK sysroot...
4053 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
4054
4055$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
4056
Ying Wang09c4b682015-08-11 11:24:19 -07004057ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07004058# -----------------------------------------------------------------
4059# OTA update package
4060
Yifan Hong50e79542018-11-08 17:44:12 -08004061# $(1): output file
4062# $(2): additional args
4063define build-ota-package-target
4064PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
4065 build/make/tools/releasetools/ota_from_target_files -v \
4066 --block \
4067 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
4068 -p $(HOST_OUT) \
4069 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
4070 $(2) \
4071 $(BUILT_TARGET_FILES_PACKAGE) $(1)
4072endef
4073
Doug Zongker8678df42009-06-15 14:30:14 -07004074name := $(TARGET_PRODUCT)
4075ifeq ($(TARGET_BUILD_TYPE),debug)
4076 name := $(name)_debug
4077endif
4078name := $(name)-ota-$(FILE_NAME_TAG)
4079
4080INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4081
4082$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4083
Tao Baoe53c6e72017-04-19 15:54:22 -07004084ifeq ($(AB_OTA_UPDATER),true)
4085$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07004086else
Alex Deymob10e07a2017-11-09 23:53:42 +01004087$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07004088endif
4089
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09004090$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004091 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07004092 @echo "Package OTA: $@"
Yifan Hong50e79542018-11-08 17:44:12 -08004093 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR))
Doug Zongker8678df42009-06-15 14:30:14 -07004094
4095.PHONY: otapackage
4096otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
4097
Tao Bao519d1822018-12-27 12:47:23 -08004098ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true)
Yifan Hong50e79542018-11-08 17:44:12 -08004099name := $(TARGET_PRODUCT)
4100ifeq ($(TARGET_BUILD_TYPE),debug)
4101 name := $(name)_debug
4102endif
4103name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
4104
4105INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4106
4107$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4108
4109ifeq ($(AB_OTA_UPDATER),true)
4110$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
4111else
4112$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BROTLI)
4113endif
4114
4115$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004116 build/make/tools/releasetools/ota_from_target_files
Yifan Hong50e79542018-11-08 17:44:12 -08004117 @echo "Package OTA (retrofit dynamic partitions): $@"
4118 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
4119
4120.PHONY: otardppackage
4121
4122otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
4123
Tao Bao519d1822018-12-27 12:47:23 -08004124endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
Yifan Hong50e79542018-11-08 17:44:12 -08004125
Ying Wang09c4b682015-08-11 11:24:19 -07004126endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07004127
Ying Wang09a00a62010-10-20 14:01:09 -07004128# -----------------------------------------------------------------
4129# The update package
4130
4131name := $(TARGET_PRODUCT)
4132ifeq ($(TARGET_BUILD_TYPE),debug)
4133 name := $(name)_debug
4134endif
4135name := $(name)-img-$(FILE_NAME_TAG)
4136
4137INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4138
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004139$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07004140 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004141 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
4142 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07004143
4144.PHONY: updatepackage
4145updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
4146
The Android Open Source Project88b60792009-03-03 19:28:42 -08004147# -----------------------------------------------------------------
Dario Frenid1011272018-07-23 20:20:15 +01004148# A zip of the appcompat directory containing logs
4149APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip
4150# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
4151ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004152$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004153 $(INSTALLED_RAMDISK_TARGET) \
4154 $(INSTALLED_BOOTIMAGE_TARGET) \
4155 $(INSTALLED_USERDATAIMAGE_TARGET) \
4156 $(INSTALLED_VENDORIMAGE_TARGET) \
4157 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4158 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
Dario Frenid1011272018-07-23 20:20:15 +01004159endif
4160$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
4161$(APPCOMPAT_ZIP): $(SOONG_ZIP)
4162 @echo "appcompat logs: $@"
4163 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4164 $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/appcompat $(dir $(PRIVATE_LIST_FILE))
4165 $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE)
4166 $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE)
4167
4168
4169# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004170# A zip of the symbols directory. Keep the full paths to make it
4171# more obvious where these files came from.
4172#
4173name := $(TARGET_PRODUCT)
4174ifeq ($(TARGET_BUILD_TYPE),debug)
4175 name := $(name)_debug
4176endif
4177name := $(name)-symbols-$(FILE_NAME_TAG)
4178
4179SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004180# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07004181ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004182$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004183 $(INSTALLED_RAMDISK_TARGET) \
4184 $(INSTALLED_BOOTIMAGE_TARGET) \
4185 $(INSTALLED_USERDATAIMAGE_TARGET) \
4186 $(INSTALLED_VENDORIMAGE_TARGET) \
4187 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4188 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4189 $(INSTALLED_ODMIMAGE_TARGET) \
4190 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07004191endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004192$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
4193$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004194 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004195 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4196 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
4197 $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08004198 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004199# -----------------------------------------------------------------
4200# A zip of the coverage directory.
4201#
4202name := $(TARGET_PRODUCT)
4203ifeq ($(TARGET_BUILD_TYPE),debug)
4204name := $(name)_debug
4205endif
4206name := $(name)-coverage-$(FILE_NAME_TAG)
4207COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
4208ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004209$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004210 $(INSTALLED_RAMDISK_TARGET) \
4211 $(INSTALLED_BOOTIMAGE_TARGET) \
4212 $(INSTALLED_USERDATAIMAGE_TARGET) \
4213 $(INSTALLED_VENDORIMAGE_TARGET) \
4214 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4215 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4216 $(INSTALLED_ODMIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004217endif
4218$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
4219$(COVERAGE_ZIP): $(SOONG_ZIP)
4220 @echo "Package coverage: $@"
4221 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4222 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
4223 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
4224 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004225
4226# -----------------------------------------------------------------
4227# A zip of the Android Apps. Not keeping full path so that we don't
4228# include product names when distributing
4229#
4230name := $(TARGET_PRODUCT)
4231ifeq ($(TARGET_BUILD_TYPE),debug)
4232 name := $(name)_debug
4233endif
4234name := $(name)-apps-$(FILE_NAME_TAG)
4235
4236APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Tao Baoe9d61b02018-08-20 21:09:07 -07004237$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004238 @echo "Package apps: $@"
4239 $(hide) rm -rf $@
4240 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004241 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
4242 if [ -z "$$apps_to_zip" ]; then \
Anton Hansson6d814982018-11-26 18:12:05 +00004243 echo "No apps to zip up. Generating empty apps archive." ; \
4244 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004245 else \
Anton Hansson6d814982018-11-26 18:12:05 +00004246 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004247 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07004248
Ying Wangbc415dd2012-08-15 12:22:44 -07004249ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07004250#------------------------------------------------------------------
4251# An archive of classes for use in generating code-coverage reports
4252# These are the uninstrumented versions of any classes that were
4253# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07004254# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004255
Colin Crossa6bc3a82017-09-27 14:28:41 -07004256JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004257$(JACOCO_REPORT_CLASSES_ALL) :
4258 @echo "Collecting uninstrumented classes"
4259 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
Anton Hansson6d814982018-11-26 18:12:05 +00004260 zip -@ -0 -q -X $@
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004261# Meaning of these options:
4262# -@ scan stdin for file paths to add to the zip
4263# -0 don't do any compression
4264# -q supress most output
4265# -X skip storing extended file attributes
4266
Ying Wangbc415dd2012-08-15 12:22:44 -07004267endif # EMMA_INSTRUMENT=true
4268
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004269
Ying Wangae9115a2013-08-22 20:52:47 -07004270#------------------------------------------------------------------
4271# A zip of Proguard obfuscation dictionary files.
4272# Only for apps_only build.
4273#
4274ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07004275PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004276# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07004277$(PROGUARD_DICT_ZIP) :
4278 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07004279 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Anton Hansson6d814982018-11-26 18:12:05 +00004280 if [ -n "$$dict_files" ]; then \
4281 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
4282 zip -qX $@ $$dict_files $$unobfuscated_jars; \
4283 else \
4284 touch $(dir $@)/zipdummy; \
4285 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
4286 zip -qd $@ zipdummy; \
4287 rm $(dir $@)/zipdummy; \
4288 fi
Ying Wangae9115a2013-08-22 20:52:47 -07004289
4290endif # TARGET_BUILD_APPS
4291
The Android Open Source Project88b60792009-03-03 19:28:42 -08004292# -----------------------------------------------------------------
Yifan Hong2b891ac2018-11-29 12:06:31 -08004293# super partition image
4294
4295ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4296
4297# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
4298ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4299
4300ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
4301INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
4302$(INSTALLED_SUPERIMAGE_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
4303$(INSTALLED_SUPERIMAGE_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
4304 $(call pretty,"Target super fs image: $@")
Tao Bao403a2f92018-12-13 10:45:46 -08004305 PATH=$(dir $(LPMAKE)):$$PATH \
4306 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
Yifan Hong2b891ac2018-11-29 12:06:31 -08004307endif
4308
4309$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
4310
Yifan Hong8b79d162018-11-29 12:32:00 -08004311INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
4312$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty)
4313$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE)
4314 $(call pretty,"Target empty super fs image: $@")
4315 mkdir -p $(intermediates)
4316 rm -rf $(intermediates)/misc_info.txt
4317 $(call dump-dynamic-partitions-info,$(intermediates)/misc_info.txt)
4318ifeq ($(AB_OTA_UPDATER),true)
Tao Bao403a2f92018-12-13 10:45:46 -08004319 echo "ab_update=true" >> $(intermediates)/misc_info.txt
Yifan Hong8b79d162018-11-29 12:32:00 -08004320endif
Tao Bao403a2f92018-12-13 10:45:46 -08004321 PATH=$(dir $(LPMAKE)):$$PATH \
4322 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@
Yifan Hong8b79d162018-11-29 12:32:00 -08004323
4324$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
4325
Yifan Hong2b891ac2018-11-29 12:06:31 -08004326endif # BOARD_SUPER_PARTITION_SIZE != ""
4327endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
4328
4329# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004330# dalvik something
4331.PHONY: dalvikfiles
4332dalvikfiles: $(INTERNAL_DALVIK_MODULES)
4333
Bo Huf0d50bb2017-08-01 19:02:09 +00004334ifeq ($(BUILD_QEMU_IMAGES),true)
Bo Huf0d50bb2017-08-01 19:02:09 +00004335MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
4336SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
Roman Kiryanove64998f2019-02-14 16:45:33 -08004337
4338ifdef INSTALLED_SYSTEMIMAGE_TARGET
4339INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
Tao Baoe9d61b02018-08-20 21:09:07 -07004340$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004341 @echo Create system-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004342 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEMIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004343
4344systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
4345droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
Roman Kiryanove64998f2019-02-14 16:45:33 -08004346endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004347ifdef INSTALLED_VENDORIMAGE_TARGET
Bo Huf0d50bb2017-08-01 19:02:09 +00004348INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004349$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004350 @echo Create vendor-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004351 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004352
4353vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
4354droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
4355endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004356ifdef INSTALLED_PRODUCTIMAGE_TARGET
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004357INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004358$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004359 @echo Create product-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004360 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004361
4362productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
4363droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
4364endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004365ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Dario Freni924af7d2018-08-17 00:56:14 +01004366INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004367$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Dario Freni924af7d2018-08-17 00:56:14 +01004368 @echo Create product_services-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004369 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET))
Dario Freni5f681e12018-05-29 13:09:01 +01004370
4371productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4372droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4373endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004374ifdef INSTALLED_ODMIMAGE_TARGET
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004375INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
4376$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
4377 @echo Create odm-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004378 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004379
4380odmimage: $(INSTALLED_QEMU_ODMIMAGE)
4381droidcore: $(INSTALLED_QEMU_ODMIMAGE)
4382endif
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004383
4384ifeq ($(BOARD_AVB_ENABLE),true)
4385QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
4386MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_verified_boot_params.sh
4387$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_QEMU_SYSTEMIMAGE) $(MK_VERIFIED_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) $(SGDISK_HOST) $(AVBTOOL)
4388 @echo Creating $@
Matt Wachowski40afa812018-09-27 12:49:18 -07004389 (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 -07004390
4391
4392systemimage: $(QEMU_VERIFIED_BOOT_PARAMS)
4393droidcore: $(QEMU_VERIFIED_BOOT_PARAMS)
4394endif
Bo Huf0d50bb2017-08-01 19:02:09 +00004395endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004396# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004397# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07004398ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004399INTERNAL_EMULATOR_PACKAGE_FILES += \
4400 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08004401 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004402 $(INSTALLED_RAMDISK_TARGET) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004403 $(INSTALLED_SYSTEMIMAGE_TARGET) \
4404 $(INSTALLED_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004405
4406name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
4407
4408INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4409
Ying Wang5d887702015-11-04 10:06:25 -08004410$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004411 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07004412 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004413
Ying Wang7d8c5352012-07-26 10:15:21 -07004414endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004415# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08004416# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08004417# The pdk package (Platform Development Kit)
4418
Keun young Park7fc7aad2012-02-27 15:49:23 -08004419#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
4420# include development/pdk/Pdk.mk
4421#endif
4422
The Android Open Source Project88b60792009-03-03 19:28:42 -08004423
4424# -----------------------------------------------------------------
4425# The SDK
4426
The Android Open Source Project88b60792009-03-03 19:28:42 -08004427# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07004428sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004429
4430# Build a name that looks like:
4431#
4432# linux-x86 --> android-sdk_12345_linux-x86
4433# darwin-x86 --> android-sdk_12345_mac-x86
4434# windows-x86 --> android-sdk_12345_windows
4435#
4436sdk_name := android-sdk_$(FILE_NAME_TAG)
4437ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07004438 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08004439else
Joe Onorato03fbe402009-04-13 08:31:16 -07004440 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004441endif
4442ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07004443 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004444endif
Joe Onorato03fbe402009-04-13 08:31:16 -07004445sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004446
4447sdk_dep_file := $(sdk_dir)/sdk_deps.mk
4448
4449ATREE_FILES :=
4450-include $(sdk_dep_file)
4451
4452# if we don't have a real list, then use "everything"
4453ifeq ($(strip $(ATREE_FILES)),)
4454ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004455 $(ALL_DEFAULT_INSTALLED_MODULES) \
4456 $(INSTALLED_RAMDISK_TARGET) \
4457 $(ALL_DOCS) \
Nan Zhangcb0a6882018-08-07 15:26:32 -07004458 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api-stubs-docs_annotations.zip \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004459 $(ALL_SDK_FILES)
4460endif
4461
4462atree_dir := development/build
4463
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01004464
The Android Open Source Project88b60792009-03-03 19:28:42 -08004465sdk_atree_files := \
4466 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07004467 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08004468
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02004469# development/build/sdk-android-<abi>.atree is used to differentiate
4470# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
4471# files like the kernel image. We use TARGET_CPU_ABI because we don't
4472# have a better way to distinguish between CPU models.
4473ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
4474 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
4475endif
4476
Griff Hazen433febb2014-02-28 08:45:59 -08004477ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES),)
4478sdk_atree_files += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES)
4479else
4480sdk_atree_files += $(atree_dir)/sdk.atree
4481endif
4482
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004483include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004484
The Android Open Source Project88b60792009-03-03 19:28:42 -08004485deps := \
4486 $(target_notice_file_txt) \
4487 $(tools_notice_file_txt) \
4488 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07004489 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07004490 $(COVERAGE_ZIP) \
Dario Frenid1011272018-07-23 20:20:15 +01004491 $(APPCOMPAT_ZIP) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004492 $(INSTALLED_SYSTEMIMAGE_TARGET) \
Bo Huf0d50bb2017-08-01 19:02:09 +00004493 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07004494 $(INSTALLED_QEMU_VENDORIMAGE) \
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004495 $(QEMU_VERIFIED_BOOT_PARAMS) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07004496 $(INSTALLED_USERDATAIMAGE_TARGET) \
4497 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004498 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07004499 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004500 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08004501 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004502 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004503 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004504 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004505
4506INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
4507$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
4508$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
4509$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
4510$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
4511
4512# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
4513#
4514#SDK_GNU_ERROR := true
4515
Ying Wang5d887702015-11-04 10:06:25 -08004516$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004517 @echo "Package SDK: $@"
4518 $(hide) rm -rf $(PRIVATE_DIR) $@
4519 $(hide) for f in $(target_gnu_MODULES); do \
4520 if [ -f $$f ]; then \
4521 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
4522 including GNU target $$f >&2; \
4523 FAIL=$(SDK_GNU_ERROR); \
4524 fi; \
4525 done; \
4526 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07004527 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08004528 $(hide) ( \
Anton Hansson6d814982018-11-26 18:12:05 +00004529 ATREE_STRIP="$(HOST_STRIP) -x" \
4530 $(HOST_OUT_EXECUTABLES)/atree \
4531 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
4532 -m $(PRIVATE_DEP_FILE) \
4533 -I . \
4534 -I $(PRODUCT_OUT) \
4535 -I $(HOST_OUT) \
4536 -I $(TARGET_COMMON_OUT_ROOT) \
4537 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
4538 -v "OUT_DIR=$(OUT_DIR)" \
4539 -v "HOST_OUT=$(HOST_OUT)" \
4540 -v "TARGET_ARCH=$(TARGET_ARCH)" \
4541 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
4542 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
4543 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
4544 -o $(PRIVATE_DIR) && \
4545 cp -f $(target_notice_file_txt) \
4546 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
4547 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
4548 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
4549 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
4550 chmod -R ug+rwX $(PRIVATE_DIR) && \
4551 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004552 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
4553
Raphael3d224a02010-04-16 17:50:09 -07004554
4555# Is a Windows SDK requested? If so, we need some definitions from here
4556# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08004557MAIN_SDK_NAME := $(sdk_name)
4558MAIN_SDK_DIR := $(sdk_dir)
4559MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08004560ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07004561include $(TOPDIR)development/build/tools/windows_sdk.mk
4562endif
4563
The Android Open Source Project88b60792009-03-03 19:28:42 -08004564# -----------------------------------------------------------------
4565# Findbugs
4566INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
4567INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
4568$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
4569 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004570 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004571 > $@
4572$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
4573 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004574 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07004575 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08004576
4577# -----------------------------------------------------------------
4578# Findbugs
4579
4580# -----------------------------------------------------------------
4581# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07004582ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004583include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01004584-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07004585-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004586-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07004587# Also the project-specific tasks
4588-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
4589-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004590-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07004591# Also add test specifc tasks
4592include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07004593include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07004594endif
Raphaelc4d47312011-02-15 16:09:36 -08004595
Ying Wang67132ba2015-10-28 16:42:39 -07004596include $(BUILD_SYSTEM)/product-graph.mk
4597
Raphaelc4d47312011-02-15 16:09:36 -08004598# -----------------------------------------------------------------
4599# Create SDK repository packages. Must be done after tasks/* since
4600# we need the addon rules defined.
4601ifneq ($(sdk_repo_goal),)
4602include $(TOPDIR)development/build/tools/sdk_repo.mk
4603endif
Jayant Chowdhary67e0cc52018-02-23 16:50:39 -08004604
4605#------------------------------------------------------------------
4606# Find lsdump paths
4607FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
4608$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
Yi-yo Chiangac0d49f2018-07-25 13:34:28 +08004609 $(hide) rm -rf $@ && echo "$^" | sed -e 's/ /\n/g' > $@