blob: 27252e249fd06913cead20796d871f0a3a2ce8ce [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))
1142)
1143$(if $(filter $(2),product),\
1144 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1145 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1146 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1147 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1148 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1149 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1150 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1151 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1152 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1153 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
1154)
1155$(if $(filter $(2),oem),\
1156 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1157 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1158 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1159 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1160)
Ying Wangbd93d422011-10-28 17:02:30 -07001161$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001162$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001163$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001164$(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 -07001165$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
Paul Lawrencea37b2bb2014-11-13 17:54:30 -08001166$(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 +02001167$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001168$(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 +08001169$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001170$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1171$(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 +09001172$(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 -07001173$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1174$(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 -07001175$(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 -08001176$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001177$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001178$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001179$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1180$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1181$(if $(BOARD_AVB_ENABLE),\
1182 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1183 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1184 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1185 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
1186$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1187$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1188$(if $(BOARD_AVB_ENABLE),\
1189 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1190 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1191 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1192 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001193$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1194$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1195$(if $(BOARD_AVB_ENABLE),\
1196 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1197 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1198 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1199 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001200$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1201 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001202$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Yifan Hong760d3c02018-05-30 11:16:46 -07001203 $(hide) echo "system_root_image=true" >> $(1)
1204 $(hide) echo "ramdisk_dir=$(TARGET_ROOT_OUT)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001205$(if $(USE_LOGICAL_PARTITIONS),$(hide) echo "use_logical_partitions=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001206$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1207endef
1208
1209# $(1): the path of the output dictionary file
1210# $(2): additional "key=value" pairs to append to the dictionary file.
1211define generate-userimage-prop-dictionary
1212$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product oem,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001213endef
1214
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001215# $(1): the path of the input dictionary file, where each line has the format key=value
1216# $(2): the key to look up
1217define read-image-prop-dictionary
1218$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1219endef
1220
Xu Chao2b04bf42017-07-06 14:34:31 +08001221# $(1): modules list
1222# $(2): output dir
1223# $(3): mount point
1224# $(4): staging dir
1225# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1226define build-image-kernel-modules
1227 $(hide) rm -rf $(2)/lib/modules
1228 $(hide) mkdir -p $(2)/lib/modules
1229 $(hide) cp $(1) $(2)/lib/modules/
1230 $(hide) rm -rf $(4)
1231 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1232 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1233 $(hide) $(DEPMOD) -b $(4) 0.0
1234 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1235 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1236endef
1237
The Android Open Source Project88b60792009-03-03 19:28:42 -08001238# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001239# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001240
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001241# Recovery image exists if we are building recovery, or building recovery as boot.
1242ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001243
Ying Wang37526142015-03-10 12:02:57 -07001244INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1245 $(ALL_DEFAULT_INSTALLED_MODULES))
1246
Doug Zongker4647f122009-07-02 09:00:54 -07001247recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001248recovery_sepolicy := \
1249 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001250 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001251 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001252 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001253 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts
1254
Bowgo Tsai99671252017-11-30 22:15:17 +08001255ifdef BOARD_ODM_SEPOLICY_DIRS
1256recovery_sepolicy += \
1257 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
1258 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts
1259endif
1260
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001261# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1262# SELinux files
1263IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1264
Doug Zongker4647f122009-07-02 09:00:54 -07001265recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1266recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001267recovery_build_props := $(intermediate_system_build_prop)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +09001268ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001269recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
1270endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001271ifdef BOARD_USES_PRODUCTIMAGE
1272recovery_build_props += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
1273endif
Doug Zongker4647f122009-07-02 09:00:54 -07001274recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001275
Doug Zongker8eaeea92014-05-12 15:32:20 -07001276# Set recovery_density to the density bucket of the device.
1277recovery_density := unknown
1278ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
1279# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value.
1280recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Doug Zongker25d55f82014-04-04 13:51:15 -07001281else
Adam Lesinski83ee6d72014-12-02 16:13:09 -08001282# Otherwise, use the default medium density.
1283recovery_densities := mdpi
Doug Zongker8eaeea92014-05-12 15:32:20 -07001284endif
1285
1286ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1287recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1288else
Doug Zongker25d55f82014-04-04 13:51:15 -07001289recovery_resources_common := $(recovery_resources_common)-xhdpi
1290endif
1291
Doug Zongker8eaeea92014-05-12 15:32:20 -07001292# Select the 18x32 font on high-density devices (xhdpi and up); and
1293# the 12x22 font on other devices. Note that the font selected here
1294# can be overridden for a particular device by putting a font.png in
1295# its private recovery resources.
1296
Tao Baoabbc9112015-04-08 14:14:43 -07001297ifneq (,$(filter xxxhdpi 560dpi xxhdpi 400dpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001298recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1299else
1300recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1301endif
1302
Ying Wang9a175682015-08-06 11:47:47 -07001303ifndef TARGET_PRIVATE_RES_DIRS
1304TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1305endif
Doug Zongker4647f122009-07-02 09:00:54 -07001306recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001307 $(TARGET_PRIVATE_RES_DIRS) -type f)
Andrew Boiefa61ff02012-09-28 09:33:45 -07001308ifdef TARGET_RECOVERY_FSTAB
1309recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1310else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001311recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001312endif
Tao Baoc3c17532016-06-10 10:11:54 -07001313ifdef TARGET_RECOVERY_WIPE
1314recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001315else
Tao Baoc3c17532016-06-10 10:11:54 -07001316recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001317endif
Tao Bao8beab692015-07-22 12:33:18 -07001318
Tao Bao6d5d6232018-03-09 17:04:42 -08001319# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001320# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001321# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1322# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001323#
1324# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001325# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001326# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001327# b) We build a single image that contains boot and recovery both - no recovery image to install
1328# (BOARD_USES_RECOVERY_AS_BOOT = true);
1329# c) We build the root into system image - not needing the resource file as we do bsdiff
1330# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001331# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1332# do bsdiff because boot and recovery will contain different number of entries
1333# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Tao Bao6d5d6232018-03-09 17:04:42 -08001334# Note that condition b) implies condition c), because of the earlier check in this file:
1335# "BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true" (not vice
1336# versa though).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001337
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001338ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) \
1339 $(BOARD_INCLUDE_RECOVERY_DTBO)))
Doug Zongker56588872012-08-20 15:38:58 -07001340# Named '.dat' so we don't attempt to use imgdiff for patching it.
1341RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001342else
Tao Bao8beab692015-07-22 12:33:18 -07001343RECOVERY_RESOURCE_ZIP :=
1344endif
Doug Zongker4647f122009-07-02 09:00:54 -07001345
Doug Zongker4647f122009-07-02 09:00:54 -07001346INTERNAL_RECOVERYIMAGE_ARGS := \
1347 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1348 --kernel $(recovery_kernel) \
1349 --ramdisk $(recovery_ramdisk)
1350
1351# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001352ifdef INTERNAL_KERNEL_CMDLINE
1353 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001354endif
1355ifdef BOARD_KERNEL_BASE
1356 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1357endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001358ifdef BOARD_KERNEL_PAGESIZE
1359 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1360endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001361ifdef BOARD_INCLUDE_RECOVERY_DTBO
1362 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1363endif
Doug Zongker4647f122009-07-02 09:00:54 -07001364
1365# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001366# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001367# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001368OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001369
1370# Generate a file containing the keys that will be read by the
1371# recovery binary.
1372RECOVERY_INSTALL_OTA_KEYS := \
1373 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
1374DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
1375$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001376$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Doug Zongkere121d6a2011-02-01 14:13:52 -08001377$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
1378 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
Doug Zongker4647f122009-07-02 09:00:54 -07001379 @rm -rf $@
1380 @mkdir -p $(dir $@)
Colin Cross0851df82017-06-30 13:55:38 -07001381 $(JAVA) -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
Doug Zongker4647f122009-07-02 09:00:54 -07001382
Andres Moralesb8876e12015-05-06 20:44:22 -07001383RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001384
Ying Wang747b9f12015-01-30 14:05:22 -08001385# $(1): output file
1386define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001387 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001388 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao3f56a332016-01-12 11:34:58 -08001389 $(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 -08001390 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001391 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
1392 $(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 -08001393 # Modifying ramdisk contents...
Howard Chen1756f8d2017-02-22 17:27:10 +08001394 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1395 $(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 +08001396 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1397 $(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 -08001398 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Ying Wang36b039a2015-04-02 12:48:32 -07001399 $(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 -08001400 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1401 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1402 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
1403 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001404 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1405 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001406 $(hide) $(foreach item,$(recovery_fstab), \
1407 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001408 $(if $(strip $(recovery_wipe)), \
1409 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.wipe)
Ying Wang747b9f12015-01-30 14:05:22 -08001410 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001411 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001412 > $(TARGET_RECOVERY_ROOT_OUT)/prop.default
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001413 $(if $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET), \
1414 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001415 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default)
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001416 $(hide) cat $(recovery_build_props) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001417 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1418 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001419 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001420 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Tao Baod95e9fd2015-03-29 23:07:41 -07001421 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001422 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1423 $(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 +01001424 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001425 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1426 $(BOOT_SIGNER) /boot $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1427 $(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
1428 )\
1429 )
Tao Baod95e9fd2015-03-29 23:07:41 -07001430 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001431 $(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 +08001432 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1433 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1434 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001435 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1436 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1437 $(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),\
1438 $(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 -08001439endef
1440
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001441ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Ying Wangbd07ad02016-03-10 12:57:33 -08001442ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
1443$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1444endif
1445ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
1446$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1447endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001448ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001449$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001450endif
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001451$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001452 $(INSTALLED_RAMDISK_TARGET) \
1453 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001454 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001455 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001456 $(recovery_build_props) $(recovery_resource_deps) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001457 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001458 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001459 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1460 $(BOARD_RECOVERY_KERNEL_MODULES) \
1461 $(DEPMOD)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001462 $(call pretty,"Target boot image from recovery: $@")
1463 $(call build-recoveryimage-target, $@)
1464endif
1465
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001466$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Doug Zongker4647f122009-07-02 09:00:54 -07001467 $(INSTALLED_RAMDISK_TARGET) \
1468 $(INSTALLED_BOOTIMAGE_TARGET) \
Ying Wang37526142015-03-10 12:02:57 -07001469 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001470 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Doug Zongker4647f122009-07-02 09:00:54 -07001471 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001472 $(recovery_build_props) $(recovery_resource_deps) \
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001473 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001474 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001475 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1476 $(BOARD_RECOVERY_KERNEL_MODULES) \
1477 $(DEPMOD)
Ying Wang747b9f12015-01-30 14:05:22 -08001478 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001479
Tao Bao4594d0e2015-12-22 09:47:46 -08001480ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001481$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001482 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001483 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1484 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001485endif
Doug Zongker56588872012-08-20 15:38:58 -07001486
Ying Wang747b9f12015-01-30 14:05:22 -08001487.PHONY: recoveryimage-nodeps
1488recoveryimage-nodeps:
1489 @echo "make $@: ignoring dependencies"
1490 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1491
Tao Bao8beab692015-07-22 12:33:18 -07001492else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07001493RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07001494endif
1495
1496.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001497recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001498
Jiyong Park03eb0612017-10-04 21:22:41 +09001499ifneq ($(BOARD_NAND_PAGE_SIZE),)
1500$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001501endif
1502
Jiyong Park03eb0612017-10-04 21:22:41 +09001503ifneq ($(BOARD_NAND_SPARE_SIZE),)
1504$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001505endif
1506
Doug Zongker4647f122009-07-02 09:00:54 -07001507# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07001508# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08001509#
Ying Wang9c649a72012-08-08 15:27:00 -07001510# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
1511PDK_FUSION_SYSIMG_FILES := \
1512 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
1513 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001514
1515INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07001516 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07001517 $(ALL_DEFAULT_INSTALLED_MODULES) \
1518 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08001519 $(RECOVERY_RESOURCE_ZIP)) \
1520 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wang160b6702012-03-13 18:58:27 -07001521
Ying Wang82cceba2012-08-13 15:03:00 -07001522FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001523
1524# ASAN libraries in the system image - add dependency.
1525ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
1526ifneq (,$(SANITIZE_TARGET))
1527 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
1528 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
1529 endif
1530endif
1531
Ying Wange5e8c5f2011-09-09 16:35:53 -07001532# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07001533# Final System VINTF manifest including fragments. This is not assembled
1534# on the device because it depends on everything in a given device
1535# image which defines a vintf_fragment.
1536
1537BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
1538$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
1539$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
1540$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
1541$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
1542 @echo "Verifying system VINTF manifest."
1543 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
1544 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
1545 -c $(BUILT_VENDOR_MATRIX) \
1546 -i $(BUILT_SYSTEM_MANIFEST) \
1547 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
1548 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
1549 sed "s/^/-i /" | tr '\n' ' ') -o $@
1550
1551# -----------------------------------------------------------------
Ying Wange5e8c5f2011-09-09 16:35:53 -07001552# installed file list
1553# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
1554# We put installed-files.txt ahead of image itself in the dependency graph
1555# so that we can get the size stat even if the build fails due to too large
1556# system image.
1557INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07001558INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
1559$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001560$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001561 @echo Installed file list: $@
1562 @mkdir -p $(dir $@)
1563 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001564 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08001565 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07001566
1567.PHONY: installed-file-list
1568installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08001569
1570$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07001571
1572systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001573 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001574BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
1575
Ying Wang23898df2014-06-18 20:26:24 -07001576# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07001577ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07001578define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07001579$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
1580 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
1581 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
1582 exit 1; \
1583fi
Ying Wang23898df2014-06-18 20:26:24 -07001584$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
1585endef
1586else
1587define create-system-vendor-symlink
1588endef
1589endif
1590
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001591# Create symlink /system/product to /product if necessary.
1592ifdef BOARD_USES_PRODUCTIMAGE
1593define create-system-product-symlink
1594$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
1595 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
1596 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
1597 exit 1; \
1598fi
1599$(hide) ln -sf /product $(TARGET_OUT)/product
1600endef
1601else
1602define create-system-product-symlink
1603endef
1604endif
1605
The Android Open Source Project88b60792009-03-03 19:28:42 -08001606# $(1): output file
1607define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07001608 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07001609 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001610 $(call create-system-product-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07001611 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001612 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07001613 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001614 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001615 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001616 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001617 $(systemimage_intermediates)/generated_system_image_info.txt \
1618 || ( mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07001619 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08001620endef
1621
Steven Moreland627debe2018-05-01 09:54:21 -07001622$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09001623$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001624 $(call build-systemimage-target,$@)
1625
The Android Open Source Project88b60792009-03-03 19:28:42 -08001626INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07001627SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001628
Doug Zongker73ef8252009-07-23 15:12:53 -07001629# The system partition needs room for the recovery image as well. We
1630# now store the recovery image as a binary patch using the boot image
1631# as the source (since they are very similar). Generate the patch so
1632# we can see how big it's going to be, and include that in the system
1633# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -07001634ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07001635ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001636ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08001637diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
1638else
1639diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
1640endif
Doug Zongker73ef8252009-07-23 15:12:53 -07001641intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
1642RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08001643$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
1644$(RECOVERY_FROM_BOOT_PATCH): \
1645 $(INSTALLED_RECOVERYIMAGE_TARGET) \
1646 $(INSTALLED_BOOTIMAGE_TARGET) \
1647 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07001648 @echo "Construct recovery from boot"
1649 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08001650 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07001651else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
1652RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
1653endif
Sriram Raman1e96ac82009-07-24 13:52:32 -07001654endif
1655
Doug Zongker73ef8252009-07-23 15:12:53 -07001656
Dan Willemsen7f016152016-02-29 17:52:39 -08001657$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001658 @echo "Install system fs image: $@"
1659 $(copy-file-to-target)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001660 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
1661 $(call read-image-prop-dictionary,\
1662 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001663
1664systemimage: $(INSTALLED_SYSTEMIMAGE)
1665
1666.PHONY: systemimage-nodeps snod
1667systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07001668 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001669 @echo "make $@: ignoring dependencies"
1670 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001671 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),\
1672 $(call read-image-prop-dictionary,\
1673 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001674
Ying Wangacf01ec2012-02-24 11:05:48 -08001675ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
1676ifeq (true,$(WITH_DEXPREOPT))
1677$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
1678endif
1679endif
1680
Colin Cross91a52272017-06-20 16:57:52 -07001681.PHONY: sync
1682sync: $(INTERNAL_SYSTEMIMAGE_FILES)
1683
The Android Open Source Project88b60792009-03-03 19:28:42 -08001684#######
1685## system tarball
1686define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07001687 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
1688 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001689 $(call create-system-product-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07001690 $(MKTARBALL) $(FS_GET_STATS) \
1691 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001692 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001693endef
1694
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001695ifndef SYSTEM_TARBALL_FORMAT
1696 SYSTEM_TARBALL_FORMAT := bz2
1697endif
1698
The Android Open Source Project88b60792009-03-03 19:28:42 -08001699system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001700INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001701$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
1702$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
1703 $(build-systemtarball-target)
1704
1705.PHONY: systemtarball-nodeps
1706systemtarball-nodeps: $(FS_GET_STATS) \
1707 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
1708 $(build-systemtarball-target)
1709
1710.PHONY: stnod
1711stnod: systemtarball-nodeps
1712
Ying Wang3a61eeb2016-03-11 10:32:01 -08001713# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07001714## platform.zip: system, plus other files to be used in PDK fusion build,
1715## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07001716##
1717## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
1718## The variable will be typically set from BoardConfig.mk.
1719## Files under out dir will be rejected to prevent possible conflicts with other rules.
Ying Wang3a61eeb2016-03-11 10:32:01 -08001720pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
1721 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1722pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
1723 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1724pdk_classes_dex := $(strip \
1725 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
1726 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
1727
1728pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
1729$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
1730$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
1731$(pdk_odex_config_mk) :
1732 @echo "PDK odex config makefile: $@"
1733 $(hide) mkdir -p $(dir $@)
1734 $(hide) echo "# Auto-generated. Do not modify." > $@
1735 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
1736 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
1737 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
1738 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
1739 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1740 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1741 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1742 )
1743 $(foreach m,$(PRIVATE_APPS),\
1744 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
1745 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1746 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1747 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1748 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07001749 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08001750 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
1751 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
1752 )
1753
keunyoungc0178062013-07-22 14:54:58 -07001754PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07001755INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08001756
1757$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
1758$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
1759$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_odex_config_mk)
Keun young Park816b9fd2012-05-16 10:32:41 -07001760 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Ying Wang4c289e52012-03-30 13:52:54 -07001761 $(hide) rm -f $@
Dan Willemsen48a621c2015-10-29 16:33:05 -07001762 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wang4534d812012-04-09 17:04:12 -07001763 $(TARGET_COPY_OUT_SYSTEM) \
Keun young Park72226692012-07-31 17:13:20 -07001764 $(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES)) \
1765 $(addprefix symbols/,$(PDK_SYMBOL_FILES_LIST))
Ying Wangcff38622014-07-16 17:46:35 -07001766ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
Dan Willemsen48a621c2015-10-29 16:33:05 -07001767 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wangcff38622014-07-16 17:46:35 -07001768 $(TARGET_COPY_OUT_VENDOR)
1769endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001770ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
1771 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
1772 $(TARGET_COPY_OUT_PRODUCT)
1773endif
Colin Crossc451a372013-12-18 19:36:44 -08001774ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001775 $(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
Keun young Park816b9fd2012-05-16 10:32:41 -07001776endif
keunyoungc0178062013-07-22 14:54:58 -07001777ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001778 $(hide) zip -qryX $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
keunyoungc0178062013-07-22 14:54:58 -07001779endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08001780 @# Add dex-preopt files and config.
1781 $(if $(PRIVATE_DEX_FILES),$(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@ $(PRIVATE_DEX_FILES)))
Dan Willemsen0663f682018-03-06 14:07:21 -08001782 $(hide) touch $(PRODUCT_OUT)/pdk.mk
1783 $(hide) zip -qryXj $@ $(PRIVATE_ODEX_CONFIG) $(PRODUCT_OUT)/pdk.mk
Ying Wang4c289e52012-03-30 13:52:54 -07001784
1785.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07001786platform: $(INSTALLED_PLATFORM_ZIP)
1787
1788.PHONY: platform-java
1789platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07001790
1791# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07001792ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
1793$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07001794endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001795
Ying Wang3a61eeb2016-03-11 10:32:01 -08001796# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07001797## boot tarball
1798define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07001799 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07001800 $(hide) mkdir -p $(PRODUCT_OUT)/boot
1801 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001802 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07001803 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
1804 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001805 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07001806endef
1807
1808ifndef BOOT_TARBALL_FORMAT
1809 BOOT_TARBALL_FORMAT := bz2
1810endif
1811
1812boot_tar := $(PRODUCT_OUT)/boot.tar
1813INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
1814$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
1815$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
1816 $(build-boottarball-target)
1817
1818.PHONY: boottarball-nodeps btnod
1819boottarball-nodeps btnod: $(FS_GET_STATS) \
1820 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
1821 $(build-boottarball-target)
1822
1823
The Android Open Source Project88b60792009-03-03 19:28:42 -08001824# -----------------------------------------------------------------
1825# data partition image
1826INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001827 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001828
Ying Wangd7321d32013-03-15 10:32:29 -07001829# Don't build userdata.img if it's extfs but no partition size
1830skip_userdata.img :=
1831ifdef INTERNAL_USERIMAGES_EXT_VARIANT
1832ifndef BOARD_USERDATAIMAGE_PARTITION_SIZE
1833skip_userdata.img := true
1834endif
1835endif
1836
1837ifneq ($(skip_userdata.img),true)
Ying Wangbd93d422011-10-28 17:02:30 -07001838userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001839 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07001840BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
1841
Ying Wangbd93d422011-10-28 17:02:30 -07001842define build-userdataimage-target
1843 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
1844 @mkdir -p $(TARGET_OUT_DATA)
1845 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001846 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001847 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001848 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001849 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001850 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07001851endef
1852
Joe Onorato64d85d02009-04-09 19:31:12 -07001853# We just build this directly to the install location.
1854INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001855INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
1856 $(INTERNAL_USERIMAGES_DEPS) \
1857 $(INTERNAL_USERDATAIMAGE_FILES) \
1858 $(BUILD_IMAGE_SRCS)
1859$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001860 $(build-userdataimage-target)
1861
1862.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07001863userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001864 $(build-userdataimage-target)
1865
Ying Wangd7321d32013-03-15 10:32:29 -07001866endif # not skip_userdata.img
1867skip_userdata.img :=
Ying Wange215ed52012-10-15 14:36:22 -07001868
Andreas Gampe039b5c72017-03-24 16:06:31 -07001869# ASAN libraries in the system image - build rule.
1870ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
1871 $(TARGET_OUT_SHARED_LIBRARIES) \
1872 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
1873 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
1874 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07001875# Extra options: Enforce the system user for the files to avoid having to change ownership.
1876ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07001877# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
1878# enough space.
1879$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07001880 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 -07001881
The Android Open Source Project88b60792009-03-03 19:28:42 -08001882#######
1883## data partition tarball
1884define build-userdatatarball-target
1885 $(call pretty,"Target userdata fs tarball: " \
1886 "$(INSTALLED_USERDATATARBALL_TARGET)")
1887 $(MKTARBALL) $(FS_GET_STATS) \
1888 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001889 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001890endef
1891
1892userdata_tar := $(PRODUCT_OUT)/userdata.tar
1893INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
1894$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
1895$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
1896 $(build-userdatatarball-target)
1897
Dan Willemsen69af2e42016-08-16 16:36:05 -07001898$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
1899
The Android Open Source Project88b60792009-03-03 19:28:42 -08001900.PHONY: userdatatarball-nodeps
1901userdatatarball-nodeps: $(FS_GET_STATS)
1902 $(build-userdatatarball-target)
1903
1904
The Android Open Source Project88b60792009-03-03 19:28:42 -08001905# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04001906# partition table image
1907ifdef BOARD_BPT_INPUT_FILES
1908
1909BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001910BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04001911
1912INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
1913 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001914 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04001915 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
1916
1917ifdef BOARD_BPT_DISK_SIZE
1918INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
1919endif
1920
1921define build-bptimage-target
1922 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
1923 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
1924endef
1925
1926INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001927$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
1928 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
1929
David Zeuthen25328622016-04-08 15:08:03 -04001930$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
1931 $(build-bptimage-target)
1932
1933.PHONY: bptimage-nodeps
1934bptimage-nodeps:
1935 $(build-bptimage-target)
1936
1937endif # BOARD_BPT_INPUT_FILES
1938
1939# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07001940# cache partition image
1941ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1942INTERNAL_CACHEIMAGE_FILES := \
1943 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
1944
1945cacheimage_intermediates := \
1946 $(call intermediates-dir-for,PACKAGING,cache)
1947BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
1948
1949define build-cacheimage-target
1950 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
1951 @mkdir -p $(TARGET_OUT_CACHE)
1952 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001953 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07001954 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001955 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001956 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001957 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07001958endef
1959
1960# We just build this directly to the install location.
1961INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09001962$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07001963 $(build-cacheimage-target)
1964
1965.PHONY: cacheimage-nodeps
1966cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
1967 $(build-cacheimage-target)
1968
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07001969else # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1970# we need to ignore the broken cache link when doing the rsync
1971IGNORE_CACHE_LINK := --exclude=cache
Ying Wang9f8e8db2011-11-04 11:37:01 -07001972endif # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1973
David Zeuthen0eb10972016-09-28 17:55:27 -04001974# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07001975# system_other partition image
1976ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
1977BOARD_USES_SYSTEM_OTHER := true
1978
1979# Marker file to identify that odex files are installed
1980INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
1981ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
1982$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
1983 $(hide) touch $@
1984endif
1985
1986ifdef BOARD_USES_SYSTEM_OTHER
1987INTERNAL_SYSTEMOTHERIMAGE_FILES := \
1988 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
1989 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08001990 $(ALL_PDK_FUSION_FILES)) \
1991 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07001992
1993INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07001994INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
1995$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001996$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07001997 @echo Installed file list: $@
1998 @mkdir -p $(dir $@)
1999 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002000 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002001 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002002
2003systemotherimage_intermediates := \
2004 $(call intermediates-dir-for,PACKAGING,system_other)
2005BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2006
2007# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2008define build-systemotherimage-target
2009 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2010 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2011 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002012 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002013 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002014 build/make/tools/releasetools/build_image.py \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002015 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
2016 $(systemotherimage_intermediates)/generated_system_other_image_info.txt
2017 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
2018 $(call read-image-prop-dictionary,\
2019 $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_size))
Alex Light4e358ab2016-06-16 14:47:10 -07002020endef
2021
2022# We just build this directly to the install location.
2023INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002024ifneq (true,$(SANITIZE_LITE))
2025# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002026$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2027 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002028endif
Alex Light4e358ab2016-06-16 14:47:10 -07002029
2030.PHONY: systemotherimage-nodeps
2031systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2032 $(build-systemotherimage-target)
2033
2034endif # BOARD_USES_SYSTEM_OTHER
2035
2036
2037# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002038# vendor partition image
2039ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2040INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002041 $(filter $(TARGET_OUT_VENDOR)/%,\
2042 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002043 $(ALL_PDK_FUSION_FILES)) \
2044 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002045
Steven Moreland627debe2018-05-01 09:54:21 -07002046# Final Vendor VINTF manifest including fragments. This is not assembled
2047# on the device because it depends on everything in a given device
2048# image which defines a vintf_fragment.
2049ifdef BUILT_VENDOR_MANIFEST
2050BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
2051ifeq (true,$(strip $(PRODUCT_ENFORCE_VINTF_MANIFEST)))
2052ifdef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2053# TODO(b/65028233): turn this on globally
2054$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
2055endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2056endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2057$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2058$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2059$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2060$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
2061 @echo "Verifying vendor VINTF manifest."
2062 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2063 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2064 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
2065 -c $(BUILT_SYSTEM_MATRIX) \
2066 -i $(BUILT_VENDOR_MANIFEST) \
2067 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2068 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2069 sed "s/^/-i /" | tr '\n' ' ') -o $@
2070endif # BUILT_VENDOR_MANIFEST
2071
Ying Wangcff38622014-07-16 17:46:35 -07002072# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2073$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002074
Ying Wang8da19e32015-09-15 14:22:12 -07002075INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002076INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2077$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002078$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002079 @echo Installed file list: $@
2080 @mkdir -p $(dir $@)
2081 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002082 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002083 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002084
Ying Wanga0febe52013-03-20 11:02:05 -07002085vendorimage_intermediates := \
2086 $(call intermediates-dir-for,PACKAGING,vendor)
2087BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002088define build-vendorimage-target
2089 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2090 @mkdir -p $(TARGET_OUT_VENDOR)
2091 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002092 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002093 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2094 $(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 -07002095 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002096 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002097 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002098 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
Ying Wanga0febe52013-03-20 11:02:05 -07002099endef
2100
2101# We just build this directly to the install location.
2102INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002103ifdef BUILT_VENDOR_MANIFEST
2104$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2105endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002106$(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 -07002107 $(build-vendorimage-target)
2108
Steven Morelanda2e734d2017-03-07 12:10:09 -08002109.PHONY: vendorimage-nodeps vnod
2110vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002111 $(build-vendorimage-target)
2112
Colin Cross91a52272017-06-20 16:57:52 -07002113sync: $(INTERNAL_VENDORIMAGE_FILES)
2114
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002115else ifdef BOARD_PREBUILT_VENDORIMAGE
2116INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2117$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2118endif
Ying Wanga0febe52013-03-20 11:02:05 -07002119
Ying Wang9f8e8db2011-11-04 11:37:01 -07002120# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002121# product partition image
2122ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2123INTERNAL_PRODUCTIMAGE_FILES := \
2124 $(filter $(TARGET_OUT_PRODUCT)/%,\
2125 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002126 $(ALL_PDK_FUSION_FILES)) \
2127 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002128
2129# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2130$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2131
2132INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002133INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2134$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002135$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2136 @echo Installed file list: $@
2137 @mkdir -p $(dir $@)
2138 @rm -f $@
2139 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2140 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2141
2142productimage_intermediates := \
2143 $(call intermediates-dir-for,PACKAGING,product)
2144BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2145define build-productimage-target
2146 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2147 @mkdir -p $(TARGET_OUT_PRODUCT)
2148 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002149 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002150 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2151 ./build/tools/releasetools/build_image.py \
2152 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
2153 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
2154endef
2155
2156# We just build this directly to the install location.
2157INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2158$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2159 $(build-productimage-target)
2160
2161.PHONY: productimage-nodeps pnod
2162productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2163 $(build-productimage-target)
2164
2165sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2166
2167else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2168INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2169$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2170endif
2171
2172# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07002173# dtbo image
2174ifdef BOARD_PREBUILT_DTBOIMAGE
2175INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
2176
2177ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002178$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002179 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2180 $(AVBTOOL) add_hash_footer \
2181 --image $@ \
2182 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002183 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002184 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
2185else
2186$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
2187 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2188endif
2189
2190endif
2191
2192# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002193# vbmeta image
2194ifeq ($(BOARD_AVB_ENABLE),true)
2195
2196BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002197AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002198
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002199ifdef BOARD_AVB_KEY_PATH
2200$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
2201else
2202# If key path isn't specified, use the 4096-bit test key.
2203BOARD_AVB_ALGORITHM := SHA256_RSA4096
2204BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
2205endif
2206
2207INTERNAL_AVB_SIGNING_ARGS := \
2208 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
2209
2210BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
2211DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
2212SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
2213VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05002214RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002215PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002216
2217# Check and set required build variables for a chain partition.
2218# $(1): the partition to enable AVB chain, e.g., BOOT or SYSTEM.
2219define check-and-set-avb-chain-args
2220$(eval PART := $(1))
Bowgo Tsaie615afd2017-06-20 17:38:21 +08002221$(eval part=$(call to-lower,$(PART)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002222
2223$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
2224$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
2225$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
2226$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
2227$(if $($(_key_path)),,$(error $(_key_path) is not defined))
2228$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
2229$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
2230$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
2231
2232# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
2233$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
2234$(eval $(_signing_args) := \
2235 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
2236
2237$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2238 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
2239
2240# Set rollback_index via footer args
2241$(eval _footer_args := $(PART)_FOOTER_ARGS)
2242$(eval $($(_footer_args)) += --rollback_index $($(_rollback_index)))
2243endef
2244
2245ifdef BOARD_AVB_BOOT_KEY_PATH
2246$(eval $(call check-and-set-avb-chain-args,BOOT))
2247else
2248INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2249 --include_descriptors_from_image $(INSTALLED_BOOTIMAGE_TARGET)
2250endif
2251
2252ifdef BOARD_AVB_SYSTEM_KEY_PATH
2253$(eval $(call check-and-set-avb-chain-args,SYSTEM))
2254else
2255INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2256 --include_descriptors_from_image $(INSTALLED_SYSTEMIMAGE)
2257endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002258
2259ifdef INSTALLED_VENDORIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002260ifdef BOARD_AVB_VENDOR_KEY_PATH
2261$(eval $(call check-and-set-avb-chain-args,VENDOR))
2262else
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002263INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2264 --include_descriptors_from_image $(INSTALLED_VENDORIMAGE_TARGET)
2265endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002266endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002267
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002268ifdef INSTALLED_PRODUCTIMAGE_TARGET
2269ifdef BOARD_AVB_PRODUCT_KEY_PATH
2270$(eval $(call check-and-set-avb-chain-args,PRODUCT))
2271else
2272INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2273 --include_descriptors_from_image $(INSTALLED_PRODUCTIMAGE_TARGET)
2274endif
2275endif
2276
Yueyao Zhu211c9012017-04-27 00:34:50 -07002277ifdef INSTALLED_DTBOIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002278ifdef BOARD_AVB_DTBO_KEY_PATH
2279$(eval $(call check-and-set-avb-chain-args,DTBO))
2280else
Yueyao Zhu211c9012017-04-27 00:34:50 -07002281INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
Tao Baoc633ed02017-05-30 21:46:33 -07002282 --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002283endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002284endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07002285
David Zeuthen8fecb282017-12-01 16:24:01 -05002286ifdef INSTALLED_RECOVERYIMAGE_TARGET
2287ifdef BOARD_AVB_RECOVERY_KEY_PATH
2288$(eval $(call check-and-set-avb-chain-args,RECOVERY))
2289else
2290INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2291 --include_descriptors_from_image $(INSTALLED_RECOVERYIMAGE_TARGET)
2292endif
2293endif
2294
Bowgo Tsai9e95bea2017-06-30 12:12:15 +08002295BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
Bowgo Tsai53cf9992017-06-13 11:27:06 +08002296
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002297# Add kernel cmdline descriptor for kernel to mount system.img as root with
2298# dm-verity. This works when system.img is either chained or not-chained:
2299# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
2300# cmdline descriptor to system.img
2301# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
2302# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08002303ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002304BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08002305endif
2306
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002307ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002308BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002309endif
2310
John Reck0588b432018-05-03 13:20:01 -07002311ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
2312BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
2313endif
2314
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002315ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
2316 $(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
2317endif
2318
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002319# $(1): the directory to extract public keys to
2320define extract-avb-chain-public-keys
2321 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
2322 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
2323 --output $(1)/boot.avbpubkey)
2324 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
2325 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
2326 --output $(1)/system.avbpubkey)
2327 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
2328 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
2329 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002330 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
2331 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
2332 --output $(1)/product.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002333 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
2334 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
2335 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05002336 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
2337 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
2338 --output $(1)/recovery.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002339endef
2340
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002341define build-vbmetaimage-target
2342 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002343 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
2344 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002345 $(hide) $(AVBTOOL) make_vbmeta_image \
2346 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2347 $(INTERNAL_AVB_SIGNING_ARGS) \
2348 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2349 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002350 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002351endef
2352
2353INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
David Zeuthen8fecb282017-12-01 16:24:01 -05002354$(INSTALLED_VBMETAIMAGE_TARGET): \
2355 $(AVBTOOL) \
2356 $(INSTALLED_BOOTIMAGE_TARGET) \
2357 $(INSTALLED_SYSTEMIMAGE) \
2358 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002359 $(INSTALLED_PRODUCTIMAGE_TARGET) \
David Zeuthen8fecb282017-12-01 16:24:01 -05002360 $(INSTALLED_DTBOIMAGE_TARGET) \
2361 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2362 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002363 $(build-vbmetaimage-target)
2364
2365.PHONY: vbmetaimage-nodeps
2366vbmetaimage-nodeps:
2367 $(build-vbmetaimage-target)
2368
Bowgo Tsai9afc0d52017-07-27 21:22:14 +08002369else ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
2370BUILT_DISABLED_VBMETAIMAGE := $(PRODUCT_OUT)/vbmeta.img
2371
2372INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_DISABLED_VBMETAIMAGE)
2373$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL)
2374 $(hide) $(AVBTOOL) make_vbmeta_image \
2375 --flag 2 --padding_size 4096 --output $@
2376
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002377endif # BOARD_AVB_ENABLE
2378
2379# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08002380# bring in the installer image generation defines if necessary
2381ifeq ($(TARGET_USE_DISKINSTALLER),true)
2382include bootable/diskinstaller/config.mk
2383endif
2384
2385# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07002386# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08002387
Ying Wangbd2d0242015-09-22 11:17:52 -07002388build_ota_package := true
2389ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
2390build_ota_package := false
2391endif
2392ifeq ($(BUILD_OS),darwin)
2393build_ota_package := false
2394endif
2395ifneq ($(strip $(SANITIZE_TARGET)),)
2396build_ota_package := false
2397endif
2398ifeq ($(TARGET_PRODUCT),sdk)
2399build_ota_package := false
2400endif
2401ifneq ($(filter generic%,$(TARGET_DEVICE)),)
2402build_ota_package := false
2403endif
2404ifeq ($(TARGET_NO_KERNEL),true)
2405build_ota_package := false
2406endif
2407ifeq ($(recovery_fstab),)
2408build_ota_package := false
2409endif
Colin Cross481cc5a2016-02-04 15:09:23 -08002410ifeq ($(TARGET_BUILD_PDK),true)
2411build_ota_package := false
2412endif
Ying Wangbd2d0242015-09-22 11:17:52 -07002413
2414ifeq ($(build_ota_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07002415OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
2416 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08002417 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07002418 $(HOST_OUT_EXECUTABLES)/mkbootfs \
2419 $(HOST_OUT_EXECUTABLES)/mkbootimg \
2420 $(HOST_OUT_EXECUTABLES)/fs_config \
2421 $(HOST_OUT_EXECUTABLES)/zipalign \
2422 $(HOST_OUT_EXECUTABLES)/bsdiff \
2423 $(HOST_OUT_EXECUTABLES)/imgdiff \
2424 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
2425 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
2426 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002427 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08002428 $(HOST_OUT_EXECUTABLES)/mke2fs \
2429 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh \
2430 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Tao Baocffaf732016-04-14 12:11:36 -07002431 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
2432 $(HOST_OUT_EXECUTABLES)/mksquashfs \
2433 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
2434 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08002435 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07002436 $(HOST_OUT_EXECUTABLES)/simg2img \
2437 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002438 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07002439 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08002440 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07002441 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07002442 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01002443 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002444 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08002445 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
2446 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07002447 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tao Bao3cba3742017-05-16 16:27:25 -07002448 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002449 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07002450 $(BROTLI) \
2451 $(BUILD_VERITY_METADATA) \
2452 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08002453
2454ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2455OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08002456 $(FUTILITY) \
2457 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08002458endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08002459
Ying Wangc45a47b2015-04-08 12:24:37 -07002460# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07002461OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07002462 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
2463 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
2464 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002465 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002466 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002467 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002468 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
2469 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
2470 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
2471 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08002472 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002473 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
2474 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08002475 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002476 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
2477 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
2478 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002479 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
2480 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00002481 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08002482 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002483 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01002484 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08002485 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01002486 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002487 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
2488 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX)
2489
The Android Open Source Project88b60792009-03-03 19:28:42 -08002490
Ying Wang06898662010-06-17 17:52:18 -07002491.PHONY: otatools
2492otatools: $(OTATOOLS)
2493
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002494BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07002495$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002496
Tao Baoe8ef8f702017-05-17 11:41:50 -07002497OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002498 system/extras/ext4_utils/mke2fs.conf \
Tao Bao2d0e5122018-05-23 09:23:28 -07002499 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
2500 -name "atx_metadata.bin")) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002501 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print)) \
2502 $(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002503 -name verity_key)) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002504 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
2505 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002506
2507OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07002508 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002509
2510ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2511OTATOOLS_DEPS += \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002512 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002513endif
2514
2515$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) | $(ACP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002516 @echo "Package OTA tools: $@"
2517 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002518 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07002519 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Colin Crossfdea8932017-12-06 14:38:40 -08002520 $(hide) $(ACP) -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002521 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Dan Willemsen48a621c2015-10-29 16:33:05 -07002522 $(hide) (cd $(zip_root) && zip -qryX $(abspath $@) *)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002523 $(hide) echo $(OTATOOLS_DEPS) | xargs zip -qryX $(abspath $@)>/dev/null || true
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002524
2525.PHONY: otatools-package
2526otatools-package: $(BUILT_OTATOOLS_PACKAGE)
2527
Ying Wangbd2d0242015-09-22 11:17:52 -07002528endif # build_ota_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002529
The Android Open Source Project88b60792009-03-03 19:28:42 -08002530# -----------------------------------------------------------------
2531# A zip of the directories that map to the target filesystem.
2532# This zip can be used to create an OTA package or filesystem image
2533# as a post-build step.
2534#
2535name := $(TARGET_PRODUCT)
2536ifeq ($(TARGET_BUILD_TYPE),debug)
2537 name := $(name)_debug
2538endif
2539name := $(name)-target_files-$(FILE_NAME_TAG)
2540
2541intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
2542BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
2543$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
2544$(BUILT_TARGET_FILES_PACKAGE): \
2545 zip_root := $(intermediates)/$(name)
2546
2547# $(1): Directory to copy
2548# $(2): Location to copy it to
2549# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
2550define package_files-copy-root
2551 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
2552 mkdir -p $(2) && \
2553 $(ACP) -rd $(strip $(1))/* $(2); \
2554 fi
2555endef
2556
Tao Baoa04fca32015-11-30 12:22:24 -08002557built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07002558
2559# We can't build static executables when SANITIZE_TARGET=address
Ivan Krasin74b32b82015-09-18 11:54:43 -07002560ifeq ($(strip $(SANITIZE_TARGET)),)
Ying Wange6e544e2015-06-22 18:35:35 -07002561built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07002562 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
2563endif
2564
The Android Open Source Project88b60792009-03-03 19:28:42 -08002565$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
2566
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002567$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002568$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002569
Doug Zongkerc18736b2009-09-30 09:20:32 -07002570ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
2571# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07002572tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07002573else
Dan Willemsen653bea92017-03-21 15:47:37 -07002574tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002575endif
Dan Willemsen653bea92017-03-21 15:47:37 -07002576tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
2577$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
2578$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002579
Sen Jiang4438fd92016-03-07 16:51:01 -08002580ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08002581updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08002582else
Steve Fung48e49f52015-10-01 23:53:31 -07002583# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002584updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07002585endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002586$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07002587
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002588# If we are using recovery as boot, output recovery files to BOOT/.
2589ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2590$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
2591else
2592$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
2593endif
2594
Dan Willemsen653bea92017-03-21 15:47:37 -07002595ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07002596 ifdef OSRELEASED_DIRECTORY
2597 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
2598 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
2599 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
2600 endif
2601endif
2602
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002603# Run fs_config while creating the target files package
2604# $1: root directory
2605# $2: add prefix
2606define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08002607(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 -08002608endef
2609
The Android Open Source Project88b60792009-03-03 19:28:42 -08002610# Depending on the various images guarantees that the underlying
2611# directories are up-to-date.
2612$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002613 $(INSTALLED_BOOTIMAGE_TARGET) \
2614 $(INSTALLED_RADIOIMAGE_TARGET) \
2615 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002616 $(FULL_SYSTEMIMAGE_DEPS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002617 $(INSTALLED_USERDATAIMAGE_TARGET) \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002618 $(INSTALLED_CACHEIMAGE_TARGET) \
Ying Wanga0febe52013-03-20 11:02:05 -07002619 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002620 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Bowgo Tsai6a749792017-09-01 22:55:44 +08002621 $(INSTALLED_VBMETAIMAGE_TARGET) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002622 $(INSTALLED_DTBOIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002623 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002624 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
Dan Willemsen653bea92017-03-21 15:47:37 -07002625 $(INSTALLED_KERNEL_TARGET) \
2626 $(INSTALLED_2NDBOOTLOADER_TARGET) \
2627 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
2628 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002629 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
Nick Kralevich0eb17d92013-09-07 17:10:29 -07002630 $(SELINUX_FC) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002631 $(APKCERTS_FILE) \
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002632 $(SOONG_ZIP) \
Doug Zongker283e2a12010-03-15 17:52:32 -07002633 $(HOST_OUT_EXECUTABLES)/fs_config \
Dan Willemsend79a08f2017-03-23 22:09:06 -07002634 $(HOST_OUT_EXECUTABLES)/imgdiff \
2635 $(HOST_OUT_EXECUTABLES)/bsdiff \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002636 $(BUILD_IMAGE_SRCS) \
Steven Moreland627debe2018-05-01 09:54:21 -07002637 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
2638 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
2639 $(BUILT_SYSTEM_MATRIX) \
Steven Moreland915f3512018-01-25 10:44:47 -08002640 $(BUILT_VENDOR_MATRIX) \
Ying Wang5d887702015-11-04 10:06:25 -08002641 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002642 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07002643 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002644 $(call create-system-product-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002645 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002646 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002647ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002648 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002649 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002650 $(hide) $(call package_files-copy-root, \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002651 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002652ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002653 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002654endif
2655ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002656 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002657endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002658ifdef BOARD_INCLUDE_RECOVERY_DTBO
2659 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
2660endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002661ifdef INTERNAL_KERNEL_CMDLINE
2662 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002663endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002664ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002665 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07002666endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002667ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002668 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07002669endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002670endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08002671 @# Components of the boot image
2672 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07002673ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
2674 $(hide) mkdir -p $(zip_root)/ROOT
2675 $(hide) $(call package_files-copy-root, \
2676 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
2677else
The Android Open Source Project88b60792009-03-03 19:28:42 -08002678 $(hide) $(call package_files-copy-root, \
2679 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07002680endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002681 @# If we are using recovery as boot, this is already done when processing recovery.
2682ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002683ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002684 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002685endif
2686ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002687 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002688endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002689ifdef INTERNAL_KERNEL_CMDLINE
2690 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002691endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002692ifdef BOARD_KERNEL_BASE
2693 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
2694endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002695ifdef BOARD_KERNEL_PAGESIZE
2696 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
2697endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002698endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07002699 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
2700 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07002701 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002702 @# Contents of the system image
2703 $(hide) $(call package_files-copy-root, \
2704 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
2705 @# Contents of the data image
2706 $(hide) $(call package_files-copy-root, \
2707 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Ying Wanga0febe52013-03-20 11:02:05 -07002708ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2709 @# Contents of the vendor image
2710 $(hide) $(call package_files-copy-root, \
2711 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
2712endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002713ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2714 @# Contents of the product image
2715 $(hide) $(call package_files-copy-root, \
2716 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
2717endif
Alex Light4e358ab2016-06-16 14:47:10 -07002718ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
2719 @# Contents of the system_other image
2720 $(hide) $(call package_files-copy-root, \
2721 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
2722endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002723 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07002724 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07002725 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07002726ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08002727ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07002728 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07002729 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07002730endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08002731endif
Doug Zongker8678df42009-06-15 14:30:14 -07002732 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08002733 @# build them.
2734 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07002735 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
2736ifneq ($(tool_extension),)
2737 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
2738endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07002739 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07002740 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07002741 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002742 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002743ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07002744 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002745endif
2746ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002747 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002748endif
Tao Baodb45efa2015-10-27 19:25:18 -07002749ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2750 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
2751endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002752ifdef BOARD_INCLUDE_RECOVERY_DTBO
2753 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
2754endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002755ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002756 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002757endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07002758ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
2759 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
2760 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
2761else
2762 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
2763endif
Dan Willemsen653bea92017-03-21 15:47:37 -07002764 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07002765 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07002766ifdef PRODUCT_EXTRA_RECOVERY_KEYS
2767 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08002768endif
Jianxun Zhang09849492013-04-17 15:19:19 -07002769 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00002770 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08002771 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08002772 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Ying Wange24e17a2014-10-07 18:42:11 -07002773ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07002774 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07002775 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07002776endif
Tao Baof54216f2016-03-29 15:12:37 -07002777ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07002778 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07002779 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH))
2780endif
2781ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07002782 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07002783 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
2784endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002785ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
2786 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
2787 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
2788endif
Ivan Krasin74b32b82015-09-18 11:54:43 -07002789ifneq ($(strip $(SANITIZE_TARGET)),)
Ying Wang2a048392015-06-25 13:56:53 -07002790 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
2791 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
2792endif
Tao Bao8beab692015-07-22 12:33:18 -07002793ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
2794 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
2795endif
David Zeuthen0eb10972016-09-28 17:55:27 -04002796ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002797 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
2798 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2799 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2800 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
2801 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2802ifdef BOARD_AVB_BOOT_KEY_PATH
2803 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2804 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2805 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
2806endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05002807 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2808ifdef BOARD_AVB_RECOVERY_KEY_PATH
2809 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2810 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2811 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
2812endif # BOARD_AVB_RECOVERY_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002813endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04002814ifdef BOARD_BPT_INPUT_FILES
2815 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
2816 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
2817 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
2818endif
2819ifdef BOARD_BPT_DISK_SIZE
2820 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
2821endif
Ying Wangbd93d422011-10-28 17:02:30 -07002822 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07002823ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Per Astrandcab66992015-03-25 14:06:30 +01002824 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002825 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07002826endif
Alex Deymo70067ac2015-09-29 19:05:37 -07002827ifeq ($(AB_OTA_UPDATER),true)
2828 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07002829 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07002830 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07002831 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
2832 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08002833 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
2834 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
2835 done
Steve Fung4044b382015-11-05 02:04:04 -08002836 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
2837 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002838 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07002839ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07002840 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
2841 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
2842 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07002843endif
Alex Deymo70067ac2015-09-29 19:05:37 -07002844endif
Steve Fungdfbab492015-09-24 18:12:33 -07002845ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07002846 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07002847 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
2848endif
Bowgo Tsai6a749792017-09-01 22:55:44 +08002849# BOARD_BUILD_DISABLED_VBMETAIMAGE is used to build a special vbmeta.img
2850# that disables AVB verification. The content is fixed and we can just copy
2851# it to $(zip_root)/IMAGES without passing some info into misc_info.txt for
2852# regeneration.
2853ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
2854 $(hide) mkdir -p $(zip_root)/IMAGES
2855 $(hide) cp $(INSTALLED_VBMETAIMAGE_TARGET) $(zip_root)/IMAGES/
2856endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002857ifdef BOARD_PREBUILT_VENDORIMAGE
2858 $(hide) mkdir -p $(zip_root)/IMAGES
2859 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
2860endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002861ifdef BOARD_PREBUILT_PRODUCTIMAGE
2862 $(hide) mkdir -p $(zip_root)/IMAGES
2863 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
2864endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07002865ifdef BOARD_PREBUILT_BOOTIMAGE
2866 $(hide) mkdir -p $(zip_root)/IMAGES
2867 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
2868endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07002869ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07002870 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
2871 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
2872 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
2873ifeq ($(BOARD_AVB_ENABLE),true)
2874 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002875 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2876ifdef BOARD_AVB_DTBO_KEY_PATH
2877 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2878 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2879 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07002880 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002881endif # BOARD_AVB_DTBO_KEY_PATH
2882endif # BOARD_AVB_ENABLE
2883endif # BOARD_PREBUILT_DTBOIMAGE
Tao Bao95a95c32017-06-16 15:30:23 -07002884 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
2885 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
2886 @# INSTALLED_RADIOIMAGE_TARGET.
2887 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
2888 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002889 @# Run fs_config on all the system, vendor, boot ramdisk,
2890 @# and recovery ramdisk files in the zip, and save the output
2891 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
2892ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2893 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
2894endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002895ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2896 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
2897endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002898ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Tao Baoda01b212018-02-28 21:20:08 -08002899 @# When using BOARD_BUILD_SYSTEM_ROOT_IMAGE, ROOT always contains the files for the root under
2900 @# normal boot. BOOT/RAMDISK exists only if additionally using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002901 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08002902ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002903 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08002904endif
2905else # BOARD_BUILD_SYSTEM_ROOT_IMAGE != true
2906 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
2907endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002908ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2909 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
2910endif
2911ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
2912 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
2913endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002914 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07002915 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Steven Moreland627debe2018-05-01 09:54:21 -07002916 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
2917ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
2918 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002919endif
Yifan Hongaa212212017-04-14 00:00:46 -07002920ifdef BUILT_VENDOR_MATRIX
2921 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002922endif
2923
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002924 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002925 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08002926 @# Zip everything up, preserving symlinks and placing META/ files first to
2927 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002928 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07002929 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002930 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07002931
Ying Wanga0febe52013-03-20 11:02:05 -07002932.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08002933target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
2934
Ying Wang4709d7c2014-04-14 17:25:43 -07002935ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
2936$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
2937endif
Doug Zongker367910f2009-06-15 18:56:51 -07002938
Dan Albert4d323332016-10-14 13:23:06 -07002939# -----------------------------------------------------------------
2940# NDK Sysroot Package
2941NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07002942$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07002943 @echo Package NDK sysroot...
2944 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
2945
2946$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
2947
Ying Wang09c4b682015-08-11 11:24:19 -07002948ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07002949# -----------------------------------------------------------------
2950# OTA update package
2951
Doug Zongker8678df42009-06-15 14:30:14 -07002952name := $(TARGET_PRODUCT)
2953ifeq ($(TARGET_BUILD_TYPE),debug)
2954 name := $(name)_debug
2955endif
2956name := $(name)-ota-$(FILE_NAME_TAG)
2957
2958INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
2959
2960$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
2961
Tao Baoe53c6e72017-04-19 15:54:22 -07002962ifeq ($(AB_OTA_UPDATER),true)
2963$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002964else
Alex Deymob10e07a2017-11-09 23:53:42 +01002965$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07002966endif
2967
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002968$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Colin Crossfdea8932017-12-06 14:38:40 -08002969 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07002970 @echo "Package OTA: $@"
Ying Wang9d252e12015-02-09 17:20:06 -08002971 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002972 build/make/tools/releasetools/ota_from_target_files -v \
Doug Zongker26e66192014-02-20 13:22:07 -08002973 --block \
Dan Willemsencea5cd22017-03-21 14:44:27 -07002974 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
Doug Zongker602a84e2009-06-18 08:35:12 -07002975 -p $(HOST_OUT) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05002976 -k $(KEY_CERT_PAIR) \
Michael Runge6e836112014-04-15 17:40:21 -07002977 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05002978 $(BUILT_TARGET_FILES_PACKAGE) $@
Doug Zongker8678df42009-06-15 14:30:14 -07002979
2980.PHONY: otapackage
2981otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
2982
Ying Wang09c4b682015-08-11 11:24:19 -07002983endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07002984
Ying Wang09a00a62010-10-20 14:01:09 -07002985# -----------------------------------------------------------------
2986# The update package
2987
2988name := $(TARGET_PRODUCT)
2989ifeq ($(TARGET_BUILD_TYPE),debug)
2990 name := $(name)_debug
2991endif
2992name := $(name)-img-$(FILE_NAME_TAG)
2993
2994INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
2995
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002996$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07002997 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002998 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
2999 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07003000
3001.PHONY: updatepackage
3002updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
3003
The Android Open Source Project88b60792009-03-03 19:28:42 -08003004# -----------------------------------------------------------------
3005# A zip of the symbols directory. Keep the full paths to make it
3006# more obvious where these files came from.
3007#
3008name := $(TARGET_PRODUCT)
3009ifeq ($(TARGET_BUILD_TYPE),debug)
3010 name := $(name)_debug
3011endif
3012name := $(name)-symbols-$(FILE_NAME_TAG)
3013
3014SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003015# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07003016ifndef TARGET_BUILD_APPS
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003017$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3018 $(INSTALLED_BOOTIMAGE_TARGET) \
3019 $(INSTALLED_USERDATAIMAGE_TARGET) \
3020 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003021 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003022 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07003023endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003024$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
3025$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003026 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003027 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3028 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
3029 $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08003030 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003031# -----------------------------------------------------------------
3032# A zip of the coverage directory.
3033#
3034name := $(TARGET_PRODUCT)
3035ifeq ($(TARGET_BUILD_TYPE),debug)
3036name := $(name)_debug
3037endif
3038name := $(name)-coverage-$(FILE_NAME_TAG)
3039COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
3040ifndef TARGET_BUILD_APPS
3041$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3042 $(INSTALLED_BOOTIMAGE_TARGET) \
3043 $(INSTALLED_USERDATAIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003044 $(INSTALLED_VENDORIMAGE_TARGET) \
3045 $(INSTALLED_PRODUCTIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003046endif
3047$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
3048$(COVERAGE_ZIP): $(SOONG_ZIP)
3049 @echo "Package coverage: $@"
3050 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3051 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
3052 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
3053 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003054
3055# -----------------------------------------------------------------
3056# A zip of the Android Apps. Not keeping full path so that we don't
3057# include product names when distributing
3058#
3059name := $(TARGET_PRODUCT)
3060ifeq ($(TARGET_BUILD_TYPE),debug)
3061 name := $(name)_debug
3062endif
3063name := $(name)-apps-$(FILE_NAME_TAG)
3064
3065APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Ying Wang5d887702015-11-04 10:06:25 -08003066$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003067 @echo "Package apps: $@"
3068 $(hide) rm -rf $@
3069 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003070 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
3071 if [ -z "$$apps_to_zip" ]; then \
3072 echo "No apps to zip up. Generating empty apps archive." ; \
3073 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
3074 else \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003075 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003076 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07003077
Ying Wangbc415dd2012-08-15 12:22:44 -07003078ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07003079#------------------------------------------------------------------
3080# An archive of classes for use in generating code-coverage reports
3081# These are the uninstrumented versions of any classes that were
3082# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07003083# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003084
Colin Crossa6bc3a82017-09-27 14:28:41 -07003085JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003086$(JACOCO_REPORT_CLASSES_ALL) :
3087 @echo "Collecting uninstrumented classes"
3088 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
3089 zip -@ -0 -q -X $@
3090# Meaning of these options:
3091# -@ scan stdin for file paths to add to the zip
3092# -0 don't do any compression
3093# -q supress most output
3094# -X skip storing extended file attributes
3095
Ying Wangbc415dd2012-08-15 12:22:44 -07003096endif # EMMA_INSTRUMENT=true
3097
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003098
Ying Wangae9115a2013-08-22 20:52:47 -07003099#------------------------------------------------------------------
3100# A zip of Proguard obfuscation dictionary files.
3101# Only for apps_only build.
3102#
3103ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07003104PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003105# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07003106$(PROGUARD_DICT_ZIP) :
3107 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07003108 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Ying Wangae9115a2013-08-22 20:52:47 -07003109 if [ -n "$$dict_files" ]; then \
Ying Wang33d64592013-11-25 17:39:50 -08003110 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003111 zip -qX $@ $$dict_files $$unobfuscated_jars; \
Ying Wangae9115a2013-08-22 20:52:47 -07003112 else \
Ying Wangdcd90832015-02-26 09:36:27 -08003113 touch $(dir $@)/zipdummy; \
3114 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
3115 zip -qd $@ zipdummy; \
3116 rm $(dir $@)/zipdummy; \
Ying Wangae9115a2013-08-22 20:52:47 -07003117 fi
3118
3119endif # TARGET_BUILD_APPS
3120
The Android Open Source Project88b60792009-03-03 19:28:42 -08003121# -----------------------------------------------------------------
3122# dalvik something
3123.PHONY: dalvikfiles
3124dalvikfiles: $(INTERNAL_DALVIK_MODULES)
3125
Bo Huf0d50bb2017-08-01 19:02:09 +00003126ifeq ($(BUILD_QEMU_IMAGES),true)
3127INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
3128MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
3129SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
3130$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3131 @echo Create system-qemu.img
3132 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img)
3133
3134systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
3135droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
3136ifeq ($(BOARD_USES_VENDORIMAGE),true)
3137INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
3138$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3139 @echo Create vendor-qemu.img
3140 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img)
3141
3142vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
3143droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
3144endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003145ifeq ($(BOARD_USES_PRODUCTIMAGE),true)
3146INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
3147$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3148 @echo Create product-qemu.img
3149 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img)
3150
3151productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
3152droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
3153endif
Bo Huf0d50bb2017-08-01 19:02:09 +00003154endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003155# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08003156# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07003157ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003158INTERNAL_EMULATOR_PACKAGE_FILES += \
3159 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08003160 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003161 $(INSTALLED_RAMDISK_TARGET) \
3162 $(INSTALLED_SYSTEMIMAGE) \
3163 $(INSTALLED_USERDATAIMAGE_TARGET)
3164
3165name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
3166
3167INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
3168
Ying Wang5d887702015-11-04 10:06:25 -08003169$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003170 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07003171 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003172
Ying Wang7d8c5352012-07-26 10:15:21 -07003173endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003174# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08003175# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08003176# The pdk package (Platform Development Kit)
3177
Keun young Park7fc7aad2012-02-27 15:49:23 -08003178#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
3179# include development/pdk/Pdk.mk
3180#endif
3181
The Android Open Source Project88b60792009-03-03 19:28:42 -08003182
3183# -----------------------------------------------------------------
3184# The SDK
3185
The Android Open Source Project88b60792009-03-03 19:28:42 -08003186# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07003187sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003188
3189# Build a name that looks like:
3190#
3191# linux-x86 --> android-sdk_12345_linux-x86
3192# darwin-x86 --> android-sdk_12345_mac-x86
3193# windows-x86 --> android-sdk_12345_windows
3194#
3195sdk_name := android-sdk_$(FILE_NAME_TAG)
3196ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07003197 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08003198else
Joe Onorato03fbe402009-04-13 08:31:16 -07003199 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003200endif
3201ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07003202 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003203endif
Joe Onorato03fbe402009-04-13 08:31:16 -07003204sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003205
3206sdk_dep_file := $(sdk_dir)/sdk_deps.mk
3207
3208ATREE_FILES :=
3209-include $(sdk_dep_file)
3210
3211# if we don't have a real list, then use "everything"
3212ifeq ($(strip $(ATREE_FILES)),)
3213ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003214 $(ALL_DEFAULT_INSTALLED_MODULES) \
3215 $(INSTALLED_RAMDISK_TARGET) \
3216 $(ALL_DOCS) \
3217 $(ALL_SDK_FILES)
3218endif
3219
3220atree_dir := development/build
3221
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01003222
The Android Open Source Project88b60792009-03-03 19:28:42 -08003223sdk_atree_files := \
3224 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07003225 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08003226
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02003227# development/build/sdk-android-<abi>.atree is used to differentiate
3228# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
3229# files like the kernel image. We use TARGET_CPU_ABI because we don't
3230# have a better way to distinguish between CPU models.
3231ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
3232 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
3233endif
3234
Griff Hazen433febb2014-02-28 08:45:59 -08003235ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES),)
3236sdk_atree_files += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES)
3237else
3238sdk_atree_files += $(atree_dir)/sdk.atree
3239endif
3240
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003241include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003242
The Android Open Source Project88b60792009-03-03 19:28:42 -08003243deps := \
3244 $(target_notice_file_txt) \
3245 $(tools_notice_file_txt) \
3246 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07003247 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07003248 $(COVERAGE_ZIP) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003249 $(INSTALLED_SYSTEMIMAGE) \
Bo Huf0d50bb2017-08-01 19:02:09 +00003250 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07003251 $(INSTALLED_QEMU_VENDORIMAGE) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003252 $(INSTALLED_USERDATAIMAGE_TARGET) \
3253 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003254 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07003255 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003256 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08003257 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003258 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003259 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003260 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003261
3262INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
3263$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
3264$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
3265$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
3266$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
3267
3268# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
3269#
3270#SDK_GNU_ERROR := true
3271
Ying Wang5d887702015-11-04 10:06:25 -08003272$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003273 @echo "Package SDK: $@"
3274 $(hide) rm -rf $(PRIVATE_DIR) $@
3275 $(hide) for f in $(target_gnu_MODULES); do \
3276 if [ -f $$f ]; then \
3277 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
3278 including GNU target $$f >&2; \
3279 FAIL=$(SDK_GNU_ERROR); \
3280 fi; \
3281 done; \
3282 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07003283 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08003284 $(hide) ( \
Dan Willemsen6f57b282018-06-01 10:53:55 -07003285 ATREE_STRIP="$(HOST_STRIP) -x" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003286 $(HOST_OUT_EXECUTABLES)/atree \
3287 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
3288 -m $(PRIVATE_DEP_FILE) \
3289 -I . \
3290 -I $(PRODUCT_OUT) \
3291 -I $(HOST_OUT) \
3292 -I $(TARGET_COMMON_OUT_ROOT) \
3293 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
Raphael Moll7558ad52011-01-05 14:58:17 -08003294 -v "OUT_DIR=$(OUT_DIR)" \
Raphael2a533172011-11-15 16:29:16 -08003295 -v "HOST_OUT=$(HOST_OUT)" \
Bruce Beare18a130e2011-02-18 15:06:20 -08003296 -v "TARGET_ARCH=$(TARGET_ARCH)" \
3297 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
David 'Digit' Turner557c51f2011-08-25 14:28:03 +02003298 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003299 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003300 -o $(PRIVATE_DIR) && \
3301 cp -f $(target_notice_file_txt) \
Xavier Ducrohet6de7bc62011-09-21 10:22:19 -07003302 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
Xavier Ducrohet4216a8c2011-03-15 13:28:40 -07003303 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003304 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Raphael7a6a9c32011-02-01 13:30:00 -08003305 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003306 chmod -R ug+rwX $(PRIVATE_DIR) && \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003307 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003308 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
3309
Raphael3d224a02010-04-16 17:50:09 -07003310
3311# Is a Windows SDK requested? If so, we need some definitions from here
3312# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08003313MAIN_SDK_NAME := $(sdk_name)
3314MAIN_SDK_DIR := $(sdk_dir)
3315MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08003316ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07003317include $(TOPDIR)development/build/tools/windows_sdk.mk
3318endif
3319
The Android Open Source Project88b60792009-03-03 19:28:42 -08003320# -----------------------------------------------------------------
3321# Findbugs
3322INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
3323INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
3324$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
3325 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003326 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003327 > $@
3328$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
3329 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003330 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07003331 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08003332
3333# -----------------------------------------------------------------
3334# Findbugs
3335
3336# -----------------------------------------------------------------
3337# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07003338ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003339include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01003340-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07003341-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003342-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07003343# Also the project-specific tasks
3344-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
3345-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003346-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07003347# Also add test specifc tasks
3348include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07003349include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07003350endif
Raphaelc4d47312011-02-15 16:09:36 -08003351
Ying Wang67132ba2015-10-28 16:42:39 -07003352include $(BUILD_SYSTEM)/product-graph.mk
3353
Raphaelc4d47312011-02-15 16:09:36 -08003354# -----------------------------------------------------------------
3355# Create SDK repository packages. Must be done after tasks/* since
3356# we need the addon rules defined.
3357ifneq ($(sdk_repo_goal),)
3358include $(TOPDIR)development/build/tools/sdk_repo.mk
3359endif
Jayant Chowdhary67e0cc52018-02-23 16:50:39 -08003360
3361#------------------------------------------------------------------
3362# Find lsdump paths
3363FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
3364$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
3365 $(hide) rm -rf $@ && echo "$^" > $@