blob: 31387aef2203f3904686c3efdb562b8fb13c6f4e [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
Luis Hector Chavezff489932018-07-03 15:41:40 -0700685INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
686INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
687$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
688$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
689 @echo Installed file list: $@
690 @mkdir -p $(dir $@)
691 @rm -f $@
692 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
693 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
694
695$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
696
Joe Onorato64d85d02009-04-09 19:31:12 -0700697BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
698
699# We just build this directly to the install location.
700INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700701$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_ROOT) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800702 $(call pretty,"Target ram disk: $@")
Thierry Strudel74a81e62015-07-09 09:54:55 -0700703 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800704
Ying Wangad7fd292013-08-08 16:34:29 -0700705.PHONY: ramdisk-nodeps
706ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
707 @echo "make $@: ignoring dependencies"
Thierry Strudel74a81e62015-07-09 09:54:55 -0700708 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800709
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700710INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
711
The Android Open Source Project88b60792009-03-03 19:28:42 -0800712ifneq ($(strip $(TARGET_NO_KERNEL)),true)
713
714# -----------------------------------------------------------------
715# the boot image, which is a collection of other images.
716INTERNAL_BOOTIMAGE_ARGS := \
717 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700718 --kernel $(INSTALLED_KERNEL_TARGET)
719
720ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
721INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
722endif
723
The Android Open Source Project88b60792009-03-03 19:28:42 -0800724INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
725
Dima Zavin1e0847c2009-05-07 19:43:08 -0700726ifdef BOARD_KERNEL_BASE
727 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
728endif
729
Ying Wangffff0022010-08-23 12:56:25 -0700730ifdef BOARD_KERNEL_PAGESIZE
731 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
732endif
733
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700734ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
735ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
736VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
737 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
738endif
739endif
740
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700741INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
742ifdef INTERNAL_KERNEL_CMDLINE
743INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700744endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700745
Sami Tolvanen3303d902016-03-15 16:49:30 +0000746INTERNAL_MKBOOTIMG_VERSION_ARGS := \
747 --os_version $(PLATFORM_VERSION) \
748 --os_patch_level $(PLATFORM_SECURITY_PATCH)
749
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800750# BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true.
751ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
752ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
753 $(error BOARD_BUILD_SYSTEM_ROOT_IMAGE must be enabled for BOARD_USES_RECOVERY_AS_BOOT.)
754endif
755endif
756
757# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
758ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800759ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800760$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400761
762else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
763
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800764$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400765 $(call pretty,"Target boot image: $@")
766 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800767 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400768 $(hide) $(AVBTOOL) add_hash_footer \
769 --image $@ \
770 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800771 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400772 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
773
774.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800775bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400776 @echo "make $@: ignoring dependencies"
777 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800778 $(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 -0400779 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800780 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400781 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800782 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400783 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
784
785else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700786
787$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
788 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000789 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800790 $(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 -0700791 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
792
793.PHONY: bootimage-nodeps
794bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
795 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000796 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800797 $(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 -0700798 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
799
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +0100800else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -0800801
Tao Bao4b577412017-02-22 22:54:39 -0800802$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800803 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000804 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700805 $(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 -0800806 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
807
808.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -0800809bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800810 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000811 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700812 $(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 -0800813 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
814
815else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800816
817$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
818 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000819 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700820 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700821
822.PHONY: bootimage-nodeps
823bootimage-nodeps: $(MKBOOTIMG)
824 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000825 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700826 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700827
The Android Open Source Project88b60792009-03-03 19:28:42 -0800828endif # TARGET_BOOTIMAGE_USE_EXT2
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800829endif # BOARD_USES_RECOVERY_AS_BOOT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800830
831else # TARGET_NO_KERNEL
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700832ifdef BOARD_PREBUILT_BOOTIMAGE
833ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
834# Remove when b/63676296 is resolved.
835$(error Prebuilt bootimage is only supported for AB targets)
836endif
837$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
838else
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700839INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800840# HACK: The top-level targets depend on the bootimage. Not all targets
841# can produce a bootimage, though, and emulator targets need the ramdisk
842# instead. Fake it out by calling the ramdisk the bootimage.
843# TODO: make the emulator use bootimages, and make mkbootimg accept
844# kernel-less inputs.
845INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
846endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700847endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800848
849# -----------------------------------------------------------------
850# NOTICE files
851#
Steve Blockd14d3b42012-03-01 11:34:41 +0000852# We are required to publish the licenses for all code under BSD, GPL and
853# Apache licenses (and possibly other more exotic ones as well). We err on the
854# side of caution, so the licenses for other third-party code are included here
855# too.
856#
The Android Open Source Project88b60792009-03-03 19:28:42 -0800857# This needs to be before the systemimage rules, because it adds to
858# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
859# go into the systemimage.
860
Steve Block495e5852012-02-29 19:18:08 +0000861.PHONY: notice_files
862
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900863# Create the rule to combine the files into text and html/xml forms
864# $(1) - xml_excluded_vendor|xml_vendor|html
865# $(2) - Plain text output file
866# $(3) - HTML/XML output file
867# $(4) - File title
868# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -0800869# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900870# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -0800871#
872# The algorithm here is that we go collect a hash for each of the notice
873# files and write the names of the files that match that hash. Then
874# to generate the real files, we go print out all of the files and their
875# hashes.
876#
877# These rules are fairly complex, so they depend on this makefile so if
878# it changes, they'll run again.
879#
880# TODO: We could clean this up so that we just record the locations of the
881# original notice files instead of making rules to copy them somwehere.
882# Then we could traverse that without quite as much bash drama.
883define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900884$(2) $(3): PRIVATE_MESSAGE := $(4)
885$(2) $(3): PRIVATE_DIR := $(5)
886$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -0800887$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
888 build/make/tools/generate-notice-files.py --text-output $(2) \
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900889 $(if $(filter $(1),xml_excluded_vendor),-e vendor --xml-output, \
890 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
891 --html-output)) $(3) \
892 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
893notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800894endef
895
896# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
897# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
898# the src subdirectory.
899
Steve Block495e5852012-02-29 19:18:08 +0000900target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900901target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
902target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
903installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
Steve Block495e5852012-02-29 19:18:08 +0000904tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -0800905tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
906
Steven Morelandae69e572017-12-15 14:49:55 -0800907# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
908ifeq ($(PRODUCT_NOTICE_SPLIT),true)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900909target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
910target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
911installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
912
913target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
914target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
915target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
916installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
917endif
918
Ying Wang62c81f82013-08-22 20:02:03 -0700919ifndef TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -0800920kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
Josh Gao4d9268e2017-02-23 13:17:46 -0800921winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
Ying Wang4534d812012-04-09 17:04:12 -0700922pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800923
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900924ifdef target_vendor_notice_file_xml_gz
925$(eval $(call combine-notice-files, xml_excluded_vendor, \
Steve Block495e5852012-02-29 19:18:08 +0000926 $(target_notice_file_txt), \
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900927 $(target_notice_file_html_or_xml), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800928 "Notices for files contained in the filesystem images in this directory:", \
929 $(TARGET_OUT_NOTICE_FILES), \
Ying Wang4534d812012-04-09 17:04:12 -0700930 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900931$(eval $(call combine-notice-files, xml_vendor, \
932 $(target_vendor_notice_file_txt), \
933 $(target_vendor_notice_file_xml), \
934 "Notices for files contained in the vendor filesystem image in this directory:", \
935 $(TARGET_OUT_NOTICE_FILES), \
936 $(target_notice_file_html_or_xml)))
937else
938$(eval $(call combine-notice-files, html, \
939 $(target_notice_file_txt), \
940 $(target_notice_file_html_or_xml), \
941 "Notices for files contained in the filesystem images in this directory:", \
942 $(TARGET_OUT_NOTICE_FILES), \
943 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
944endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800945
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900946$(eval $(call combine-notice-files, html, \
Steve Block495e5852012-02-29 19:18:08 +0000947 $(tools_notice_file_txt), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800948 $(tools_notice_file_html), \
949 "Notices for files contained in the tools directory:", \
950 $(HOST_OUT_NOTICE_FILES), \
Josh Gao4d9268e2017-02-23 13:17:46 -0800951 $(ALL_DEFAULT_INSTALLED_MODULES) \
952 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800953
954# Install the html file at /system/etc/NOTICE.html.gz.
955# This is not ideal, but this is very late in the game, after a lot of
956# the module processing has already been done -- in fact, we used the
957# fact that all that has been done to get the list of modules that we
958# need notice files for.
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900959$(target_notice_file_html_or_xml_gz): $(target_notice_file_html_or_xml) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -0700960 $(hide) $(MINIGZIP) -9 < $< > $@
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900961$(installed_notice_html_or_xml_gz): $(target_notice_file_html_or_xml_gz)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800962 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -0700963
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900964ifdef target_vendor_notice_file_xml_gz
965# Install the vendor html file at /vendor/etc/NOTICE.xml.gz.
966$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
967 $(hide) $(MINIGZIP) -9 < $< > $@
968$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
969 $(copy-file-to-target)
970endif
971
Joe Onorato7b2845a2009-04-30 13:52:50 -0700972# if we've been run my mm, mmm, etc, don't reinstall this every time
973ifeq ($(ONE_SHOT_MAKEFILE),)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900974 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
975 ifdef target_vendor_notice_file_xml_gz
976 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
977 endif
Joe Onorato7b2845a2009-04-30 13:52:50 -0700978endif
Ying Wang62c81f82013-08-22 20:02:03 -0700979endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -0800980
981# The kernel isn't really a module, so to get its module file in there, we
982# make the target NOTICE files depend on this particular file too, which will
983# then be in the right directory for the find in combine-notice-files to work.
984$(kernel_notice_file): \
Lee Campbellb463fcd2015-11-08 16:28:15 -0800985 $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800986 | $(ACP)
987 @echo Copying: $@
988 $(hide) mkdir -p $(dir $@)
989 $(hide) $(ACP) $< $@
990
Josh Gao4d9268e2017-02-23 13:17:46 -0800991$(winpthreads_notice_file): \
992 $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
993 | $(ACP)
994 @echo Copying: $@
995 $(hide) mkdir -p $(dir $@)
996 $(hide) $(ACP) $< $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800997
Doug Zongker8678df42009-06-15 14:30:14 -0700998# -----------------------------------------------------------------
999# Build a keystore with the authorized keys in it, used to verify the
1000# authenticity of downloaded OTA packages.
1001#
1002# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
1003# before the rules that use that variable to build the image.
Dan Willemsenb589ae42015-10-29 21:26:18 +00001004ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
1005$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001006$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR)) | $(ZIPTIME)
Doug Zongker8678df42009-06-15 14:30:14 -07001007 $(hide) rm -f $@
1008 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001009 $(hide) zip -qjX $@ $<
1010 $(remove-timestamps-from-package)
Doug Zongker8678df42009-06-15 14:30:14 -07001011
Alex Deymocec578c2017-03-28 20:48:18 -07001012# Carry the public key for update_engine if it's a non-IoT target that
Tao Bao38812d62016-01-20 20:58:20 -08001013# uses the AB updater. We use the same key as otacerts but in RSA public key
1014# format.
1015ifeq ($(AB_OTA_UPDATER),true)
Alex Deymocec578c2017-03-28 20:48:18 -07001016ifneq ($(PRODUCT_IOT),true)
Tao Bao23c3db92016-01-21 14:28:50 -08001017ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
1018$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Tao Bao38812d62016-01-20 20:58:20 -08001019 $(hide) rm -f $@
1020 $(hide) mkdir -p $(dir $@)
1021 $(hide) openssl x509 -pubkey -noout -in $< > $@
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001022
1023ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_RECOVERY_ROOT_OUT)/etc/update_engine/update-payload-key.pub.pem
1024$(TARGET_RECOVERY_ROOT_OUT)/etc/update_engine/update-payload-key.pub.pem: $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
1025 $(hide) cp -f $< $@
Tao Bao38812d62016-01-20 20:58:20 -08001026endif
1027endif
1028
Doug Zongker8678df42009-06-15 14:30:14 -07001029.PHONY: otacerts
1030otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
1031
1032
The Android Open Source Project88b60792009-03-03 19:28:42 -08001033# #################################################################
1034# Targets for user images
1035# #################################################################
1036
Ying Wang933abf12010-06-16 14:31:34 -07001037INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001038ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001039INTERNAL_USERIMAGES_USE_EXT := true
1040INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1041else
1042ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
1043INTERNAL_USERIMAGES_USE_EXT := true
1044INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1045else
1046ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
1047INTERNAL_USERIMAGES_USE_EXT := true
1048INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1049endif
1050endif
1051endif
1052
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001053# These options tell the recovery updater/installer how to mount the partitions writebale.
1054# <fstype>=<fstype_opts>[|<fstype_opts>]...
1055# fstype_opts := <opt>[,<opt>]...
1056# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001057# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1058DEFAULT_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 -07001059
Ying Wang542903a2010-11-17 15:40:38 -08001060ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1061 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1062endif
1063
Colin Cross0a7b2c52010-05-07 02:23:59 -07001064ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001065INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
1066INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK)
1067ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1068INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1069endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001070endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001071
Chris Friesdf0387d2017-06-21 15:51:46 -05001072ifeq ($(BOARD_AVB_ENABLE),true)
1073INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1074endif
1075
Todd Poynorb2a555e2015-12-15 18:00:14 -08001076ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1077 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1078endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001079ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
Mohamad Ayyash353265b2015-06-24 15:42:19 -07001080INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001081endif
1082
Ying Wang178ef922011-10-31 18:13:30 -07001083INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001084
Colin Cross8a30f722014-04-28 16:27:32 -07001085ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001086INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001087ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC))
1088INTERNAL_USERIMAGES_DEPS += $(FEC)
1089endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001090endif
1091
Alex Klyubin092c9022017-03-13 13:28:34 -07001092SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001093INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1094
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001095INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1096
Jin Qianabcec5e2017-03-10 16:53:45 -08001097ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
1098INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
1099endif
1100
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001101ifeq (true,$(USE_LOGICAL_PARTITIONS))
1102
1103ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
1104 $(error vboot 1.0 doesn't support logical partition)
1105endif
1106
1107# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1108# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1109
1110endif # USE_LOGICAL_PARTITIONS
1111
Ying Wangbd93d422011-10-28 17:02:30 -07001112# $(1): the path of the output dictionary file
Yifan Hong760d3c02018-05-30 11:16:46 -07001113# $(2): a subset of "system vendor cache userdata product oem"
1114# $(3): additional "key=value" pairs to append to the dictionary file.
1115define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001116$(if $(filter $(2),system),\
1117 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
1118 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1119 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1120 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1121 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1122 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1123 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1124 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1125 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1126 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1127 $(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 -07001128 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001129)
Yifan Hong760d3c02018-05-30 11:16:46 -07001130$(if $(filter $(2),userdata),\
1131 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1132 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
1133)
Yifan Hong760d3c02018-05-30 11:16:46 -07001134$(if $(filter $(2),cache),\
1135 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1136 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
1137)
1138$(if $(filter $(2),vendor),\
1139 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1140 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1141 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1142 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1143 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1144 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1145 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1146 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1147 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1148 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
Yifan Hong749062d2018-06-19 16:23:16 -07001149 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001150)
1151$(if $(filter $(2),product),\
1152 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1153 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1154 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1155 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1156 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1157 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1158 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1159 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1160 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1161 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
1162)
1163$(if $(filter $(2),oem),\
1164 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1165 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1166 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1167 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1168)
Tao Bao3602eca2018-07-10 10:53:55 -07001169$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
1170$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001171$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001172$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001173$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1174$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1175$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001176$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001177$(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 -07001178$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
Paul Lawrencea37b2bb2014-11-13 17:54:30 -08001179$(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 +02001180$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001181$(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 +08001182$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001183$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1184$(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 +09001185$(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 -07001186$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1187$(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 -07001188$(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 -08001189$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001190$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001191$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001192$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1193$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1194$(if $(BOARD_AVB_ENABLE),\
1195 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1196 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1197 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1198 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
1199$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1200$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1201$(if $(BOARD_AVB_ENABLE),\
1202 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1203 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1204 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1205 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001206$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1207$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1208$(if $(BOARD_AVB_ENABLE),\
1209 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1210 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1211 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1212 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001213$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1214 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001215$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Yifan Hong760d3c02018-05-30 11:16:46 -07001216 $(hide) echo "system_root_image=true" >> $(1)
1217 $(hide) echo "ramdisk_dir=$(TARGET_ROOT_OUT)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001218$(if $(USE_LOGICAL_PARTITIONS),$(hide) echo "use_logical_partitions=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001219$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1220endef
1221
1222# $(1): the path of the output dictionary file
1223# $(2): additional "key=value" pairs to append to the dictionary file.
1224define generate-userimage-prop-dictionary
1225$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product oem,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001226endef
1227
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001228# $(1): the path of the input dictionary file, where each line has the format key=value
1229# $(2): the key to look up
1230define read-image-prop-dictionary
1231$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1232endef
1233
Xu Chao2b04bf42017-07-06 14:34:31 +08001234# $(1): modules list
1235# $(2): output dir
1236# $(3): mount point
1237# $(4): staging dir
1238# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1239define build-image-kernel-modules
1240 $(hide) rm -rf $(2)/lib/modules
1241 $(hide) mkdir -p $(2)/lib/modules
1242 $(hide) cp $(1) $(2)/lib/modules/
1243 $(hide) rm -rf $(4)
1244 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1245 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1246 $(hide) $(DEPMOD) -b $(4) 0.0
1247 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1248 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1249endef
1250
The Android Open Source Project88b60792009-03-03 19:28:42 -08001251# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001252# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001253
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001254# Recovery image exists if we are building recovery, or building recovery as boot.
1255ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001256
Ying Wang37526142015-03-10 12:02:57 -07001257INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1258 $(ALL_DEFAULT_INSTALLED_MODULES))
1259
Doug Zongker4647f122009-07-02 09:00:54 -07001260recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001261recovery_sepolicy := \
1262 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001263 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001264 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001265 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001266 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts
1267
Bowgo Tsai99671252017-11-30 22:15:17 +08001268ifdef BOARD_ODM_SEPOLICY_DIRS
1269recovery_sepolicy += \
1270 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
1271 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts
1272endif
1273
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001274# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1275# SELinux files
1276IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1277
Doug Zongker4647f122009-07-02 09:00:54 -07001278recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1279recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001280recovery_build_props := $(intermediate_system_build_prop)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +09001281ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001282recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
1283endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001284ifdef BOARD_USES_PRODUCTIMAGE
1285recovery_build_props += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
1286endif
Doug Zongker4647f122009-07-02 09:00:54 -07001287recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001288
Doug Zongker8eaeea92014-05-12 15:32:20 -07001289# Set recovery_density to the density bucket of the device.
1290recovery_density := unknown
1291ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
1292# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value.
1293recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Doug Zongker25d55f82014-04-04 13:51:15 -07001294else
Adam Lesinski83ee6d72014-12-02 16:13:09 -08001295# Otherwise, use the default medium density.
1296recovery_densities := mdpi
Doug Zongker8eaeea92014-05-12 15:32:20 -07001297endif
1298
1299ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1300recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1301else
Doug Zongker25d55f82014-04-04 13:51:15 -07001302recovery_resources_common := $(recovery_resources_common)-xhdpi
1303endif
1304
Doug Zongker8eaeea92014-05-12 15:32:20 -07001305# Select the 18x32 font on high-density devices (xhdpi and up); and
1306# the 12x22 font on other devices. Note that the font selected here
1307# can be overridden for a particular device by putting a font.png in
1308# its private recovery resources.
1309
Tao Baoabbc9112015-04-08 14:14:43 -07001310ifneq (,$(filter xxxhdpi 560dpi xxhdpi 400dpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001311recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1312else
1313recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1314endif
1315
Ying Wang9a175682015-08-06 11:47:47 -07001316ifndef TARGET_PRIVATE_RES_DIRS
1317TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1318endif
Doug Zongker4647f122009-07-02 09:00:54 -07001319recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001320 $(TARGET_PRIVATE_RES_DIRS) -type f)
Andrew Boiefa61ff02012-09-28 09:33:45 -07001321ifdef TARGET_RECOVERY_FSTAB
1322recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1323else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001324recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001325endif
Tao Baoc3c17532016-06-10 10:11:54 -07001326ifdef TARGET_RECOVERY_WIPE
1327recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001328else
Tao Baoc3c17532016-06-10 10:11:54 -07001329recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001330endif
Tao Bao8beab692015-07-22 12:33:18 -07001331
Tao Bao6d5d6232018-03-09 17:04:42 -08001332# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001333# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001334# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1335# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001336#
1337# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001338# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001339# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001340# b) We build a single image that contains boot and recovery both - no recovery image to install
1341# (BOARD_USES_RECOVERY_AS_BOOT = true);
1342# c) We build the root into system image - not needing the resource file as we do bsdiff
1343# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001344# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1345# do bsdiff because boot and recovery will contain different number of entries
1346# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Tao Bao6d5d6232018-03-09 17:04:42 -08001347# Note that condition b) implies condition c), because of the earlier check in this file:
1348# "BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true" (not vice
1349# versa though).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001350
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001351ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) \
1352 $(BOARD_INCLUDE_RECOVERY_DTBO)))
Doug Zongker56588872012-08-20 15:38:58 -07001353# Named '.dat' so we don't attempt to use imgdiff for patching it.
1354RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001355else
Tao Bao8beab692015-07-22 12:33:18 -07001356RECOVERY_RESOURCE_ZIP :=
1357endif
Doug Zongker4647f122009-07-02 09:00:54 -07001358
Doug Zongker4647f122009-07-02 09:00:54 -07001359INTERNAL_RECOVERYIMAGE_ARGS := \
1360 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1361 --kernel $(recovery_kernel) \
1362 --ramdisk $(recovery_ramdisk)
1363
1364# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001365ifdef INTERNAL_KERNEL_CMDLINE
1366 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001367endif
1368ifdef BOARD_KERNEL_BASE
1369 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1370endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001371ifdef BOARD_KERNEL_PAGESIZE
1372 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1373endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001374ifdef BOARD_INCLUDE_RECOVERY_DTBO
1375 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1376endif
Doug Zongker4647f122009-07-02 09:00:54 -07001377
1378# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001379# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001380# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001381OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001382
1383# Generate a file containing the keys that will be read by the
1384# recovery binary.
1385RECOVERY_INSTALL_OTA_KEYS := \
1386 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
1387DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
1388$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001389$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Doug Zongkere121d6a2011-02-01 14:13:52 -08001390$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
1391 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
Doug Zongker4647f122009-07-02 09:00:54 -07001392 @rm -rf $@
1393 @mkdir -p $(dir $@)
Colin Cross0851df82017-06-30 13:55:38 -07001394 $(JAVA) -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
Doug Zongker4647f122009-07-02 09:00:54 -07001395
Andres Moralesb8876e12015-05-06 20:44:22 -07001396RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001397
Ying Wang747b9f12015-01-30 14:05:22 -08001398# $(1): output file
1399define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001400 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001401 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao3f56a332016-01-12 11:34:58 -08001402 $(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 -08001403 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001404 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
1405 $(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 -08001406 # Modifying ramdisk contents...
Howard Chen1756f8d2017-02-22 17:27:10 +08001407 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1408 $(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 +08001409 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1410 $(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 -08001411 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Ying Wang36b039a2015-04-02 12:48:32 -07001412 $(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 -08001413 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1414 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1415 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
1416 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001417 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1418 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001419 $(hide) $(foreach item,$(recovery_fstab), \
1420 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001421 $(if $(strip $(recovery_wipe)), \
1422 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.wipe)
Ying Wang747b9f12015-01-30 14:05:22 -08001423 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001424 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001425 > $(TARGET_RECOVERY_ROOT_OUT)/prop.default
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001426 $(if $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET), \
1427 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001428 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default)
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001429 $(hide) cat $(recovery_build_props) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001430 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1431 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001432 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001433 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Tao Baod95e9fd2015-03-29 23:07:41 -07001434 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001435 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1436 $(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 +01001437 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001438 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1439 $(BOOT_SIGNER) /boot $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1440 $(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
1441 )\
1442 )
Tao Baod95e9fd2015-03-29 23:07:41 -07001443 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001444 $(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 +08001445 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1446 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1447 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001448 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1449 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1450 $(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),\
1451 $(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 -08001452endef
1453
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001454ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Ying Wangbd07ad02016-03-10 12:57:33 -08001455ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
1456$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1457endif
1458ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
1459$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1460endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001461ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001462$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001463endif
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001464$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001465 $(INSTALLED_RAMDISK_TARGET) \
1466 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001467 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001468 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001469 $(recovery_build_props) $(recovery_resource_deps) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001470 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001471 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001472 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1473 $(BOARD_RECOVERY_KERNEL_MODULES) \
1474 $(DEPMOD)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001475 $(call pretty,"Target boot image from recovery: $@")
1476 $(call build-recoveryimage-target, $@)
1477endif
1478
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001479$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Doug Zongker4647f122009-07-02 09:00:54 -07001480 $(INSTALLED_RAMDISK_TARGET) \
1481 $(INSTALLED_BOOTIMAGE_TARGET) \
Ying Wang37526142015-03-10 12:02:57 -07001482 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001483 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Doug Zongker4647f122009-07-02 09:00:54 -07001484 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001485 $(recovery_build_props) $(recovery_resource_deps) \
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001486 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001487 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001488 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1489 $(BOARD_RECOVERY_KERNEL_MODULES) \
1490 $(DEPMOD)
Ying Wang747b9f12015-01-30 14:05:22 -08001491 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001492
Tao Bao4594d0e2015-12-22 09:47:46 -08001493ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001494$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001495 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001496 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1497 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001498endif
Doug Zongker56588872012-08-20 15:38:58 -07001499
Ying Wang747b9f12015-01-30 14:05:22 -08001500.PHONY: recoveryimage-nodeps
1501recoveryimage-nodeps:
1502 @echo "make $@: ignoring dependencies"
1503 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1504
Tao Bao8beab692015-07-22 12:33:18 -07001505else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07001506RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07001507endif
1508
1509.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001510recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001511
Jiyong Park03eb0612017-10-04 21:22:41 +09001512ifneq ($(BOARD_NAND_PAGE_SIZE),)
1513$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001514endif
1515
Jiyong Park03eb0612017-10-04 21:22:41 +09001516ifneq ($(BOARD_NAND_SPARE_SIZE),)
1517$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001518endif
1519
Doug Zongker4647f122009-07-02 09:00:54 -07001520# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07001521# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08001522#
Ying Wang9c649a72012-08-08 15:27:00 -07001523# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
1524PDK_FUSION_SYSIMG_FILES := \
1525 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
1526 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001527
1528INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07001529 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07001530 $(ALL_DEFAULT_INSTALLED_MODULES) \
1531 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08001532 $(RECOVERY_RESOURCE_ZIP)) \
1533 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wang160b6702012-03-13 18:58:27 -07001534
Ying Wang82cceba2012-08-13 15:03:00 -07001535FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001536
1537# ASAN libraries in the system image - add dependency.
1538ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
1539ifneq (,$(SANITIZE_TARGET))
1540 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
1541 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
1542 endif
1543endif
1544
Luis Hector Chavezff489932018-07-03 15:41:40 -07001545# When building a system root image, also add the ramdisk image as a dependency
1546# to ensure all files in it are built before it is created.
1547ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
1548 FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_ROOT)
1549endif
1550
Ying Wange5e8c5f2011-09-09 16:35:53 -07001551# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07001552# Final System VINTF manifest including fragments. This is not assembled
1553# on the device because it depends on everything in a given device
1554# image which defines a vintf_fragment.
1555
1556BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
1557$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
1558$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
1559$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
1560$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
1561 @echo "Verifying system VINTF manifest."
1562 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
1563 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
1564 -c $(BUILT_VENDOR_MATRIX) \
1565 -i $(BUILT_SYSTEM_MANIFEST) \
1566 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
1567 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
1568 sed "s/^/-i /" | tr '\n' ' ') -o $@
1569
1570# -----------------------------------------------------------------
Ying Wange5e8c5f2011-09-09 16:35:53 -07001571# installed file list
1572# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
1573# We put installed-files.txt ahead of image itself in the dependency graph
1574# so that we can get the size stat even if the build fails due to too large
1575# system image.
1576INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07001577INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
1578$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001579$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001580 @echo Installed file list: $@
1581 @mkdir -p $(dir $@)
1582 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001583 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08001584 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07001585
1586.PHONY: installed-file-list
1587installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08001588
1589$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07001590
1591systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001592 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001593BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
1594
Ying Wang23898df2014-06-18 20:26:24 -07001595# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07001596ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07001597define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07001598$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
1599 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
1600 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
1601 exit 1; \
1602fi
Ying Wang23898df2014-06-18 20:26:24 -07001603$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
1604endef
1605else
1606define create-system-vendor-symlink
1607endef
1608endif
1609
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001610# Create symlink /system/product to /product if necessary.
1611ifdef BOARD_USES_PRODUCTIMAGE
1612define create-system-product-symlink
1613$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
1614 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
1615 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
1616 exit 1; \
1617fi
1618$(hide) ln -sf /product $(TARGET_OUT)/product
1619endef
1620else
1621define create-system-product-symlink
1622endef
1623endif
1624
The Android Open Source Project88b60792009-03-03 19:28:42 -08001625# $(1): output file
1626define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07001627 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07001628 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001629 $(call create-system-product-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07001630 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001631 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07001632 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001633 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001634 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001635 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001636 $(systemimage_intermediates)/generated_system_image_info.txt \
1637 || ( mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07001638 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08001639endef
1640
Steven Moreland627debe2018-05-01 09:54:21 -07001641$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09001642$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001643 $(call build-systemimage-target,$@)
1644
The Android Open Source Project88b60792009-03-03 19:28:42 -08001645INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07001646SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001647
Doug Zongker73ef8252009-07-23 15:12:53 -07001648# The system partition needs room for the recovery image as well. We
1649# now store the recovery image as a binary patch using the boot image
1650# as the source (since they are very similar). Generate the patch so
1651# we can see how big it's going to be, and include that in the system
1652# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -07001653ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07001654ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001655ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08001656diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
1657else
1658diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
1659endif
Doug Zongker73ef8252009-07-23 15:12:53 -07001660intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
1661RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08001662$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
1663$(RECOVERY_FROM_BOOT_PATCH): \
1664 $(INSTALLED_RECOVERYIMAGE_TARGET) \
1665 $(INSTALLED_BOOTIMAGE_TARGET) \
1666 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07001667 @echo "Construct recovery from boot"
1668 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08001669 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07001670else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
1671RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
1672endif
Sriram Raman1e96ac82009-07-24 13:52:32 -07001673endif
1674
Doug Zongker73ef8252009-07-23 15:12:53 -07001675
Dan Willemsen7f016152016-02-29 17:52:39 -08001676$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001677 @echo "Install system fs image: $@"
1678 $(copy-file-to-target)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001679 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
1680 $(call read-image-prop-dictionary,\
1681 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001682
1683systemimage: $(INSTALLED_SYSTEMIMAGE)
1684
1685.PHONY: systemimage-nodeps snod
1686systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07001687 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001688 @echo "make $@: ignoring dependencies"
1689 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001690 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),\
1691 $(call read-image-prop-dictionary,\
1692 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001693
Ying Wangacf01ec2012-02-24 11:05:48 -08001694ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
1695ifeq (true,$(WITH_DEXPREOPT))
1696$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
1697endif
1698endif
1699
Colin Cross91a52272017-06-20 16:57:52 -07001700.PHONY: sync
1701sync: $(INTERNAL_SYSTEMIMAGE_FILES)
1702
The Android Open Source Project88b60792009-03-03 19:28:42 -08001703#######
1704## system tarball
1705define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07001706 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
1707 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001708 $(call create-system-product-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07001709 $(MKTARBALL) $(FS_GET_STATS) \
1710 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001711 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001712endef
1713
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001714ifndef SYSTEM_TARBALL_FORMAT
1715 SYSTEM_TARBALL_FORMAT := bz2
1716endif
1717
The Android Open Source Project88b60792009-03-03 19:28:42 -08001718system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001719INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001720$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
1721$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
1722 $(build-systemtarball-target)
1723
1724.PHONY: systemtarball-nodeps
1725systemtarball-nodeps: $(FS_GET_STATS) \
1726 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
1727 $(build-systemtarball-target)
1728
1729.PHONY: stnod
1730stnod: systemtarball-nodeps
1731
Ying Wang3a61eeb2016-03-11 10:32:01 -08001732# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07001733## platform.zip: system, plus other files to be used in PDK fusion build,
1734## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07001735##
1736## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
1737## The variable will be typically set from BoardConfig.mk.
1738## Files under out dir will be rejected to prevent possible conflicts with other rules.
Ying Wang3a61eeb2016-03-11 10:32:01 -08001739pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
1740 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1741pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
1742 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1743pdk_classes_dex := $(strip \
1744 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
1745 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
1746
1747pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
1748$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
1749$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
1750$(pdk_odex_config_mk) :
1751 @echo "PDK odex config makefile: $@"
1752 $(hide) mkdir -p $(dir $@)
1753 $(hide) echo "# Auto-generated. Do not modify." > $@
1754 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
1755 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
1756 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
1757 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
1758 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1759 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1760 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1761 )
1762 $(foreach m,$(PRIVATE_APPS),\
1763 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
1764 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1765 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1766 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1767 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07001768 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08001769 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
1770 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
1771 )
1772
keunyoungc0178062013-07-22 14:54:58 -07001773PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07001774INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08001775
1776$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
1777$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
1778$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_odex_config_mk)
Keun young Park816b9fd2012-05-16 10:32:41 -07001779 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Ying Wang4c289e52012-03-30 13:52:54 -07001780 $(hide) rm -f $@
Dan Willemsen48a621c2015-10-29 16:33:05 -07001781 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wang4534d812012-04-09 17:04:12 -07001782 $(TARGET_COPY_OUT_SYSTEM) \
Keun young Park72226692012-07-31 17:13:20 -07001783 $(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES)) \
1784 $(addprefix symbols/,$(PDK_SYMBOL_FILES_LIST))
Ying Wangcff38622014-07-16 17:46:35 -07001785ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
Dan Willemsen48a621c2015-10-29 16:33:05 -07001786 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wangcff38622014-07-16 17:46:35 -07001787 $(TARGET_COPY_OUT_VENDOR)
1788endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001789ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
1790 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
1791 $(TARGET_COPY_OUT_PRODUCT)
1792endif
Colin Crossc451a372013-12-18 19:36:44 -08001793ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001794 $(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
Keun young Park816b9fd2012-05-16 10:32:41 -07001795endif
keunyoungc0178062013-07-22 14:54:58 -07001796ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001797 $(hide) zip -qryX $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
keunyoungc0178062013-07-22 14:54:58 -07001798endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08001799 @# Add dex-preopt files and config.
1800 $(if $(PRIVATE_DEX_FILES),$(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@ $(PRIVATE_DEX_FILES)))
Dan Willemsen0663f682018-03-06 14:07:21 -08001801 $(hide) touch $(PRODUCT_OUT)/pdk.mk
1802 $(hide) zip -qryXj $@ $(PRIVATE_ODEX_CONFIG) $(PRODUCT_OUT)/pdk.mk
Ying Wang4c289e52012-03-30 13:52:54 -07001803
1804.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07001805platform: $(INSTALLED_PLATFORM_ZIP)
1806
1807.PHONY: platform-java
1808platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07001809
1810# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07001811ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
1812$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07001813endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001814
Ying Wang3a61eeb2016-03-11 10:32:01 -08001815# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07001816## boot tarball
1817define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07001818 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07001819 $(hide) mkdir -p $(PRODUCT_OUT)/boot
1820 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001821 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07001822 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
1823 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001824 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07001825endef
1826
1827ifndef BOOT_TARBALL_FORMAT
1828 BOOT_TARBALL_FORMAT := bz2
1829endif
1830
1831boot_tar := $(PRODUCT_OUT)/boot.tar
1832INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
1833$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
1834$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
1835 $(build-boottarball-target)
1836
1837.PHONY: boottarball-nodeps btnod
1838boottarball-nodeps btnod: $(FS_GET_STATS) \
1839 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
1840 $(build-boottarball-target)
1841
1842
The Android Open Source Project88b60792009-03-03 19:28:42 -08001843# -----------------------------------------------------------------
1844# data partition image
1845INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001846 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001847
Ying Wangd7321d32013-03-15 10:32:29 -07001848# Don't build userdata.img if it's extfs but no partition size
1849skip_userdata.img :=
1850ifdef INTERNAL_USERIMAGES_EXT_VARIANT
1851ifndef BOARD_USERDATAIMAGE_PARTITION_SIZE
1852skip_userdata.img := true
1853endif
1854endif
1855
1856ifneq ($(skip_userdata.img),true)
Ying Wangbd93d422011-10-28 17:02:30 -07001857userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001858 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07001859BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
1860
Ying Wangbd93d422011-10-28 17:02:30 -07001861define build-userdataimage-target
1862 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
1863 @mkdir -p $(TARGET_OUT_DATA)
1864 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001865 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001866 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001867 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001868 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001869 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07001870endef
1871
Joe Onorato64d85d02009-04-09 19:31:12 -07001872# We just build this directly to the install location.
1873INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001874INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
1875 $(INTERNAL_USERIMAGES_DEPS) \
1876 $(INTERNAL_USERDATAIMAGE_FILES) \
1877 $(BUILD_IMAGE_SRCS)
1878$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001879 $(build-userdataimage-target)
1880
1881.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07001882userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001883 $(build-userdataimage-target)
1884
Ying Wangd7321d32013-03-15 10:32:29 -07001885endif # not skip_userdata.img
1886skip_userdata.img :=
Ying Wange215ed52012-10-15 14:36:22 -07001887
Andreas Gampe039b5c72017-03-24 16:06:31 -07001888# ASAN libraries in the system image - build rule.
1889ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
1890 $(TARGET_OUT_SHARED_LIBRARIES) \
1891 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
1892 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
1893 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07001894# Extra options: Enforce the system user for the files to avoid having to change ownership.
1895ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07001896# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
1897# enough space.
1898$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07001899 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 -07001900
The Android Open Source Project88b60792009-03-03 19:28:42 -08001901#######
1902## data partition tarball
1903define build-userdatatarball-target
1904 $(call pretty,"Target userdata fs tarball: " \
1905 "$(INSTALLED_USERDATATARBALL_TARGET)")
1906 $(MKTARBALL) $(FS_GET_STATS) \
1907 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001908 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001909endef
1910
1911userdata_tar := $(PRODUCT_OUT)/userdata.tar
1912INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
1913$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
1914$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
1915 $(build-userdatatarball-target)
1916
Dan Willemsen69af2e42016-08-16 16:36:05 -07001917$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
1918
The Android Open Source Project88b60792009-03-03 19:28:42 -08001919.PHONY: userdatatarball-nodeps
1920userdatatarball-nodeps: $(FS_GET_STATS)
1921 $(build-userdatatarball-target)
1922
1923
The Android Open Source Project88b60792009-03-03 19:28:42 -08001924# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04001925# partition table image
1926ifdef BOARD_BPT_INPUT_FILES
1927
1928BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001929BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04001930
1931INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
1932 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001933 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04001934 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
1935
1936ifdef BOARD_BPT_DISK_SIZE
1937INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
1938endif
1939
1940define build-bptimage-target
1941 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
1942 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
1943endef
1944
1945INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07001946$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
1947 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
1948
David Zeuthen25328622016-04-08 15:08:03 -04001949$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
1950 $(build-bptimage-target)
1951
1952.PHONY: bptimage-nodeps
1953bptimage-nodeps:
1954 $(build-bptimage-target)
1955
1956endif # BOARD_BPT_INPUT_FILES
1957
1958# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07001959# cache partition image
1960ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1961INTERNAL_CACHEIMAGE_FILES := \
1962 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
1963
1964cacheimage_intermediates := \
1965 $(call intermediates-dir-for,PACKAGING,cache)
1966BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
1967
1968define build-cacheimage-target
1969 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
1970 @mkdir -p $(TARGET_OUT_CACHE)
1971 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001972 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07001973 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001974 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001975 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001976 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07001977endef
1978
1979# We just build this directly to the install location.
1980INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09001981$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07001982 $(build-cacheimage-target)
1983
1984.PHONY: cacheimage-nodeps
1985cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
1986 $(build-cacheimage-target)
1987
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07001988else # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1989# we need to ignore the broken cache link when doing the rsync
1990IGNORE_CACHE_LINK := --exclude=cache
Ying Wang9f8e8db2011-11-04 11:37:01 -07001991endif # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
1992
David Zeuthen0eb10972016-09-28 17:55:27 -04001993# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07001994# system_other partition image
1995ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
1996BOARD_USES_SYSTEM_OTHER := true
1997
1998# Marker file to identify that odex files are installed
1999INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2000ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2001$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2002 $(hide) touch $@
2003endif
2004
2005ifdef BOARD_USES_SYSTEM_OTHER
2006INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2007 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2008 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002009 $(ALL_PDK_FUSION_FILES)) \
2010 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002011
2012INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002013INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2014$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002015$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07002016 @echo Installed file list: $@
2017 @mkdir -p $(dir $@)
2018 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002019 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002020 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002021
2022systemotherimage_intermediates := \
2023 $(call intermediates-dir-for,PACKAGING,system_other)
2024BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2025
2026# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2027define build-systemotherimage-target
2028 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2029 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2030 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002031 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002032 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002033 build/make/tools/releasetools/build_image.py \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002034 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
2035 $(systemotherimage_intermediates)/generated_system_other_image_info.txt
2036 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
2037 $(call read-image-prop-dictionary,\
2038 $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_size))
Alex Light4e358ab2016-06-16 14:47:10 -07002039endef
2040
2041# We just build this directly to the install location.
2042INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002043ifneq (true,$(SANITIZE_LITE))
2044# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002045$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2046 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002047endif
Alex Light4e358ab2016-06-16 14:47:10 -07002048
2049.PHONY: systemotherimage-nodeps
2050systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2051 $(build-systemotherimage-target)
2052
2053endif # BOARD_USES_SYSTEM_OTHER
2054
2055
2056# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002057# vendor partition image
2058ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2059INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002060 $(filter $(TARGET_OUT_VENDOR)/%,\
2061 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002062 $(ALL_PDK_FUSION_FILES)) \
2063 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002064
Steven Moreland627debe2018-05-01 09:54:21 -07002065# Final Vendor VINTF manifest including fragments. This is not assembled
2066# on the device because it depends on everything in a given device
2067# image which defines a vintf_fragment.
2068ifdef BUILT_VENDOR_MANIFEST
2069BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
2070ifeq (true,$(strip $(PRODUCT_ENFORCE_VINTF_MANIFEST)))
2071ifdef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2072# TODO(b/65028233): turn this on globally
2073$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
2074endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2075endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2076$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2077$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2078$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2079$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
2080 @echo "Verifying vendor VINTF manifest."
2081 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2082 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2083 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
2084 -c $(BUILT_SYSTEM_MATRIX) \
2085 -i $(BUILT_VENDOR_MANIFEST) \
2086 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2087 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2088 sed "s/^/-i /" | tr '\n' ' ') -o $@
2089endif # BUILT_VENDOR_MANIFEST
2090
Ying Wangcff38622014-07-16 17:46:35 -07002091# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2092$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002093
Ying Wang8da19e32015-09-15 14:22:12 -07002094INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002095INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2096$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002097$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002098 @echo Installed file list: $@
2099 @mkdir -p $(dir $@)
2100 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002101 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002102 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002103
Ying Wanga0febe52013-03-20 11:02:05 -07002104vendorimage_intermediates := \
2105 $(call intermediates-dir-for,PACKAGING,vendor)
2106BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002107define build-vendorimage-target
2108 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2109 @mkdir -p $(TARGET_OUT_VENDOR)
2110 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002111 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002112 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2113 $(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 -07002114 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002115 build/make/tools/releasetools/build_image.py \
Yifan Hong749062d2018-06-19 16:23:16 -07002116 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
2117 $(vendorimage_intermediates)/generated_vendor_image_info.txt
2118 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
2119 $(call read-image-prop-dictionary,\
2120 $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
Ying Wanga0febe52013-03-20 11:02:05 -07002121endef
2122
2123# We just build this directly to the install location.
2124INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002125ifdef BUILT_VENDOR_MANIFEST
2126$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2127endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002128$(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 -07002129 $(build-vendorimage-target)
2130
Steven Morelanda2e734d2017-03-07 12:10:09 -08002131.PHONY: vendorimage-nodeps vnod
2132vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002133 $(build-vendorimage-target)
2134
Colin Cross91a52272017-06-20 16:57:52 -07002135sync: $(INTERNAL_VENDORIMAGE_FILES)
2136
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002137else ifdef BOARD_PREBUILT_VENDORIMAGE
2138INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2139$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2140endif
Ying Wanga0febe52013-03-20 11:02:05 -07002141
Ying Wang9f8e8db2011-11-04 11:37:01 -07002142# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002143# product partition image
2144ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2145INTERNAL_PRODUCTIMAGE_FILES := \
2146 $(filter $(TARGET_OUT_PRODUCT)/%,\
2147 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002148 $(ALL_PDK_FUSION_FILES)) \
2149 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002150
2151# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2152$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2153
2154INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002155INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2156$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002157$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2158 @echo Installed file list: $@
2159 @mkdir -p $(dir $@)
2160 @rm -f $@
2161 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2162 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2163
2164productimage_intermediates := \
2165 $(call intermediates-dir-for,PACKAGING,product)
2166BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2167define build-productimage-target
2168 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2169 @mkdir -p $(TARGET_OUT_PRODUCT)
2170 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002171 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002172 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2173 ./build/tools/releasetools/build_image.py \
2174 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
2175 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
2176endef
2177
2178# We just build this directly to the install location.
2179INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2180$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2181 $(build-productimage-target)
2182
2183.PHONY: productimage-nodeps pnod
2184productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2185 $(build-productimage-target)
2186
2187sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2188
2189else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2190INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2191$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2192endif
2193
2194# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07002195# dtbo image
2196ifdef BOARD_PREBUILT_DTBOIMAGE
2197INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
2198
2199ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002200$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002201 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2202 $(AVBTOOL) add_hash_footer \
2203 --image $@ \
2204 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002205 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002206 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
2207else
2208$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
2209 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2210endif
2211
2212endif
2213
2214# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002215# vbmeta image
2216ifeq ($(BOARD_AVB_ENABLE),true)
2217
2218BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002219AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002220
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002221ifdef BOARD_AVB_KEY_PATH
2222$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
2223else
2224# If key path isn't specified, use the 4096-bit test key.
2225BOARD_AVB_ALGORITHM := SHA256_RSA4096
2226BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
2227endif
2228
2229INTERNAL_AVB_SIGNING_ARGS := \
2230 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
2231
2232BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
2233DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
2234SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
2235VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05002236RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002237PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002238
2239# Check and set required build variables for a chain partition.
2240# $(1): the partition to enable AVB chain, e.g., BOOT or SYSTEM.
2241define check-and-set-avb-chain-args
2242$(eval PART := $(1))
Bowgo Tsaie615afd2017-06-20 17:38:21 +08002243$(eval part=$(call to-lower,$(PART)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002244
2245$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
2246$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
2247$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
2248$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
2249$(if $($(_key_path)),,$(error $(_key_path) is not defined))
2250$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
2251$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
2252$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
2253
2254# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
2255$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
2256$(eval $(_signing_args) := \
2257 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
2258
2259$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2260 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
2261
2262# Set rollback_index via footer args
2263$(eval _footer_args := $(PART)_FOOTER_ARGS)
2264$(eval $($(_footer_args)) += --rollback_index $($(_rollback_index)))
2265endef
2266
2267ifdef BOARD_AVB_BOOT_KEY_PATH
2268$(eval $(call check-and-set-avb-chain-args,BOOT))
2269else
2270INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2271 --include_descriptors_from_image $(INSTALLED_BOOTIMAGE_TARGET)
2272endif
2273
2274ifdef BOARD_AVB_SYSTEM_KEY_PATH
2275$(eval $(call check-and-set-avb-chain-args,SYSTEM))
2276else
2277INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2278 --include_descriptors_from_image $(INSTALLED_SYSTEMIMAGE)
2279endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002280
2281ifdef INSTALLED_VENDORIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002282ifdef BOARD_AVB_VENDOR_KEY_PATH
2283$(eval $(call check-and-set-avb-chain-args,VENDOR))
2284else
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002285INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2286 --include_descriptors_from_image $(INSTALLED_VENDORIMAGE_TARGET)
2287endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002288endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002289
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002290ifdef INSTALLED_PRODUCTIMAGE_TARGET
2291ifdef BOARD_AVB_PRODUCT_KEY_PATH
2292$(eval $(call check-and-set-avb-chain-args,PRODUCT))
2293else
2294INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2295 --include_descriptors_from_image $(INSTALLED_PRODUCTIMAGE_TARGET)
2296endif
2297endif
2298
Yueyao Zhu211c9012017-04-27 00:34:50 -07002299ifdef INSTALLED_DTBOIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002300ifdef BOARD_AVB_DTBO_KEY_PATH
2301$(eval $(call check-and-set-avb-chain-args,DTBO))
2302else
Yueyao Zhu211c9012017-04-27 00:34:50 -07002303INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
Tao Baoc633ed02017-05-30 21:46:33 -07002304 --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002305endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002306endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07002307
David Zeuthen8fecb282017-12-01 16:24:01 -05002308ifdef INSTALLED_RECOVERYIMAGE_TARGET
2309ifdef BOARD_AVB_RECOVERY_KEY_PATH
2310$(eval $(call check-and-set-avb-chain-args,RECOVERY))
2311else
2312INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2313 --include_descriptors_from_image $(INSTALLED_RECOVERYIMAGE_TARGET)
2314endif
2315endif
2316
Bowgo Tsai9e95bea2017-06-30 12:12:15 +08002317BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
Bowgo Tsai53cf9992017-06-13 11:27:06 +08002318
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002319# Add kernel cmdline descriptor for kernel to mount system.img as root with
2320# dm-verity. This works when system.img is either chained or not-chained:
2321# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
2322# cmdline descriptor to system.img
2323# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
2324# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08002325ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002326BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08002327endif
2328
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002329ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002330BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002331endif
2332
John Reck0588b432018-05-03 13:20:01 -07002333ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
2334BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
2335endif
2336
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002337ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
2338 $(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
2339endif
2340
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002341# $(1): the directory to extract public keys to
2342define extract-avb-chain-public-keys
2343 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
2344 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
2345 --output $(1)/boot.avbpubkey)
2346 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
2347 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
2348 --output $(1)/system.avbpubkey)
2349 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
2350 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
2351 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002352 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
2353 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
2354 --output $(1)/product.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002355 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
2356 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
2357 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05002358 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
2359 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
2360 --output $(1)/recovery.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002361endef
2362
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002363define build-vbmetaimage-target
2364 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002365 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
2366 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002367 $(hide) $(AVBTOOL) make_vbmeta_image \
2368 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2369 $(INTERNAL_AVB_SIGNING_ARGS) \
2370 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2371 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002372 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002373endef
2374
2375INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
David Zeuthen8fecb282017-12-01 16:24:01 -05002376$(INSTALLED_VBMETAIMAGE_TARGET): \
2377 $(AVBTOOL) \
2378 $(INSTALLED_BOOTIMAGE_TARGET) \
2379 $(INSTALLED_SYSTEMIMAGE) \
2380 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002381 $(INSTALLED_PRODUCTIMAGE_TARGET) \
David Zeuthen8fecb282017-12-01 16:24:01 -05002382 $(INSTALLED_DTBOIMAGE_TARGET) \
2383 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2384 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002385 $(build-vbmetaimage-target)
2386
2387.PHONY: vbmetaimage-nodeps
2388vbmetaimage-nodeps:
2389 $(build-vbmetaimage-target)
2390
Bowgo Tsai9afc0d52017-07-27 21:22:14 +08002391else ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
2392BUILT_DISABLED_VBMETAIMAGE := $(PRODUCT_OUT)/vbmeta.img
2393
2394INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_DISABLED_VBMETAIMAGE)
2395$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL)
2396 $(hide) $(AVBTOOL) make_vbmeta_image \
2397 --flag 2 --padding_size 4096 --output $@
2398
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002399endif # BOARD_AVB_ENABLE
2400
2401# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08002402# bring in the installer image generation defines if necessary
2403ifeq ($(TARGET_USE_DISKINSTALLER),true)
2404include bootable/diskinstaller/config.mk
2405endif
2406
2407# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07002408# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08002409
Ying Wangbd2d0242015-09-22 11:17:52 -07002410build_ota_package := true
2411ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
2412build_ota_package := false
2413endif
2414ifeq ($(BUILD_OS),darwin)
2415build_ota_package := false
2416endif
2417ifneq ($(strip $(SANITIZE_TARGET)),)
2418build_ota_package := false
2419endif
2420ifeq ($(TARGET_PRODUCT),sdk)
2421build_ota_package := false
2422endif
2423ifneq ($(filter generic%,$(TARGET_DEVICE)),)
2424build_ota_package := false
2425endif
2426ifeq ($(TARGET_NO_KERNEL),true)
2427build_ota_package := false
2428endif
2429ifeq ($(recovery_fstab),)
2430build_ota_package := false
2431endif
Colin Cross481cc5a2016-02-04 15:09:23 -08002432ifeq ($(TARGET_BUILD_PDK),true)
2433build_ota_package := false
2434endif
Ying Wangbd2d0242015-09-22 11:17:52 -07002435
2436ifeq ($(build_ota_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07002437OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
2438 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08002439 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07002440 $(HOST_OUT_EXECUTABLES)/mkbootfs \
2441 $(HOST_OUT_EXECUTABLES)/mkbootimg \
2442 $(HOST_OUT_EXECUTABLES)/fs_config \
2443 $(HOST_OUT_EXECUTABLES)/zipalign \
2444 $(HOST_OUT_EXECUTABLES)/bsdiff \
2445 $(HOST_OUT_EXECUTABLES)/imgdiff \
2446 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
2447 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
2448 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002449 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08002450 $(HOST_OUT_EXECUTABLES)/mke2fs \
2451 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh \
2452 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Tao Baocffaf732016-04-14 12:11:36 -07002453 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
2454 $(HOST_OUT_EXECUTABLES)/mksquashfs \
2455 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
2456 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08002457 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07002458 $(HOST_OUT_EXECUTABLES)/simg2img \
2459 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002460 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07002461 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08002462 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07002463 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07002464 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01002465 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002466 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08002467 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
2468 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07002469 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tao Bao3cba3742017-05-16 16:27:25 -07002470 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002471 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07002472 $(BROTLI) \
2473 $(BUILD_VERITY_METADATA) \
2474 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08002475
2476ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2477OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08002478 $(FUTILITY) \
2479 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08002480endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08002481
Ying Wangc45a47b2015-04-08 12:24:37 -07002482# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07002483OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07002484 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
2485 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
2486 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002487 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002488 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002489 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002490 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
2491 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
2492 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
2493 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08002494 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002495 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
2496 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08002497 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002498 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
2499 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
2500 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002501 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
2502 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00002503 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08002504 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002505 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01002506 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08002507 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01002508 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002509 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
2510 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX)
2511
The Android Open Source Project88b60792009-03-03 19:28:42 -08002512
Ying Wang06898662010-06-17 17:52:18 -07002513.PHONY: otatools
2514otatools: $(OTATOOLS)
2515
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002516BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07002517$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002518
Tao Baoe8ef8f702017-05-17 11:41:50 -07002519OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002520 system/extras/ext4_utils/mke2fs.conf \
Tao Bao2d0e5122018-05-23 09:23:28 -07002521 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
2522 -name "atx_metadata.bin")) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002523 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print)) \
2524 $(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002525 -name verity_key)) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002526 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
2527 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002528
2529OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07002530 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002531
2532ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2533OTATOOLS_DEPS += \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002534 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002535endif
2536
2537$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) | $(ACP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002538 @echo "Package OTA tools: $@"
2539 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002540 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07002541 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Colin Crossfdea8932017-12-06 14:38:40 -08002542 $(hide) $(ACP) -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002543 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Dan Willemsen48a621c2015-10-29 16:33:05 -07002544 $(hide) (cd $(zip_root) && zip -qryX $(abspath $@) *)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002545 $(hide) echo $(OTATOOLS_DEPS) | xargs zip -qryX $(abspath $@)>/dev/null || true
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002546
2547.PHONY: otatools-package
2548otatools-package: $(BUILT_OTATOOLS_PACKAGE)
2549
Ying Wangbd2d0242015-09-22 11:17:52 -07002550endif # build_ota_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002551
The Android Open Source Project88b60792009-03-03 19:28:42 -08002552# -----------------------------------------------------------------
2553# A zip of the directories that map to the target filesystem.
2554# This zip can be used to create an OTA package or filesystem image
2555# as a post-build step.
2556#
2557name := $(TARGET_PRODUCT)
2558ifeq ($(TARGET_BUILD_TYPE),debug)
2559 name := $(name)_debug
2560endif
2561name := $(name)-target_files-$(FILE_NAME_TAG)
2562
2563intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
2564BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
2565$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
2566$(BUILT_TARGET_FILES_PACKAGE): \
2567 zip_root := $(intermediates)/$(name)
2568
2569# $(1): Directory to copy
2570# $(2): Location to copy it to
2571# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
2572define package_files-copy-root
2573 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
2574 mkdir -p $(2) && \
2575 $(ACP) -rd $(strip $(1))/* $(2); \
2576 fi
2577endef
2578
Tao Baoa04fca32015-11-30 12:22:24 -08002579built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07002580
2581# We can't build static executables when SANITIZE_TARGET=address
Ivan Krasin74b32b82015-09-18 11:54:43 -07002582ifeq ($(strip $(SANITIZE_TARGET)),)
Ying Wange6e544e2015-06-22 18:35:35 -07002583built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07002584 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
2585endif
2586
The Android Open Source Project88b60792009-03-03 19:28:42 -08002587$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
2588
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002589$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002590$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002591
Doug Zongkerc18736b2009-09-30 09:20:32 -07002592ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
2593# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07002594tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07002595else
Dan Willemsen653bea92017-03-21 15:47:37 -07002596tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002597endif
Dan Willemsen653bea92017-03-21 15:47:37 -07002598tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
2599$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
2600$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002601
Sen Jiang4438fd92016-03-07 16:51:01 -08002602ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08002603updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08002604else
Steve Fung48e49f52015-10-01 23:53:31 -07002605# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002606updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07002607endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002608$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07002609
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002610# If we are using recovery as boot, output recovery files to BOOT/.
2611ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2612$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
2613else
2614$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
2615endif
2616
Dan Willemsen653bea92017-03-21 15:47:37 -07002617ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07002618 ifdef OSRELEASED_DIRECTORY
2619 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
2620 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
2621 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
2622 endif
2623endif
2624
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002625# Run fs_config while creating the target files package
2626# $1: root directory
2627# $2: add prefix
2628define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08002629(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 -08002630endef
2631
The Android Open Source Project88b60792009-03-03 19:28:42 -08002632# Depending on the various images guarantees that the underlying
2633# directories are up-to-date.
2634$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002635 $(INSTALLED_BOOTIMAGE_TARGET) \
2636 $(INSTALLED_RADIOIMAGE_TARGET) \
2637 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002638 $(FULL_SYSTEMIMAGE_DEPS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002639 $(INSTALLED_USERDATAIMAGE_TARGET) \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002640 $(INSTALLED_CACHEIMAGE_TARGET) \
Ying Wanga0febe52013-03-20 11:02:05 -07002641 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002642 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Bowgo Tsai6a749792017-09-01 22:55:44 +08002643 $(INSTALLED_VBMETAIMAGE_TARGET) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002644 $(INSTALLED_DTBOIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002645 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002646 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
Dan Willemsen653bea92017-03-21 15:47:37 -07002647 $(INSTALLED_KERNEL_TARGET) \
2648 $(INSTALLED_2NDBOOTLOADER_TARGET) \
2649 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
2650 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002651 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
Nick Kralevich0eb17d92013-09-07 17:10:29 -07002652 $(SELINUX_FC) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002653 $(APKCERTS_FILE) \
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002654 $(SOONG_ZIP) \
Doug Zongker283e2a12010-03-15 17:52:32 -07002655 $(HOST_OUT_EXECUTABLES)/fs_config \
Dan Willemsend79a08f2017-03-23 22:09:06 -07002656 $(HOST_OUT_EXECUTABLES)/imgdiff \
2657 $(HOST_OUT_EXECUTABLES)/bsdiff \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002658 $(BUILD_IMAGE_SRCS) \
Steven Moreland627debe2018-05-01 09:54:21 -07002659 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
2660 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
2661 $(BUILT_SYSTEM_MATRIX) \
Steven Moreland915f3512018-01-25 10:44:47 -08002662 $(BUILT_VENDOR_MATRIX) \
Ying Wang5d887702015-11-04 10:06:25 -08002663 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002664 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07002665 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002666 $(call create-system-product-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002667 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002668 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002669ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002670 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002671 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002672 $(hide) $(call package_files-copy-root, \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002673 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002674ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002675 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002676endif
2677ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002678 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002679endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002680ifdef BOARD_INCLUDE_RECOVERY_DTBO
2681 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
2682endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002683ifdef INTERNAL_KERNEL_CMDLINE
2684 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002685endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002686ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002687 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07002688endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002689ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002690 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07002691endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002692endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08002693 @# Components of the boot image
2694 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07002695ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
2696 $(hide) mkdir -p $(zip_root)/ROOT
2697 $(hide) $(call package_files-copy-root, \
2698 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
2699else
The Android Open Source Project88b60792009-03-03 19:28:42 -08002700 $(hide) $(call package_files-copy-root, \
2701 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07002702endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002703 @# If we are using recovery as boot, this is already done when processing recovery.
2704ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002705ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002706 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002707endif
2708ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002709 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002710endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002711ifdef INTERNAL_KERNEL_CMDLINE
2712 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002713endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002714ifdef BOARD_KERNEL_BASE
2715 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
2716endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002717ifdef BOARD_KERNEL_PAGESIZE
2718 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
2719endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002720endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07002721 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
2722 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07002723 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002724 @# Contents of the system image
2725 $(hide) $(call package_files-copy-root, \
2726 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
2727 @# Contents of the data image
2728 $(hide) $(call package_files-copy-root, \
2729 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Ying Wanga0febe52013-03-20 11:02:05 -07002730ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2731 @# Contents of the vendor image
2732 $(hide) $(call package_files-copy-root, \
2733 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
2734endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002735ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2736 @# Contents of the product image
2737 $(hide) $(call package_files-copy-root, \
2738 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
2739endif
Alex Light4e358ab2016-06-16 14:47:10 -07002740ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
2741 @# Contents of the system_other image
2742 $(hide) $(call package_files-copy-root, \
2743 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
2744endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002745 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07002746 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07002747 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07002748ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08002749ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07002750 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07002751 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07002752endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08002753endif
Doug Zongker8678df42009-06-15 14:30:14 -07002754 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08002755 @# build them.
2756 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07002757 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
2758ifneq ($(tool_extension),)
2759 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
2760endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07002761 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07002762 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07002763 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002764 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002765ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07002766 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002767endif
2768ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002769 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002770endif
Tao Baodb45efa2015-10-27 19:25:18 -07002771ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2772 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
2773endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002774ifdef BOARD_INCLUDE_RECOVERY_DTBO
2775 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
2776endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002777ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002778 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002779endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07002780ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
2781 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
2782 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
2783else
2784 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
2785endif
Dan Willemsen653bea92017-03-21 15:47:37 -07002786 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07002787 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07002788ifdef PRODUCT_EXTRA_RECOVERY_KEYS
2789 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08002790endif
Jianxun Zhang09849492013-04-17 15:19:19 -07002791 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00002792 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08002793 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08002794 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Ying Wange24e17a2014-10-07 18:42:11 -07002795ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07002796 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07002797 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07002798endif
Tao Baof54216f2016-03-29 15:12:37 -07002799ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07002800 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07002801 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH))
2802endif
2803ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07002804 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07002805 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
2806endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002807ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
2808 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
2809 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
2810endif
Ivan Krasin74b32b82015-09-18 11:54:43 -07002811ifneq ($(strip $(SANITIZE_TARGET)),)
Ying Wang2a048392015-06-25 13:56:53 -07002812 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
2813 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
2814endif
Tao Bao8beab692015-07-22 12:33:18 -07002815ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
2816 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
2817endif
David Zeuthen0eb10972016-09-28 17:55:27 -04002818ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002819 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
2820 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2821 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2822 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
2823 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2824ifdef BOARD_AVB_BOOT_KEY_PATH
2825 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2826 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2827 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
2828endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05002829 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2830ifdef BOARD_AVB_RECOVERY_KEY_PATH
2831 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2832 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2833 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
2834endif # BOARD_AVB_RECOVERY_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002835endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04002836ifdef BOARD_BPT_INPUT_FILES
2837 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
2838 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
2839 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
2840endif
2841ifdef BOARD_BPT_DISK_SIZE
2842 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
2843endif
Ying Wangbd93d422011-10-28 17:02:30 -07002844 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07002845ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Per Astrandcab66992015-03-25 14:06:30 +01002846 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002847 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07002848endif
Alex Deymo70067ac2015-09-29 19:05:37 -07002849ifeq ($(AB_OTA_UPDATER),true)
2850 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07002851 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07002852 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07002853 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
2854 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08002855 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
2856 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
2857 done
Steve Fung4044b382015-11-05 02:04:04 -08002858 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
2859 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002860 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07002861ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07002862 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
2863 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
2864 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07002865endif
Alex Deymo70067ac2015-09-29 19:05:37 -07002866endif
Steve Fungdfbab492015-09-24 18:12:33 -07002867ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07002868 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07002869 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
2870endif
Bowgo Tsai6a749792017-09-01 22:55:44 +08002871# BOARD_BUILD_DISABLED_VBMETAIMAGE is used to build a special vbmeta.img
2872# that disables AVB verification. The content is fixed and we can just copy
2873# it to $(zip_root)/IMAGES without passing some info into misc_info.txt for
2874# regeneration.
2875ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
2876 $(hide) mkdir -p $(zip_root)/IMAGES
2877 $(hide) cp $(INSTALLED_VBMETAIMAGE_TARGET) $(zip_root)/IMAGES/
2878endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002879ifdef BOARD_PREBUILT_VENDORIMAGE
2880 $(hide) mkdir -p $(zip_root)/IMAGES
2881 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
2882endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002883ifdef BOARD_PREBUILT_PRODUCTIMAGE
2884 $(hide) mkdir -p $(zip_root)/IMAGES
2885 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
2886endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07002887ifdef BOARD_PREBUILT_BOOTIMAGE
2888 $(hide) mkdir -p $(zip_root)/IMAGES
2889 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
2890endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07002891ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07002892 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
2893 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
2894 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
2895ifeq ($(BOARD_AVB_ENABLE),true)
2896 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002897 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
2898ifdef BOARD_AVB_DTBO_KEY_PATH
2899 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
2900 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
2901 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07002902 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002903endif # BOARD_AVB_DTBO_KEY_PATH
2904endif # BOARD_AVB_ENABLE
2905endif # BOARD_PREBUILT_DTBOIMAGE
Tao Bao95a95c32017-06-16 15:30:23 -07002906 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
2907 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
2908 @# INSTALLED_RADIOIMAGE_TARGET.
2909 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
2910 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002911 @# Run fs_config on all the system, vendor, boot ramdisk,
2912 @# and recovery ramdisk files in the zip, and save the output
2913 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
2914ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2915 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
2916endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002917ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2918 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
2919endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002920ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Tao Baoda01b212018-02-28 21:20:08 -08002921 @# When using BOARD_BUILD_SYSTEM_ROOT_IMAGE, ROOT always contains the files for the root under
2922 @# normal boot. BOOT/RAMDISK exists only if additionally using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002923 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08002924ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002925 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08002926endif
2927else # BOARD_BUILD_SYSTEM_ROOT_IMAGE != true
2928 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
2929endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002930ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2931 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
2932endif
2933ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
2934 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
2935endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002936 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07002937 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Steven Moreland627debe2018-05-01 09:54:21 -07002938 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
2939ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
2940 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002941endif
Yifan Hongaa212212017-04-14 00:00:46 -07002942ifdef BUILT_VENDOR_MATRIX
2943 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07002944endif
2945
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002946 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002947 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08002948 @# Zip everything up, preserving symlinks and placing META/ files first to
2949 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002950 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07002951 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002952 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07002953
Ying Wanga0febe52013-03-20 11:02:05 -07002954.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08002955target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
2956
Ying Wang4709d7c2014-04-14 17:25:43 -07002957ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
2958$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
2959endif
Doug Zongker367910f2009-06-15 18:56:51 -07002960
Dan Albert4d323332016-10-14 13:23:06 -07002961# -----------------------------------------------------------------
2962# NDK Sysroot Package
2963NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07002964$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07002965 @echo Package NDK sysroot...
2966 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
2967
2968$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
2969
Ying Wang09c4b682015-08-11 11:24:19 -07002970ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07002971# -----------------------------------------------------------------
2972# OTA update package
2973
Doug Zongker8678df42009-06-15 14:30:14 -07002974name := $(TARGET_PRODUCT)
2975ifeq ($(TARGET_BUILD_TYPE),debug)
2976 name := $(name)_debug
2977endif
2978name := $(name)-ota-$(FILE_NAME_TAG)
2979
2980INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
2981
2982$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
2983
Tao Baoe53c6e72017-04-19 15:54:22 -07002984ifeq ($(AB_OTA_UPDATER),true)
2985$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002986else
Alex Deymob10e07a2017-11-09 23:53:42 +01002987$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07002988endif
2989
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002990$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Colin Crossfdea8932017-12-06 14:38:40 -08002991 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07002992 @echo "Package OTA: $@"
Ying Wang9d252e12015-02-09 17:20:06 -08002993 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08002994 build/make/tools/releasetools/ota_from_target_files -v \
Doug Zongker26e66192014-02-20 13:22:07 -08002995 --block \
Dan Willemsencea5cd22017-03-21 14:44:27 -07002996 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
Doug Zongker602a84e2009-06-18 08:35:12 -07002997 -p $(HOST_OUT) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05002998 -k $(KEY_CERT_PAIR) \
Michael Runge6e836112014-04-15 17:40:21 -07002999 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05003000 $(BUILT_TARGET_FILES_PACKAGE) $@
Doug Zongker8678df42009-06-15 14:30:14 -07003001
3002.PHONY: otapackage
3003otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
3004
Ying Wang09c4b682015-08-11 11:24:19 -07003005endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07003006
Ying Wang09a00a62010-10-20 14:01:09 -07003007# -----------------------------------------------------------------
3008# The update package
3009
3010name := $(TARGET_PRODUCT)
3011ifeq ($(TARGET_BUILD_TYPE),debug)
3012 name := $(name)_debug
3013endif
3014name := $(name)-img-$(FILE_NAME_TAG)
3015
3016INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
3017
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003018$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07003019 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003020 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
3021 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07003022
3023.PHONY: updatepackage
3024updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
3025
The Android Open Source Project88b60792009-03-03 19:28:42 -08003026# -----------------------------------------------------------------
3027# A zip of the symbols directory. Keep the full paths to make it
3028# more obvious where these files came from.
3029#
3030name := $(TARGET_PRODUCT)
3031ifeq ($(TARGET_BUILD_TYPE),debug)
3032 name := $(name)_debug
3033endif
3034name := $(name)-symbols-$(FILE_NAME_TAG)
3035
3036SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003037# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07003038ifndef TARGET_BUILD_APPS
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003039$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3040 $(INSTALLED_BOOTIMAGE_TARGET) \
3041 $(INSTALLED_USERDATAIMAGE_TARGET) \
3042 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003043 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003044 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07003045endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003046$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
3047$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003048 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003049 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3050 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
3051 $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08003052 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003053# -----------------------------------------------------------------
3054# A zip of the coverage directory.
3055#
3056name := $(TARGET_PRODUCT)
3057ifeq ($(TARGET_BUILD_TYPE),debug)
3058name := $(name)_debug
3059endif
3060name := $(name)-coverage-$(FILE_NAME_TAG)
3061COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
3062ifndef TARGET_BUILD_APPS
3063$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3064 $(INSTALLED_BOOTIMAGE_TARGET) \
3065 $(INSTALLED_USERDATAIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003066 $(INSTALLED_VENDORIMAGE_TARGET) \
3067 $(INSTALLED_PRODUCTIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003068endif
3069$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
3070$(COVERAGE_ZIP): $(SOONG_ZIP)
3071 @echo "Package coverage: $@"
3072 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3073 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
3074 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
3075 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003076
3077# -----------------------------------------------------------------
3078# A zip of the Android Apps. Not keeping full path so that we don't
3079# include product names when distributing
3080#
3081name := $(TARGET_PRODUCT)
3082ifeq ($(TARGET_BUILD_TYPE),debug)
3083 name := $(name)_debug
3084endif
3085name := $(name)-apps-$(FILE_NAME_TAG)
3086
3087APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Ying Wang5d887702015-11-04 10:06:25 -08003088$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003089 @echo "Package apps: $@"
3090 $(hide) rm -rf $@
3091 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003092 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
3093 if [ -z "$$apps_to_zip" ]; then \
3094 echo "No apps to zip up. Generating empty apps archive." ; \
3095 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
3096 else \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003097 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003098 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07003099
Ying Wangbc415dd2012-08-15 12:22:44 -07003100ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07003101#------------------------------------------------------------------
3102# An archive of classes for use in generating code-coverage reports
3103# These are the uninstrumented versions of any classes that were
3104# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07003105# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003106
Colin Crossa6bc3a82017-09-27 14:28:41 -07003107JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003108$(JACOCO_REPORT_CLASSES_ALL) :
3109 @echo "Collecting uninstrumented classes"
3110 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
3111 zip -@ -0 -q -X $@
3112# Meaning of these options:
3113# -@ scan stdin for file paths to add to the zip
3114# -0 don't do any compression
3115# -q supress most output
3116# -X skip storing extended file attributes
3117
Ying Wangbc415dd2012-08-15 12:22:44 -07003118endif # EMMA_INSTRUMENT=true
3119
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003120
Ying Wangae9115a2013-08-22 20:52:47 -07003121#------------------------------------------------------------------
3122# A zip of Proguard obfuscation dictionary files.
3123# Only for apps_only build.
3124#
3125ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07003126PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003127# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07003128$(PROGUARD_DICT_ZIP) :
3129 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07003130 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Ying Wangae9115a2013-08-22 20:52:47 -07003131 if [ -n "$$dict_files" ]; then \
Ying Wang33d64592013-11-25 17:39:50 -08003132 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003133 zip -qX $@ $$dict_files $$unobfuscated_jars; \
Ying Wangae9115a2013-08-22 20:52:47 -07003134 else \
Ying Wangdcd90832015-02-26 09:36:27 -08003135 touch $(dir $@)/zipdummy; \
3136 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
3137 zip -qd $@ zipdummy; \
3138 rm $(dir $@)/zipdummy; \
Ying Wangae9115a2013-08-22 20:52:47 -07003139 fi
3140
3141endif # TARGET_BUILD_APPS
3142
The Android Open Source Project88b60792009-03-03 19:28:42 -08003143# -----------------------------------------------------------------
3144# dalvik something
3145.PHONY: dalvikfiles
3146dalvikfiles: $(INTERNAL_DALVIK_MODULES)
3147
Bo Huf0d50bb2017-08-01 19:02:09 +00003148ifeq ($(BUILD_QEMU_IMAGES),true)
3149INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
3150MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
3151SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
3152$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3153 @echo Create system-qemu.img
3154 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img)
3155
3156systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
3157droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
3158ifeq ($(BOARD_USES_VENDORIMAGE),true)
3159INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
3160$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3161 @echo Create vendor-qemu.img
3162 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img)
3163
3164vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
3165droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
3166endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003167ifeq ($(BOARD_USES_PRODUCTIMAGE),true)
3168INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
3169$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3170 @echo Create product-qemu.img
3171 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img)
3172
3173productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
3174droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
3175endif
Bo Huf0d50bb2017-08-01 19:02:09 +00003176endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003177# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08003178# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07003179ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003180INTERNAL_EMULATOR_PACKAGE_FILES += \
3181 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08003182 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003183 $(INSTALLED_RAMDISK_TARGET) \
3184 $(INSTALLED_SYSTEMIMAGE) \
3185 $(INSTALLED_USERDATAIMAGE_TARGET)
3186
3187name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
3188
3189INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
3190
Ying Wang5d887702015-11-04 10:06:25 -08003191$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003192 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07003193 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003194
Ying Wang7d8c5352012-07-26 10:15:21 -07003195endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003196# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08003197# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08003198# The pdk package (Platform Development Kit)
3199
Keun young Park7fc7aad2012-02-27 15:49:23 -08003200#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
3201# include development/pdk/Pdk.mk
3202#endif
3203
The Android Open Source Project88b60792009-03-03 19:28:42 -08003204
3205# -----------------------------------------------------------------
3206# The SDK
3207
The Android Open Source Project88b60792009-03-03 19:28:42 -08003208# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07003209sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003210
3211# Build a name that looks like:
3212#
3213# linux-x86 --> android-sdk_12345_linux-x86
3214# darwin-x86 --> android-sdk_12345_mac-x86
3215# windows-x86 --> android-sdk_12345_windows
3216#
3217sdk_name := android-sdk_$(FILE_NAME_TAG)
3218ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07003219 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08003220else
Joe Onorato03fbe402009-04-13 08:31:16 -07003221 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003222endif
3223ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07003224 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003225endif
Joe Onorato03fbe402009-04-13 08:31:16 -07003226sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003227
3228sdk_dep_file := $(sdk_dir)/sdk_deps.mk
3229
3230ATREE_FILES :=
3231-include $(sdk_dep_file)
3232
3233# if we don't have a real list, then use "everything"
3234ifeq ($(strip $(ATREE_FILES)),)
3235ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003236 $(ALL_DEFAULT_INSTALLED_MODULES) \
3237 $(INSTALLED_RAMDISK_TARGET) \
3238 $(ALL_DOCS) \
3239 $(ALL_SDK_FILES)
3240endif
3241
3242atree_dir := development/build
3243
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01003244
The Android Open Source Project88b60792009-03-03 19:28:42 -08003245sdk_atree_files := \
3246 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07003247 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08003248
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02003249# development/build/sdk-android-<abi>.atree is used to differentiate
3250# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
3251# files like the kernel image. We use TARGET_CPU_ABI because we don't
3252# have a better way to distinguish between CPU models.
3253ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
3254 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
3255endif
3256
Griff Hazen433febb2014-02-28 08:45:59 -08003257ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES),)
3258sdk_atree_files += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES)
3259else
3260sdk_atree_files += $(atree_dir)/sdk.atree
3261endif
3262
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003263include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003264
The Android Open Source Project88b60792009-03-03 19:28:42 -08003265deps := \
3266 $(target_notice_file_txt) \
3267 $(tools_notice_file_txt) \
3268 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07003269 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07003270 $(COVERAGE_ZIP) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003271 $(INSTALLED_SYSTEMIMAGE) \
Bo Huf0d50bb2017-08-01 19:02:09 +00003272 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07003273 $(INSTALLED_QEMU_VENDORIMAGE) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003274 $(INSTALLED_USERDATAIMAGE_TARGET) \
3275 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003276 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07003277 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003278 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08003279 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003280 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003281 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003282 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003283
3284INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
3285$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
3286$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
3287$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
3288$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
3289
3290# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
3291#
3292#SDK_GNU_ERROR := true
3293
Ying Wang5d887702015-11-04 10:06:25 -08003294$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003295 @echo "Package SDK: $@"
3296 $(hide) rm -rf $(PRIVATE_DIR) $@
3297 $(hide) for f in $(target_gnu_MODULES); do \
3298 if [ -f $$f ]; then \
3299 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
3300 including GNU target $$f >&2; \
3301 FAIL=$(SDK_GNU_ERROR); \
3302 fi; \
3303 done; \
3304 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07003305 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08003306 $(hide) ( \
Dan Willemsen6f57b282018-06-01 10:53:55 -07003307 ATREE_STRIP="$(HOST_STRIP) -x" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003308 $(HOST_OUT_EXECUTABLES)/atree \
3309 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
3310 -m $(PRIVATE_DEP_FILE) \
3311 -I . \
3312 -I $(PRODUCT_OUT) \
3313 -I $(HOST_OUT) \
3314 -I $(TARGET_COMMON_OUT_ROOT) \
3315 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
Raphael Moll7558ad52011-01-05 14:58:17 -08003316 -v "OUT_DIR=$(OUT_DIR)" \
Raphael2a533172011-11-15 16:29:16 -08003317 -v "HOST_OUT=$(HOST_OUT)" \
Bruce Beare18a130e2011-02-18 15:06:20 -08003318 -v "TARGET_ARCH=$(TARGET_ARCH)" \
3319 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
David 'Digit' Turner557c51f2011-08-25 14:28:03 +02003320 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003321 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003322 -o $(PRIVATE_DIR) && \
3323 cp -f $(target_notice_file_txt) \
Xavier Ducrohet6de7bc62011-09-21 10:22:19 -07003324 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
Xavier Ducrohet4216a8c2011-03-15 13:28:40 -07003325 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003326 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Raphael7a6a9c32011-02-01 13:30:00 -08003327 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003328 chmod -R ug+rwX $(PRIVATE_DIR) && \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003329 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003330 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
3331
Raphael3d224a02010-04-16 17:50:09 -07003332
3333# Is a Windows SDK requested? If so, we need some definitions from here
3334# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08003335MAIN_SDK_NAME := $(sdk_name)
3336MAIN_SDK_DIR := $(sdk_dir)
3337MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08003338ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07003339include $(TOPDIR)development/build/tools/windows_sdk.mk
3340endif
3341
The Android Open Source Project88b60792009-03-03 19:28:42 -08003342# -----------------------------------------------------------------
3343# Findbugs
3344INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
3345INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
3346$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
3347 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003348 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003349 > $@
3350$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
3351 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003352 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07003353 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08003354
3355# -----------------------------------------------------------------
3356# Findbugs
3357
3358# -----------------------------------------------------------------
3359# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07003360ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003361include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01003362-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07003363-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003364-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07003365# Also the project-specific tasks
3366-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
3367-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003368-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07003369# Also add test specifc tasks
3370include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07003371include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07003372endif
Raphaelc4d47312011-02-15 16:09:36 -08003373
Ying Wang67132ba2015-10-28 16:42:39 -07003374include $(BUILD_SYSTEM)/product-graph.mk
3375
Raphaelc4d47312011-02-15 16:09:36 -08003376# -----------------------------------------------------------------
3377# Create SDK repository packages. Must be done after tasks/* since
3378# we need the addon rules defined.
3379ifneq ($(sdk_repo_goal),)
3380include $(TOPDIR)development/build/tools/sdk_repo.mk
3381endif
Jayant Chowdhary67e0cc52018-02-23 16:50:39 -08003382
3383#------------------------------------------------------------------
3384# Find lsdump paths
3385FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
3386$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
3387 $(hide) rm -rf $@ && echo "$^" > $@