blob: 3eb4211cacc236891879c7596304fb34d224a441 [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 Cherry03303f92018-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 Wang462d26b2010-11-02 21:31:47 -070042 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
Ying Wang7e8d4422011-06-17 17:05:35 -070043 $(eval unique_product_copy_files_destinations += $(_dest))))
Dan Willemsen403b98a2017-11-15 11:13:23 -080044
45# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
46$(file >$(PRODUCT_OUT)/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
47ifdef dist_goal
48$(file >$(DIST_DIR)/logs/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
49endif
50
51product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070052unique_product_copy_files_pairs :=
Ying Wang7e8d4422011-06-17 17:05:35 -070053unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080054
55# -----------------------------------------------------------------
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +080056# Returns the max allowed size for an image suitable for hash verification
57# (e.g., boot.img, recovery.img, etc).
58# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL).
59# $(1): partition size to flash the image
60define get-hash-image-max-size
61$(if $(1), \
62 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
63 $(eval _hash_meta_size := 69632), \
64 $(eval _hash_meta_size := 0)) \
65 $(1)-$(_hash_meta_size))
66endef
67
68# -----------------------------------------------------------------
Dan Willemsen6f60f022016-02-23 13:40:07 -080069# Define rules to copy headers defined in copy_headers.mk
70# If more than one makefile declared a header, print a warning,
71# then copy the last one defined. This matches the previous make
72# behavior.
73$(foreach dest,$(ALL_COPIED_HEADERS), \
74 $(eval _srcs := $(ALL_COPIED_HEADERS.$(dest).SRC)) \
75 $(eval _src := $(word $(words $(_srcs)),$(_srcs))) \
76 $(if $(call streq,$(_src),$(_srcs)),, \
77 $(warning Duplicate header copy: $(dest)) \
78 $(warning Defined in: $(ALL_COPIED_HEADERS.$(dest).MAKEFILE))) \
79 $(eval $(call copy-one-header,$(_src),$(dest))))
80all_copied_headers: $(ALL_COPIED_HEADERS)
81
82# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -080083# docs/index.html
Ying Wang3f45b3c2012-04-02 18:21:36 -070084ifeq (,$(TARGET_BUILD_APPS))
The Android Open Source Project88b60792009-03-03 19:28:42 -080085gen := $(OUT_DOCS)/index.html
86ALL_DOCS += $(gen)
87$(gen): frameworks/base/docs/docs-redirect-index.html
88 @mkdir -p $(dir $@)
89 @cp -f $< $@
Ying Wang3f45b3c2012-04-02 18:21:36 -070090endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080091
Dan Albert303e6032017-10-04 10:20:20 -070092ndk_doxygen_out := $(OUT_NDK_DOCS)
93ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include
94ndk_docs_src_dir := frameworks/native/docs
95ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile
96ifneq ($(wildcard $(ndk_docs_src_dir)),)
97ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\
98 $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.))
99$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp
100 @mkdir -p $(ndk_doxygen_out)
101 @echo "Generating NDK docs to $(ndk_doxygen_out)"
102 @( cat $(ndk_doxyfile); \
103 echo "INPUT=$(ndk_headers)"; \
104 echo "HTML_OUTPUT=$(ndk_doxygen_out)" \
105 ) | doxygen -
106
107# Note: Not a part of the docs target because we don't have doxygen available.
108# You can run this target locally if you have doxygen installed.
109ndk-docs: $(ndk_doxygen_out)/index.html
110.PHONY: ndk-docs
111endif
112
The Android Open Source Project88b60792009-03-03 19:28:42 -0800113# -----------------------------------------------------------------
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900114# property_overrides_split_enabled
115property_overrides_split_enabled :=
116ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
117 property_overrides_split_enabled := true
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900118endif
119
120# -----------------------------------------------------------------
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900121# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if
122# property_overrides_split_enabled is true. Otherwise it will be installed in
123# ROOT/default.prop.
124ifdef BOARD_VNDK_VERSION
125 ifeq ($(BOARD_VNDK_VERSION),current)
126 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
127 else
128 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
129 endif
Logan Chien86b52ae2018-05-04 19:33:17 +0800130 ifdef BOARD_VNDK_RUNTIME_DISABLE
131 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
132 endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900133else
Logan Chien86b52ae2018-05-04 19:33:17 +0800134 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
135 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900136endif
137FINAL_VENDOR_DEFAULT_PROPERTIES += \
138 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
139FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
140 $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
141
142# -----------------------------------------------------------------
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800143# prop.default
144ifdef property_overrides_split_enabled
145INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800146INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
147ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
148$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800149else
150# legacy path
The Android Open Source Project88b60792009-03-03 19:28:42 -0800151INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800152endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800153ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900154FINAL_DEFAULT_PROPERTIES := \
Jaekyun Seokb31b9ba2017-11-03 15:18:55 +0900155 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
156 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900157ifndef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900158 FINAL_DEFAULT_PROPERTIES += \
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900159 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900160endif
Jaekyun Seok294286d2017-01-20 13:17:12 +0900161FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
162 $(FINAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800163
Andres Moralesb8876e12015-05-06 20:44:22 -0700164intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
165
166$(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800167 @echo Target buildinfo: $@
168 @mkdir -p $(dir $@)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800169 @rm -f $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800170 $(hide) echo "#" > $@; \
171 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
172 echo "#" >> $@;
Jaekyun Seok294286d2017-01-20 13:17:12 +0900173 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -0700174 echo "$(line)" >> $@;)
Andres Moralesb8876e12015-05-06 20:44:22 -0700175 $(hide) echo "#" >> $@; \
176 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
177 echo "#" >> $@;
Dan Willemsen014719f2015-08-17 20:44:29 -0700178 $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
179 $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
Colin Cross73021682015-07-21 12:54:17 -0700180 $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
Colin Crossfdea8932017-12-06 14:38:40 -0800181 $(hide) build/make/tools/post_process_props.py $@
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800182ifdef property_overrides_split_enabled
183 $(hide) mkdir -p $(TARGET_ROOT_OUT)
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800184 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800185endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800186
187# -----------------------------------------------------------------
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900188# vendor default.prop
189INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900190ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900191INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
192ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
193
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900194$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
195 @echo Target buildinfo: $@
196 @mkdir -p $(dir $@)
197 $(hide) echo "#" > $@; \
198 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
199 echo "#" >> $@;
200 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
201 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800202 $(hide) build/make/tools/post_process_props.py $@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900203
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900204endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900205
206# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800207# build.prop
208INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
209ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900210FINAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -0700211 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
Jaekyun Seok294286d2017-01-20 13:17:12 +0900212FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
213 $(FINAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800214
215# A list of arbitrary tags describing the build configuration.
216# Force ":=" so we can use +=
217BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
218ifeq ($(TARGET_BUILD_TYPE),debug)
219 BUILD_VERSION_TAGS += debug
220endif
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700221# The "test-keys" tag marks builds signed with the old test keys,
222# which are available in the SDK. "dev-keys" marks builds signed with
223# non-default dev keys (usually private keys from a vendor directory).
224# Both of these tags will be removed and replaced with "release-keys"
225# when the target-files is signed in a post-build step.
226ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/target/product/security/testkey)
Doug Zongkera8608a72013-07-23 11:51:04 -0700227BUILD_KEYS := test-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700228else
Doug Zongkera8608a72013-07-23 11:51:04 -0700229BUILD_KEYS := dev-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700230endif
Doug Zongkera8608a72013-07-23 11:51:04 -0700231BUILD_VERSION_TAGS += $(BUILD_KEYS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800232BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
233
234# A human-readable string that descibes this build in detail.
Colin Crossf37b4552015-07-16 17:15:19 -0700235build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
Andres Moralesb8876e12015-05-06 20:44:22 -0700236$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800237
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700238# 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 -0800239ifeq (,$(strip $(BUILD_FINGERPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800240 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
241 BF_BUILD_NUMBER := $(USER)$$($(DATE_FROM_FILE) +%m%d%H%M)
Ying Wang50367cc2014-06-12 18:42:53 -0700242 else
Nan Zhang0abdb582018-02-20 17:00:39 -0800243 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
Ying Wang50367cc2014-06-12 18:42:53 -0700244 endif
245 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 -0800246endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800247# unset it for safety.
248BF_BUILD_NUMBER :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800249
Nan Zhang0abdb582018-02-20 17:00:39 -0800250BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
251ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
252 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
253endif
254BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
255# unset it for safety.
256BUILD_FINGERPRINT :=
Colin Crossf37b4552015-07-16 17:15:19 -0700257
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700258# The string used to uniquely identify the system build; used by the OTA server.
259# This purposefully excludes any product-specific variables.
260ifeq (,$(strip $(BUILD_THUMBPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800261 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700262endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800263
264BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
265ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
266 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700267endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800268BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
269# unset it for safety.
270BUILD_THUMBPRINT :=
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700271
Ying Wange24e17a2014-10-07 18:42:11 -0700272KNOWN_OEM_THUMBPRINT_PROPERTIES := \
273 ro.product.brand \
274 ro.product.name \
275 ro.product.device
276OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
277 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES))
278
Sriram Raman7b641242009-03-24 22:40:59 -0700279# Display parameters shown under Settings -> About Phone
280ifeq ($(TARGET_BUILD_VARIANT),user)
281 # User builds should show:
282 # release build number or branch.buld_number non-release builds
283
284 # Dev. branches should have DISPLAY_BUILD_NUMBER set
Colin Cross63fe36a2017-02-21 17:23:02 -0800285 ifeq (true,$(DISPLAY_BUILD_NUMBER))
Colin Crossf37b4552015-07-16 17:15:19 -0700286 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700287 else
Doug Zongkera8608a72013-07-23 11:51:04 -0700288 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700289 endif
290else
291 # Non-user builds should show detailed build information
292 BUILD_DISPLAY_ID := $(build_desc)
293endif
294
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000295# Accepts a whitespace separated list of product locales such as
296# (en_US en_AU en_GB...) and returns the first locale in the list with
297# underscores replaced with hyphens. In the example above, this will
298# return "en-US".
299define get-default-product-locale
300$(strip $(subst _,-, $(firstword $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800301endef
302
Colin Crossfdea8932017-12-06 14:38:40 -0800303BUILDINFO_SH := build/make/tools/buildinfo.sh
304VENDOR_BUILDINFO_SH := build/make/tools/vendor_buildinfo.sh
Andrew Boiefa61ff02012-09-28 09:33:45 -0700305
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700306# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
307# harness to distinguish builds. Only add _asan for a sanitized build
308# if it isn't already a part of the flavor (via a dedicated lunch
309# config for example).
Ying Wang21ec03d2015-10-28 18:45:03 -0700310TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
Ivan Lozano0f71db32017-08-14 07:57:37 -0700311ifneq (, $(filter address, $(SANITIZE_TARGET)))
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700312ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
Ying Wang21ec03d2015-10-28 18:45:03 -0700313TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
314endif
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700315endif
Ying Wang21ec03d2015-10-28 18:45:03 -0700316
Andrew Boiefa61ff02012-09-28 09:33:45 -0700317ifdef TARGET_SYSTEM_PROP
318system_prop_file := $(TARGET_SYSTEM_PROP)
319else
320system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
321endif
Jaekyun Seokf9af5fa2017-10-25 12:08:32 +0900322$(intermediate_system_build_prop): $(BUILDINFO_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800323 @echo Target buildinfo: $@
324 @mkdir -p $(dir $@)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700325 $(hide) echo > $@
326ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES),)
327 $(hide) echo "#" >> $@; \
328 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700329 echo "#" >> $@;
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700330 $(hide) $(foreach prop,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES), \
331 echo "import /oem/oem.prop $(prop)" >> $@;)
332endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800333 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Ying Wang21ec03d2015-10-28 18:45:03 -0700334 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800335 TARGET_DEVICE="$(TARGET_DEVICE)" \
336 PRODUCT_NAME="$(TARGET_PRODUCT)" \
337 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000338 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
Robert Greenwaltfbd10d92009-05-20 13:37:35 -0700339 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800340 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
341 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
342 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
343 BUILD_ID="$(BUILD_ID)" \
344 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
Dan Willemsenccc933e2015-08-11 15:25:12 -0700345 DATE="$(DATE_FROM_FILE)" \
Colin Crossf37b4552015-07-16 17:15:19 -0700346 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
Daniel Rosenberg59156a62015-06-29 17:20:43 -0700347 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
Tao Bao532fdf42015-11-11 10:22:48 -0800348 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800349 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
Dianne Hackborne593e5c2015-08-12 16:11:20 -0700350 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
351 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800352 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
Adam Powellbdd5e8e2015-05-21 13:49:05 -0700353 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
Dianne Hackborn95378842009-05-08 12:06:17 -0700354 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
Dianne Hackborn6ee3c432014-04-24 16:19:14 -0700355 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800356 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
Colin Crossf37b4552015-07-16 17:15:19 -0700357 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
Nan Zhang0abdb582018-02-20 17:00:39 -0800358 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
Narayan Kamath1a43b372014-03-26 17:33:55 +0000359 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
Narayan Kamath7303ebd2014-04-07 11:01:54 +0100360 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
361 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700362 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
David 'Digit' Turner2edfb712009-11-06 15:12:00 -0800363 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Joe Onorato25939e22010-11-09 08:53:01 -0800364 TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700365 bash $(BUILDINFO_SH) >> $@
Johan Redestig674a27d2012-04-12 17:00:58 +0200366 $(hide) $(foreach file,$(system_prop_file), \
367 if [ -f "$(file)" ]; then \
368 echo "#" >> $@; \
369 echo Target buildinfo from: "$(file)"; \
370 echo "# from $(file)" >> $@; \
371 echo "#" >> $@; \
372 cat $(file) >> $@; \
373 fi;)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900374 $(if $(FINAL_BUILD_PROPERTIES), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800375 $(hide) echo >> $@; \
376 echo "#" >> $@; \
377 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
378 echo "#" >> $@; )
Jaekyun Seok294286d2017-01-20 13:17:12 +0900379 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -0700380 echo "$(line)" >> $@;)
Andres Morales085a0ce2015-02-06 10:12:55 -0800381 $(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 -0800382 $(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 -0800383
384build_desc :=
385
Andres Moralesb8876e12015-05-06 20:44:22 -0700386ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
387INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
388else
389INSTALLED_RECOVERYIMAGE_TARGET :=
390endif
391
392$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
393 @echo "Target build info: $@"
Steven Morelandec082652017-10-22 02:11:47 -0700394 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
Andres Moralesb8876e12015-05-06 20:44:22 -0700395ifdef INSTALLED_RECOVERYIMAGE_TARGET
396 $(hide) echo ro.expect.recovery_id=`cat $(RECOVERYIMAGE_ID_FILE)` >> $@
397endif
398
The Android Open Source Project88b60792009-03-03 19:28:42 -0800399# -----------------------------------------------------------------
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700400# vendor build.prop
401#
Alex Naidis47e24e92016-01-10 14:18:54 +0000402# For verifying that the vendor build is what we think it is
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700403INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
404ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900405
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900406ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900407FINAL_VENDOR_BUILD_PROPERTIES += \
408 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
409FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
410 $(FINAL_VENDOR_BUILD_PROPERTIES),=)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900411endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900412
Steven Morelandec082652017-10-22 02:11:47 -0700413$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(VENDOR_BUILDINFO_SH) $(intermediate_system_build_prop)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700414 @echo Target vendor buildinfo: $@
415 @mkdir -p $(dir $@)
416 $(hide) echo > $@
Sandeep Patil127f5012017-10-23 19:47:43 -0700417 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
Dan Willemsenccc933e2015-08-11 15:25:12 -0700418 $(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@
419 $(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
Colin Crossf37b4552015-07-16 17:15:19 -0700420 $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
Isaac Chen8d11feb2018-01-31 14:27:37 +0800421 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
422 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
423 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Ryan Campbell63fc0e62017-10-02 12:29:41 -0700424 $(hide) TARGET_DEVICE="$(TARGET_DEVICE)" \
425 PRODUCT_NAME="$(TARGET_PRODUCT)" \
426 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
427 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
428 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
429 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
Jaekyun Seok4e3fcca2017-02-27 13:12:07 +0900430 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
431 bash $(VENDOR_BUILDINFO_SH) >> $@
Jaekyun Seokf9af5fa2017-10-25 12:08:32 +0900432ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900433 $(hide) echo "#" >> $@; \
434 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
435 echo "#" >> $@;
436 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
437 echo "$(line)" >> $@;)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900438endif # property_overrides_split_enabled
Ivan Podogovd5726322018-03-29 15:22:33 +0100439 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_PROPERTY_BLACKLIST)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700440
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900441# -----------------------------------------------------------------
442# product build.prop
443INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
444ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
445
446FINAL_PRODUCT_PROPERTIES += \
447 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES))
448FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
449 $(FINAL_PRODUCT_PROPERTIES),=)
450
451$(INSTALLED_PRODUCT_BUILD_PROP_TARGET):
452 @echo Target product buildinfo: $@
453 @mkdir -p $(dir $@)
454 $(hide) echo > $@
455ifdef BOARD_USES_PRODUCTIMAGE
456 $(hide) echo ro.product.build.date=`$(DATE_FROM_FILE)`>>$@
457 $(hide) echo ro.product.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
458 $(hide) echo ro.product.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
459endif # BOARD_USES_PRODUCTIMAGE
460 $(hide) echo "#" >> $@; \
461 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
462 echo "#" >> $@;
463 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
464 echo "$(line)" >> $@;)
465 $(hide) build/make/tools/post_process_props.py $@
466
Andres Morales9c820f82015-01-13 15:30:34 -0800467# ----------------------------------------------------------------
Andres Morales9c820f82015-01-13 15:30:34 -0800468
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700469# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800470# sdk-build.prop
471#
472# There are certain things in build.prop that we don't want to
473# ship with the sdk; remove them.
474
475# This must be a list of entire property keys followed by
476# "=" characters, without any internal spaces.
477sdk_build_prop_remove := \
478 ro.build.user= \
479 ro.build.host= \
480 ro.product.brand= \
481 ro.product.manufacturer= \
482 ro.product.device=
483# TODO: Remove this soon-to-be obsolete property
484sdk_build_prop_remove += ro.build.product=
485INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
486$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
487 @echo SDK buildinfo: $@
488 @mkdir -p $(dir $@)
489 $(hide) grep -v "$(subst $(space),\|,$(strip \
490 $(sdk_build_prop_remove)))" $< > $@.tmp
491 $(hide) for x in $(sdk_build_prop_remove); do \
492 echo "$$x"generic >> $@.tmp; done
493 $(hide) mv $@.tmp $@
494
495# -----------------------------------------------------------------
496# package stats
497PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
498PACKAGES_TO_STAT := \
499 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
500 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
501$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
502 @echo Package stats: $@
503 @mkdir -p $(dir $@)
504 $(hide) rm -f $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700505ifeq ($(PACKAGES_TO_STAT),)
506# Create empty package stats file if target builds no jar(s) or apk(s).
507 $(hide) touch $@
508else
Colin Crossfdea8932017-12-06 14:38:40 -0800509 $(hide) build/make/tools/dump-package-stats $^ > $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700510endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800511
512.PHONY: package-stats
513package-stats: $(PACKAGE_STATS_FILE)
514
515# -----------------------------------------------------------------
516# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700517# Use a macro to add newline to each echo command
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100518define _apkcerts_write_line
519$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
520$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
521$(hide) echo '' >> $5
Ying Wangd9a88d52012-10-26 09:21:28 -0700522
523endef
524
The Android Open Source Project88b60792009-03-03 19:28:42 -0800525name := $(TARGET_PRODUCT)
526ifeq ($(TARGET_BUILD_TYPE),debug)
527 name := $(name)_debug
528endif
529name := $(name)-apkcerts-$(FILE_NAME_TAG)
530intermediates := \
531 $(call intermediates-dir-for,PACKAGING,apkcerts)
532APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800533# We don't need to really build all the modules.
534# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700535$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800536 @echo APK certs list: $@
537 @mkdir -p $(dir $@)
538 @rm -f $@
Ying Wangd9a88d52012-10-26 09:21:28 -0700539 $(foreach p,$(PACKAGES),\
540 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100541 $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
542 $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
Ying Wangd9a88d52012-10-26 09:21:28 -0700543 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700544 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800545
546.PHONY: apkcerts-list
547apkcerts-list: $(APKCERTS_FILE)
548
Ying Wang15e487a2011-02-15 10:56:18 -0800549ifneq (,$(TARGET_BUILD_APPS))
550 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
551endif
Ying Wangefb21682010-07-23 16:42:13 -0700552
The Android Open Source Project88b60792009-03-03 19:28:42 -0800553# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700554# build system stats
555BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
556$(BUILD_SYSTEM_STATS):
557 @rm -f $@
558 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
559 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
560$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700561
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700562# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700563# Modules ready to be converted to Soong, ordered by how many
564# modules depend on them.
565SOONG_CONV := $(sort $(SOONG_CONV))
566SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
567$(SOONG_CONV_DATA):
568 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800569 @$(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 -0700570
Colin Crossfdea8932017-12-06 14:38:40 -0800571SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700572SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
573$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
574 @rm -f $@
575 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
576$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
577
578# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800579# Modules use -Wno-error, or added default -Wall -Werror
580WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
581$(WALL_WERROR):
582 @rm -f $@
583 echo "# Modules using -Wno-error" >> $@
584 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 -0800585 echo "# Modules added default -Wall" >> $@
586 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
587
588$(call dist-for-goals,droidcore,$(WALL_WERROR))
589
590# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800591# Modules missing profile files
592PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
593$(PGO_PROFILE_MISSING):
594 @rm -f $@
595 echo "# Modules missing PGO profile files" >> $@
596 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
597
598$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
599
600# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700601# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700602# for future OTA packages installed by this system. Actual product
603# deliverables will be re-signed by hand. We expect this file to
604# exist with the suffixes ".x509.pem" and ".pk8".
Ying Wang3c21fe52011-10-04 10:50:08 -0700605DEFAULT_KEY_CERT_PAIR := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
Doug Zongker8678df42009-06-15 14:30:14 -0700606
607
Jeff Browne33ba4c2011-07-11 22:11:46 -0700608# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800609# if they don't do anything.
610.PHONY: systemimage
611systemimage:
612
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800613# -----------------------------------------------------------------
614
615.PHONY: event-log-tags
616
Joe Onoratob7510532010-07-14 10:22:54 -0700617# Produce an event logs tag file for everything we know about, in order
618# to properly allocate numbers. Then produce a file that's filtered
619# for what's going to be installed.
620
621all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
622
Colin Crossdc8f8e42012-04-12 13:25:54 -0700623event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
624
Joe Onoratob7510532010-07-14 10:22:54 -0700625# Include tags from all packages that we know about
626all_event_log_tags_src := \
627 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
628
Colin Crossdc8f8e42012-04-12 13:25:54 -0700629# PDK builds will already have a full list of tags that needs to get merged
630# in with the ones from source
631pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
632
633$(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 -0800634$(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 -0700635 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900636 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700637
Doug Zongkera34fa952011-02-23 12:17:29 -0800638# Include tags from all packages included in this product, plus all
639# tags that are part of the system (ie, not in a vendor/ or device/
640# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800641event_log_tags_src := \
642 $(sort $(foreach m,\
643 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
644 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800645 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
646 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800647
Colin Crossdc8f8e42012-04-12 13:25:54 -0700648$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700649$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800650$(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 -0800651 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900652 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800653
654event-log-tags: $(event_log_tags_file)
655
656ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
657
Joe Onoratob7510532010-07-14 10:22:54 -0700658
The Android Open Source Project88b60792009-03-03 19:28:42 -0800659# #################################################################
660# Targets for boot/OS images
661# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800662ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
663 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
664 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
665 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
666 else
667 INSTALLED_2NDBOOTLOADER_TARGET :=
668 endif
669else
670 INSTALLED_BOOTLOADER_MODULE :=
671 INSTALLED_2NDBOOTLOADER_TARGET :=
672endif # TARGET_NO_BOOTLOADER
673ifneq ($(strip $(TARGET_NO_KERNEL)),true)
674 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
675else
676 INSTALLED_KERNEL_TARGET :=
677endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800678
679# -----------------------------------------------------------------
680# the ramdisk
681INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800682 $(ALL_GENERATED_SOURCES) \
683 $(ALL_DEFAULT_INSTALLED_MODULES))
684
Joe Onorato64d85d02009-04-09 19:31:12 -0700685BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
686
687# We just build this directly to the install location.
688INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Ying Wang82cceba2012-08-13 15:03:00 -0700689$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800690 $(call pretty,"Target ram disk: $@")
Thierry Strudel74a81e62015-07-09 09:54:55 -0700691 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800692
Ying Wangad7fd292013-08-08 16:34:29 -0700693.PHONY: ramdisk-nodeps
694ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
695 @echo "make $@: ignoring dependencies"
Thierry Strudel74a81e62015-07-09 09:54:55 -0700696 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800697
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700698INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
699
The Android Open Source Project88b60792009-03-03 19:28:42 -0800700ifneq ($(strip $(TARGET_NO_KERNEL)),true)
701
702# -----------------------------------------------------------------
703# the boot image, which is a collection of other images.
704INTERNAL_BOOTIMAGE_ARGS := \
705 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700706 --kernel $(INSTALLED_KERNEL_TARGET)
707
708ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
709INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
710endif
711
The Android Open Source Project88b60792009-03-03 19:28:42 -0800712INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
713
Dima Zavin1e0847c2009-05-07 19:43:08 -0700714ifdef BOARD_KERNEL_BASE
715 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
716endif
717
Ying Wangffff0022010-08-23 12:56:25 -0700718ifdef BOARD_KERNEL_PAGESIZE
719 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
720endif
721
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700722ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
723ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
724VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
725 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
726endif
727endif
728
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700729INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
730ifdef INTERNAL_KERNEL_CMDLINE
731INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700732endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700733
Sami Tolvanen3303d902016-03-15 16:49:30 +0000734INTERNAL_MKBOOTIMG_VERSION_ARGS := \
735 --os_version $(PLATFORM_VERSION) \
736 --os_patch_level $(PLATFORM_SECURITY_PATCH)
737
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800738# BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true.
739ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
740ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
741 $(error BOARD_BUILD_SYSTEM_ROOT_IMAGE must be enabled for BOARD_USES_RECOVERY_AS_BOOT.)
742endif
743endif
744
745# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
746ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800747ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800748$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400749
750else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
751
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800752$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400753 $(call pretty,"Target boot image: $@")
754 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800755 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400756 $(hide) $(AVBTOOL) add_hash_footer \
757 --image $@ \
758 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800759 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400760 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
761
762.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800763bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400764 @echo "make $@: ignoring dependencies"
765 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800766 $(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 -0400767 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800768 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400769 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800770 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400771 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
772
773else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700774
775$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
776 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000777 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800778 $(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 -0700779 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
780
781.PHONY: bootimage-nodeps
782bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
783 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000784 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800785 $(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 -0700786 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
787
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +0100788else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -0800789
Tao Bao4b577412017-02-22 22:54:39 -0800790$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800791 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000792 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700793 $(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 -0800794 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
795
796.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -0800797bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800798 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000799 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700800 $(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 -0800801 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
802
803else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800804
805$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
806 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000807 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700808 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700809
810.PHONY: bootimage-nodeps
811bootimage-nodeps: $(MKBOOTIMG)
812 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000813 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700814 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700815
The Android Open Source Project88b60792009-03-03 19:28:42 -0800816endif # TARGET_BOOTIMAGE_USE_EXT2
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800817endif # BOARD_USES_RECOVERY_AS_BOOT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800818
819else # TARGET_NO_KERNEL
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700820ifdef BOARD_PREBUILT_BOOTIMAGE
821ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
822# Remove when b/63676296 is resolved.
823$(error Prebuilt bootimage is only supported for AB targets)
824endif
825$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
826else
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700827INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800828# HACK: The top-level targets depend on the bootimage. Not all targets
829# can produce a bootimage, though, and emulator targets need the ramdisk
830# instead. Fake it out by calling the ramdisk the bootimage.
831# TODO: make the emulator use bootimages, and make mkbootimg accept
832# kernel-less inputs.
833INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
834endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700835endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800836
837# -----------------------------------------------------------------
838# NOTICE files
839#
Steve Blockd14d3b42012-03-01 11:34:41 +0000840# We are required to publish the licenses for all code under BSD, GPL and
841# Apache licenses (and possibly other more exotic ones as well). We err on the
842# side of caution, so the licenses for other third-party code are included here
843# too.
844#
The Android Open Source Project88b60792009-03-03 19:28:42 -0800845# This needs to be before the systemimage rules, because it adds to
846# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
847# go into the systemimage.
848
Steve Block495e5852012-02-29 19:18:08 +0000849.PHONY: notice_files
850
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900851# Create the rule to combine the files into text and html/xml forms
852# $(1) - xml_excluded_vendor|xml_vendor|html
853# $(2) - Plain text output file
854# $(3) - HTML/XML output file
855# $(4) - File title
856# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -0800857# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900858# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -0800859#
860# The algorithm here is that we go collect a hash for each of the notice
861# files and write the names of the files that match that hash. Then
862# to generate the real files, we go print out all of the files and their
863# hashes.
864#
865# These rules are fairly complex, so they depend on this makefile so if
866# it changes, they'll run again.
867#
868# TODO: We could clean this up so that we just record the locations of the
869# original notice files instead of making rules to copy them somwehere.
870# Then we could traverse that without quite as much bash drama.
871define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900872$(2) $(3): PRIVATE_MESSAGE := $(4)
873$(2) $(3): PRIVATE_DIR := $(5)
874$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -0800875$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
876 build/make/tools/generate-notice-files.py --text-output $(2) \
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900877 $(if $(filter $(1),xml_excluded_vendor),-e vendor --xml-output, \
878 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
879 --html-output)) $(3) \
880 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
881notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800882endef
883
884# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
885# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
886# the src subdirectory.
887
Steve Block495e5852012-02-29 19:18:08 +0000888target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900889target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
890target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
891installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
Steve Block495e5852012-02-29 19:18:08 +0000892tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -0800893tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
894
Steven Morelandae69e572017-12-15 14:49:55 -0800895# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
896ifeq ($(PRODUCT_NOTICE_SPLIT),true)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900897target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
898target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
899installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
900
901target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
902target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
903target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
904installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
905endif
906
Ying Wang62c81f82013-08-22 20:02:03 -0700907ifndef TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -0800908kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
Josh Gao4d9268e2017-02-23 13:17:46 -0800909winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
Ying Wang4534d812012-04-09 17:04:12 -0700910pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800911
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900912ifdef target_vendor_notice_file_xml_gz
913$(eval $(call combine-notice-files, xml_excluded_vendor, \
Steve Block495e5852012-02-29 19:18:08 +0000914 $(target_notice_file_txt), \
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900915 $(target_notice_file_html_or_xml), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800916 "Notices for files contained in the filesystem images in this directory:", \
917 $(TARGET_OUT_NOTICE_FILES), \
Ying Wang4534d812012-04-09 17:04:12 -0700918 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900919$(eval $(call combine-notice-files, xml_vendor, \
920 $(target_vendor_notice_file_txt), \
921 $(target_vendor_notice_file_xml), \
922 "Notices for files contained in the vendor filesystem image in this directory:", \
923 $(TARGET_OUT_NOTICE_FILES), \
924 $(target_notice_file_html_or_xml)))
925else
926$(eval $(call combine-notice-files, html, \
927 $(target_notice_file_txt), \
928 $(target_notice_file_html_or_xml), \
929 "Notices for files contained in the filesystem images in this directory:", \
930 $(TARGET_OUT_NOTICE_FILES), \
931 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
932endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800933
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900934$(eval $(call combine-notice-files, html, \
Steve Block495e5852012-02-29 19:18:08 +0000935 $(tools_notice_file_txt), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800936 $(tools_notice_file_html), \
937 "Notices for files contained in the tools directory:", \
938 $(HOST_OUT_NOTICE_FILES), \
Josh Gao4d9268e2017-02-23 13:17:46 -0800939 $(ALL_DEFAULT_INSTALLED_MODULES) \
940 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800941
942# Install the html file at /system/etc/NOTICE.html.gz.
943# This is not ideal, but this is very late in the game, after a lot of
944# the module processing has already been done -- in fact, we used the
945# fact that all that has been done to get the list of modules that we
946# need notice files for.
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900947$(target_notice_file_html_or_xml_gz): $(target_notice_file_html_or_xml) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -0700948 $(hide) $(MINIGZIP) -9 < $< > $@
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900949$(installed_notice_html_or_xml_gz): $(target_notice_file_html_or_xml_gz)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800950 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700951
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900952ifdef target_vendor_notice_file_xml_gz
953# Install the vendor html file at /vendor/etc/NOTICE.xml.gz.
954$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
955 $(hide) $(MINIGZIP) -9 < $< > $@
956$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
957 $(copy-file-to-target)
958endif
959
Joe Onorato7b2845a2009-04-30 13:52:50 -0700960# if we've been run my mm, mmm, etc, don't reinstall this every time
961ifeq ($(ONE_SHOT_MAKEFILE),)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900962 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
963 ifdef target_vendor_notice_file_xml_gz
964 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
965 endif
Joe Onorato7b2845a2009-04-30 13:52:50 -0700966endif
Ying Wang62c81f82013-08-22 20:02:03 -0700967endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -0800968
969# The kernel isn't really a module, so to get its module file in there, we
970# make the target NOTICE files depend on this particular file too, which will
971# then be in the right directory for the find in combine-notice-files to work.
972$(kernel_notice_file): \
Lee Campbellb463fcd2015-11-08 16:28:15 -0800973 $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800974 | $(ACP)
975 @echo Copying: $@
976 $(hide) mkdir -p $(dir $@)
977 $(hide) $(ACP) $< $@
978
Josh Gao4d9268e2017-02-23 13:17:46 -0800979$(winpthreads_notice_file): \
980 $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
981 | $(ACP)
982 @echo Copying: $@
983 $(hide) mkdir -p $(dir $@)
984 $(hide) $(ACP) $< $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800985
Doug Zongker8678df42009-06-15 14:30:14 -0700986# -----------------------------------------------------------------
987# Build a keystore with the authorized keys in it, used to verify the
988# authenticity of downloaded OTA packages.
989#
990# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
991# before the rules that use that variable to build the image.
Dan Willemsenb589ae42015-10-29 21:26:18 +0000992ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
993$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Dan Willemsen48a621c2015-10-29 16:33:05 -0700994$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR)) | $(ZIPTIME)
Doug Zongker8678df42009-06-15 14:30:14 -0700995 $(hide) rm -f $@
996 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -0700997 $(hide) zip -qjX $@ $<
998 $(remove-timestamps-from-package)
Doug Zongker8678df42009-06-15 14:30:14 -0700999
Alex Deymocec578c2017-03-28 20:48:18 -07001000# Carry the public key for update_engine if it's a non-IoT target that
Tao Bao38812d62016-01-20 20:58:20 -08001001# uses the AB updater. We use the same key as otacerts but in RSA public key
1002# format.
1003ifeq ($(AB_OTA_UPDATER),true)
Alex Deymocec578c2017-03-28 20:48:18 -07001004ifneq ($(PRODUCT_IOT),true)
Tao Bao23c3db92016-01-21 14:28:50 -08001005ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
1006$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Tao Bao38812d62016-01-20 20:58:20 -08001007 $(hide) rm -f $@
1008 $(hide) mkdir -p $(dir $@)
1009 $(hide) openssl x509 -pubkey -noout -in $< > $@
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001010
1011ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_RECOVERY_ROOT_OUT)/etc/update_engine/update-payload-key.pub.pem
1012$(TARGET_RECOVERY_ROOT_OUT)/etc/update_engine/update-payload-key.pub.pem: $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
1013 $(hide) cp -f $< $@
Tao Bao38812d62016-01-20 20:58:20 -08001014endif
1015endif
1016
Doug Zongker8678df42009-06-15 14:30:14 -07001017.PHONY: otacerts
1018otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
1019
1020
The Android Open Source Project88b60792009-03-03 19:28:42 -08001021# #################################################################
1022# Targets for user images
1023# #################################################################
1024
Ying Wang933abf12010-06-16 14:31:34 -07001025INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001026ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001027INTERNAL_USERIMAGES_USE_EXT := true
1028INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1029else
1030ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
1031INTERNAL_USERIMAGES_USE_EXT := true
1032INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1033else
1034ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
1035INTERNAL_USERIMAGES_USE_EXT := true
1036INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1037endif
1038endif
1039endif
1040
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001041# These options tell the recovery updater/installer how to mount the partitions writebale.
1042# <fstype>=<fstype_opts>[|<fstype_opts>]...
1043# fstype_opts := <opt>[,<opt>]...
1044# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001045# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1046DEFAULT_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 -07001047
Ying Wang542903a2010-11-17 15:40:38 -08001048ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1049 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1050endif
1051
Colin Cross0a7b2c52010-05-07 02:23:59 -07001052ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001053INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
1054INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK)
1055ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1056INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1057endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001058endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001059
Chris Friesdf0387d2017-06-21 15:51:46 -05001060ifeq ($(BOARD_AVB_ENABLE),true)
1061INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1062endif
1063
Todd Poynorb2a555e2015-12-15 18:00:14 -08001064ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1065 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1066endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001067ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
Mohamad Ayyash353265b2015-06-24 15:42:19 -07001068INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001069endif
1070
Ying Wang178ef922011-10-31 18:13:30 -07001071INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001072
Colin Cross8a30f722014-04-28 16:27:32 -07001073ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001074INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001075ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC))
1076INTERNAL_USERIMAGES_DEPS += $(FEC)
1077endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001078endif
1079
Alex Klyubin092c9022017-03-13 13:28:34 -07001080SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001081INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1082
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001083INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1084
Jin Qianabcec5e2017-03-10 16:53:45 -08001085ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
1086INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
1087endif
1088
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001089ifeq (true,$(USE_LOGICAL_PARTITIONS))
1090
1091ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
1092 $(error vboot 1.0 doesn't support logical partition)
1093endif
1094
1095# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1096# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1097
1098endif # USE_LOGICAL_PARTITIONS
1099
Ying Wangbd93d422011-10-28 17:02:30 -07001100# $(1): the path of the output dictionary file
Yifan Hong760d3c02018-05-30 11:16:46 -07001101# $(2): a subset of "system vendor cache userdata product oem"
1102# $(3): additional "key=value" pairs to append to the dictionary file.
1103define generate-image-prop-dictionary
Vikram Dattu29e88b82016-12-16 09:45:19 +01001104$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
Ying Wangbd93d422011-10-28 17:02:30 -07001105$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001106$(if $(filter $(2),system),\
1107 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
1108 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1109 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1110 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1111 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1112 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1113 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1114 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1115 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1116 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1117 $(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 -07001118 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001119)
Jin Qianfde9f792018-01-22 13:15:46 -08001120$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001121$(if $(filter $(2),userdata),\
1122 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1123 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
1124)
Connor O'Briene9ee68d2017-01-05 16:48:14 -08001125$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1126$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001127$(if $(filter $(2),cache),\
1128 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1129 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
1130)
1131$(if $(filter $(2),vendor),\
1132 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1133 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1134 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1135 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1136 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1137 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1138 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1139 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1140 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1141 $(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 -07001142 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001143)
1144$(if $(filter $(2),product),\
1145 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1146 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1147 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1148 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1149 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1150 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1151 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1152 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1153 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1154 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
1155)
1156$(if $(filter $(2),oem),\
1157 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1158 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1159 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1160 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1161)
Ying Wangbd93d422011-10-28 17:02:30 -07001162$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001163$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001164$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001165$(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 -07001166$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
Paul Lawrencea37b2bb2014-11-13 17:54:30 -08001167$(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 +02001168$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001169$(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 +08001170$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001171$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1172$(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 +09001173$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001174$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1175$(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 -07001176$(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 -08001177$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001178$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001179$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001180$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1181$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1182$(if $(BOARD_AVB_ENABLE),\
1183 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1184 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1185 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1186 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
1187$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1188$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1189$(if $(BOARD_AVB_ENABLE),\
1190 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1191 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1192 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1193 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001194$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1195$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1196$(if $(BOARD_AVB_ENABLE),\
1197 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1198 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1199 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1200 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001201$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1202 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001203$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Yifan Hong760d3c02018-05-30 11:16:46 -07001204 $(hide) echo "system_root_image=true" >> $(1)
1205 $(hide) echo "ramdisk_dir=$(TARGET_ROOT_OUT)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001206$(if $(USE_LOGICAL_PARTITIONS),$(hide) echo "use_logical_partitions=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001207$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1208endef
1209
1210# $(1): the path of the output dictionary file
1211# $(2): additional "key=value" pairs to append to the dictionary file.
1212define generate-userimage-prop-dictionary
1213$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product oem,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001214endef
1215
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001216# $(1): the path of the input dictionary file, where each line has the format key=value
1217# $(2): the key to look up
1218define read-image-prop-dictionary
1219$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1220endef
1221
Xu Chao2b04bf42017-07-06 14:34:31 +08001222# $(1): modules list
1223# $(2): output dir
1224# $(3): mount point
1225# $(4): staging dir
1226# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1227define build-image-kernel-modules
1228 $(hide) rm -rf $(2)/lib/modules
1229 $(hide) mkdir -p $(2)/lib/modules
1230 $(hide) cp $(1) $(2)/lib/modules/
1231 $(hide) rm -rf $(4)
1232 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1233 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1234 $(hide) $(DEPMOD) -b $(4) 0.0
1235 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1236 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1237endef
1238
The Android Open Source Project88b60792009-03-03 19:28:42 -08001239# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001240# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001241
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001242# Recovery image exists if we are building recovery, or building recovery as boot.
1243ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001244
Ying Wang37526142015-03-10 12:02:57 -07001245INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1246 $(ALL_DEFAULT_INSTALLED_MODULES))
1247
Doug Zongker4647f122009-07-02 09:00:54 -07001248recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001249recovery_sepolicy := \
1250 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001251 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001252 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001253 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001254 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts
1255
Bowgo Tsai99671252017-11-30 22:15:17 +08001256ifdef BOARD_ODM_SEPOLICY_DIRS
1257recovery_sepolicy += \
1258 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
1259 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts
1260endif
1261
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001262# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1263# SELinux files
1264IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1265
Doug Zongker4647f122009-07-02 09:00:54 -07001266recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1267recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001268recovery_build_props := $(intermediate_system_build_prop)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +09001269ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001270recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
1271endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001272ifdef BOARD_USES_PRODUCTIMAGE
1273recovery_build_props += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
1274endif
Doug Zongker4647f122009-07-02 09:00:54 -07001275recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001276
Doug Zongker8eaeea92014-05-12 15:32:20 -07001277# Set recovery_density to the density bucket of the device.
1278recovery_density := unknown
1279ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
1280# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value.
1281recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Doug Zongker25d55f82014-04-04 13:51:15 -07001282else
Adam Lesinski83ee6d72014-12-02 16:13:09 -08001283# Otherwise, use the default medium density.
1284recovery_densities := mdpi
Doug Zongker8eaeea92014-05-12 15:32:20 -07001285endif
1286
1287ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1288recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1289else
Doug Zongker25d55f82014-04-04 13:51:15 -07001290recovery_resources_common := $(recovery_resources_common)-xhdpi
1291endif
1292
Doug Zongker8eaeea92014-05-12 15:32:20 -07001293# Select the 18x32 font on high-density devices (xhdpi and up); and
1294# the 12x22 font on other devices. Note that the font selected here
1295# can be overridden for a particular device by putting a font.png in
1296# its private recovery resources.
1297
Tao Baoabbc9112015-04-08 14:14:43 -07001298ifneq (,$(filter xxxhdpi 560dpi xxhdpi 400dpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001299recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1300else
1301recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1302endif
1303
Ying Wang9a175682015-08-06 11:47:47 -07001304ifndef TARGET_PRIVATE_RES_DIRS
1305TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1306endif
Doug Zongker4647f122009-07-02 09:00:54 -07001307recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001308 $(TARGET_PRIVATE_RES_DIRS) -type f)
Andrew Boiefa61ff02012-09-28 09:33:45 -07001309ifdef TARGET_RECOVERY_FSTAB
1310recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1311else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001312recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001313endif
Tao Baoc3c17532016-06-10 10:11:54 -07001314ifdef TARGET_RECOVERY_WIPE
1315recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001316else
Tao Baoc3c17532016-06-10 10:11:54 -07001317recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001318endif
Tao Bao8beab692015-07-22 12:33:18 -07001319
Tao Bao6d5d6232018-03-09 17:04:42 -08001320# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001321# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001322# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1323# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001324#
1325# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001326# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001327# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001328# b) We build a single image that contains boot and recovery both - no recovery image to install
1329# (BOARD_USES_RECOVERY_AS_BOOT = true);
1330# c) We build the root into system image - not needing the resource file as we do bsdiff
1331# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001332# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1333# do bsdiff because boot and recovery will contain different number of entries
1334# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Tao Bao6d5d6232018-03-09 17:04:42 -08001335# Note that condition b) implies condition c), because of the earlier check in this file:
1336# "BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true" (not vice
1337# versa though).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001338
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001339ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) \
1340 $(BOARD_INCLUDE_RECOVERY_DTBO)))
Doug Zongker56588872012-08-20 15:38:58 -07001341# Named '.dat' so we don't attempt to use imgdiff for patching it.
1342RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001343else
Tao Bao8beab692015-07-22 12:33:18 -07001344RECOVERY_RESOURCE_ZIP :=
1345endif
Doug Zongker4647f122009-07-02 09:00:54 -07001346
Doug Zongker4647f122009-07-02 09:00:54 -07001347INTERNAL_RECOVERYIMAGE_ARGS := \
1348 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1349 --kernel $(recovery_kernel) \
1350 --ramdisk $(recovery_ramdisk)
1351
1352# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001353ifdef INTERNAL_KERNEL_CMDLINE
1354 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001355endif
1356ifdef BOARD_KERNEL_BASE
1357 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1358endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001359ifdef BOARD_KERNEL_PAGESIZE
1360 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1361endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001362ifdef BOARD_INCLUDE_RECOVERY_DTBO
1363 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1364endif
Doug Zongker4647f122009-07-02 09:00:54 -07001365
1366# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001367# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001368# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001369OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001370
1371# Generate a file containing the keys that will be read by the
1372# recovery binary.
1373RECOVERY_INSTALL_OTA_KEYS := \
1374 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
1375DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
1376$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001377$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Doug Zongkere121d6a2011-02-01 14:13:52 -08001378$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
1379 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
Doug Zongker4647f122009-07-02 09:00:54 -07001380 @rm -rf $@
1381 @mkdir -p $(dir $@)
Colin Cross0851df82017-06-30 13:55:38 -07001382 $(JAVA) -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
Doug Zongker4647f122009-07-02 09:00:54 -07001383
Andres Moralesb8876e12015-05-06 20:44:22 -07001384RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001385
Ying Wang747b9f12015-01-30 14:05:22 -08001386# $(1): output file
1387define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001388 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001389 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao3f56a332016-01-12 11:34:58 -08001390 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001391 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001392 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
1393 $(hide) rsync -a --exclude=etc --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001394 # Modifying ramdisk contents...
Howard Chen1756f8d2017-02-22 17:27:10 +08001395 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1396 $(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 +08001397 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1398 $(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 -08001399 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Ying Wang36b039a2015-04-02 12:48:32 -07001400 $(hide) cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ || true # Ignore error when the src file doesn't exist.
Ying Wang747b9f12015-01-30 14:05:22 -08001401 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1402 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1403 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
1404 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001405 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1406 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001407 $(hide) $(foreach item,$(recovery_fstab), \
1408 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001409 $(if $(strip $(recovery_wipe)), \
1410 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.wipe)
Ying Wang747b9f12015-01-30 14:05:22 -08001411 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001412 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001413 > $(TARGET_RECOVERY_ROOT_OUT)/prop.default
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001414 $(if $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET), \
1415 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001416 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default)
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001417 $(hide) cat $(recovery_build_props) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001418 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1419 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001420 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001421 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Tao Baod95e9fd2015-03-29 23:07:41 -07001422 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001423 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1424 $(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 +01001425 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001426 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1427 $(BOOT_SIGNER) /boot $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1428 $(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
1429 )\
1430 )
Tao Baod95e9fd2015-03-29 23:07:41 -07001431 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001432 $(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 +08001433 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1434 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1435 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001436 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1437 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1438 $(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),\
1439 $(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 -08001440endef
1441
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001442ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Ying Wangbd07ad02016-03-10 12:57:33 -08001443ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
1444$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1445endif
1446ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
1447$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1448endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001449ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001450$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001451endif
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001452$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001453 $(INSTALLED_RAMDISK_TARGET) \
1454 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001455 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001456 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001457 $(recovery_build_props) $(recovery_resource_deps) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001458 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001459 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001460 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1461 $(BOARD_RECOVERY_KERNEL_MODULES) \
1462 $(DEPMOD)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001463 $(call pretty,"Target boot image from recovery: $@")
1464 $(call build-recoveryimage-target, $@)
1465endif
1466
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001467$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Doug Zongker4647f122009-07-02 09:00:54 -07001468 $(INSTALLED_RAMDISK_TARGET) \
1469 $(INSTALLED_BOOTIMAGE_TARGET) \
Ying Wang37526142015-03-10 12:02:57 -07001470 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001471 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Doug Zongker4647f122009-07-02 09:00:54 -07001472 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001473 $(recovery_build_props) $(recovery_resource_deps) \
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001474 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001475 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001476 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1477 $(BOARD_RECOVERY_KERNEL_MODULES) \
1478 $(DEPMOD)
Ying Wang747b9f12015-01-30 14:05:22 -08001479 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001480
Tao Bao4594d0e2015-12-22 09:47:46 -08001481ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001482$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001483 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001484 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1485 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001486endif
Doug Zongker56588872012-08-20 15:38:58 -07001487
Ying Wang747b9f12015-01-30 14:05:22 -08001488.PHONY: recoveryimage-nodeps
1489recoveryimage-nodeps:
1490 @echo "make $@: ignoring dependencies"
1491 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1492
Tao Bao8beab692015-07-22 12:33:18 -07001493else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07001494RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07001495endif
1496
1497.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001498recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001499
Jiyong Park03eb0612017-10-04 21:22:41 +09001500ifneq ($(BOARD_NAND_PAGE_SIZE),)
1501$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001502endif
1503
Jiyong Park03eb0612017-10-04 21:22:41 +09001504ifneq ($(BOARD_NAND_SPARE_SIZE),)
1505$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001506endif
1507
Doug Zongker4647f122009-07-02 09:00:54 -07001508# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07001509# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08001510#
Ying Wang9c649a72012-08-08 15:27:00 -07001511# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
1512PDK_FUSION_SYSIMG_FILES := \
1513 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
1514 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001515
1516INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07001517 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07001518 $(ALL_DEFAULT_INSTALLED_MODULES) \
1519 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08001520 $(RECOVERY_RESOURCE_ZIP)) \
1521 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wang160b6702012-03-13 18:58:27 -07001522
Ying Wang82cceba2012-08-13 15:03:00 -07001523FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001524
1525# ASAN libraries in the system image - add dependency.
1526ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
1527ifneq (,$(SANITIZE_TARGET))
1528 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
1529 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
1530 endif
1531endif
1532
Ying Wange5e8c5f2011-09-09 16:35:53 -07001533# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07001534# Final System VINTF manifest including fragments. This is not assembled
1535# on the device because it depends on everything in a given device
1536# image which defines a vintf_fragment.
1537
1538BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
1539$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
1540$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
1541$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
1542$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
1543 @echo "Verifying system VINTF manifest."
1544 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
1545 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
1546 -c $(BUILT_VENDOR_MATRIX) \
1547 -i $(BUILT_SYSTEM_MANIFEST) \
1548 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
1549 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
1550 sed "s/^/-i /" | tr '\n' ' ') -o $@
1551
1552# -----------------------------------------------------------------
Ying Wange5e8c5f2011-09-09 16:35:53 -07001553# installed file list
1554# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
1555# We put installed-files.txt ahead of image itself in the dependency graph
1556# so that we can get the size stat even if the build fails due to too large
1557# system image.
1558INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07001559INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
1560$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001561$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001562 @echo Installed file list: $@
1563 @mkdir -p $(dir $@)
1564 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001565 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08001566 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07001567
1568.PHONY: installed-file-list
1569installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08001570
1571$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07001572
1573systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001574 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001575BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
1576
Ying Wang23898df2014-06-18 20:26:24 -07001577# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07001578ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07001579define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07001580$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
1581 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
1582 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
1583 exit 1; \
1584fi
Ying Wang23898df2014-06-18 20:26:24 -07001585$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
1586endef
1587else
1588define create-system-vendor-symlink
1589endef
1590endif
1591
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001592# Create symlink /system/product to /product if necessary.
1593ifdef BOARD_USES_PRODUCTIMAGE
1594define create-system-product-symlink
1595$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
1596 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
1597 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
1598 exit 1; \
1599fi
1600$(hide) ln -sf /product $(TARGET_OUT)/product
1601endef
1602else
1603define create-system-product-symlink
1604endef
1605endif
1606
The Android Open Source Project88b60792009-03-03 19:28:42 -08001607# $(1): output file
1608define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07001609 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07001610 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001611 $(call create-system-product-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07001612 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001613 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07001614 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001615 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001616 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001617 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001618 $(systemimage_intermediates)/generated_system_image_info.txt \
1619 || ( mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07001620 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08001621endef
1622
Steven Moreland627debe2018-05-01 09:54:21 -07001623$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09001624$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001625 $(call build-systemimage-target,$@)
1626
The Android Open Source Project88b60792009-03-03 19:28:42 -08001627INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07001628SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001629
Doug Zongker73ef8252009-07-23 15:12:53 -07001630# The system partition needs room for the recovery image as well. We
1631# now store the recovery image as a binary patch using the boot image
1632# as the source (since they are very similar). Generate the patch so
1633# we can see how big it's going to be, and include that in the system
1634# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -07001635ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07001636ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001637ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08001638diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
1639else
1640diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
1641endif
Doug Zongker73ef8252009-07-23 15:12:53 -07001642intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
1643RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08001644$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
1645$(RECOVERY_FROM_BOOT_PATCH): \
1646 $(INSTALLED_RECOVERYIMAGE_TARGET) \
1647 $(INSTALLED_BOOTIMAGE_TARGET) \
1648 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07001649 @echo "Construct recovery from boot"
1650 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08001651 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07001652else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
1653RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
1654endif
Sriram Raman1e96ac82009-07-24 13:52:32 -07001655endif
1656
Doug Zongker73ef8252009-07-23 15:12:53 -07001657
Dan Willemsen7f016152016-02-29 17:52:39 -08001658$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001659 @echo "Install system fs image: $@"
1660 $(copy-file-to-target)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001661 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
1662 $(call read-image-prop-dictionary,\
1663 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001664
1665systemimage: $(INSTALLED_SYSTEMIMAGE)
1666
1667.PHONY: systemimage-nodeps snod
1668systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07001669 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001670 @echo "make $@: ignoring dependencies"
1671 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001672 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),\
1673 $(call read-image-prop-dictionary,\
1674 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001675
Ying Wangacf01ec2012-02-24 11:05:48 -08001676ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
1677ifeq (true,$(WITH_DEXPREOPT))
1678$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
1679endif
1680endif
1681
Colin Cross91a52272017-06-20 16:57:52 -07001682.PHONY: sync
1683sync: $(INTERNAL_SYSTEMIMAGE_FILES)
1684
The Android Open Source Project88b60792009-03-03 19:28:42 -08001685#######
1686## system tarball
1687define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07001688 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
1689 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001690 $(call create-system-product-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07001691 $(MKTARBALL) $(FS_GET_STATS) \
1692 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001693 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001694endef
1695
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001696ifndef SYSTEM_TARBALL_FORMAT
1697 SYSTEM_TARBALL_FORMAT := bz2
1698endif
1699
The Android Open Source Project88b60792009-03-03 19:28:42 -08001700system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001701INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001702$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
1703$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
1704 $(build-systemtarball-target)
1705
1706.PHONY: systemtarball-nodeps
1707systemtarball-nodeps: $(FS_GET_STATS) \
1708 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
1709 $(build-systemtarball-target)
1710
1711.PHONY: stnod
1712stnod: systemtarball-nodeps
1713
Ying Wang3a61eeb2016-03-11 10:32:01 -08001714# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07001715## platform.zip: system, plus other files to be used in PDK fusion build,
1716## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07001717##
1718## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
1719## The variable will be typically set from BoardConfig.mk.
1720## Files under out dir will be rejected to prevent possible conflicts with other rules.
Ying Wang3a61eeb2016-03-11 10:32:01 -08001721pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
1722 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1723pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
1724 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1725pdk_classes_dex := $(strip \
1726 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
1727 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
1728
1729pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
1730$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
1731$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
1732$(pdk_odex_config_mk) :
1733 @echo "PDK odex config makefile: $@"
1734 $(hide) mkdir -p $(dir $@)
1735 $(hide) echo "# Auto-generated. Do not modify." > $@
1736 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
1737 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
1738 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
1739 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
1740 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1741 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1742 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1743 )
1744 $(foreach m,$(PRIVATE_APPS),\
1745 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
1746 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1747 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1748 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1749 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07001750 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08001751 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
1752 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
1753 )
1754
keunyoungc0178062013-07-22 14:54:58 -07001755PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07001756INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08001757
1758$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
1759$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
1760$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_odex_config_mk)
Keun young Park816b9fd2012-05-16 10:32:41 -07001761 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Ying Wang4c289e52012-03-30 13:52:54 -07001762 $(hide) rm -f $@
Dan Willemsen48a621c2015-10-29 16:33:05 -07001763 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wang4534d812012-04-09 17:04:12 -07001764 $(TARGET_COPY_OUT_SYSTEM) \
Keun young Park72226692012-07-31 17:13:20 -07001765 $(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES)) \
1766 $(addprefix symbols/,$(PDK_SYMBOL_FILES_LIST))
Ying Wangcff38622014-07-16 17:46:35 -07001767ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
Dan Willemsen48a621c2015-10-29 16:33:05 -07001768 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wangcff38622014-07-16 17:46:35 -07001769 $(TARGET_COPY_OUT_VENDOR)
1770endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001771ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
1772 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
1773 $(TARGET_COPY_OUT_PRODUCT)
1774endif
Colin Crossc451a372013-12-18 19:36:44 -08001775ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001776 $(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
Keun young Park816b9fd2012-05-16 10:32:41 -07001777endif
keunyoungc0178062013-07-22 14:54:58 -07001778ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001779 $(hide) zip -qryX $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
keunyoungc0178062013-07-22 14:54:58 -07001780endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08001781 @# Add dex-preopt files and config.
1782 $(if $(PRIVATE_DEX_FILES),$(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@ $(PRIVATE_DEX_FILES)))
Dan Willemsen0663f682018-03-06 14:07:21 -08001783 $(hide) touch $(PRODUCT_OUT)/pdk.mk
1784 $(hide) zip -qryXj $@ $(PRIVATE_ODEX_CONFIG) $(PRODUCT_OUT)/pdk.mk
Ying Wang4c289e52012-03-30 13:52:54 -07001785
1786.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07001787platform: $(INSTALLED_PLATFORM_ZIP)
1788
1789.PHONY: platform-java
1790platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07001791
1792# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07001793ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
1794$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07001795endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001796
Ying Wang3a61eeb2016-03-11 10:32:01 -08001797# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07001798## boot tarball
1799define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07001800 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07001801 $(hide) mkdir -p $(PRODUCT_OUT)/boot
1802 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001803 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07001804 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
1805 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001806 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07001807endef
1808
1809ifndef BOOT_TARBALL_FORMAT
1810 BOOT_TARBALL_FORMAT := bz2
1811endif
1812
1813boot_tar := $(PRODUCT_OUT)/boot.tar
1814INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
1815$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
1816$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
1817 $(build-boottarball-target)
1818
1819.PHONY: boottarball-nodeps btnod
1820boottarball-nodeps btnod: $(FS_GET_STATS) \
1821 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
1822 $(build-boottarball-target)
1823
1824
The Android Open Source Project88b60792009-03-03 19:28:42 -08001825# -----------------------------------------------------------------
1826# data partition image
1827INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001828 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001829
Ying Wangd7321d32013-03-15 10:32:29 -07001830# Don't build userdata.img if it's extfs but no partition size
1831skip_userdata.img :=
1832ifdef INTERNAL_USERIMAGES_EXT_VARIANT
1833ifndef BOARD_USERDATAIMAGE_PARTITION_SIZE
1834skip_userdata.img := true
1835endif
1836endif
1837
1838ifneq ($(skip_userdata.img),true)
Ying Wangbd93d422011-10-28 17:02:30 -07001839userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001840 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07001841BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
1842
Ying Wangbd93d422011-10-28 17:02:30 -07001843define build-userdataimage-target
1844 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
1845 @mkdir -p $(TARGET_OUT_DATA)
1846 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001847 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001848 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001849 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001850 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001851 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07001852endef
1853
Joe Onorato64d85d02009-04-09 19:31:12 -07001854# We just build this directly to the install location.
1855INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001856INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
1857 $(INTERNAL_USERIMAGES_DEPS) \
1858 $(INTERNAL_USERDATAIMAGE_FILES) \
1859 $(BUILD_IMAGE_SRCS)
1860$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001861 $(build-userdataimage-target)
1862
1863.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07001864userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001865 $(build-userdataimage-target)
1866
Ying Wangd7321d32013-03-15 10:32:29 -07001867endif # not skip_userdata.img
1868skip_userdata.img :=
Ying Wange215ed52012-10-15 14:36:22 -07001869
Andreas Gampe039b5c72017-03-24 16:06:31 -07001870# ASAN libraries in the system image - build rule.
1871ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
1872 $(TARGET_OUT_SHARED_LIBRARIES) \
1873 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
1874 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
1875 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07001876# Extra options: Enforce the system user for the files to avoid having to change ownership.
1877ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07001878# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
1879# enough space.
1880$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07001881 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 -07001882
The Android Open Source Project88b60792009-03-03 19:28:42 -08001883#######
1884## data partition tarball
1885define build-userdatatarball-target
1886 $(call pretty,"Target userdata fs tarball: " \
1887 "$(INSTALLED_USERDATATARBALL_TARGET)")
1888 $(MKTARBALL) $(FS_GET_STATS) \
1889 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001890 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001891endef
1892
1893userdata_tar := $(PRODUCT_OUT)/userdata.tar
1894INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
1895$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
1896$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
1897 $(build-userdatatarball-target)
1898
Dan Willemsen69af2e42016-08-16 16:36:05 -07001899$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
1900
The Android Open Source Project88b60792009-03-03 19:28:42 -08001901.PHONY: userdatatarball-nodeps
1902userdatatarball-nodeps: $(FS_GET_STATS)
1903 $(build-userdatatarball-target)
1904
1905
The Android Open Source Project88b60792009-03-03 19:28:42 -08001906# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04001907# partition table image
1908ifdef BOARD_BPT_INPUT_FILES
1909
1910BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001911BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04001912
1913INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
1914 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001915 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04001916 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
1917
1918ifdef BOARD_BPT_DISK_SIZE
1919INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
1920endif
1921
1922define build-bptimage-target
1923 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
1924 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
1925endef
1926
1927INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001928$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
1929 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
1930
David Zeuthen25328622016-04-08 15:08:03 -04001931$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
1932 $(build-bptimage-target)
1933
1934.PHONY: bptimage-nodeps
1935bptimage-nodeps:
1936 $(build-bptimage-target)
1937
1938endif # BOARD_BPT_INPUT_FILES
1939
1940# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07001941# cache partition image
1942ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1943INTERNAL_CACHEIMAGE_FILES := \
1944 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
1945
1946cacheimage_intermediates := \
1947 $(call intermediates-dir-for,PACKAGING,cache)
1948BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
1949
1950define build-cacheimage-target
1951 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
1952 @mkdir -p $(TARGET_OUT_CACHE)
1953 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001954 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07001955 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001956 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001957 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001958 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07001959endef
1960
1961# We just build this directly to the install location.
1962INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09001963$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07001964 $(build-cacheimage-target)
1965
1966.PHONY: cacheimage-nodeps
1967cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
1968 $(build-cacheimage-target)
1969
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07001970else # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1971# we need to ignore the broken cache link when doing the rsync
1972IGNORE_CACHE_LINK := --exclude=cache
Ying Wang9f8e8db2011-11-04 11:37:01 -07001973endif # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1974
David Zeuthen0eb10972016-09-28 17:55:27 -04001975# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07001976# system_other partition image
1977ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
1978BOARD_USES_SYSTEM_OTHER := true
1979
1980# Marker file to identify that odex files are installed
1981INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
1982ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
1983$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
1984 $(hide) touch $@
1985endif
1986
1987ifdef BOARD_USES_SYSTEM_OTHER
1988INTERNAL_SYSTEMOTHERIMAGE_FILES := \
1989 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
1990 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08001991 $(ALL_PDK_FUSION_FILES)) \
1992 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07001993
1994INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07001995INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
1996$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001997$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07001998 @echo Installed file list: $@
1999 @mkdir -p $(dir $@)
2000 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002001 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002002 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002003
2004systemotherimage_intermediates := \
2005 $(call intermediates-dir-for,PACKAGING,system_other)
2006BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2007
2008# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2009define build-systemotherimage-target
2010 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2011 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2012 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002013 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002014 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002015 build/make/tools/releasetools/build_image.py \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002016 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
2017 $(systemotherimage_intermediates)/generated_system_other_image_info.txt
2018 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
2019 $(call read-image-prop-dictionary,\
2020 $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_size))
Alex Light4e358ab2016-06-16 14:47:10 -07002021endef
2022
2023# We just build this directly to the install location.
2024INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002025ifneq (true,$(SANITIZE_LITE))
2026# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002027$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2028 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002029endif
Alex Light4e358ab2016-06-16 14:47:10 -07002030
2031.PHONY: systemotherimage-nodeps
2032systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2033 $(build-systemotherimage-target)
2034
2035endif # BOARD_USES_SYSTEM_OTHER
2036
2037
2038# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002039# vendor partition image
2040ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2041INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002042 $(filter $(TARGET_OUT_VENDOR)/%,\
2043 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002044 $(ALL_PDK_FUSION_FILES)) \
2045 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002046
Steven Moreland627debe2018-05-01 09:54:21 -07002047# Final Vendor VINTF manifest including fragments. This is not assembled
2048# on the device because it depends on everything in a given device
2049# image which defines a vintf_fragment.
2050ifdef BUILT_VENDOR_MANIFEST
2051BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
2052ifeq (true,$(strip $(PRODUCT_ENFORCE_VINTF_MANIFEST)))
2053ifdef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2054# TODO(b/65028233): turn this on globally
2055$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
2056endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2057endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2058$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2059$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2060$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2061$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
2062 @echo "Verifying vendor VINTF manifest."
2063 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2064 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2065 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
2066 -c $(BUILT_SYSTEM_MATRIX) \
2067 -i $(BUILT_VENDOR_MANIFEST) \
2068 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2069 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2070 sed "s/^/-i /" | tr '\n' ' ') -o $@
2071endif # BUILT_VENDOR_MANIFEST
2072
Ying Wangcff38622014-07-16 17:46:35 -07002073# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2074$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002075
Ying Wang8da19e32015-09-15 14:22:12 -07002076INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002077INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2078$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002079$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002080 @echo Installed file list: $@
2081 @mkdir -p $(dir $@)
2082 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002083 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002084 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002085
Ying Wanga0febe52013-03-20 11:02:05 -07002086vendorimage_intermediates := \
2087 $(call intermediates-dir-for,PACKAGING,vendor)
2088BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002089define build-vendorimage-target
2090 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2091 @mkdir -p $(TARGET_OUT_VENDOR)
2092 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002093 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002094 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2095 $(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 -07002096 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002097 build/make/tools/releasetools/build_image.py \
Yifan Hong749062d2018-06-19 16:23:16 -07002098 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
2099 $(vendorimage_intermediates)/generated_vendor_image_info.txt
2100 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
2101 $(call read-image-prop-dictionary,\
2102 $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
Ying Wanga0febe52013-03-20 11:02:05 -07002103endef
2104
2105# We just build this directly to the install location.
2106INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002107ifdef BUILT_VENDOR_MANIFEST
2108$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2109endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002110$(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 -07002111 $(build-vendorimage-target)
2112
Steven Morelanda2e734d2017-03-07 12:10:09 -08002113.PHONY: vendorimage-nodeps vnod
2114vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002115 $(build-vendorimage-target)
2116
Colin Cross91a52272017-06-20 16:57:52 -07002117sync: $(INTERNAL_VENDORIMAGE_FILES)
2118
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002119else ifdef BOARD_PREBUILT_VENDORIMAGE
2120INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2121$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2122endif
Ying Wanga0febe52013-03-20 11:02:05 -07002123
Ying Wang9f8e8db2011-11-04 11:37:01 -07002124# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002125# product partition image
2126ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2127INTERNAL_PRODUCTIMAGE_FILES := \
2128 $(filter $(TARGET_OUT_PRODUCT)/%,\
2129 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002130 $(ALL_PDK_FUSION_FILES)) \
2131 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002132
2133# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2134$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2135
2136INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002137INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2138$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002139$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2140 @echo Installed file list: $@
2141 @mkdir -p $(dir $@)
2142 @rm -f $@
2143 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2144 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2145
2146productimage_intermediates := \
2147 $(call intermediates-dir-for,PACKAGING,product)
2148BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2149define build-productimage-target
2150 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2151 @mkdir -p $(TARGET_OUT_PRODUCT)
2152 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002153 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002154 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2155 ./build/tools/releasetools/build_image.py \
2156 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
2157 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
2158endef
2159
2160# We just build this directly to the install location.
2161INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2162$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2163 $(build-productimage-target)
2164
2165.PHONY: productimage-nodeps pnod
2166productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2167 $(build-productimage-target)
2168
2169sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2170
2171else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2172INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2173$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2174endif
2175
2176# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07002177# dtbo image
2178ifdef BOARD_PREBUILT_DTBOIMAGE
2179INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
2180
2181ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002182$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002183 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2184 $(AVBTOOL) add_hash_footer \
2185 --image $@ \
2186 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002187 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002188 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
2189else
2190$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
2191 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2192endif
2193
2194endif
2195
2196# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002197# vbmeta image
2198ifeq ($(BOARD_AVB_ENABLE),true)
2199
2200BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002201AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002202
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002203ifdef BOARD_AVB_KEY_PATH
2204$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
2205else
2206# If key path isn't specified, use the 4096-bit test key.
2207BOARD_AVB_ALGORITHM := SHA256_RSA4096
2208BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
2209endif
2210
2211INTERNAL_AVB_SIGNING_ARGS := \
2212 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
2213
2214BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
2215DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
2216SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
2217VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05002218RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002219PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002220
2221# Check and set required build variables for a chain partition.
2222# $(1): the partition to enable AVB chain, e.g., BOOT or SYSTEM.
2223define check-and-set-avb-chain-args
2224$(eval PART := $(1))
Bowgo Tsaie615afd2017-06-20 17:38:21 +08002225$(eval part=$(call to-lower,$(PART)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002226
2227$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
2228$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
2229$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
2230$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
2231$(if $($(_key_path)),,$(error $(_key_path) is not defined))
2232$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
2233$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
2234$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
2235
2236# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
2237$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
2238$(eval $(_signing_args) := \
2239 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
2240
2241$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2242 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
2243
2244# Set rollback_index via footer args
2245$(eval _footer_args := $(PART)_FOOTER_ARGS)
2246$(eval $($(_footer_args)) += --rollback_index $($(_rollback_index)))
2247endef
2248
2249ifdef BOARD_AVB_BOOT_KEY_PATH
2250$(eval $(call check-and-set-avb-chain-args,BOOT))
2251else
2252INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2253 --include_descriptors_from_image $(INSTALLED_BOOTIMAGE_TARGET)
2254endif
2255
2256ifdef BOARD_AVB_SYSTEM_KEY_PATH
2257$(eval $(call check-and-set-avb-chain-args,SYSTEM))
2258else
2259INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2260 --include_descriptors_from_image $(INSTALLED_SYSTEMIMAGE)
2261endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002262
2263ifdef INSTALLED_VENDORIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002264ifdef BOARD_AVB_VENDOR_KEY_PATH
2265$(eval $(call check-and-set-avb-chain-args,VENDOR))
2266else
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002267INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2268 --include_descriptors_from_image $(INSTALLED_VENDORIMAGE_TARGET)
2269endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002270endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002271
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002272ifdef INSTALLED_PRODUCTIMAGE_TARGET
2273ifdef BOARD_AVB_PRODUCT_KEY_PATH
2274$(eval $(call check-and-set-avb-chain-args,PRODUCT))
2275else
2276INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2277 --include_descriptors_from_image $(INSTALLED_PRODUCTIMAGE_TARGET)
2278endif
2279endif
2280
Yueyao Zhu211c9012017-04-27 00:34:50 -07002281ifdef INSTALLED_DTBOIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002282ifdef BOARD_AVB_DTBO_KEY_PATH
2283$(eval $(call check-and-set-avb-chain-args,DTBO))
2284else
Yueyao Zhu211c9012017-04-27 00:34:50 -07002285INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
Tao Baoc633ed02017-05-30 21:46:33 -07002286 --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002287endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002288endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07002289
David Zeuthen8fecb282017-12-01 16:24:01 -05002290ifdef INSTALLED_RECOVERYIMAGE_TARGET
2291ifdef BOARD_AVB_RECOVERY_KEY_PATH
2292$(eval $(call check-and-set-avb-chain-args,RECOVERY))
2293else
2294INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2295 --include_descriptors_from_image $(INSTALLED_RECOVERYIMAGE_TARGET)
2296endif
2297endif
2298
Bowgo Tsai9e95bea2017-06-30 12:12:15 +08002299BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
Bowgo Tsai53cf9992017-06-13 11:27:06 +08002300
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002301# Add kernel cmdline descriptor for kernel to mount system.img as root with
2302# dm-verity. This works when system.img is either chained or not-chained:
2303# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
2304# cmdline descriptor to system.img
2305# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
2306# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08002307ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002308BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08002309endif
2310
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002311ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002312BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002313endif
2314
John Reck0588b432018-05-03 13:20:01 -07002315ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
2316BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
2317endif
2318
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002319ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
2320 $(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
2321endif
2322
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002323# $(1): the directory to extract public keys to
2324define extract-avb-chain-public-keys
2325 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
2326 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
2327 --output $(1)/boot.avbpubkey)
2328 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
2329 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
2330 --output $(1)/system.avbpubkey)
2331 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
2332 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
2333 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002334 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
2335 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
2336 --output $(1)/product.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002337 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
2338 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
2339 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05002340 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
2341 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
2342 --output $(1)/recovery.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002343endef
2344
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002345define build-vbmetaimage-target
2346 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002347 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
2348 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002349 $(hide) $(AVBTOOL) make_vbmeta_image \
2350 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2351 $(INTERNAL_AVB_SIGNING_ARGS) \
2352 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2353 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002354 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002355endef
2356
2357INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
David Zeuthen8fecb282017-12-01 16:24:01 -05002358$(INSTALLED_VBMETAIMAGE_TARGET): \
2359 $(AVBTOOL) \
2360 $(INSTALLED_BOOTIMAGE_TARGET) \
2361 $(INSTALLED_SYSTEMIMAGE) \
2362 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002363 $(INSTALLED_PRODUCTIMAGE_TARGET) \
David Zeuthen8fecb282017-12-01 16:24:01 -05002364 $(INSTALLED_DTBOIMAGE_TARGET) \
2365 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2366 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002367 $(build-vbmetaimage-target)
2368
2369.PHONY: vbmetaimage-nodeps
2370vbmetaimage-nodeps:
2371 $(build-vbmetaimage-target)
2372
Bowgo Tsai9afc0d52017-07-27 21:22:14 +08002373else ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
2374BUILT_DISABLED_VBMETAIMAGE := $(PRODUCT_OUT)/vbmeta.img
2375
2376INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_DISABLED_VBMETAIMAGE)
2377$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL)
2378 $(hide) $(AVBTOOL) make_vbmeta_image \
2379 --flag 2 --padding_size 4096 --output $@
2380
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002381endif # BOARD_AVB_ENABLE
2382
2383# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08002384# bring in the installer image generation defines if necessary
2385ifeq ($(TARGET_USE_DISKINSTALLER),true)
2386include bootable/diskinstaller/config.mk
2387endif
2388
2389# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07002390# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08002391
Ying Wangbd2d0242015-09-22 11:17:52 -07002392build_ota_package := true
2393ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
2394build_ota_package := false
2395endif
2396ifeq ($(BUILD_OS),darwin)
2397build_ota_package := false
2398endif
2399ifneq ($(strip $(SANITIZE_TARGET)),)
2400build_ota_package := false
2401endif
2402ifeq ($(TARGET_PRODUCT),sdk)
2403build_ota_package := false
2404endif
2405ifneq ($(filter generic%,$(TARGET_DEVICE)),)
2406build_ota_package := false
2407endif
2408ifeq ($(TARGET_NO_KERNEL),true)
2409build_ota_package := false
2410endif
2411ifeq ($(recovery_fstab),)
2412build_ota_package := false
2413endif
Colin Cross481cc5a2016-02-04 15:09:23 -08002414ifeq ($(TARGET_BUILD_PDK),true)
2415build_ota_package := false
2416endif
Ying Wangbd2d0242015-09-22 11:17:52 -07002417
2418ifeq ($(build_ota_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07002419OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
2420 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08002421 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07002422 $(HOST_OUT_EXECUTABLES)/mkbootfs \
2423 $(HOST_OUT_EXECUTABLES)/mkbootimg \
2424 $(HOST_OUT_EXECUTABLES)/fs_config \
2425 $(HOST_OUT_EXECUTABLES)/zipalign \
2426 $(HOST_OUT_EXECUTABLES)/bsdiff \
2427 $(HOST_OUT_EXECUTABLES)/imgdiff \
2428 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
2429 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
2430 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002431 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08002432 $(HOST_OUT_EXECUTABLES)/mke2fs \
2433 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh \
2434 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Tao Baocffaf732016-04-14 12:11:36 -07002435 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
2436 $(HOST_OUT_EXECUTABLES)/mksquashfs \
2437 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
2438 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08002439 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07002440 $(HOST_OUT_EXECUTABLES)/simg2img \
2441 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002442 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07002443 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08002444 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07002445 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07002446 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01002447 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002448 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08002449 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
2450 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07002451 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tao Bao3cba3742017-05-16 16:27:25 -07002452 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002453 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07002454 $(BROTLI) \
2455 $(BUILD_VERITY_METADATA) \
2456 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08002457
2458ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2459OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08002460 $(FUTILITY) \
2461 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08002462endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08002463
Ying Wangc45a47b2015-04-08 12:24:37 -07002464# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07002465OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07002466 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
2467 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
2468 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002469 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002470 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002471 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002472 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
2473 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
2474 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
2475 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08002476 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002477 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
2478 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08002479 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002480 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
2481 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
2482 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002483 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
2484 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00002485 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08002486 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002487 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01002488 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08002489 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01002490 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002491 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
2492 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX)
2493
The Android Open Source Project88b60792009-03-03 19:28:42 -08002494
Ying Wang06898662010-06-17 17:52:18 -07002495.PHONY: otatools
2496otatools: $(OTATOOLS)
2497
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002498BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07002499$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002500
Tao Baoe8ef8f702017-05-17 11:41:50 -07002501OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002502 system/extras/ext4_utils/mke2fs.conf \
Tao Bao2d0e5122018-05-23 09:23:28 -07002503 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
2504 -name "atx_metadata.bin")) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002505 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print)) \
2506 $(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002507 -name verity_key)) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002508 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
2509 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002510
2511OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07002512 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002513
2514ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2515OTATOOLS_DEPS += \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002516 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002517endif
2518
2519$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) | $(ACP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002520 @echo "Package OTA tools: $@"
2521 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002522 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07002523 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Colin Crossfdea8932017-12-06 14:38:40 -08002524 $(hide) $(ACP) -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002525 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Dan Willemsen48a621c2015-10-29 16:33:05 -07002526 $(hide) (cd $(zip_root) && zip -qryX $(abspath $@) *)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002527 $(hide) echo $(OTATOOLS_DEPS) | xargs zip -qryX $(abspath $@)>/dev/null || true
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002528
2529.PHONY: otatools-package
2530otatools-package: $(BUILT_OTATOOLS_PACKAGE)
2531
Ying Wangbd2d0242015-09-22 11:17:52 -07002532endif # build_ota_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002533
The Android Open Source Project88b60792009-03-03 19:28:42 -08002534# -----------------------------------------------------------------
2535# A zip of the directories that map to the target filesystem.
2536# This zip can be used to create an OTA package or filesystem image
2537# as a post-build step.
2538#
2539name := $(TARGET_PRODUCT)
2540ifeq ($(TARGET_BUILD_TYPE),debug)
2541 name := $(name)_debug
2542endif
2543name := $(name)-target_files-$(FILE_NAME_TAG)
2544
2545intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
2546BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
2547$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
2548$(BUILT_TARGET_FILES_PACKAGE): \
2549 zip_root := $(intermediates)/$(name)
2550
2551# $(1): Directory to copy
2552# $(2): Location to copy it to
2553# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
2554define package_files-copy-root
2555 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
2556 mkdir -p $(2) && \
2557 $(ACP) -rd $(strip $(1))/* $(2); \
2558 fi
2559endef
2560
Tao Baoa04fca32015-11-30 12:22:24 -08002561built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07002562
2563# We can't build static executables when SANITIZE_TARGET=address
Ivan Krasin74b32b82015-09-18 11:54:43 -07002564ifeq ($(strip $(SANITIZE_TARGET)),)
Ying Wange6e544e2015-06-22 18:35:35 -07002565built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07002566 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
2567endif
2568
The Android Open Source Project88b60792009-03-03 19:28:42 -08002569$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
2570
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002571$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002572$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002573
Doug Zongkerc18736b2009-09-30 09:20:32 -07002574ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
2575# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07002576tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07002577else
Dan Willemsen653bea92017-03-21 15:47:37 -07002578tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002579endif
Dan Willemsen653bea92017-03-21 15:47:37 -07002580tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
2581$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
2582$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002583
Sen Jiang4438fd92016-03-07 16:51:01 -08002584ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08002585updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08002586else
Steve Fung48e49f52015-10-01 23:53:31 -07002587# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002588updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07002589endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002590$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07002591
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002592# If we are using recovery as boot, output recovery files to BOOT/.
2593ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2594$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
2595else
2596$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
2597endif
2598
Dan Willemsen653bea92017-03-21 15:47:37 -07002599ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07002600 ifdef OSRELEASED_DIRECTORY
2601 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
2602 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
2603 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
2604 endif
2605endif
2606
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002607# Run fs_config while creating the target files package
2608# $1: root directory
2609# $2: add prefix
2610define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08002611(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 -08002612endef
2613
The Android Open Source Project88b60792009-03-03 19:28:42 -08002614# Depending on the various images guarantees that the underlying
2615# directories are up-to-date.
2616$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002617 $(INSTALLED_BOOTIMAGE_TARGET) \
2618 $(INSTALLED_RADIOIMAGE_TARGET) \
2619 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002620 $(FULL_SYSTEMIMAGE_DEPS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002621 $(INSTALLED_USERDATAIMAGE_TARGET) \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002622 $(INSTALLED_CACHEIMAGE_TARGET) \
Ying Wanga0febe52013-03-20 11:02:05 -07002623 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002624 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Bowgo Tsai6a749792017-09-01 22:55:44 +08002625 $(INSTALLED_VBMETAIMAGE_TARGET) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002626 $(INSTALLED_DTBOIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002627 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002628 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
Dan Willemsen653bea92017-03-21 15:47:37 -07002629 $(INSTALLED_KERNEL_TARGET) \
2630 $(INSTALLED_2NDBOOTLOADER_TARGET) \
2631 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
2632 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002633 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
Nick Kralevich0eb17d92013-09-07 17:10:29 -07002634 $(SELINUX_FC) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002635 $(APKCERTS_FILE) \
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002636 $(SOONG_ZIP) \
Doug Zongker283e2a12010-03-15 17:52:32 -07002637 $(HOST_OUT_EXECUTABLES)/fs_config \
Dan Willemsend79a08f2017-03-23 22:09:06 -07002638 $(HOST_OUT_EXECUTABLES)/imgdiff \
2639 $(HOST_OUT_EXECUTABLES)/bsdiff \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002640 $(BUILD_IMAGE_SRCS) \
Steven Moreland627debe2018-05-01 09:54:21 -07002641 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
2642 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
2643 $(BUILT_SYSTEM_MATRIX) \
Steven Moreland915f3512018-01-25 10:44:47 -08002644 $(BUILT_VENDOR_MATRIX) \
Ying Wang5d887702015-11-04 10:06:25 -08002645 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002646 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07002647 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002648 $(call create-system-product-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002649 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002650 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002651ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002652 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002653 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002654 $(hide) $(call package_files-copy-root, \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002655 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002656ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002657 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002658endif
2659ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002660 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002661endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002662ifdef BOARD_INCLUDE_RECOVERY_DTBO
2663 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
2664endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002665ifdef INTERNAL_KERNEL_CMDLINE
2666 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002667endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002668ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002669 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07002670endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002671ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002672 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07002673endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002674endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08002675 @# Components of the boot image
2676 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07002677ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
2678 $(hide) mkdir -p $(zip_root)/ROOT
2679 $(hide) $(call package_files-copy-root, \
2680 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
2681else
The Android Open Source Project88b60792009-03-03 19:28:42 -08002682 $(hide) $(call package_files-copy-root, \
2683 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07002684endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002685 @# If we are using recovery as boot, this is already done when processing recovery.
2686ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002687ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002688 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002689endif
2690ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002691 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002692endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002693ifdef INTERNAL_KERNEL_CMDLINE
2694 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002695endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002696ifdef BOARD_KERNEL_BASE
2697 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
2698endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002699ifdef BOARD_KERNEL_PAGESIZE
2700 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
2701endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002702endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07002703 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
2704 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07002705 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002706 @# Contents of the system image
2707 $(hide) $(call package_files-copy-root, \
2708 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
2709 @# Contents of the data image
2710 $(hide) $(call package_files-copy-root, \
2711 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Ying Wanga0febe52013-03-20 11:02:05 -07002712ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2713 @# Contents of the vendor image
2714 $(hide) $(call package_files-copy-root, \
2715 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
2716endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002717ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2718 @# Contents of the product image
2719 $(hide) $(call package_files-copy-root, \
2720 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
2721endif
Alex Light4e358ab2016-06-16 14:47:10 -07002722ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
2723 @# Contents of the system_other image
2724 $(hide) $(call package_files-copy-root, \
2725 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
2726endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002727 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07002728 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07002729 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07002730ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08002731ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07002732 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07002733 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07002734endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08002735endif
Doug Zongker8678df42009-06-15 14:30:14 -07002736 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08002737 @# build them.
2738 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07002739 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
2740ifneq ($(tool_extension),)
2741 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
2742endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07002743 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07002744 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07002745 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002746 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002747ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07002748 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002749endif
2750ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002751 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002752endif
Tao Baodb45efa2015-10-27 19:25:18 -07002753ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2754 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
2755endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002756ifdef BOARD_INCLUDE_RECOVERY_DTBO
2757 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
2758endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002759ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002760 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002761endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07002762ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
2763 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
2764 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
2765else
2766 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
2767endif
Dan Willemsen653bea92017-03-21 15:47:37 -07002768 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07002769 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07002770ifdef PRODUCT_EXTRA_RECOVERY_KEYS
2771 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08002772endif
Jianxun Zhang09849492013-04-17 15:19:19 -07002773 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00002774 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08002775 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08002776 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Ying Wange24e17a2014-10-07 18:42:11 -07002777ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07002778 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07002779 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07002780endif
Tao Baof54216f2016-03-29 15:12:37 -07002781ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07002782 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07002783 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH))
2784endif
2785ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07002786 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07002787 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
2788endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002789ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
2790 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
2791 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
2792endif
Ivan Krasin74b32b82015-09-18 11:54:43 -07002793ifneq ($(strip $(SANITIZE_TARGET)),)
Ying Wang2a048392015-06-25 13:56:53 -07002794 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
2795 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
2796endif
Tao Bao8beab692015-07-22 12:33:18 -07002797ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
2798 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
2799endif
David Zeuthen0eb10972016-09-28 17:55:27 -04002800ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002801 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
2802 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2803 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2804 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
2805 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2806ifdef BOARD_AVB_BOOT_KEY_PATH
2807 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2808 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2809 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
2810endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05002811 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2812ifdef BOARD_AVB_RECOVERY_KEY_PATH
2813 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2814 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2815 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
2816endif # BOARD_AVB_RECOVERY_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002817endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04002818ifdef BOARD_BPT_INPUT_FILES
2819 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
2820 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
2821 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
2822endif
2823ifdef BOARD_BPT_DISK_SIZE
2824 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
2825endif
Ying Wangbd93d422011-10-28 17:02:30 -07002826 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07002827ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Per Astrandcab66992015-03-25 14:06:30 +01002828 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002829 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07002830endif
Alex Deymo70067ac2015-09-29 19:05:37 -07002831ifeq ($(AB_OTA_UPDATER),true)
2832 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07002833 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07002834 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07002835 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
2836 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08002837 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
2838 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
2839 done
Steve Fung4044b382015-11-05 02:04:04 -08002840 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
2841 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002842 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07002843ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07002844 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
2845 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
2846 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07002847endif
Alex Deymo70067ac2015-09-29 19:05:37 -07002848endif
Steve Fungdfbab492015-09-24 18:12:33 -07002849ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07002850 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07002851 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
2852endif
Bowgo Tsai6a749792017-09-01 22:55:44 +08002853# BOARD_BUILD_DISABLED_VBMETAIMAGE is used to build a special vbmeta.img
2854# that disables AVB verification. The content is fixed and we can just copy
2855# it to $(zip_root)/IMAGES without passing some info into misc_info.txt for
2856# regeneration.
2857ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
2858 $(hide) mkdir -p $(zip_root)/IMAGES
2859 $(hide) cp $(INSTALLED_VBMETAIMAGE_TARGET) $(zip_root)/IMAGES/
2860endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002861ifdef BOARD_PREBUILT_VENDORIMAGE
2862 $(hide) mkdir -p $(zip_root)/IMAGES
2863 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
2864endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002865ifdef BOARD_PREBUILT_PRODUCTIMAGE
2866 $(hide) mkdir -p $(zip_root)/IMAGES
2867 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
2868endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07002869ifdef BOARD_PREBUILT_BOOTIMAGE
2870 $(hide) mkdir -p $(zip_root)/IMAGES
2871 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
2872endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07002873ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07002874 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
2875 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
2876 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
2877ifeq ($(BOARD_AVB_ENABLE),true)
2878 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002879 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2880ifdef BOARD_AVB_DTBO_KEY_PATH
2881 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2882 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2883 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07002884 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002885endif # BOARD_AVB_DTBO_KEY_PATH
2886endif # BOARD_AVB_ENABLE
2887endif # BOARD_PREBUILT_DTBOIMAGE
Tao Bao95a95c32017-06-16 15:30:23 -07002888 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
2889 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
2890 @# INSTALLED_RADIOIMAGE_TARGET.
2891 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
2892 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002893 @# Run fs_config on all the system, vendor, boot ramdisk,
2894 @# and recovery ramdisk files in the zip, and save the output
2895 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
2896ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2897 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
2898endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002899ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2900 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
2901endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002902ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Tao Baoda01b212018-02-28 21:20:08 -08002903 @# When using BOARD_BUILD_SYSTEM_ROOT_IMAGE, ROOT always contains the files for the root under
2904 @# normal boot. BOOT/RAMDISK exists only if additionally using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002905 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08002906ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002907 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08002908endif
2909else # BOARD_BUILD_SYSTEM_ROOT_IMAGE != true
2910 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
2911endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002912ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2913 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
2914endif
2915ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
2916 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
2917endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002918 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07002919 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Steven Moreland627debe2018-05-01 09:54:21 -07002920 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
2921ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
2922 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002923endif
Yifan Hongaa212212017-04-14 00:00:46 -07002924ifdef BUILT_VENDOR_MATRIX
2925 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002926endif
2927
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002928 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002929 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08002930 @# Zip everything up, preserving symlinks and placing META/ files first to
2931 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002932 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07002933 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002934 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07002935
Ying Wanga0febe52013-03-20 11:02:05 -07002936.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08002937target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
2938
Ying Wang4709d7c2014-04-14 17:25:43 -07002939ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
2940$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
2941endif
Doug Zongker367910f2009-06-15 18:56:51 -07002942
Dan Albert4d323332016-10-14 13:23:06 -07002943# -----------------------------------------------------------------
2944# NDK Sysroot Package
2945NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07002946$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07002947 @echo Package NDK sysroot...
2948 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
2949
2950$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
2951
Ying Wang09c4b682015-08-11 11:24:19 -07002952ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07002953# -----------------------------------------------------------------
2954# OTA update package
2955
Doug Zongker8678df42009-06-15 14:30:14 -07002956name := $(TARGET_PRODUCT)
2957ifeq ($(TARGET_BUILD_TYPE),debug)
2958 name := $(name)_debug
2959endif
2960name := $(name)-ota-$(FILE_NAME_TAG)
2961
2962INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
2963
2964$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
2965
Tao Baoe53c6e72017-04-19 15:54:22 -07002966ifeq ($(AB_OTA_UPDATER),true)
2967$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002968else
Alex Deymob10e07a2017-11-09 23:53:42 +01002969$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07002970endif
2971
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002972$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Colin Crossfdea8932017-12-06 14:38:40 -08002973 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07002974 @echo "Package OTA: $@"
Ying Wang9d252e12015-02-09 17:20:06 -08002975 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002976 build/make/tools/releasetools/ota_from_target_files -v \
Doug Zongker26e66192014-02-20 13:22:07 -08002977 --block \
Dan Willemsencea5cd22017-03-21 14:44:27 -07002978 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
Doug Zongker602a84e2009-06-18 08:35:12 -07002979 -p $(HOST_OUT) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05002980 -k $(KEY_CERT_PAIR) \
Michael Runge6e836112014-04-15 17:40:21 -07002981 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05002982 $(BUILT_TARGET_FILES_PACKAGE) $@
Doug Zongker8678df42009-06-15 14:30:14 -07002983
2984.PHONY: otapackage
2985otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
2986
Ying Wang09c4b682015-08-11 11:24:19 -07002987endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07002988
Ying Wang09a00a62010-10-20 14:01:09 -07002989# -----------------------------------------------------------------
2990# The update package
2991
2992name := $(TARGET_PRODUCT)
2993ifeq ($(TARGET_BUILD_TYPE),debug)
2994 name := $(name)_debug
2995endif
2996name := $(name)-img-$(FILE_NAME_TAG)
2997
2998INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
2999
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003000$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07003001 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003002 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
3003 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07003004
3005.PHONY: updatepackage
3006updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
3007
The Android Open Source Project88b60792009-03-03 19:28:42 -08003008# -----------------------------------------------------------------
3009# A zip of the symbols directory. Keep the full paths to make it
3010# more obvious where these files came from.
3011#
3012name := $(TARGET_PRODUCT)
3013ifeq ($(TARGET_BUILD_TYPE),debug)
3014 name := $(name)_debug
3015endif
3016name := $(name)-symbols-$(FILE_NAME_TAG)
3017
3018SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003019# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07003020ifndef TARGET_BUILD_APPS
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003021$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3022 $(INSTALLED_BOOTIMAGE_TARGET) \
3023 $(INSTALLED_USERDATAIMAGE_TARGET) \
3024 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003025 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003026 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07003027endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003028$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
3029$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003030 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003031 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3032 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
3033 $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08003034 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003035# -----------------------------------------------------------------
3036# A zip of the coverage directory.
3037#
3038name := $(TARGET_PRODUCT)
3039ifeq ($(TARGET_BUILD_TYPE),debug)
3040name := $(name)_debug
3041endif
3042name := $(name)-coverage-$(FILE_NAME_TAG)
3043COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
3044ifndef TARGET_BUILD_APPS
3045$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3046 $(INSTALLED_BOOTIMAGE_TARGET) \
3047 $(INSTALLED_USERDATAIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003048 $(INSTALLED_VENDORIMAGE_TARGET) \
3049 $(INSTALLED_PRODUCTIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003050endif
3051$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
3052$(COVERAGE_ZIP): $(SOONG_ZIP)
3053 @echo "Package coverage: $@"
3054 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3055 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
3056 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
3057 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003058
3059# -----------------------------------------------------------------
3060# A zip of the Android Apps. Not keeping full path so that we don't
3061# include product names when distributing
3062#
3063name := $(TARGET_PRODUCT)
3064ifeq ($(TARGET_BUILD_TYPE),debug)
3065 name := $(name)_debug
3066endif
3067name := $(name)-apps-$(FILE_NAME_TAG)
3068
3069APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Ying Wang5d887702015-11-04 10:06:25 -08003070$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003071 @echo "Package apps: $@"
3072 $(hide) rm -rf $@
3073 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003074 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
3075 if [ -z "$$apps_to_zip" ]; then \
3076 echo "No apps to zip up. Generating empty apps archive." ; \
3077 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
3078 else \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003079 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003080 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07003081
Ying Wangbc415dd2012-08-15 12:22:44 -07003082ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07003083#------------------------------------------------------------------
3084# An archive of classes for use in generating code-coverage reports
3085# These are the uninstrumented versions of any classes that were
3086# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07003087# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003088
Colin Crossa6bc3a82017-09-27 14:28:41 -07003089JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003090$(JACOCO_REPORT_CLASSES_ALL) :
3091 @echo "Collecting uninstrumented classes"
3092 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
3093 zip -@ -0 -q -X $@
3094# Meaning of these options:
3095# -@ scan stdin for file paths to add to the zip
3096# -0 don't do any compression
3097# -q supress most output
3098# -X skip storing extended file attributes
3099
Ying Wangbc415dd2012-08-15 12:22:44 -07003100endif # EMMA_INSTRUMENT=true
3101
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003102
Ying Wangae9115a2013-08-22 20:52:47 -07003103#------------------------------------------------------------------
3104# A zip of Proguard obfuscation dictionary files.
3105# Only for apps_only build.
3106#
3107ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07003108PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003109# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07003110$(PROGUARD_DICT_ZIP) :
3111 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07003112 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Ying Wangae9115a2013-08-22 20:52:47 -07003113 if [ -n "$$dict_files" ]; then \
Ying Wang33d64592013-11-25 17:39:50 -08003114 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003115 zip -qX $@ $$dict_files $$unobfuscated_jars; \
Ying Wangae9115a2013-08-22 20:52:47 -07003116 else \
Ying Wangdcd90832015-02-26 09:36:27 -08003117 touch $(dir $@)/zipdummy; \
3118 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
3119 zip -qd $@ zipdummy; \
3120 rm $(dir $@)/zipdummy; \
Ying Wangae9115a2013-08-22 20:52:47 -07003121 fi
3122
3123endif # TARGET_BUILD_APPS
3124
The Android Open Source Project88b60792009-03-03 19:28:42 -08003125# -----------------------------------------------------------------
3126# dalvik something
3127.PHONY: dalvikfiles
3128dalvikfiles: $(INTERNAL_DALVIK_MODULES)
3129
Bo Huf0d50bb2017-08-01 19:02:09 +00003130ifeq ($(BUILD_QEMU_IMAGES),true)
3131INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
3132MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
3133SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
3134$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3135 @echo Create system-qemu.img
3136 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img)
3137
3138systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
3139droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
3140ifeq ($(BOARD_USES_VENDORIMAGE),true)
3141INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
3142$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3143 @echo Create vendor-qemu.img
3144 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img)
3145
3146vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
3147droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
3148endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003149ifeq ($(BOARD_USES_PRODUCTIMAGE),true)
3150INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
3151$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3152 @echo Create product-qemu.img
3153 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img)
3154
3155productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
3156droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
3157endif
Bo Huf0d50bb2017-08-01 19:02:09 +00003158endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003159# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08003160# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07003161ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003162INTERNAL_EMULATOR_PACKAGE_FILES += \
3163 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08003164 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003165 $(INSTALLED_RAMDISK_TARGET) \
3166 $(INSTALLED_SYSTEMIMAGE) \
3167 $(INSTALLED_USERDATAIMAGE_TARGET)
3168
3169name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
3170
3171INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
3172
Ying Wang5d887702015-11-04 10:06:25 -08003173$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003174 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07003175 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003176
Ying Wang7d8c5352012-07-26 10:15:21 -07003177endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003178# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08003179# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08003180# The pdk package (Platform Development Kit)
3181
Keun young Park7fc7aad2012-02-27 15:49:23 -08003182#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
3183# include development/pdk/Pdk.mk
3184#endif
3185
The Android Open Source Project88b60792009-03-03 19:28:42 -08003186
3187# -----------------------------------------------------------------
3188# The SDK
3189
The Android Open Source Project88b60792009-03-03 19:28:42 -08003190# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07003191sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003192
3193# Build a name that looks like:
3194#
3195# linux-x86 --> android-sdk_12345_linux-x86
3196# darwin-x86 --> android-sdk_12345_mac-x86
3197# windows-x86 --> android-sdk_12345_windows
3198#
3199sdk_name := android-sdk_$(FILE_NAME_TAG)
3200ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07003201 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08003202else
Joe Onorato03fbe402009-04-13 08:31:16 -07003203 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003204endif
3205ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07003206 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003207endif
Joe Onorato03fbe402009-04-13 08:31:16 -07003208sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003209
3210sdk_dep_file := $(sdk_dir)/sdk_deps.mk
3211
3212ATREE_FILES :=
3213-include $(sdk_dep_file)
3214
3215# if we don't have a real list, then use "everything"
3216ifeq ($(strip $(ATREE_FILES)),)
3217ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003218 $(ALL_DEFAULT_INSTALLED_MODULES) \
3219 $(INSTALLED_RAMDISK_TARGET) \
3220 $(ALL_DOCS) \
3221 $(ALL_SDK_FILES)
3222endif
3223
3224atree_dir := development/build
3225
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01003226
The Android Open Source Project88b60792009-03-03 19:28:42 -08003227sdk_atree_files := \
3228 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07003229 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08003230
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02003231# development/build/sdk-android-<abi>.atree is used to differentiate
3232# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
3233# files like the kernel image. We use TARGET_CPU_ABI because we don't
3234# have a better way to distinguish between CPU models.
3235ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
3236 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
3237endif
3238
Griff Hazen433febb2014-02-28 08:45:59 -08003239ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES),)
3240sdk_atree_files += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES)
3241else
3242sdk_atree_files += $(atree_dir)/sdk.atree
3243endif
3244
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003245include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003246
The Android Open Source Project88b60792009-03-03 19:28:42 -08003247deps := \
3248 $(target_notice_file_txt) \
3249 $(tools_notice_file_txt) \
3250 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07003251 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07003252 $(COVERAGE_ZIP) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003253 $(INSTALLED_SYSTEMIMAGE) \
Bo Huf0d50bb2017-08-01 19:02:09 +00003254 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07003255 $(INSTALLED_QEMU_VENDORIMAGE) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003256 $(INSTALLED_USERDATAIMAGE_TARGET) \
3257 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003258 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07003259 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003260 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08003261 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003262 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003263 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003264 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003265
3266INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
3267$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
3268$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
3269$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
3270$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
3271
3272# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
3273#
3274#SDK_GNU_ERROR := true
3275
Ying Wang5d887702015-11-04 10:06:25 -08003276$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003277 @echo "Package SDK: $@"
3278 $(hide) rm -rf $(PRIVATE_DIR) $@
3279 $(hide) for f in $(target_gnu_MODULES); do \
3280 if [ -f $$f ]; then \
3281 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
3282 including GNU target $$f >&2; \
3283 FAIL=$(SDK_GNU_ERROR); \
3284 fi; \
3285 done; \
3286 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07003287 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08003288 $(hide) ( \
Dan Willemsen6f57b282018-06-01 10:53:55 -07003289 ATREE_STRIP="$(HOST_STRIP) -x" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003290 $(HOST_OUT_EXECUTABLES)/atree \
3291 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
3292 -m $(PRIVATE_DEP_FILE) \
3293 -I . \
3294 -I $(PRODUCT_OUT) \
3295 -I $(HOST_OUT) \
3296 -I $(TARGET_COMMON_OUT_ROOT) \
3297 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
Raphael Moll7558ad52011-01-05 14:58:17 -08003298 -v "OUT_DIR=$(OUT_DIR)" \
Raphael2a533172011-11-15 16:29:16 -08003299 -v "HOST_OUT=$(HOST_OUT)" \
Bruce Beare18a130e2011-02-18 15:06:20 -08003300 -v "TARGET_ARCH=$(TARGET_ARCH)" \
3301 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
David 'Digit' Turner557c51f2011-08-25 14:28:03 +02003302 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003303 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003304 -o $(PRIVATE_DIR) && \
3305 cp -f $(target_notice_file_txt) \
Xavier Ducrohet6de7bc62011-09-21 10:22:19 -07003306 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
Xavier Ducrohet4216a8c2011-03-15 13:28:40 -07003307 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003308 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Raphael7a6a9c32011-02-01 13:30:00 -08003309 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003310 chmod -R ug+rwX $(PRIVATE_DIR) && \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003311 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003312 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
3313
Raphael3d224a02010-04-16 17:50:09 -07003314
3315# Is a Windows SDK requested? If so, we need some definitions from here
3316# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08003317MAIN_SDK_NAME := $(sdk_name)
3318MAIN_SDK_DIR := $(sdk_dir)
3319MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08003320ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07003321include $(TOPDIR)development/build/tools/windows_sdk.mk
3322endif
3323
The Android Open Source Project88b60792009-03-03 19:28:42 -08003324# -----------------------------------------------------------------
3325# Findbugs
3326INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
3327INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
3328$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
3329 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003330 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003331 > $@
3332$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
3333 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003334 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07003335 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08003336
3337# -----------------------------------------------------------------
3338# Findbugs
3339
3340# -----------------------------------------------------------------
3341# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07003342ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003343include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01003344-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07003345-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003346-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07003347# Also the project-specific tasks
3348-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
3349-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003350-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07003351# Also add test specifc tasks
3352include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07003353include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07003354endif
Raphaelc4d47312011-02-15 16:09:36 -08003355
Ying Wang67132ba2015-10-28 16:42:39 -07003356include $(BUILD_SYSTEM)/product-graph.mk
3357
Raphaelc4d47312011-02-15 16:09:36 -08003358# -----------------------------------------------------------------
3359# Create SDK repository packages. Must be done after tasks/* since
3360# we need the addon rules defined.
3361ifneq ($(sdk_repo_goal),)
3362include $(TOPDIR)development/build/tools/sdk_repo.mk
3363endif
Jayant Chowdhary67e0cc52018-02-23 16:50:39 -08003364
3365#------------------------------------------------------------------
3366# Find lsdump paths
3367FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
3368$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
3369 $(hide) rm -rf $@ && echo "$^" > $@