blob: d7b3ab7d2e822fbf3a6611157df7fd4533a53d93 [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 Wang7e8d4422011-06-17 17:05:35 -070042 $(eval unique_product_copy_files_destinations += $(_dest))))
Dan Willemsen403b98a2017-11-15 11:13:23 -080043
44# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
45$(file >$(PRODUCT_OUT)/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
46ifdef dist_goal
47$(file >$(DIST_DIR)/logs/product_copy_files_ignored.txt,$(subst $(space),$(newline),$(strip $(product_copy_files_ignored))))
48endif
49
50product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070051unique_product_copy_files_pairs :=
Ying Wang7e8d4422011-06-17 17:05:35 -070052unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080053
54# -----------------------------------------------------------------
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +080055# Returns the max allowed size for an image suitable for hash verification
56# (e.g., boot.img, recovery.img, etc).
57# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL).
58# $(1): partition size to flash the image
59define get-hash-image-max-size
60$(if $(1), \
61 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
62 $(eval _hash_meta_size := 69632), \
63 $(eval _hash_meta_size := 0)) \
64 $(1)-$(_hash_meta_size))
65endef
66
67# -----------------------------------------------------------------
Dan Willemsen6f60f022016-02-23 13:40:07 -080068# Define rules to copy headers defined in copy_headers.mk
69# If more than one makefile declared a header, print a warning,
70# then copy the last one defined. This matches the previous make
71# behavior.
72$(foreach dest,$(ALL_COPIED_HEADERS), \
73 $(eval _srcs := $(ALL_COPIED_HEADERS.$(dest).SRC)) \
74 $(eval _src := $(word $(words $(_srcs)),$(_srcs))) \
75 $(if $(call streq,$(_src),$(_srcs)),, \
76 $(warning Duplicate header copy: $(dest)) \
77 $(warning Defined in: $(ALL_COPIED_HEADERS.$(dest).MAKEFILE))) \
78 $(eval $(call copy-one-header,$(_src),$(dest))))
79all_copied_headers: $(ALL_COPIED_HEADERS)
80
81# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -080082# docs/index.html
Ying Wang3f45b3c2012-04-02 18:21:36 -070083ifeq (,$(TARGET_BUILD_APPS))
The Android Open Source Project88b60792009-03-03 19:28:42 -080084gen := $(OUT_DOCS)/index.html
85ALL_DOCS += $(gen)
86$(gen): frameworks/base/docs/docs-redirect-index.html
87 @mkdir -p $(dir $@)
88 @cp -f $< $@
Ying Wang3f45b3c2012-04-02 18:21:36 -070089endif
The Android Open Source Project88b60792009-03-03 19:28:42 -080090
Dan Albert303e6032017-10-04 10:20:20 -070091ndk_doxygen_out := $(OUT_NDK_DOCS)
92ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include
93ndk_docs_src_dir := frameworks/native/docs
94ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile
95ifneq ($(wildcard $(ndk_docs_src_dir)),)
96ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\
97 $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.))
98$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp
99 @mkdir -p $(ndk_doxygen_out)
100 @echo "Generating NDK docs to $(ndk_doxygen_out)"
101 @( cat $(ndk_doxyfile); \
102 echo "INPUT=$(ndk_headers)"; \
103 echo "HTML_OUTPUT=$(ndk_doxygen_out)" \
104 ) | doxygen -
105
106# Note: Not a part of the docs target because we don't have doxygen available.
107# You can run this target locally if you have doxygen installed.
108ndk-docs: $(ndk_doxygen_out)/index.html
109.PHONY: ndk-docs
110endif
111
The Android Open Source Project88b60792009-03-03 19:28:42 -0800112# -----------------------------------------------------------------
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900113# property_overrides_split_enabled
114property_overrides_split_enabled :=
115ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
116 property_overrides_split_enabled := true
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900117endif
118
119# -----------------------------------------------------------------
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900120# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if
121# property_overrides_split_enabled is true. Otherwise it will be installed in
122# ROOT/default.prop.
123ifdef BOARD_VNDK_VERSION
124 ifeq ($(BOARD_VNDK_VERSION),current)
125 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
126 else
127 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
128 endif
Logan Chien86b52ae2018-05-04 19:33:17 +0800129 ifdef BOARD_VNDK_RUNTIME_DISABLE
130 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
131 endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900132else
Logan Chien86b52ae2018-05-04 19:33:17 +0800133 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
134 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900135endif
136FINAL_VENDOR_DEFAULT_PROPERTIES += \
137 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
138FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
139 $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
140
141# -----------------------------------------------------------------
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800142# prop.default
143ifdef property_overrides_split_enabled
144INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800145INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
146ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
147$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800148else
149# legacy path
The Android Open Source Project88b60792009-03-03 19:28:42 -0800150INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800151endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800152ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900153FINAL_DEFAULT_PROPERTIES := \
Jaekyun Seokb31b9ba2017-11-03 15:18:55 +0900154 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
155 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900156ifndef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900157 FINAL_DEFAULT_PROPERTIES += \
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900158 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900159endif
Jaekyun Seok294286d2017-01-20 13:17:12 +0900160FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
161 $(FINAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800162
Andres Moralesb8876e12015-05-06 20:44:22 -0700163intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
164
165$(INSTALLED_DEFAULT_PROP_TARGET): $(intermediate_system_build_prop)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800166 @echo Target buildinfo: $@
167 @mkdir -p $(dir $@)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800168 @rm -f $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800169 $(hide) echo "#" > $@; \
170 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
171 echo "#" >> $@;
Jaekyun Seok294286d2017-01-20 13:17:12 +0900172 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -0700173 echo "$(line)" >> $@;)
Andres Moralesb8876e12015-05-06 20:44:22 -0700174 $(hide) echo "#" >> $@; \
175 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
176 echo "#" >> $@;
Dan Willemsen014719f2015-08-17 20:44:29 -0700177 $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
178 $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
Colin Cross73021682015-07-21 12:54:17 -0700179 $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
Colin Crossfdea8932017-12-06 14:38:40 -0800180 $(hide) build/make/tools/post_process_props.py $@
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800181ifdef property_overrides_split_enabled
182 $(hide) mkdir -p $(TARGET_ROOT_OUT)
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800183 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800184endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800185
186# -----------------------------------------------------------------
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900187# vendor default.prop
188INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900189ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900190INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
191ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
192
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900193$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
194 @echo Target buildinfo: $@
195 @mkdir -p $(dir $@)
196 $(hide) echo "#" > $@; \
197 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
198 echo "#" >> $@;
199 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
200 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800201 $(hide) build/make/tools/post_process_props.py $@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900202
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900203endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900204
205# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800206# build.prop
207INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
208ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900209FINAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -0700210 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
Jaekyun Seok294286d2017-01-20 13:17:12 +0900211FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
212 $(FINAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800213
214# A list of arbitrary tags describing the build configuration.
215# Force ":=" so we can use +=
216BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
217ifeq ($(TARGET_BUILD_TYPE),debug)
218 BUILD_VERSION_TAGS += debug
219endif
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700220# The "test-keys" tag marks builds signed with the old test keys,
221# which are available in the SDK. "dev-keys" marks builds signed with
222# non-default dev keys (usually private keys from a vendor directory).
223# Both of these tags will be removed and replaced with "release-keys"
224# when the target-files is signed in a post-build step.
225ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/target/product/security/testkey)
Doug Zongkera8608a72013-07-23 11:51:04 -0700226BUILD_KEYS := test-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700227else
Doug Zongkera8608a72013-07-23 11:51:04 -0700228BUILD_KEYS := dev-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700229endif
Doug Zongkera8608a72013-07-23 11:51:04 -0700230BUILD_VERSION_TAGS += $(BUILD_KEYS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800231BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
232
233# A human-readable string that descibes this build in detail.
Colin Crossf37b4552015-07-16 17:15:19 -0700234build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
Andres Moralesb8876e12015-05-06 20:44:22 -0700235$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800236
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700237# 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 -0800238ifeq (,$(strip $(BUILD_FINGERPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800239 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
240 BF_BUILD_NUMBER := $(USER)$$($(DATE_FROM_FILE) +%m%d%H%M)
Ying Wang50367cc2014-06-12 18:42:53 -0700241 else
Nan Zhang0abdb582018-02-20 17:00:39 -0800242 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
Ying Wang50367cc2014-06-12 18:42:53 -0700243 endif
244 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 -0800245endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800246# unset it for safety.
247BF_BUILD_NUMBER :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800248
Nan Zhang0abdb582018-02-20 17:00:39 -0800249BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
250ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
251 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
252endif
253BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
254# unset it for safety.
255BUILD_FINGERPRINT :=
Colin Crossf37b4552015-07-16 17:15:19 -0700256
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700257# The string used to uniquely identify the system build; used by the OTA server.
258# This purposefully excludes any product-specific variables.
259ifeq (,$(strip $(BUILD_THUMBPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800260 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700261endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800262
263BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
264ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
265 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700266endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800267BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
268# unset it for safety.
269BUILD_THUMBPRINT :=
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700270
Ying Wange24e17a2014-10-07 18:42:11 -0700271KNOWN_OEM_THUMBPRINT_PROPERTIES := \
272 ro.product.brand \
273 ro.product.name \
274 ro.product.device
275OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
276 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES))
277
Sriram Raman7b641242009-03-24 22:40:59 -0700278# Display parameters shown under Settings -> About Phone
279ifeq ($(TARGET_BUILD_VARIANT),user)
280 # User builds should show:
281 # release build number or branch.buld_number non-release builds
282
283 # Dev. branches should have DISPLAY_BUILD_NUMBER set
Colin Cross63fe36a2017-02-21 17:23:02 -0800284 ifeq (true,$(DISPLAY_BUILD_NUMBER))
Colin Crossf37b4552015-07-16 17:15:19 -0700285 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700286 else
Doug Zongkera8608a72013-07-23 11:51:04 -0700287 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700288 endif
289else
290 # Non-user builds should show detailed build information
291 BUILD_DISPLAY_ID := $(build_desc)
292endif
293
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000294# Accepts a whitespace separated list of product locales such as
295# (en_US en_AU en_GB...) and returns the first locale in the list with
296# underscores replaced with hyphens. In the example above, this will
297# return "en-US".
298define get-default-product-locale
299$(strip $(subst _,-, $(firstword $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800300endef
301
Colin Crossfdea8932017-12-06 14:38:40 -0800302BUILDINFO_SH := build/make/tools/buildinfo.sh
303VENDOR_BUILDINFO_SH := build/make/tools/vendor_buildinfo.sh
Andrew Boiefa61ff02012-09-28 09:33:45 -0700304
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700305# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
306# harness to distinguish builds. Only add _asan for a sanitized build
307# if it isn't already a part of the flavor (via a dedicated lunch
308# config for example).
Ying Wang21ec03d2015-10-28 18:45:03 -0700309TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
Ivan Lozano0f71db32017-08-14 07:57:37 -0700310ifneq (, $(filter address, $(SANITIZE_TARGET)))
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700311ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
Ying Wang21ec03d2015-10-28 18:45:03 -0700312TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
313endif
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700314endif
Ying Wang21ec03d2015-10-28 18:45:03 -0700315
Andrew Boiefa61ff02012-09-28 09:33:45 -0700316ifdef TARGET_SYSTEM_PROP
317system_prop_file := $(TARGET_SYSTEM_PROP)
318else
319system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
320endif
Jaekyun Seokf9af5fa2017-10-25 12:08:32 +0900321$(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 -0800322 @echo Target buildinfo: $@
323 @mkdir -p $(dir $@)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700324 $(hide) echo > $@
325ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES),)
326 $(hide) echo "#" >> $@; \
327 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700328 echo "#" >> $@;
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700329 $(hide) $(foreach prop,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_OEM_PROPERTIES), \
330 echo "import /oem/oem.prop $(prop)" >> $@;)
331endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800332 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Ying Wang21ec03d2015-10-28 18:45:03 -0700333 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800334 TARGET_DEVICE="$(TARGET_DEVICE)" \
335 PRODUCT_NAME="$(TARGET_PRODUCT)" \
336 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000337 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
Robert Greenwaltfbd10d92009-05-20 13:37:35 -0700338 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800339 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
340 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
341 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
342 BUILD_ID="$(BUILD_ID)" \
343 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
Dan Willemsenccc933e2015-08-11 15:25:12 -0700344 DATE="$(DATE_FROM_FILE)" \
Colin Crossf37b4552015-07-16 17:15:19 -0700345 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
Daniel Rosenberg59156a62015-06-29 17:20:43 -0700346 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
Tao Bao532fdf42015-11-11 10:22:48 -0800347 AB_OTA_UPDATER="$(AB_OTA_UPDATER)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800348 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
Dianne Hackborne593e5c2015-08-12 16:11:20 -0700349 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
350 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800351 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
Adam Powellbdd5e8e2015-05-21 13:49:05 -0700352 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
Dianne Hackborn95378842009-05-08 12:06:17 -0700353 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
Dianne Hackborn6ee3c432014-04-24 16:19:14 -0700354 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800355 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
Colin Crossf37b4552015-07-16 17:15:19 -0700356 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
Nan Zhang0abdb582018-02-20 17:00:39 -0800357 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
Narayan Kamath1a43b372014-03-26 17:33:55 +0000358 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
Narayan Kamath7303ebd2014-04-07 11:01:54 +0100359 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
360 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
Dianne Hackbornecc70d72009-05-21 15:45:30 -0700361 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
David 'Digit' Turner2edfb712009-11-06 15:12:00 -0800362 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Joe Onorato25939e22010-11-09 08:53:01 -0800363 TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700364 bash $(BUILDINFO_SH) >> $@
Johan Redestig674a27d2012-04-12 17:00:58 +0200365 $(hide) $(foreach file,$(system_prop_file), \
366 if [ -f "$(file)" ]; then \
367 echo "#" >> $@; \
368 echo Target buildinfo from: "$(file)"; \
369 echo "# from $(file)" >> $@; \
370 echo "#" >> $@; \
371 cat $(file) >> $@; \
372 fi;)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900373 $(if $(FINAL_BUILD_PROPERTIES), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800374 $(hide) echo >> $@; \
375 echo "#" >> $@; \
376 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
377 echo "#" >> $@; )
Jaekyun Seok294286d2017-01-20 13:17:12 +0900378 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
Jean-Baptiste Queru0545c912010-09-07 10:51:12 -0700379 echo "$(line)" >> $@;)
Andres Morales085a0ce2015-02-06 10:12:55 -0800380 $(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 -0800381 $(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 -0800382
383build_desc :=
384
Andres Moralesb8876e12015-05-06 20:44:22 -0700385ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY)))
386INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
387else
388INSTALLED_RECOVERYIMAGE_TARGET :=
389endif
390
391$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
392 @echo "Target build info: $@"
Steven Morelandec082652017-10-22 02:11:47 -0700393 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
Andres Moralesb8876e12015-05-06 20:44:22 -0700394ifdef INSTALLED_RECOVERYIMAGE_TARGET
395 $(hide) echo ro.expect.recovery_id=`cat $(RECOVERYIMAGE_ID_FILE)` >> $@
396endif
397
The Android Open Source Project88b60792009-03-03 19:28:42 -0800398# -----------------------------------------------------------------
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700399# vendor build.prop
400#
Alex Naidis47e24e92016-01-10 14:18:54 +0000401# For verifying that the vendor build is what we think it is
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700402INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
403ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900404
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900405ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900406FINAL_VENDOR_BUILD_PROPERTIES += \
407 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
408FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
409 $(FINAL_VENDOR_BUILD_PROPERTIES),=)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900410endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900411
Steven Morelandec082652017-10-22 02:11:47 -0700412$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(VENDOR_BUILDINFO_SH) $(intermediate_system_build_prop)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700413 @echo Target vendor buildinfo: $@
414 @mkdir -p $(dir $@)
415 $(hide) echo > $@
Sandeep Patil127f5012017-10-23 19:47:43 -0700416 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
Dan Willemsenccc933e2015-08-11 15:25:12 -0700417 $(hide) echo ro.vendor.build.date=`$(DATE_FROM_FILE)`>>$@
418 $(hide) echo ro.vendor.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
Colin Crossf37b4552015-07-16 17:15:19 -0700419 $(hide) echo ro.vendor.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
Isaac Chen8d11feb2018-01-31 14:27:37 +0800420 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
421 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
422 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Ryan Campbell63fc0e62017-10-02 12:29:41 -0700423 $(hide) TARGET_DEVICE="$(TARGET_DEVICE)" \
424 PRODUCT_NAME="$(TARGET_PRODUCT)" \
425 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
426 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
427 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
428 TARGET_BOOTLOADER_BOARD_NAME="$(TARGET_BOOTLOADER_BOARD_NAME)" \
Jaekyun Seok4e3fcca2017-02-27 13:12:07 +0900429 TARGET_BOARD_PLATFORM="$(TARGET_BOARD_PLATFORM)" \
430 bash $(VENDOR_BUILDINFO_SH) >> $@
Jaekyun Seokf9af5fa2017-10-25 12:08:32 +0900431ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900432 $(hide) echo "#" >> $@; \
433 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
434 echo "#" >> $@;
435 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
436 echo "$(line)" >> $@;)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900437endif # property_overrides_split_enabled
Ivan Podogovd5726322018-03-29 15:22:33 +0100438 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_PROPERTY_BLACKLIST)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700439
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900440# -----------------------------------------------------------------
441# product build.prop
442INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
443ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
444
445FINAL_PRODUCT_PROPERTIES += \
446 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES))
447FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
448 $(FINAL_PRODUCT_PROPERTIES),=)
449
450$(INSTALLED_PRODUCT_BUILD_PROP_TARGET):
451 @echo Target product buildinfo: $@
452 @mkdir -p $(dir $@)
453 $(hide) echo > $@
454ifdef BOARD_USES_PRODUCTIMAGE
455 $(hide) echo ro.product.build.date=`$(DATE_FROM_FILE)`>>$@
456 $(hide) echo ro.product.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
457 $(hide) echo ro.product.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
458endif # BOARD_USES_PRODUCTIMAGE
459 $(hide) echo "#" >> $@; \
460 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
461 echo "#" >> $@;
462 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
463 echo "$(line)" >> $@;)
464 $(hide) build/make/tools/post_process_props.py $@
465
Andres Morales9c820f82015-01-13 15:30:34 -0800466# ----------------------------------------------------------------
Andres Morales9c820f82015-01-13 15:30:34 -0800467
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700468# -----------------------------------------------------------------
Dario Freni5f681e12018-05-29 13:09:01 +0100469# product-services build.prop
470INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
471ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
472
473FINAL_PRODUCT_SERVICES_PROPERTIES += \
474 $(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
475FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
476 $(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
477
478$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET):
479 @echo Target product-services buildinfo: $@
480 @mkdir -p $(dir $@)
481 $(hide) echo > $@
482ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
483 $(hide) echo ro.productservices.build.date=`$(DATE_FROM_FILE)`>>$@
484 $(hide) echo ro.productservices.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
485 $(hide) echo ro.productservices.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
486endif # BOARD_USES_PRODUCT_SERVICESIMAGE
487 $(hide) echo "#" >> $@; \
488 echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
489 echo "#" >> $@;
490 $(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
491 echo "$(line)" >> $@;)
492 $(hide) build/make/tools/post_process_props.py $@
493
494# ----------------------------------------------------------------
495
496# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800497# sdk-build.prop
498#
499# There are certain things in build.prop that we don't want to
500# ship with the sdk; remove them.
501
502# This must be a list of entire property keys followed by
503# "=" characters, without any internal spaces.
504sdk_build_prop_remove := \
505 ro.build.user= \
506 ro.build.host= \
507 ro.product.brand= \
508 ro.product.manufacturer= \
509 ro.product.device=
510# TODO: Remove this soon-to-be obsolete property
511sdk_build_prop_remove += ro.build.product=
512INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
513$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
514 @echo SDK buildinfo: $@
515 @mkdir -p $(dir $@)
516 $(hide) grep -v "$(subst $(space),\|,$(strip \
517 $(sdk_build_prop_remove)))" $< > $@.tmp
518 $(hide) for x in $(sdk_build_prop_remove); do \
519 echo "$$x"generic >> $@.tmp; done
520 $(hide) mv $@.tmp $@
521
522# -----------------------------------------------------------------
523# package stats
524PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
525PACKAGES_TO_STAT := \
526 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
527 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
528$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
529 @echo Package stats: $@
530 @mkdir -p $(dir $@)
531 $(hide) rm -f $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700532ifeq ($(PACKAGES_TO_STAT),)
533# Create empty package stats file if target builds no jar(s) or apk(s).
534 $(hide) touch $@
535else
Colin Crossfdea8932017-12-06 14:38:40 -0800536 $(hide) build/make/tools/dump-package-stats $^ > $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700537endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800538
539.PHONY: package-stats
540package-stats: $(PACKAGE_STATS_FILE)
541
542# -----------------------------------------------------------------
543# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700544# Use a macro to add newline to each echo command
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100545define _apkcerts_write_line
546$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
547$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
548$(hide) echo '' >> $5
Ying Wangd9a88d52012-10-26 09:21:28 -0700549
550endef
551
The Android Open Source Project88b60792009-03-03 19:28:42 -0800552name := $(TARGET_PRODUCT)
553ifeq ($(TARGET_BUILD_TYPE),debug)
554 name := $(name)_debug
555endif
556name := $(name)-apkcerts-$(FILE_NAME_TAG)
557intermediates := \
558 $(call intermediates-dir-for,PACKAGING,apkcerts)
559APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800560# We don't need to really build all the modules.
561# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700562$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800563 @echo APK certs list: $@
564 @mkdir -p $(dir $@)
565 @rm -f $@
Ying Wangd9a88d52012-10-26 09:21:28 -0700566 $(foreach p,$(PACKAGES),\
567 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100568 $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
569 $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
Ying Wangd9a88d52012-10-26 09:21:28 -0700570 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700571 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800572
573.PHONY: apkcerts-list
574apkcerts-list: $(APKCERTS_FILE)
575
Ying Wang15e487a2011-02-15 10:56:18 -0800576ifneq (,$(TARGET_BUILD_APPS))
577 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
578endif
Ying Wangefb21682010-07-23 16:42:13 -0700579
The Android Open Source Project88b60792009-03-03 19:28:42 -0800580# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700581# build system stats
582BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
583$(BUILD_SYSTEM_STATS):
584 @rm -f $@
585 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
586 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
587$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700588
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700589# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700590# Modules ready to be converted to Soong, ordered by how many
591# modules depend on them.
592SOONG_CONV := $(sort $(SOONG_CONV))
593SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
594$(SOONG_CONV_DATA):
595 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800596 @$(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 -0700597
Colin Crossfdea8932017-12-06 14:38:40 -0800598SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700599SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
600$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
601 @rm -f $@
602 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
603$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
604
605# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800606# Modules use -Wno-error, or added default -Wall -Werror
607WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
608$(WALL_WERROR):
609 @rm -f $@
610 echo "# Modules using -Wno-error" >> $@
611 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 -0800612 echo "# Modules added default -Wall" >> $@
613 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
614
615$(call dist-for-goals,droidcore,$(WALL_WERROR))
616
617# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800618# Modules missing profile files
619PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
620$(PGO_PROFILE_MISSING):
621 @rm -f $@
622 echo "# Modules missing PGO profile files" >> $@
623 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
624
625$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
626
627# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700628# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700629# for future OTA packages installed by this system. Actual product
630# deliverables will be re-signed by hand. We expect this file to
631# exist with the suffixes ".x509.pem" and ".pk8".
Ying Wang3c21fe52011-10-04 10:50:08 -0700632DEFAULT_KEY_CERT_PAIR := $(DEFAULT_SYSTEM_DEV_CERTIFICATE)
Doug Zongker8678df42009-06-15 14:30:14 -0700633
634
Jeff Browne33ba4c2011-07-11 22:11:46 -0700635# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800636# if they don't do anything.
637.PHONY: systemimage
638systemimage:
639
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800640# -----------------------------------------------------------------
641
642.PHONY: event-log-tags
643
Joe Onoratob7510532010-07-14 10:22:54 -0700644# Produce an event logs tag file for everything we know about, in order
645# to properly allocate numbers. Then produce a file that's filtered
646# for what's going to be installed.
647
648all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
649
Colin Crossdc8f8e42012-04-12 13:25:54 -0700650event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
651
Joe Onoratob7510532010-07-14 10:22:54 -0700652# Include tags from all packages that we know about
653all_event_log_tags_src := \
654 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
655
Colin Crossdc8f8e42012-04-12 13:25:54 -0700656# PDK builds will already have a full list of tags that needs to get merged
657# in with the ones from source
658pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
659
660$(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 -0800661$(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 -0700662 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900663 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700664
Doug Zongkera34fa952011-02-23 12:17:29 -0800665# Include tags from all packages included in this product, plus all
666# tags that are part of the system (ie, not in a vendor/ or device/
667# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800668event_log_tags_src := \
669 $(sort $(foreach m,\
670 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
671 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800672 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
673 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800674
Colin Crossdc8f8e42012-04-12 13:25:54 -0700675$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700676$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800677$(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 -0800678 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900679 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800680
681event-log-tags: $(event_log_tags_file)
682
683ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
684
Joe Onoratob7510532010-07-14 10:22:54 -0700685
The Android Open Source Project88b60792009-03-03 19:28:42 -0800686# #################################################################
687# Targets for boot/OS images
688# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800689ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
690 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
691 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
692 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
693 else
694 INSTALLED_2NDBOOTLOADER_TARGET :=
695 endif
696else
697 INSTALLED_BOOTLOADER_MODULE :=
698 INSTALLED_2NDBOOTLOADER_TARGET :=
699endif # TARGET_NO_BOOTLOADER
700ifneq ($(strip $(TARGET_NO_KERNEL)),true)
701 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
702else
703 INSTALLED_KERNEL_TARGET :=
704endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800705
706# -----------------------------------------------------------------
707# the ramdisk
708INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800709 $(ALL_GENERATED_SOURCES) \
710 $(ALL_DEFAULT_INSTALLED_MODULES))
711
Luis Hector Chavezff489932018-07-03 15:41:40 -0700712INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
713INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
714$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
715$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
716 @echo Installed file list: $@
717 @mkdir -p $(dir $@)
718 @rm -f $@
719 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
720 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
721
722$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
723
Joe Onorato64d85d02009-04-09 19:31:12 -0700724BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
725
726# We just build this directly to the install location.
727INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700728$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_ROOT) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800729 $(call pretty,"Target ram disk: $@")
Thierry Strudel74a81e62015-07-09 09:54:55 -0700730 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800731
Ying Wangad7fd292013-08-08 16:34:29 -0700732.PHONY: ramdisk-nodeps
733ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
734 @echo "make $@: ignoring dependencies"
Thierry Strudel74a81e62015-07-09 09:54:55 -0700735 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800736
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700737INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
738
The Android Open Source Project88b60792009-03-03 19:28:42 -0800739ifneq ($(strip $(TARGET_NO_KERNEL)),true)
740
741# -----------------------------------------------------------------
742# the boot image, which is a collection of other images.
743INTERNAL_BOOTIMAGE_ARGS := \
744 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700745 --kernel $(INSTALLED_KERNEL_TARGET)
746
747ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
748INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
749endif
750
The Android Open Source Project88b60792009-03-03 19:28:42 -0800751INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
752
Dima Zavin1e0847c2009-05-07 19:43:08 -0700753ifdef BOARD_KERNEL_BASE
754 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
755endif
756
Ying Wangffff0022010-08-23 12:56:25 -0700757ifdef BOARD_KERNEL_PAGESIZE
758 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
759endif
760
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700761ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
762ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
763VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
764 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
765endif
766endif
767
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700768INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
769ifdef INTERNAL_KERNEL_CMDLINE
770INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700771endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700772
Sami Tolvanen3303d902016-03-15 16:49:30 +0000773INTERNAL_MKBOOTIMG_VERSION_ARGS := \
774 --os_version $(PLATFORM_VERSION) \
775 --os_patch_level $(PLATFORM_SECURITY_PATCH)
776
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800777# BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true.
778ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
779ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
780 $(error BOARD_BUILD_SYSTEM_ROOT_IMAGE must be enabled for BOARD_USES_RECOVERY_AS_BOOT.)
781endif
782endif
783
784# We build recovery as boot image if BOARD_USES_RECOVERY_AS_BOOT is true.
785ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800786ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -0800787$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -0400788
789else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
790
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800791$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400792 $(call pretty,"Target boot image: $@")
793 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800794 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -0400795 $(hide) $(AVBTOOL) add_hash_footer \
796 --image $@ \
797 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800798 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400799 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
800
801.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800802bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -0400803 @echo "make $@: ignoring dependencies"
804 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800805 $(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 -0400806 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +0800807 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400808 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +0800809 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -0400810 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
811
812else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -0700813
814$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
815 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000816 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800817 $(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 -0700818 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
819
820.PHONY: bootimage-nodeps
821bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
822 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000823 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Sami Tolvanen72d90eb2014-11-06 20:38:00 -0800824 $(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 -0700825 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
826
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +0100827else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -0800828
Tao Bao4b577412017-02-22 22:54:39 -0800829$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800830 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000831 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700832 $(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 -0800833 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
834
835.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -0800836bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -0800837 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000838 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Furquan Shaikhe8c21222015-08-07 11:58:05 -0700839 $(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 -0800840 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
841
842else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -0800843
844$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
845 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +0000846 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700847 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700848
849.PHONY: bootimage-nodeps
850bootimage-nodeps: $(MKBOOTIMG)
851 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +0000852 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -0700853 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -0700854
The Android Open Source Project88b60792009-03-03 19:28:42 -0800855endif # TARGET_BOOTIMAGE_USE_EXT2
Daniel Rosenbergd80bef22015-11-10 19:21:34 -0800856endif # BOARD_USES_RECOVERY_AS_BOOT
The Android Open Source Project88b60792009-03-03 19:28:42 -0800857
858else # TARGET_NO_KERNEL
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700859ifdef BOARD_PREBUILT_BOOTIMAGE
860ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
861# Remove when b/63676296 is resolved.
862$(error Prebuilt bootimage is only supported for AB targets)
863endif
864$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
865else
Dan Willemsenc1f17ff2016-10-05 16:57:27 -0700866INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800867# HACK: The top-level targets depend on the bootimage. Not all targets
868# can produce a bootimage, though, and emulator targets need the ramdisk
869# instead. Fake it out by calling the ramdisk the bootimage.
870# TODO: make the emulator use bootimages, and make mkbootimg accept
871# kernel-less inputs.
872INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
873endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -0700874endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800875
876# -----------------------------------------------------------------
877# NOTICE files
878#
Steve Blockd14d3b42012-03-01 11:34:41 +0000879# We are required to publish the licenses for all code under BSD, GPL and
880# Apache licenses (and possibly other more exotic ones as well). We err on the
881# side of caution, so the licenses for other third-party code are included here
882# too.
883#
The Android Open Source Project88b60792009-03-03 19:28:42 -0800884# This needs to be before the systemimage rules, because it adds to
885# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
886# go into the systemimage.
887
Steve Block495e5852012-02-29 19:18:08 +0000888.PHONY: notice_files
889
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900890# Create the rule to combine the files into text and html/xml forms
Dario Freniadc972d2018-07-09 18:38:38 +0100891# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900892# $(2) - Plain text output file
893# $(3) - HTML/XML output file
894# $(4) - File title
895# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -0800896# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900897# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -0800898#
899# The algorithm here is that we go collect a hash for each of the notice
900# files and write the names of the files that match that hash. Then
901# to generate the real files, we go print out all of the files and their
902# hashes.
903#
904# These rules are fairly complex, so they depend on this makefile so if
905# it changes, they'll run again.
906#
907# TODO: We could clean this up so that we just record the locations of the
908# original notice files instead of making rules to copy them somwehere.
909# Then we could traverse that without quite as much bash drama.
910define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900911$(2) $(3): PRIVATE_MESSAGE := $(4)
912$(2) $(3): PRIVATE_DIR := $(5)
913$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -0800914$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
915 build/make/tools/generate-notice-files.py --text-output $(2) \
Dario Freniadc972d2018-07-09 18:38:38 +0100916 $(if $(filter $(1),xml_excluded_vendor_product),-e vendor$(comma)product --xml-output, \
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900917 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
Dario Freniadc972d2018-07-09 18:38:38 +0100918 $(if $(filter $(1),xml_product),-i product --xml-output, \
919 --html-output))) $(3) \
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900920 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
921notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800922endef
923
924# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
925# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
926# the src subdirectory.
927
Steve Block495e5852012-02-29 19:18:08 +0000928target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900929target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
930target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
931installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
Steve Block495e5852012-02-29 19:18:08 +0000932tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -0800933tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
934
Steven Morelandae69e572017-12-15 14:49:55 -0800935# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
936ifeq ($(PRODUCT_NOTICE_SPLIT),true)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900937target_notice_file_html_or_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
938target_notice_file_html_or_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
939installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
940
941target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
942target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
943target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
944installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
Dario Freniadc972d2018-07-09 18:38:38 +0100945
946target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
947target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
948target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
949installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900950endif
951
Ying Wang62c81f82013-08-22 20:02:03 -0700952ifndef TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -0800953kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
Josh Gao4d9268e2017-02-23 13:17:46 -0800954winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
Ying Wang4534d812012-04-09 17:04:12 -0700955pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800956
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900957ifdef target_vendor_notice_file_xml_gz
Dario Freniadc972d2018-07-09 18:38:38 +0100958$(eval $(call combine-notice-files, xml_excluded_vendor_product, \
Steve Block495e5852012-02-29 19:18:08 +0000959 $(target_notice_file_txt), \
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900960 $(target_notice_file_html_or_xml), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800961 "Notices for files contained in the filesystem images in this directory:", \
962 $(TARGET_OUT_NOTICE_FILES), \
Ying Wang4534d812012-04-09 17:04:12 -0700963 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900964$(eval $(call combine-notice-files, xml_vendor, \
965 $(target_vendor_notice_file_txt), \
966 $(target_vendor_notice_file_xml), \
967 "Notices for files contained in the vendor filesystem image in this directory:", \
968 $(TARGET_OUT_NOTICE_FILES), \
969 $(target_notice_file_html_or_xml)))
Dario Freniadc972d2018-07-09 18:38:38 +0100970ifdef target_product_notice_file_txt
971$(eval $(call combine-notice-files, xml_product, \
972 $(target_product_notice_file_txt), \
973 $(target_product_notice_file_xml), \
974 "Notices for files contained in the product filesystem image in this directory:", \
975 $(TARGET_OUT_NOTICE_FILES), \
976 $(target_notice_file_html_or_xml)))
977endif
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900978else
979$(eval $(call combine-notice-files, html, \
980 $(target_notice_file_txt), \
981 $(target_notice_file_html_or_xml), \
982 "Notices for files contained in the filesystem images in this directory:", \
983 $(TARGET_OUT_NOTICE_FILES), \
984 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
985endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800986
Jaekyun Seok3b7560b2017-04-19 15:26:47 +0900987$(eval $(call combine-notice-files, html, \
Steve Block495e5852012-02-29 19:18:08 +0000988 $(tools_notice_file_txt), \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800989 $(tools_notice_file_html), \
990 "Notices for files contained in the tools directory:", \
991 $(HOST_OUT_NOTICE_FILES), \
Josh Gao4d9268e2017-02-23 13:17:46 -0800992 $(ALL_DEFAULT_INSTALLED_MODULES) \
993 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800994
995# Install the html file at /system/etc/NOTICE.html.gz.
996# This is not ideal, but this is very late in the game, after a lot of
997# the module processing has already been done -- in fact, we used the
998# fact that all that has been done to get the list of modules that we
999# need notice files for.
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001000$(target_notice_file_html_or_xml_gz): $(target_notice_file_html_or_xml) | $(MINIGZIP)
Doug Zongker8678df42009-06-15 14:30:14 -07001001 $(hide) $(MINIGZIP) -9 < $< > $@
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001002$(installed_notice_html_or_xml_gz): $(target_notice_file_html_or_xml_gz)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001003 $(copy-file-to-target)
Joe Onorato7b2845a2009-04-30 13:52:50 -07001004
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001005ifdef target_vendor_notice_file_xml_gz
1006# Install the vendor html file at /vendor/etc/NOTICE.xml.gz.
1007$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
1008 $(hide) $(MINIGZIP) -9 < $< > $@
1009$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
1010 $(copy-file-to-target)
1011endif
1012
Dario Freniadc972d2018-07-09 18:38:38 +01001013ifdef target_product_notice_file_xml_gz
1014# Install the product html file at /product/etc/NOTICE.xml.gz.
1015$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
1016 $(hide) $(MINIGZIP) -9 < $< > $@
1017$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
1018 $(copy-file-to-target)
1019endif
1020
Joe Onorato7b2845a2009-04-30 13:52:50 -07001021# if we've been run my mm, mmm, etc, don't reinstall this every time
1022ifeq ($(ONE_SHOT_MAKEFILE),)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001023 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
1024 ifdef target_vendor_notice_file_xml_gz
1025 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
1026 endif
Dario Freniadc972d2018-07-09 18:38:38 +01001027 ifdef target_product_notice_file_xml_gz
1028 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
1029 endif
Joe Onorato7b2845a2009-04-30 13:52:50 -07001030endif
Ying Wang62c81f82013-08-22 20:02:03 -07001031endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -08001032
1033# The kernel isn't really a module, so to get its module file in there, we
1034# make the target NOTICE files depend on this particular file too, which will
1035# then be in the right directory for the find in combine-notice-files to work.
1036$(kernel_notice_file): \
Lee Campbellb463fcd2015-11-08 16:28:15 -08001037 $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
The Android Open Source Project88b60792009-03-03 19:28:42 -08001038 | $(ACP)
1039 @echo Copying: $@
1040 $(hide) mkdir -p $(dir $@)
1041 $(hide) $(ACP) $< $@
1042
Josh Gao4d9268e2017-02-23 13:17:46 -08001043$(winpthreads_notice_file): \
1044 $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
1045 | $(ACP)
1046 @echo Copying: $@
1047 $(hide) mkdir -p $(dir $@)
1048 $(hide) $(ACP) $< $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08001049
Doug Zongker8678df42009-06-15 14:30:14 -07001050# -----------------------------------------------------------------
1051# Build a keystore with the authorized keys in it, used to verify the
1052# authenticity of downloaded OTA packages.
1053#
1054# This rule adds to ALL_DEFAULT_INSTALLED_MODULES, so it needs to come
1055# before the rules that use that variable to build the image.
Dan Willemsenb589ae42015-10-29 21:26:18 +00001056ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/security/otacerts.zip
1057$(TARGET_OUT_ETC)/security/otacerts.zip: KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001058$(TARGET_OUT_ETC)/security/otacerts.zip: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR)) | $(ZIPTIME)
Doug Zongker8678df42009-06-15 14:30:14 -07001059 $(hide) rm -f $@
1060 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001061 $(hide) zip -qjX $@ $<
1062 $(remove-timestamps-from-package)
Doug Zongker8678df42009-06-15 14:30:14 -07001063
Alex Deymocec578c2017-03-28 20:48:18 -07001064# Carry the public key for update_engine if it's a non-IoT target that
Tao Bao38812d62016-01-20 20:58:20 -08001065# uses the AB updater. We use the same key as otacerts but in RSA public key
1066# format.
1067ifeq ($(AB_OTA_UPDATER),true)
Alex Deymocec578c2017-03-28 20:48:18 -07001068ifneq ($(PRODUCT_IOT),true)
Tao Bao23c3db92016-01-21 14:28:50 -08001069ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
1070$(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem: $(addsuffix .x509.pem,$(DEFAULT_KEY_CERT_PAIR))
Tao Bao38812d62016-01-20 20:58:20 -08001071 $(hide) rm -f $@
1072 $(hide) mkdir -p $(dir $@)
1073 $(hide) openssl x509 -pubkey -noout -in $< > $@
Alex Deymoc6ebe9f2016-08-03 20:52:54 -07001074
1075ALL_DEFAULT_INSTALLED_MODULES += $(TARGET_RECOVERY_ROOT_OUT)/etc/update_engine/update-payload-key.pub.pem
1076$(TARGET_RECOVERY_ROOT_OUT)/etc/update_engine/update-payload-key.pub.pem: $(TARGET_OUT_ETC)/update_engine/update-payload-key.pub.pem
1077 $(hide) cp -f $< $@
Tao Bao38812d62016-01-20 20:58:20 -08001078endif
1079endif
1080
Doug Zongker8678df42009-06-15 14:30:14 -07001081.PHONY: otacerts
1082otacerts: $(TARGET_OUT_ETC)/security/otacerts.zip
1083
1084
The Android Open Source Project88b60792009-03-03 19:28:42 -08001085# #################################################################
1086# Targets for user images
1087# #################################################################
1088
Ying Wang933abf12010-06-16 14:31:34 -07001089INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001090ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001091INTERNAL_USERIMAGES_USE_EXT := true
1092INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1093else
1094ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
1095INTERNAL_USERIMAGES_USE_EXT := true
1096INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1097else
1098ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
1099INTERNAL_USERIMAGES_USE_EXT := true
1100INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1101endif
1102endif
1103endif
1104
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001105# These options tell the recovery updater/installer how to mount the partitions writebale.
1106# <fstype>=<fstype_opts>[|<fstype_opts>]...
1107# fstype_opts := <opt>[,<opt>]...
1108# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001109# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1110DEFAULT_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 -07001111
Ying Wang542903a2010-11-17 15:40:38 -08001112ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1113 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1114endif
1115
Colin Cross0a7b2c52010-05-07 02:23:59 -07001116ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001117INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
1118INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK)
1119ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1120INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1121endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001122endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001123
Chris Friesdf0387d2017-06-21 15:51:46 -05001124ifeq ($(BOARD_AVB_ENABLE),true)
1125INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1126endif
1127
Todd Poynorb2a555e2015-12-15 18:00:14 -08001128ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1129 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1130endif
Dario Freni5f681e12018-05-29 13:09:01 +01001131ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
Mohamad Ayyash353265b2015-06-24 15:42:19 -07001132INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001133endif
1134
Ying Wang178ef922011-10-31 18:13:30 -07001135INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001136
Colin Cross8a30f722014-04-28 16:27:32 -07001137ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001138INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001139ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY_FEC))
1140INTERNAL_USERIMAGES_DEPS += $(FEC)
1141endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001142endif
1143
Alex Klyubin092c9022017-03-13 13:28:34 -07001144SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001145INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1146
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001147INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1148
Jin Qianabcec5e2017-03-10 16:53:45 -08001149ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
1150INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
1151endif
1152
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001153ifeq (true,$(USE_LOGICAL_PARTITIONS))
1154
1155ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),true)
1156 $(error vboot 1.0 doesn't support logical partition)
1157endif
1158
1159# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1160# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1161
1162endif # USE_LOGICAL_PARTITIONS
1163
Ying Wangbd93d422011-10-28 17:02:30 -07001164# $(1): the path of the output dictionary file
Dario Freni5f681e12018-05-29 13:09:01 +01001165# $(2): a subset of "system vendor cache userdata product productservices oem"
Yifan Hong760d3c02018-05-30 11:16:46 -07001166# $(3): additional "key=value" pairs to append to the dictionary file.
1167define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001168$(if $(filter $(2),system),\
1169 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
1170 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1171 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1172 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1173 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1174 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1175 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1176 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1177 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1178 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1179 $(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 -07001180 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001181)
Yifan Hong760d3c02018-05-30 11:16:46 -07001182$(if $(filter $(2),userdata),\
1183 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1184 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
1185)
Yifan Hong760d3c02018-05-30 11:16:46 -07001186$(if $(filter $(2),cache),\
1187 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1188 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
1189)
1190$(if $(filter $(2),vendor),\
1191 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1192 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1193 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1194 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1195 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1196 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1197 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1198 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1199 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1200 $(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 -07001201 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001202)
1203$(if $(filter $(2),product),\
1204 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1205 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1206 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1207 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1208 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1209 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1210 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1211 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1212 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1213 $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
Yifan Hong56a6c3b2018-07-20 15:19:34 -07001214 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001215)
Dario Freni5f681e12018-05-29 13:09:01 +01001216$(if $(filter $(2),productservices),\
1217 $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "productservices_fs_type=$(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1218 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "productservices_extfs_inode_count=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1219 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT),$(hide) echo "productservices_extfs_rsv_pct=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT)" >> $(1))
1220 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),$(hide) echo "productservices_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)" >> $(1))
1221 $(if $(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE),$(hide) echo "productservices_journal_size=$(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE)" >> $(1))
1222 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "productservices_squashfs_compressor=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1223 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "productservices_squashfs_compressor_opt=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1224 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "productservices_squashfs_block_size=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1225 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "productservices_squashfs_disable_4k_align=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Yifan Hong9c35a022018-07-20 15:33:47 -07001226 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "productservices_reserved_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001227)
Yifan Hong760d3c02018-05-30 11:16:46 -07001228$(if $(filter $(2),oem),\
1229 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1230 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1231 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1232 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1233)
Tao Bao3602eca2018-07-10 10:53:55 -07001234$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
1235$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001236$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001237$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001238$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1239$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1240$(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 -08001241$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
Sami Tolvanen8b3f08b2015-04-07 15:08:59 +01001242$(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 -07001243$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)" >> $(1))
Paul Lawrencea37b2bb2014-11-13 17:54:30 -08001244$(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 +02001245$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001246$(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 +08001247$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Daniel Rosenbergf4eabc32014-07-10 15:42:38 -07001248$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1249$(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 +09001250$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001251$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION),$(hide) echo "productservices_verity_block_device=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION)" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001252$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1253$(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 -07001254$(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 -08001255$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
Tao Baod95e9fd2015-03-29 23:07:41 -07001256$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001257$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001258$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1259$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1260$(if $(BOARD_AVB_ENABLE),\
1261 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1262 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1263 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1264 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
1265$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1266$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1267$(if $(BOARD_AVB_ENABLE),\
1268 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1269 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1270 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1271 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001272$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1273$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1274$(if $(BOARD_AVB_ENABLE),\
1275 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1276 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1277 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1278 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Dario Freni5f681e12018-05-29 13:09:01 +01001279$(if $(BOARD_AVB_ENABLE),\
1280 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
1281 $(hide) echo "avb_productservices_key_path=$(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH)" >> $(1)
1282 $(hide) echo "avb_productservices_algorithm=$(BOARD_AVB_PRODUCT_SERVICES_ALGORITHM)" >> $(1)
1283 $(hide) echo "avb_productservices_rollback_index_location=$(BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001284$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1285 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001286$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Yifan Hong760d3c02018-05-30 11:16:46 -07001287 $(hide) echo "system_root_image=true" >> $(1)
Tao Bao8bfd3c72018-07-20 15:20:28 -07001288 $(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001289$(if $(USE_LOGICAL_PARTITIONS),$(hide) echo "use_logical_partitions=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001290$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1291endef
1292
1293# $(1): the path of the output dictionary file
1294# $(2): additional "key=value" pairs to append to the dictionary file.
1295define generate-userimage-prop-dictionary
Dario Freni5f681e12018-05-29 13:09:01 +01001296$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product productservices oem,$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001297endef
1298
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001299# $(1): the path of the input dictionary file, where each line has the format key=value
1300# $(2): the key to look up
1301define read-image-prop-dictionary
1302$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1303endef
1304
Xu Chao2b04bf42017-07-06 14:34:31 +08001305# $(1): modules list
1306# $(2): output dir
1307# $(3): mount point
1308# $(4): staging dir
1309# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
1310define build-image-kernel-modules
1311 $(hide) rm -rf $(2)/lib/modules
1312 $(hide) mkdir -p $(2)/lib/modules
1313 $(hide) cp $(1) $(2)/lib/modules/
1314 $(hide) rm -rf $(4)
1315 $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
1316 $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
1317 $(hide) $(DEPMOD) -b $(4) 0.0
1318 $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
1319 $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
1320endef
1321
The Android Open Source Project88b60792009-03-03 19:28:42 -08001322# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001323# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001324
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001325# Recovery image exists if we are building recovery, or building recovery as boot.
1326ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
Doug Zongker4647f122009-07-02 09:00:54 -07001327
Ying Wang37526142015-03-10 12:02:57 -07001328INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1329 $(ALL_DEFAULT_INSTALLED_MODULES))
1330
Doug Zongker4647f122009-07-02 09:00:54 -07001331recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001332recovery_sepolicy := \
1333 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001334 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001335 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001336 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001337 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts
1338
Bowgo Tsai99671252017-11-30 22:15:17 +08001339ifdef BOARD_ODM_SEPOLICY_DIRS
1340recovery_sepolicy += \
1341 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
1342 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts
1343endif
1344
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001345# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1346# SELinux files
1347IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1348
Doug Zongker4647f122009-07-02 09:00:54 -07001349recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1350recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001351recovery_build_props := $(intermediate_system_build_prop)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +09001352ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001353recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
1354endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001355ifdef BOARD_USES_PRODUCTIMAGE
1356recovery_build_props += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
1357endif
Dario Freni5f681e12018-05-29 13:09:01 +01001358ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
1359recovery_build_props += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
1360endif
Doug Zongker4647f122009-07-02 09:00:54 -07001361recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001362
Doug Zongker8eaeea92014-05-12 15:32:20 -07001363# Set recovery_density to the density bucket of the device.
1364recovery_density := unknown
1365ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
1366# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value.
1367recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
Doug Zongker25d55f82014-04-04 13:51:15 -07001368else
Adam Lesinski83ee6d72014-12-02 16:13:09 -08001369# Otherwise, use the default medium density.
1370recovery_densities := mdpi
Doug Zongker8eaeea92014-05-12 15:32:20 -07001371endif
1372
1373ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1374recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1375else
Doug Zongker25d55f82014-04-04 13:51:15 -07001376recovery_resources_common := $(recovery_resources_common)-xhdpi
1377endif
1378
Doug Zongker8eaeea92014-05-12 15:32:20 -07001379# Select the 18x32 font on high-density devices (xhdpi and up); and
1380# the 12x22 font on other devices. Note that the font selected here
1381# can be overridden for a particular device by putting a font.png in
1382# its private recovery resources.
1383
Tao Baoabbc9112015-04-08 14:14:43 -07001384ifneq (,$(filter xxxhdpi 560dpi xxhdpi 400dpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001385recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1386else
1387recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1388endif
1389
Ying Wang9a175682015-08-06 11:47:47 -07001390ifndef TARGET_PRIVATE_RES_DIRS
1391TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1392endif
Doug Zongker4647f122009-07-02 09:00:54 -07001393recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001394 $(TARGET_PRIVATE_RES_DIRS) -type f)
Andrew Boiefa61ff02012-09-28 09:33:45 -07001395ifdef TARGET_RECOVERY_FSTAB
1396recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1397else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001398recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001399endif
Tao Baoc3c17532016-06-10 10:11:54 -07001400ifdef TARGET_RECOVERY_WIPE
1401recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001402else
Tao Baoc3c17532016-06-10 10:11:54 -07001403recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001404endif
Tao Bao8beab692015-07-22 12:33:18 -07001405
Tao Bao6d5d6232018-03-09 17:04:42 -08001406# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001407# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001408# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1409# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001410#
1411# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001412# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001413# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001414# b) We build a single image that contains boot and recovery both - no recovery image to install
1415# (BOARD_USES_RECOVERY_AS_BOOT = true);
1416# c) We build the root into system image - not needing the resource file as we do bsdiff
1417# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001418# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1419# do bsdiff because boot and recovery will contain different number of entries
1420# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Tao Bao6d5d6232018-03-09 17:04:42 -08001421# Note that condition b) implies condition c), because of the earlier check in this file:
1422# "BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true" (not vice
1423# versa though).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001424
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001425ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) \
1426 $(BOARD_INCLUDE_RECOVERY_DTBO)))
Doug Zongker56588872012-08-20 15:38:58 -07001427# Named '.dat' so we don't attempt to use imgdiff for patching it.
1428RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001429else
Tao Bao8beab692015-07-22 12:33:18 -07001430RECOVERY_RESOURCE_ZIP :=
1431endif
Doug Zongker4647f122009-07-02 09:00:54 -07001432
Doug Zongker4647f122009-07-02 09:00:54 -07001433INTERNAL_RECOVERYIMAGE_ARGS := \
1434 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1435 --kernel $(recovery_kernel) \
1436 --ramdisk $(recovery_ramdisk)
1437
1438# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001439ifdef INTERNAL_KERNEL_CMDLINE
1440 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001441endif
1442ifdef BOARD_KERNEL_BASE
1443 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1444endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001445ifdef BOARD_KERNEL_PAGESIZE
1446 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1447endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001448ifdef BOARD_INCLUDE_RECOVERY_DTBO
1449 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1450endif
Doug Zongker4647f122009-07-02 09:00:54 -07001451
1452# Keys authorized to sign OTA packages this build will accept. The
Ying Wang3c21fe52011-10-04 10:50:08 -07001453# build always uses dev-keys for this; release packaging tools will
Doug Zongker4647f122009-07-02 09:00:54 -07001454# substitute other keys for this one.
Ying Wang3c21fe52011-10-04 10:50:08 -07001455OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
Doug Zongker4647f122009-07-02 09:00:54 -07001456
1457# Generate a file containing the keys that will be read by the
1458# recovery binary.
1459RECOVERY_INSTALL_OTA_KEYS := \
1460 $(call intermediates-dir-for,PACKAGING,ota_keys)/keys
1461DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar
1462$(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS)
Doug Zongker5d4808d2011-03-16 07:49:13 -07001463$(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
Doug Zongkere121d6a2011-02-01 14:13:52 -08001464$(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
1465 @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"
Doug Zongker4647f122009-07-02 09:00:54 -07001466 @rm -rf $@
1467 @mkdir -p $(dir $@)
Colin Cross0851df82017-06-30 13:55:38 -07001468 $(JAVA) -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@
Doug Zongker4647f122009-07-02 09:00:54 -07001469
Andres Moralesb8876e12015-05-06 20:44:22 -07001470RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
Howard Chen1756f8d2017-02-22 17:27:10 +08001471
Ying Wang747b9f12015-01-30 14:05:22 -08001472# $(1): output file
1473define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001474 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001475 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao3f56a332016-01-12 11:34:58 -08001476 $(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 -08001477 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001478 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
1479 $(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 -08001480 # Modifying ramdisk contents...
Howard Chen1756f8d2017-02-22 17:27:10 +08001481 $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
1482 $(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 +08001483 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1484 $(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 -08001485 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Ying Wang36b039a2015-04-02 12:48:32 -07001486 $(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 -08001487 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1488 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1489 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
1490 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001491 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1492 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001493 $(hide) $(foreach item,$(recovery_fstab), \
1494 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001495 $(if $(strip $(recovery_wipe)), \
1496 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.wipe)
Ying Wang747b9f12015-01-30 14:05:22 -08001497 $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001498 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001499 > $(TARGET_RECOVERY_ROOT_OUT)/prop.default
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001500 $(if $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET), \
1501 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001502 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default)
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001503 $(hide) cat $(recovery_build_props) \
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001504 >> $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1505 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001506 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001507 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Tao Baod95e9fd2015-03-29 23:07:41 -07001508 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001509 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
1510 $(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 +01001511 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001512 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1513 $(BOOT_SIGNER) /boot $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1514 $(BOOT_SIGNER) /recovery $(1) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
1515 )\
1516 )
Tao Baod95e9fd2015-03-29 23:07:41 -07001517 $(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)), \
Furquan Shaikhe8c21222015-08-07 11:58:05 -07001518 $(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 +08001519 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1520 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1521 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001522 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1523 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1524 $(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),\
1525 $(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 -08001526endef
1527
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001528ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Ying Wangbd07ad02016-03-10 12:57:33 -08001529ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_BOOT_SIGNER))
1530$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1531endif
1532ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
1533$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1534endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001535ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001536$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001537endif
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001538$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001539 $(INSTALLED_RAMDISK_TARGET) \
1540 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001541 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001542 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001543 $(recovery_build_props) $(recovery_resource_deps) \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001544 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001545 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001546 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1547 $(BOARD_RECOVERY_KERNEL_MODULES) \
1548 $(DEPMOD)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001549 $(call pretty,"Target boot image from recovery: $@")
1550 $(call build-recoveryimage-target, $@)
1551endif
1552
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001553$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Doug Zongker4647f122009-07-02 09:00:54 -07001554 $(INSTALLED_RAMDISK_TARGET) \
1555 $(INSTALLED_BOOTIMAGE_TARGET) \
Ying Wang37526142015-03-10 12:02:57 -07001556 $(INTERNAL_RECOVERYIMAGE_FILES) \
Daniel Cashmandf1e2102016-12-17 00:53:52 +00001557 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
Doug Zongker4647f122009-07-02 09:00:54 -07001558 $(INSTALLED_2NDBOOTLOADER_TARGET) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001559 $(recovery_build_props) $(recovery_resource_deps) \
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001560 $(recovery_fstab) \
Jaekyun Seok8bee1202017-01-31 20:07:02 +09001561 $(RECOVERY_INSTALL_OTA_KEYS) \
Howard Chen1756f8d2017-02-22 17:27:10 +08001562 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1563 $(BOARD_RECOVERY_KERNEL_MODULES) \
1564 $(DEPMOD)
Ying Wang747b9f12015-01-30 14:05:22 -08001565 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001566
Tao Bao4594d0e2015-12-22 09:47:46 -08001567ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001568$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001569 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001570 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1571 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001572endif
Doug Zongker56588872012-08-20 15:38:58 -07001573
Ying Wang747b9f12015-01-30 14:05:22 -08001574.PHONY: recoveryimage-nodeps
1575recoveryimage-nodeps:
1576 @echo "make $@: ignoring dependencies"
1577 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1578
Tao Bao8beab692015-07-22 12:33:18 -07001579else # INSTALLED_RECOVERYIMAGE_TARGET not defined
Doug Zongker56588872012-08-20 15:38:58 -07001580RECOVERY_RESOURCE_ZIP :=
Doug Zongker4647f122009-07-02 09:00:54 -07001581endif
1582
1583.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001584recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001585
Jiyong Park03eb0612017-10-04 21:22:41 +09001586ifneq ($(BOARD_NAND_PAGE_SIZE),)
1587$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001588endif
1589
Jiyong Park03eb0612017-10-04 21:22:41 +09001590ifneq ($(BOARD_NAND_SPARE_SIZE),)
1591$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001592endif
1593
Doug Zongker4647f122009-07-02 09:00:54 -07001594# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07001595# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08001596#
Ying Wang9c649a72012-08-08 15:27:00 -07001597# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
1598PDK_FUSION_SYSIMG_FILES := \
1599 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
1600 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001601
1602INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07001603 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07001604 $(ALL_DEFAULT_INSTALLED_MODULES) \
1605 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08001606 $(RECOVERY_RESOURCE_ZIP)) \
1607 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wang160b6702012-03-13 18:58:27 -07001608
Ying Wang82cceba2012-08-13 15:03:00 -07001609FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001610
1611# ASAN libraries in the system image - add dependency.
1612ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
1613ifneq (,$(SANITIZE_TARGET))
1614 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
1615 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
1616 endif
1617endif
1618
Luis Hector Chavezff489932018-07-03 15:41:40 -07001619# When building a system root image, also add the ramdisk image as a dependency
1620# to ensure all files in it are built before it is created.
1621ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
1622 FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_ROOT)
1623endif
1624
Ying Wange5e8c5f2011-09-09 16:35:53 -07001625# -----------------------------------------------------------------
Steven Moreland627debe2018-05-01 09:54:21 -07001626# Final System VINTF manifest including fragments. This is not assembled
1627# on the device because it depends on everything in a given device
1628# image which defines a vintf_fragment.
1629
1630BUILT_ASSEMBLED_SYSTEM_MANIFEST := $(PRODUCT_OUT)/verified_assembled_system_manifest.xml
1631$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
1632$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_VENDOR_MATRIX)
1633$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(BUILT_SYSTEM_MANIFEST)
1634$(BUILT_ASSEMBLED_SYSTEM_MANIFEST): $(FULL_SYSTEMIMAGE_DEPS)
1635 @echo "Verifying system VINTF manifest."
1636 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
1637 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
1638 -c $(BUILT_VENDOR_MATRIX) \
1639 -i $(BUILT_SYSTEM_MANIFEST) \
1640 $$([ -d $(TARGET_OUT)/etc/vintf/manifest ] && \
1641 find $(TARGET_OUT)/etc/vintf/manifest -type f -name "*.xml" | \
1642 sed "s/^/-i /" | tr '\n' ' ') -o $@
1643
1644# -----------------------------------------------------------------
Ying Wange5e8c5f2011-09-09 16:35:53 -07001645# installed file list
1646# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
1647# We put installed-files.txt ahead of image itself in the dependency graph
1648# so that we can get the size stat even if the build fails due to too large
1649# system image.
1650INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07001651INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
1652$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001653$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001654 @echo Installed file list: $@
1655 @mkdir -p $(dir $@)
1656 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07001657 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08001658 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07001659
1660.PHONY: installed-file-list
1661installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08001662
1663$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07001664
1665systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001666 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07001667BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
1668
Ying Wang23898df2014-06-18 20:26:24 -07001669# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07001670ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07001671define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07001672$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
1673 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
1674 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
1675 exit 1; \
1676fi
Ying Wang23898df2014-06-18 20:26:24 -07001677$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
1678endef
1679else
1680define create-system-vendor-symlink
1681endef
1682endif
1683
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001684# Create symlink /system/product to /product if necessary.
1685ifdef BOARD_USES_PRODUCTIMAGE
1686define create-system-product-symlink
1687$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
1688 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
1689 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
1690 exit 1; \
1691fi
1692$(hide) ln -sf /product $(TARGET_OUT)/product
1693endef
1694else
1695define create-system-product-symlink
1696endef
1697endif
1698
Dario Freni5f681e12018-05-29 13:09:01 +01001699# Create symlink /system/product-services to /product-services if necessary.
1700ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
1701define create-system-productservices-symlink
1702$(hide) if [ -d $(TARGET_OUT)/product-services ] && [ ! -h $(TARGET_OUT)/product-services ]; then \
1703 echo 'Non-symlink $(TARGET_OUT)/product-services detected!' 1>&2; \
1704 echo 'You cannot install files to $(TARGET_OUT)/product-services while building a separate product-services.img!' 1>&2; \
1705 exit 1; \
1706fi
1707$(hide) ln -sf /product-services $(TARGET_OUT)/product-services
1708endef
1709else
1710define create-system-productservices-symlink
1711endef
1712endif
1713
The Android Open Source Project88b60792009-03-03 19:28:42 -08001714# $(1): output file
1715define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07001716 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07001717 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001718 $(call create-system-product-symlink)
Dario Freni5f681e12018-05-29 13:09:01 +01001719 $(call create-system-productservices-symlink)
Ying Wangbd93d422011-10-28 17:02:30 -07001720 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001721 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07001722 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001723 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001724 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001725 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001726 $(systemimage_intermediates)/generated_system_image_info.txt \
1727 || ( mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07001728 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08001729endef
1730
Steven Moreland627debe2018-05-01 09:54:21 -07001731$(BUILT_SYSTEMIMAGE): $(BUILT_ASSEMBLED_SYSTEM_MANIFEST)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09001732$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001733 $(call build-systemimage-target,$@)
1734
The Android Open Source Project88b60792009-03-03 19:28:42 -08001735INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07001736SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001737
Doug Zongker73ef8252009-07-23 15:12:53 -07001738# The system partition needs room for the recovery image as well. We
1739# now store the recovery image as a binary patch using the boot image
1740# as the source (since they are very similar). Generate the patch so
1741# we can see how big it's going to be, and include that in the system
1742# image size check calculation.
Sriram Raman1e96ac82009-07-24 13:52:32 -07001743ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07001744ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001745ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08001746diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
1747else
1748diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
1749endif
Doug Zongker73ef8252009-07-23 15:12:53 -07001750intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
1751RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08001752$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
1753$(RECOVERY_FROM_BOOT_PATCH): \
1754 $(INSTALLED_RECOVERYIMAGE_TARGET) \
1755 $(INSTALLED_BOOTIMAGE_TARGET) \
1756 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07001757 @echo "Construct recovery from boot"
1758 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08001759 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07001760else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
1761RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
1762endif
Sriram Raman1e96ac82009-07-24 13:52:32 -07001763endif
1764
Doug Zongker73ef8252009-07-23 15:12:53 -07001765
Dan Willemsen7f016152016-02-29 17:52:39 -08001766$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001767 @echo "Install system fs image: $@"
1768 $(copy-file-to-target)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001769 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
1770 $(call read-image-prop-dictionary,\
1771 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001772
1773systemimage: $(INSTALLED_SYSTEMIMAGE)
1774
1775.PHONY: systemimage-nodeps snod
1776systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07001777 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001778 @echo "make $@: ignoring dependencies"
1779 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001780 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),\
1781 $(call read-image-prop-dictionary,\
1782 $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001783
Ying Wangacf01ec2012-02-24 11:05:48 -08001784ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
1785ifeq (true,$(WITH_DEXPREOPT))
1786$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
1787endif
1788endif
1789
Colin Cross91a52272017-06-20 16:57:52 -07001790.PHONY: sync
1791sync: $(INTERNAL_SYSTEMIMAGE_FILES)
1792
The Android Open Source Project88b60792009-03-03 19:28:42 -08001793#######
1794## system tarball
1795define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07001796 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
1797 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001798 $(call create-system-product-symlink)
Dario Freni5f681e12018-05-29 13:09:01 +01001799 $(call create-system-productservices-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07001800 $(MKTARBALL) $(FS_GET_STATS) \
1801 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001802 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001803endef
1804
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001805ifndef SYSTEM_TARBALL_FORMAT
1806 SYSTEM_TARBALL_FORMAT := bz2
1807endif
1808
The Android Open Source Project88b60792009-03-03 19:28:42 -08001809system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07001810INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001811$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
1812$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
1813 $(build-systemtarball-target)
1814
1815.PHONY: systemtarball-nodeps
1816systemtarball-nodeps: $(FS_GET_STATS) \
1817 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
1818 $(build-systemtarball-target)
1819
1820.PHONY: stnod
1821stnod: systemtarball-nodeps
1822
Ying Wang3a61eeb2016-03-11 10:32:01 -08001823# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07001824## platform.zip: system, plus other files to be used in PDK fusion build,
1825## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07001826##
1827## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
1828## The variable will be typically set from BoardConfig.mk.
1829## Files under out dir will be rejected to prevent possible conflicts with other rules.
Ying Wang3a61eeb2016-03-11 10:32:01 -08001830pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
1831 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1832pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
1833 $(if $(filter $(DEXPREOPT.$(m).INSTALLED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
1834pdk_classes_dex := $(strip \
1835 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
1836 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
1837
1838pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
1839$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
1840$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
1841$(pdk_odex_config_mk) :
1842 @echo "PDK odex config makefile: $@"
1843 $(hide) mkdir -p $(dir $@)
1844 $(hide) echo "# Auto-generated. Do not modify." > $@
1845 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
1846 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
1847 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
1848 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
1849 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1850 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1851 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1852 )
1853 $(foreach m,$(PRIVATE_APPS),\
1854 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
1855 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
1856 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
1857 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
1858 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07001859 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08001860 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
1861 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
1862 )
1863
keunyoungc0178062013-07-22 14:54:58 -07001864PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07001865INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08001866
1867$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
1868$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
1869$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_odex_config_mk)
Keun young Park816b9fd2012-05-16 10:32:41 -07001870 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Ying Wang4c289e52012-03-30 13:52:54 -07001871 $(hide) rm -f $@
Dan Willemsen48a621c2015-10-29 16:33:05 -07001872 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wang4534d812012-04-09 17:04:12 -07001873 $(TARGET_COPY_OUT_SYSTEM) \
Keun young Park72226692012-07-31 17:13:20 -07001874 $(patsubst $(PRODUCT_OUT)/%, %, $(TARGET_OUT_NOTICE_FILES)) \
1875 $(addprefix symbols/,$(PDK_SYMBOL_FILES_LIST))
Ying Wangcff38622014-07-16 17:46:35 -07001876ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
Dan Willemsen48a621c2015-10-29 16:33:05 -07001877 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
Ying Wangcff38622014-07-16 17:46:35 -07001878 $(TARGET_COPY_OUT_VENDOR)
1879endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001880ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
1881 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
1882 $(TARGET_COPY_OUT_PRODUCT)
1883endif
Dario Freni5f681e12018-05-29 13:09:01 +01001884ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
1885 $(hide) cd $(dir $@) && zip -qryX $(notdir $@) \
1886 $(TARGET_COPY_OUT_PRODUCT_SERVICES)
1887endif
Colin Crossc451a372013-12-18 19:36:44 -08001888ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001889 $(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@) $(PDK_PLATFORM_JAVA_ZIP_CONTENTS)
Keun young Park816b9fd2012-05-16 10:32:41 -07001890endif
keunyoungc0178062013-07-22 14:54:58 -07001891ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001892 $(hide) zip -qryX $@ $(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)
keunyoungc0178062013-07-22 14:54:58 -07001893endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08001894 @# Add dex-preopt files and config.
1895 $(if $(PRIVATE_DEX_FILES),$(hide) cd $(OUT_DIR) && zip -qryX $(patsubst $(OUT_DIR)/%,%,$@ $(PRIVATE_DEX_FILES)))
Dan Willemsen0663f682018-03-06 14:07:21 -08001896 $(hide) touch $(PRODUCT_OUT)/pdk.mk
1897 $(hide) zip -qryXj $@ $(PRIVATE_ODEX_CONFIG) $(PRODUCT_OUT)/pdk.mk
Ying Wang4c289e52012-03-30 13:52:54 -07001898
1899.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07001900platform: $(INSTALLED_PLATFORM_ZIP)
1901
1902.PHONY: platform-java
1903platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07001904
1905# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07001906ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
1907$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07001908endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001909
Ying Wang3a61eeb2016-03-11 10:32:01 -08001910# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07001911## boot tarball
1912define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07001913 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07001914 $(hide) mkdir -p $(PRODUCT_OUT)/boot
1915 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001916 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07001917 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
1918 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001919 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07001920endef
1921
1922ifndef BOOT_TARBALL_FORMAT
1923 BOOT_TARBALL_FORMAT := bz2
1924endif
1925
1926boot_tar := $(PRODUCT_OUT)/boot.tar
1927INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
1928$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
1929$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
1930 $(build-boottarball-target)
1931
1932.PHONY: boottarball-nodeps btnod
1933boottarball-nodeps btnod: $(FS_GET_STATS) \
1934 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
1935 $(build-boottarball-target)
1936
1937
The Android Open Source Project88b60792009-03-03 19:28:42 -08001938# -----------------------------------------------------------------
1939# data partition image
1940INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001941 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001942
Ying Wangd7321d32013-03-15 10:32:29 -07001943# Don't build userdata.img if it's extfs but no partition size
1944skip_userdata.img :=
1945ifdef INTERNAL_USERIMAGES_EXT_VARIANT
1946ifndef BOARD_USERDATAIMAGE_PARTITION_SIZE
1947skip_userdata.img := true
1948endif
1949endif
1950
1951ifneq ($(skip_userdata.img),true)
Ying Wangbd93d422011-10-28 17:02:30 -07001952userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07001953 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07001954BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
1955
Ying Wangbd93d422011-10-28 17:02:30 -07001956define build-userdataimage-target
1957 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
1958 @mkdir -p $(TARGET_OUT_DATA)
1959 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07001960 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07001961 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08001962 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07001963 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001964 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07001965endef
1966
Joe Onorato64d85d02009-04-09 19:31:12 -07001967# We just build this directly to the install location.
1968INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07001969INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
1970 $(INTERNAL_USERIMAGES_DEPS) \
1971 $(INTERNAL_USERDATAIMAGE_FILES) \
1972 $(BUILD_IMAGE_SRCS)
1973$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001974 $(build-userdataimage-target)
1975
1976.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07001977userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001978 $(build-userdataimage-target)
1979
Ying Wangd7321d32013-03-15 10:32:29 -07001980endif # not skip_userdata.img
1981skip_userdata.img :=
Ying Wange215ed52012-10-15 14:36:22 -07001982
Andreas Gampe039b5c72017-03-24 16:06:31 -07001983# ASAN libraries in the system image - build rule.
1984ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
1985 $(TARGET_OUT_SHARED_LIBRARIES) \
1986 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
1987 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
1988 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07001989# Extra options: Enforce the system user for the files to avoid having to change ownership.
1990ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07001991# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
1992# enough space.
1993$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07001994 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 -07001995
The Android Open Source Project88b60792009-03-03 19:28:42 -08001996#######
1997## data partition tarball
1998define build-userdatatarball-target
1999 $(call pretty,"Target userdata fs tarball: " \
2000 "$(INSTALLED_USERDATATARBALL_TARGET)")
2001 $(MKTARBALL) $(FS_GET_STATS) \
2002 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002003 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002004endef
2005
2006userdata_tar := $(PRODUCT_OUT)/userdata.tar
2007INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
2008$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
2009$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
2010 $(build-userdatatarball-target)
2011
Dan Willemsen69af2e42016-08-16 16:36:05 -07002012$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
2013
The Android Open Source Project88b60792009-03-03 19:28:42 -08002014.PHONY: userdatatarball-nodeps
2015userdatatarball-nodeps: $(FS_GET_STATS)
2016 $(build-userdatatarball-target)
2017
2018
The Android Open Source Project88b60792009-03-03 19:28:42 -08002019# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04002020# partition table image
2021ifdef BOARD_BPT_INPUT_FILES
2022
2023BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002024BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04002025
2026INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
2027 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002028 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04002029 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
2030
2031ifdef BOARD_BPT_DISK_SIZE
2032INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
2033endif
2034
2035define build-bptimage-target
2036 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
2037 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
2038endef
2039
2040INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002041$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
2042 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
2043
David Zeuthen25328622016-04-08 15:08:03 -04002044$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
2045 $(build-bptimage-target)
2046
2047.PHONY: bptimage-nodeps
2048bptimage-nodeps:
2049 $(build-bptimage-target)
2050
2051endif # BOARD_BPT_INPUT_FILES
2052
2053# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07002054# cache partition image
2055ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
2056INTERNAL_CACHEIMAGE_FILES := \
2057 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
2058
2059cacheimage_intermediates := \
2060 $(call intermediates-dir-for,PACKAGING,cache)
2061BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
2062
2063define build-cacheimage-target
2064 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
2065 @mkdir -p $(TARGET_OUT_CACHE)
2066 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002067 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002068 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002069 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002070 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002071 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07002072endef
2073
2074# We just build this directly to the install location.
2075INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002076$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002077 $(build-cacheimage-target)
2078
2079.PHONY: cacheimage-nodeps
2080cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2081 $(build-cacheimage-target)
2082
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07002083else # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
2084# we need to ignore the broken cache link when doing the rsync
2085IGNORE_CACHE_LINK := --exclude=cache
Ying Wang9f8e8db2011-11-04 11:37:01 -07002086endif # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE
2087
David Zeuthen0eb10972016-09-28 17:55:27 -04002088# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07002089# system_other partition image
2090ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
2091BOARD_USES_SYSTEM_OTHER := true
2092
2093# Marker file to identify that odex files are installed
2094INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2095ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2096$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2097 $(hide) touch $@
2098endif
2099
2100ifdef BOARD_USES_SYSTEM_OTHER
2101INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2102 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2103 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002104 $(ALL_PDK_FUSION_FILES)) \
2105 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002106
2107INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002108INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2109$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002110$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07002111 @echo Installed file list: $@
2112 @mkdir -p $(dir $@)
2113 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002114 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002115 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002116
2117systemotherimage_intermediates := \
2118 $(call intermediates-dir-for,PACKAGING,system_other)
2119BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2120
2121# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2122define build-systemotherimage-target
2123 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2124 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2125 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002126 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002127 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002128 build/make/tools/releasetools/build_image.py \
Yifan Hongbbcba1e2018-06-18 16:32:35 -07002129 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
2130 $(systemotherimage_intermediates)/generated_system_other_image_info.txt
2131 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
2132 $(call read-image-prop-dictionary,\
2133 $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_size))
Alex Light4e358ab2016-06-16 14:47:10 -07002134endef
2135
2136# We just build this directly to the install location.
2137INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002138ifneq (true,$(SANITIZE_LITE))
2139# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002140$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2141 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002142endif
Alex Light4e358ab2016-06-16 14:47:10 -07002143
2144.PHONY: systemotherimage-nodeps
2145systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2146 $(build-systemotherimage-target)
2147
2148endif # BOARD_USES_SYSTEM_OTHER
2149
2150
2151# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002152# vendor partition image
2153ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2154INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002155 $(filter $(TARGET_OUT_VENDOR)/%,\
2156 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002157 $(ALL_PDK_FUSION_FILES)) \
2158 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002159
Steven Moreland627debe2018-05-01 09:54:21 -07002160# Final Vendor VINTF manifest including fragments. This is not assembled
2161# on the device because it depends on everything in a given device
2162# image which defines a vintf_fragment.
2163ifdef BUILT_VENDOR_MANIFEST
2164BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
2165ifeq (true,$(strip $(PRODUCT_ENFORCE_VINTF_MANIFEST)))
2166ifdef DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2167# TODO(b/65028233): turn this on globally
2168$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
2169endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE
2170endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2171$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2172$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2173$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2174$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
2175 @echo "Verifying vendor VINTF manifest."
2176 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2177 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2178 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
2179 -c $(BUILT_SYSTEM_MATRIX) \
2180 -i $(BUILT_VENDOR_MANIFEST) \
2181 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2182 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2183 sed "s/^/-i /" | tr '\n' ' ') -o $@
2184endif # BUILT_VENDOR_MANIFEST
2185
Ying Wangcff38622014-07-16 17:46:35 -07002186# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2187$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002188
Ying Wang8da19e32015-09-15 14:22:12 -07002189INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002190INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2191$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002192$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002193 @echo Installed file list: $@
2194 @mkdir -p $(dir $@)
2195 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002196 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002197 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002198
Ying Wanga0febe52013-03-20 11:02:05 -07002199vendorimage_intermediates := \
2200 $(call intermediates-dir-for,PACKAGING,vendor)
2201BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002202define build-vendorimage-target
2203 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2204 @mkdir -p $(TARGET_OUT_VENDOR)
2205 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002206 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Howard Chen1756f8d2017-02-22 17:27:10 +08002207 $(if $(BOARD_VENDOR_KERNEL_MODULES), \
2208 $(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 -07002209 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002210 build/make/tools/releasetools/build_image.py \
Yifan Hong749062d2018-06-19 16:23:16 -07002211 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
2212 $(vendorimage_intermediates)/generated_vendor_image_info.txt
2213 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
2214 $(call read-image-prop-dictionary,\
2215 $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
Ying Wanga0febe52013-03-20 11:02:05 -07002216endef
2217
2218# We just build this directly to the install location.
2219INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002220ifdef BUILT_VENDOR_MANIFEST
2221$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2222endif
Howard Chen1756f8d2017-02-22 17:27:10 +08002223$(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 -07002224 $(build-vendorimage-target)
2225
Steven Morelanda2e734d2017-03-07 12:10:09 -08002226.PHONY: vendorimage-nodeps vnod
2227vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
Ying Wanga0febe52013-03-20 11:02:05 -07002228 $(build-vendorimage-target)
2229
Colin Cross91a52272017-06-20 16:57:52 -07002230sync: $(INTERNAL_VENDORIMAGE_FILES)
2231
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002232else ifdef BOARD_PREBUILT_VENDORIMAGE
2233INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2234$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2235endif
Ying Wanga0febe52013-03-20 11:02:05 -07002236
Ying Wang9f8e8db2011-11-04 11:37:01 -07002237# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002238# product partition image
2239ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2240INTERNAL_PRODUCTIMAGE_FILES := \
2241 $(filter $(TARGET_OUT_PRODUCT)/%,\
2242 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002243 $(ALL_PDK_FUSION_FILES)) \
2244 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002245
2246# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2247$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2248
2249INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002250INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2251$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002252$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2253 @echo Installed file list: $@
2254 @mkdir -p $(dir $@)
2255 @rm -f $@
2256 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2257 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2258
2259productimage_intermediates := \
2260 $(call intermediates-dir-for,PACKAGING,product)
2261BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2262define build-productimage-target
2263 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2264 @mkdir -p $(TARGET_OUT_PRODUCT)
2265 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002266 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002267 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2268 ./build/tools/releasetools/build_image.py \
Yifan Hong56a6c3b2018-07-20 15:19:34 -07002269 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT) \
2270 $(productimage_intermediates)/generated_product_image_info.txt
2271 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),\
2272 $(call read-image-prop-dictionary,\
2273 $(productimage_intermediates)/generated_product_image_info.txt,product_size))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002274endef
2275
2276# We just build this directly to the install location.
2277INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2278$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2279 $(build-productimage-target)
2280
2281.PHONY: productimage-nodeps pnod
2282productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2283 $(build-productimage-target)
2284
2285sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2286
2287else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2288INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2289$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2290endif
2291
2292# -----------------------------------------------------------------
Dario Freni5f681e12018-05-29 13:09:01 +01002293# product-services partition image
2294ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
2295INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
2296 $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
2297 $(ALL_DEFAULT_INSTALLED_MODULES)\
2298 $(ALL_PDK_FUSION_FILES)) \
2299 $(PDK_FUSION_SYMLINK_STAMP)
2300
2301# platform.zip depends on $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES).
2302$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2303
2304INSTALLED_FILES_FILE_PRODUCT_SERVICES := $(PRODUCT_OUT)/installed-files-productservices.txt
2305INSTALLED_FILES_JSON_PRODUCT_SERVICES := $(INSTALLED_FILES_FILE_PRODUCT_SERVICES:.txt=.json)
2306$(INSTALLED_FILES_FILE_PRODUCT_SERVICES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT_SERVICES)
2307$(INSTALLED_FILES_FILE_PRODUCT_SERVICES) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(FILESLIST)
2308 @echo Installed file list: $@
2309 @mkdir -p $(dir $@)
2310 @rm -f $@
2311 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT_SERVICES) > $(@:.txt=.json)
2312 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2313
2314productservicesimage_intermediates := \
2315 $(call intermediates-dir-for,PACKAGING,productservices)
2316BUILT_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product-services.img
2317define build-productservicesimage-target
2318 $(call pretty,"Target product-services fs image: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)")
2319 @mkdir -p $(TARGET_OUT_PRODUCT_SERVICES)
2320 @mkdir -p $(productservicesimage_intermediates) && rm -rf $(productservicesimage_intermediates)/productservices_image_info.txt
2321 $(call generate-userimage-prop-dictionary, $(productservicesimage_intermediates)/productservices_image_info.txt, skip_fsck=true)
2322 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2323 ./build/tools/releasetools/build_image.py \
Yifan Hong9c35a022018-07-20 15:33:47 -07002324 $(TARGET_OUT_PRODUCT_SERVICES) $(productservicesimage_intermediates)/productservices_image_info.txt $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(TARGET_OUT) \
2325 $(productservicesimage_intermediates)/generated_productservices_image_info.txt
2326 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),\
2327 $(call read-image-prop-dictionary,\
2328 $(productservicesimage_intermediates)/generated_productservices_image_info.txt,productservices_size))
Dario Freni5f681e12018-05-29 13:09:01 +01002329endef
2330
2331# We just build this directly to the install location.
2332INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(BUILT_PRODUCT_SERVICESIMAGE_TARGET)
2333$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT_SERVICES) $(BUILD_IMAGE_SRCS)
2334 $(build-productservicesimage-target)
2335
2336.PHONY: productservicesimage-nodeps psnod
2337productservicesimage-nodeps psnod: | $(INTERNAL_USERIMAGES_DEPS)
2338 $(build-productservicesimage-target)
2339
2340sync: $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2341
2342else ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
2343INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product-services.img
2344$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCT_SERVICESIMAGE),$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)))
2345endif
2346
2347# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07002348# dtbo image
2349ifdef BOARD_PREBUILT_DTBOIMAGE
2350INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
2351
2352ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002353$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002354 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2355 $(AVBTOOL) add_hash_footer \
2356 --image $@ \
2357 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002358 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002359 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
2360else
2361$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
2362 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
2363endif
2364
2365endif
2366
2367# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002368# vbmeta image
2369ifeq ($(BOARD_AVB_ENABLE),true)
2370
2371BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002372AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002373
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002374ifdef BOARD_AVB_KEY_PATH
2375$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
2376else
2377# If key path isn't specified, use the 4096-bit test key.
2378BOARD_AVB_ALGORITHM := SHA256_RSA4096
2379BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
2380endif
2381
2382INTERNAL_AVB_SIGNING_ARGS := \
2383 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
2384
2385BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
2386DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
2387SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
2388VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05002389RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002390PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Dario Freni5f681e12018-05-29 13:09:01 +01002391PRODUCT_SERVICES_FOOTER_ARGS := BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002392
2393# Check and set required build variables for a chain partition.
2394# $(1): the partition to enable AVB chain, e.g., BOOT or SYSTEM.
2395define check-and-set-avb-chain-args
2396$(eval PART := $(1))
Bowgo Tsaie615afd2017-06-20 17:38:21 +08002397$(eval part=$(call to-lower,$(PART)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002398
2399$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
2400$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
2401$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
2402$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
2403$(if $($(_key_path)),,$(error $(_key_path) is not defined))
2404$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
2405$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
2406$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
2407
2408# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
2409$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
2410$(eval $(_signing_args) := \
2411 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
2412
2413$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2414 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
2415
2416# Set rollback_index via footer args
2417$(eval _footer_args := $(PART)_FOOTER_ARGS)
2418$(eval $($(_footer_args)) += --rollback_index $($(_rollback_index)))
2419endef
2420
2421ifdef BOARD_AVB_BOOT_KEY_PATH
2422$(eval $(call check-and-set-avb-chain-args,BOOT))
2423else
2424INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2425 --include_descriptors_from_image $(INSTALLED_BOOTIMAGE_TARGET)
2426endif
2427
2428ifdef BOARD_AVB_SYSTEM_KEY_PATH
2429$(eval $(call check-and-set-avb-chain-args,SYSTEM))
2430else
2431INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2432 --include_descriptors_from_image $(INSTALLED_SYSTEMIMAGE)
2433endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002434
2435ifdef INSTALLED_VENDORIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002436ifdef BOARD_AVB_VENDOR_KEY_PATH
2437$(eval $(call check-and-set-avb-chain-args,VENDOR))
2438else
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002439INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2440 --include_descriptors_from_image $(INSTALLED_VENDORIMAGE_TARGET)
2441endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002442endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002443
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002444ifdef INSTALLED_PRODUCTIMAGE_TARGET
2445ifdef BOARD_AVB_PRODUCT_KEY_PATH
2446$(eval $(call check-and-set-avb-chain-args,PRODUCT))
2447else
2448INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2449 --include_descriptors_from_image $(INSTALLED_PRODUCTIMAGE_TARGET)
2450endif
2451endif
2452
Yueyao Zhu211c9012017-04-27 00:34:50 -07002453ifdef INSTALLED_DTBOIMAGE_TARGET
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002454ifdef BOARD_AVB_DTBO_KEY_PATH
2455$(eval $(call check-and-set-avb-chain-args,DTBO))
2456else
Yueyao Zhu211c9012017-04-27 00:34:50 -07002457INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
Tao Baoc633ed02017-05-30 21:46:33 -07002458 --include_descriptors_from_image $(INSTALLED_DTBOIMAGE_TARGET)
Yueyao Zhu211c9012017-04-27 00:34:50 -07002459endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002460endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07002461
David Zeuthen8fecb282017-12-01 16:24:01 -05002462ifdef INSTALLED_RECOVERYIMAGE_TARGET
2463ifdef BOARD_AVB_RECOVERY_KEY_PATH
2464$(eval $(call check-and-set-avb-chain-args,RECOVERY))
2465else
2466INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
2467 --include_descriptors_from_image $(INSTALLED_RECOVERYIMAGE_TARGET)
2468endif
2469endif
2470
Bowgo Tsai9e95bea2017-06-30 12:12:15 +08002471BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
Bowgo Tsai53cf9992017-06-13 11:27:06 +08002472
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002473# Add kernel cmdline descriptor for kernel to mount system.img as root with
2474# dm-verity. This works when system.img is either chained or not-chained:
2475# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
2476# cmdline descriptor to system.img
2477# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
2478# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08002479ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002480BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08002481endif
2482
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002483ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002484BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002485endif
2486
John Reck0588b432018-05-03 13:20:01 -07002487ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
2488BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
2489endif
2490
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002491ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
2492 $(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
2493endif
2494
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002495# $(1): the directory to extract public keys to
2496define extract-avb-chain-public-keys
2497 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
2498 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
2499 --output $(1)/boot.avbpubkey)
2500 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
2501 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
2502 --output $(1)/system.avbpubkey)
2503 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
2504 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
2505 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002506 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
2507 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
2508 --output $(1)/product.avbpubkey)
Dario Freni5f681e12018-05-29 13:09:01 +01002509 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
2510 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH) \
2511 --output $(1)/product-services.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002512 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
2513 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
2514 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05002515 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
2516 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
2517 --output $(1)/recovery.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002518endef
2519
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002520define build-vbmetaimage-target
2521 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002522 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
2523 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002524 $(hide) $(AVBTOOL) make_vbmeta_image \
2525 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2526 $(INTERNAL_AVB_SIGNING_ARGS) \
2527 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
2528 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08002529 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002530endef
2531
2532INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
David Zeuthen8fecb282017-12-01 16:24:01 -05002533$(INSTALLED_VBMETAIMAGE_TARGET): \
2534 $(AVBTOOL) \
2535 $(INSTALLED_BOOTIMAGE_TARGET) \
2536 $(INSTALLED_SYSTEMIMAGE) \
2537 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002538 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Dario Freni5f681e12018-05-29 13:09:01 +01002539 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
David Zeuthen8fecb282017-12-01 16:24:01 -05002540 $(INSTALLED_DTBOIMAGE_TARGET) \
2541 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2542 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002543 $(build-vbmetaimage-target)
2544
2545.PHONY: vbmetaimage-nodeps
2546vbmetaimage-nodeps:
2547 $(build-vbmetaimage-target)
2548
Bowgo Tsai9afc0d52017-07-27 21:22:14 +08002549else ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
2550BUILT_DISABLED_VBMETAIMAGE := $(PRODUCT_OUT)/vbmeta.img
2551
2552INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_DISABLED_VBMETAIMAGE)
2553$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL)
2554 $(hide) $(AVBTOOL) make_vbmeta_image \
2555 --flag 2 --padding_size 4096 --output $@
2556
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08002557endif # BOARD_AVB_ENABLE
2558
2559# -----------------------------------------------------------------
Yifan Hong17dd45d2018-07-20 16:45:57 -07002560# Check image sizes <= size of super partition
2561
2562ifeq (,$(TARGET_BUILD_APPS))
2563# Do not check for apps-only build
2564
2565ifeq (true,$(USE_LOGICAL_PARTITIONS))
2566ifdef BOARD_SUPER_PARTITION_SIZE
2567ifdef BOARD_SUPER_PARTITION_PARTITION_LIST
2568
2569droid_targets: check_android_partition_sizes
2570
2571.PHONY: check_android_partition_sizes
2572
2573# BOARD_SUPER_PARTITION_PARTITION_LIST: a list of the following tokens
2574valid_super_partition_list := system vendor product productservices
2575ifneq (,$(filter-out $(valid_super_partition_list),$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
2576$(error BOARD_SUPER_PARTITION_PARTITION_LIST contains invalid partition name. \
2577 Valid names are $(valid_super_partition_list).)
2578endif
2579valid_super_partition_list :=
2580
2581# Add image dependencies so that generated_*_image_info.txt are written before checking.
2582ifneq (,$(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
2583check_android_partition_sizes: $(BUILT_SYSTEMIMAGE)
2584endif
2585ifneq (,$(filter vendor,$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
2586check_android_partition_sizes: $(INSTALLED_VENDORIMAGE_TARGET)
2587endif
2588ifneq (,$(filter product,$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
2589check_android_partition_sizes: $(INSTALLED_PRODUCTIMAGE_TARGET)
2590endif
2591ifneq (,$(filter productservices,$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
2592check_android_partition_sizes: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
2593endif
2594
2595check_android_partition_sizes:
2596 partition_size_list="$(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST),$(call read-image-prop-dictionary,$($(p)image_intermediates)/generated_$(p)_image_info.txt,$(p)_size))"; \
2597 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${partition_size_list}"); \
2598 if [ $$(( $${sum_sizes_expr} )) -gt $(BOARD_SUPER_PARTITION_SIZE) ]; then \
2599 echo 'The sum of sizes of all logical partitions is larger than BOARD_SUPER_PARTITION_SIZE.'; \
2600 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $(BOARD_SUPER_PARTITION_SIZE); \
2601 exit 1; \
2602 else \
2603 echo 'The sum of sizes of all logical partitions is within BOARD_SUPER_PARTITION_SIZE:' \
2604 $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $(BOARD_SUPER_PARTITION_SIZE); \
2605 fi
2606
2607endif # BOARD_SUPER_PARTITION_PARTITION_LIST
2608endif # BOARD_SUPER_PARTITION_SIZE
2609endif # USE_LOGICAL_PARTITIONS
2610
2611endif # TARGET_BUILD_APPS
2612
2613# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08002614# bring in the installer image generation defines if necessary
2615ifeq ($(TARGET_USE_DISKINSTALLER),true)
2616include bootable/diskinstaller/config.mk
2617endif
2618
2619# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07002620# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08002621
Ying Wangbd2d0242015-09-22 11:17:52 -07002622build_ota_package := true
2623ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
2624build_ota_package := false
2625endif
2626ifeq ($(BUILD_OS),darwin)
2627build_ota_package := false
2628endif
2629ifneq ($(strip $(SANITIZE_TARGET)),)
2630build_ota_package := false
2631endif
2632ifeq ($(TARGET_PRODUCT),sdk)
2633build_ota_package := false
2634endif
2635ifneq ($(filter generic%,$(TARGET_DEVICE)),)
2636build_ota_package := false
2637endif
2638ifeq ($(TARGET_NO_KERNEL),true)
2639build_ota_package := false
2640endif
2641ifeq ($(recovery_fstab),)
2642build_ota_package := false
2643endif
Colin Cross481cc5a2016-02-04 15:09:23 -08002644ifeq ($(TARGET_BUILD_PDK),true)
2645build_ota_package := false
2646endif
Ying Wangbd2d0242015-09-22 11:17:52 -07002647
2648ifeq ($(build_ota_package),true)
Ying Wang09c4b682015-08-11 11:24:19 -07002649OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
2650 $(HOST_OUT_EXECUTABLES)/aapt \
Michael Schwartz6473e752017-11-08 11:45:14 -08002651 $(HOST_OUT_EXECUTABLES)/checkvintf \
Ying Wangc45a47b2015-04-08 12:24:37 -07002652 $(HOST_OUT_EXECUTABLES)/mkbootfs \
2653 $(HOST_OUT_EXECUTABLES)/mkbootimg \
2654 $(HOST_OUT_EXECUTABLES)/fs_config \
2655 $(HOST_OUT_EXECUTABLES)/zipalign \
2656 $(HOST_OUT_EXECUTABLES)/bsdiff \
2657 $(HOST_OUT_EXECUTABLES)/imgdiff \
2658 $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
2659 $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
2660 $(HOST_OUT_JAVA_LIBRARIES)/BootSignature.jar \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002661 $(HOST_OUT_JAVA_LIBRARIES)/VeritySigner.jar \
Tao Baobcc31092017-01-06 14:24:18 -08002662 $(HOST_OUT_EXECUTABLES)/mke2fs \
2663 $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs.sh \
2664 $(HOST_OUT_EXECUTABLES)/e2fsdroid \
Tao Baocffaf732016-04-14 12:11:36 -07002665 $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh \
2666 $(HOST_OUT_EXECUTABLES)/mksquashfs \
2667 $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh \
2668 $(HOST_OUT_EXECUTABLES)/make_f2fs \
Jaegeuk Kim2ea1eba2017-11-28 19:21:28 -08002669 $(HOST_OUT_EXECUTABLES)/sload_f2fs \
Ying Wangc45a47b2015-04-08 12:24:37 -07002670 $(HOST_OUT_EXECUTABLES)/simg2img \
2671 $(HOST_OUT_EXECUTABLES)/e2fsck \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002672 $(HOST_OUT_EXECUTABLES)/generate_verity_key \
Ying Wangc45a47b2015-04-08 12:24:37 -07002673 $(HOST_OUT_EXECUTABLES)/verity_signer \
Tao Bao7f02f342016-11-18 17:04:24 -08002674 $(HOST_OUT_EXECUTABLES)/verity_verifier \
Ying Wangc45a47b2015-04-08 12:24:37 -07002675 $(HOST_OUT_EXECUTABLES)/append2simg \
Mohamad Ayyash353265b2015-06-24 15:42:19 -07002676 $(HOST_OUT_EXECUTABLES)/img2simg \
Sami Tolvanenf99b5312015-05-20 07:30:57 +01002677 $(HOST_OUT_EXECUTABLES)/boot_signer \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002678 $(HOST_OUT_EXECUTABLES)/fec \
Tao Bao6d8a8cc2016-01-19 14:47:17 -08002679 $(HOST_OUT_EXECUTABLES)/brillo_update_payload \
2680 $(HOST_OUT_EXECUTABLES)/lib/shflags/shflags \
Tao Baof54216f2016-03-29 15:12:37 -07002681 $(HOST_OUT_EXECUTABLES)/delta_generator \
Tao Bao3cba3742017-05-16 16:27:25 -07002682 $(AVBTOOL) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002683 $(BLK_ALLOC_TO_BASE_FS) \
Tao Baob4ec6d72018-03-15 23:21:28 -07002684 $(BROTLI) \
2685 $(BUILD_VERITY_METADATA) \
2686 $(BUILD_VERITY_TREE)
Tao Bao5e04c382017-02-22 16:38:19 -08002687
2688ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2689OTATOOLS += \
Tao Bao69ad1502017-02-23 11:03:45 -08002690 $(FUTILITY) \
2691 $(VBOOT_SIGNER)
Tao Bao5e04c382017-02-22 16:38:19 -08002692endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08002693
Ying Wangc45a47b2015-04-08 12:24:37 -07002694# Shared libraries.
Ying Wang09c4b682015-08-11 11:24:19 -07002695OTATOOLS += \
Mark Salyzync506e742015-04-13 09:01:24 -07002696 $(HOST_LIBRARY_PATH)/libc++$(HOST_SHLIB_SUFFIX) \
2697 $(HOST_LIBRARY_PATH)/liblog$(HOST_SHLIB_SUFFIX) \
2698 $(HOST_LIBRARY_PATH)/libcutils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002699 $(HOST_LIBRARY_PATH)/libselinux$(HOST_SHLIB_SUFFIX) \
Baligh Uddinc8bef142017-12-18 10:40:57 -08002700 $(HOST_LIBRARY_PATH)/libcrypto_utils$(HOST_SHLIB_SUFFIX) \
Claes Elgemarkd0ec6652015-06-03 08:35:52 +02002701 $(HOST_LIBRARY_PATH)/libcrypto-host$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002702 $(HOST_LIBRARY_PATH)/libext2fs-host$(HOST_SHLIB_SUFFIX) \
2703 $(HOST_LIBRARY_PATH)/libext2_blkid-host$(HOST_SHLIB_SUFFIX) \
2704 $(HOST_LIBRARY_PATH)/libext2_com_err-host$(HOST_SHLIB_SUFFIX) \
2705 $(HOST_LIBRARY_PATH)/libext2_e2p-host$(HOST_SHLIB_SUFFIX) \
Baligh Uddinb24470e2017-01-30 12:41:31 -08002706 $(HOST_LIBRARY_PATH)/libext2_misc$(HOST_SHLIB_SUFFIX) \
Alex Deymo0d799562015-12-09 18:02:56 -08002707 $(HOST_LIBRARY_PATH)/libext2_profile-host$(HOST_SHLIB_SUFFIX) \
2708 $(HOST_LIBRARY_PATH)/libext2_quota-host$(HOST_SHLIB_SUFFIX) \
Alex Klyubin9667b182015-12-10 13:38:50 -08002709 $(HOST_LIBRARY_PATH)/libext2_uuid-host$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002710 $(HOST_LIBRARY_PATH)/libconscrypt_openjdk_jni$(HOST_SHLIB_SUFFIX) \
2711 $(HOST_LIBRARY_PATH)/libbrillo$(HOST_SHLIB_SUFFIX) \
2712 $(HOST_LIBRARY_PATH)/libbrillo-stream$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002713 $(HOST_LIBRARY_PATH)/libchrome$(HOST_SHLIB_SUFFIX) \
2714 $(HOST_LIBRARY_PATH)/libcurl-host$(HOST_SHLIB_SUFFIX) \
Dan Willemsen8c2b6bb2016-07-22 23:16:30 +00002715 $(HOST_LIBRARY_PATH)/libevent-host$(HOST_SHLIB_SUFFIX) \
Tao Baofdd26932016-02-11 09:50:41 -08002716 $(HOST_LIBRARY_PATH)/libprotobuf-cpp-lite$(HOST_SHLIB_SUFFIX) \
Tao Baof8e6fbe2016-01-04 09:57:32 -08002717 $(HOST_LIBRARY_PATH)/libssl-host$(HOST_SHLIB_SUFFIX) \
Johan Redestig8f800df2016-03-24 13:57:03 +01002718 $(HOST_LIBRARY_PATH)/libz-host$(HOST_SHLIB_SUFFIX) \
Tao Bao138986b2017-01-26 08:16:57 -08002719 $(HOST_LIBRARY_PATH)/libsparse-host$(HOST_SHLIB_SUFFIX) \
Vikram Dattu8be44672016-12-16 16:33:03 +01002720 $(HOST_LIBRARY_PATH)/libbase$(HOST_SHLIB_SUFFIX) \
Tianjie Xub0a29ad2017-07-06 15:13:59 -07002721 $(HOST_LIBRARY_PATH)/libpcre2$(HOST_SHLIB_SUFFIX) \
2722 $(HOST_LIBRARY_PATH)/libbrotli$(HOST_SHLIB_SUFFIX)
2723
The Android Open Source Project88b60792009-03-03 19:28:42 -08002724
Ying Wang06898662010-06-17 17:52:18 -07002725.PHONY: otatools
2726otatools: $(OTATOOLS)
2727
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002728BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
Ying Wang62925a92015-04-08 16:37:34 -07002729$(BUILT_OTATOOLS_PACKAGE): zip_root := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002730
Tao Baoe8ef8f702017-05-17 11:41:50 -07002731OTATOOLS_DEPS := \
Tao Baoe8ef8f702017-05-17 11:41:50 -07002732 system/extras/ext4_utils/mke2fs.conf \
Tao Bao2d0e5122018-05-23 09:23:28 -07002733 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
2734 -name "atx_metadata.bin")) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002735 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print)) \
2736 $(sort $(shell find build/target/product/security -type f -name "*.x509.pem" -o -name "*.pk8" -o \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002737 -name verity_key)) \
Dan Willemsen60c66442018-05-01 19:07:27 -07002738 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
2739 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002740
2741OTATOOLS_RELEASETOOLS := \
Dan Willemsen60c66442018-05-01 19:07:27 -07002742 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002743
2744ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT))
2745OTATOOLS_DEPS += \
Dan Willemsenbe0b6ce2018-02-05 22:41:10 -08002746 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07002747endif
2748
2749$(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS) | $(ACP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002750 @echo "Package OTA tools: $@"
2751 $(hide) rm -rf $@ $(zip_root)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002752 $(hide) mkdir -p $(dir $@) $(zip_root)/bin $(zip_root)/framework $(zip_root)/releasetools
Ying Wangc45a47b2015-04-08 12:24:37 -07002753 $(call copy-files-with-structure,$(OTATOOLS),$(HOST_OUT)/,$(zip_root))
Colin Crossfdea8932017-12-06 14:38:40 -08002754 $(hide) $(ACP) -r -d -p build/make/tools/releasetools/* $(zip_root)/releasetools
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002755 $(hide) rm -rf $@ $(zip_root)/releasetools/*.pyc
Dan Willemsen48a621c2015-10-29 16:33:05 -07002756 $(hide) (cd $(zip_root) && zip -qryX $(abspath $@) *)
Tao Baoe8ef8f702017-05-17 11:41:50 -07002757 $(hide) echo $(OTATOOLS_DEPS) | xargs zip -qryX $(abspath $@)>/dev/null || true
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002758
2759.PHONY: otatools-package
2760otatools-package: $(BUILT_OTATOOLS_PACKAGE)
2761
Ying Wangbd2d0242015-09-22 11:17:52 -07002762endif # build_ota_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07002763
The Android Open Source Project88b60792009-03-03 19:28:42 -08002764# -----------------------------------------------------------------
2765# A zip of the directories that map to the target filesystem.
2766# This zip can be used to create an OTA package or filesystem image
2767# as a post-build step.
2768#
2769name := $(TARGET_PRODUCT)
2770ifeq ($(TARGET_BUILD_TYPE),debug)
2771 name := $(name)_debug
2772endif
2773name := $(name)-target_files-$(FILE_NAME_TAG)
2774
2775intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
2776BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
2777$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
2778$(BUILT_TARGET_FILES_PACKAGE): \
2779 zip_root := $(intermediates)/$(name)
2780
2781# $(1): Directory to copy
2782# $(2): Location to copy it to
2783# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
2784define package_files-copy-root
2785 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
2786 mkdir -p $(2) && \
2787 $(ACP) -rd $(strip $(1))/* $(2); \
2788 fi
2789endef
2790
Tao Baoa04fca32015-11-30 12:22:24 -08002791built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07002792
2793# We can't build static executables when SANITIZE_TARGET=address
Ivan Krasin74b32b82015-09-18 11:54:43 -07002794ifeq ($(strip $(SANITIZE_TARGET)),)
Ying Wange6e544e2015-06-22 18:35:35 -07002795built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07002796 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
2797endif
2798
The Android Open Source Project88b60792009-03-03 19:28:42 -08002799$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
2800
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002801$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002802$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07002803
Doug Zongkerc18736b2009-09-30 09:20:32 -07002804ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
2805# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07002806tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07002807else
Dan Willemsen653bea92017-03-21 15:47:37 -07002808tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002809endif
Dan Willemsen653bea92017-03-21 15:47:37 -07002810tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
2811$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
2812$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07002813
Sen Jiang4438fd92016-03-07 16:51:01 -08002814ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08002815updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08002816else
Steve Fung48e49f52015-10-01 23:53:31 -07002817# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002818updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07002819endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09002820$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07002821
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002822# If we are using recovery as boot, output recovery files to BOOT/.
2823ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2824$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
2825else
2826$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
2827endif
2828
Dan Willemsen653bea92017-03-21 15:47:37 -07002829ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07002830 ifdef OSRELEASED_DIRECTORY
2831 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
2832 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
2833 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
2834 endif
2835endif
2836
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08002837# Run fs_config while creating the target files package
2838# $1: root directory
2839# $2: add prefix
2840define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08002841(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 -08002842endef
2843
The Android Open Source Project88b60792009-03-03 19:28:42 -08002844# Depending on the various images guarantees that the underlying
2845# directories are up-to-date.
2846$(BUILT_TARGET_FILES_PACKAGE): \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002847 $(INSTALLED_BOOTIMAGE_TARGET) \
2848 $(INSTALLED_RADIOIMAGE_TARGET) \
2849 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002850 $(FULL_SYSTEMIMAGE_DEPS) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002851 $(INSTALLED_USERDATAIMAGE_TARGET) \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002852 $(INSTALLED_CACHEIMAGE_TARGET) \
Ying Wanga0febe52013-03-20 11:02:05 -07002853 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002854 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Dario Freni5f681e12018-05-29 13:09:01 +01002855 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
Bowgo Tsai6a749792017-09-01 22:55:44 +08002856 $(INSTALLED_VBMETAIMAGE_TARGET) \
Yueyao Zhu211c9012017-04-27 00:34:50 -07002857 $(INSTALLED_DTBOIMAGE_TARGET) \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002858 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002859 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
Dan Willemsen653bea92017-03-21 15:47:37 -07002860 $(INSTALLED_KERNEL_TARGET) \
2861 $(INSTALLED_2NDBOOTLOADER_TARGET) \
2862 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
2863 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002864 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
Dario Freni5f681e12018-05-29 13:09:01 +01002865 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
Nick Kralevich0eb17d92013-09-07 17:10:29 -07002866 $(SELINUX_FC) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08002867 $(APKCERTS_FILE) \
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002868 $(SOONG_ZIP) \
Doug Zongker283e2a12010-03-15 17:52:32 -07002869 $(HOST_OUT_EXECUTABLES)/fs_config \
Dan Willemsend79a08f2017-03-23 22:09:06 -07002870 $(HOST_OUT_EXECUTABLES)/imgdiff \
2871 $(HOST_OUT_EXECUTABLES)/bsdiff \
Dan Willemsenaadd4992017-03-21 16:01:02 -07002872 $(BUILD_IMAGE_SRCS) \
Steven Moreland627debe2018-05-01 09:54:21 -07002873 $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) \
2874 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
2875 $(BUILT_SYSTEM_MATRIX) \
Steven Moreland915f3512018-01-25 10:44:47 -08002876 $(BUILT_VENDOR_MATRIX) \
Ying Wang5d887702015-11-04 10:06:25 -08002877 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002878 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07002879 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002880 $(call create-system-product-symlink)
Dario Freni5f681e12018-05-29 13:09:01 +01002881 $(call create-system-productservices-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07002882 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002883 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002884ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002885 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002886 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002887 $(hide) $(call package_files-copy-root, \
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002888 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002889ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002890 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002891endif
2892ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002893 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002894endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002895ifdef BOARD_INCLUDE_RECOVERY_DTBO
2896 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
2897endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002898ifdef INTERNAL_KERNEL_CMDLINE
2899 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002900endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002901ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002902 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07002903endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002904ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002905 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07002906endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002907endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08002908 @# Components of the boot image
2909 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07002910ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
2911 $(hide) mkdir -p $(zip_root)/ROOT
2912 $(hide) $(call package_files-copy-root, \
2913 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
2914else
The Android Open Source Project88b60792009-03-03 19:28:42 -08002915 $(hide) $(call package_files-copy-root, \
2916 $(TARGET_ROOT_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07002917endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002918 @# If we are using recovery as boot, this is already done when processing recovery.
2919ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002920ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002921 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08002922endif
2923ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07002924 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08002925endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002926ifdef INTERNAL_KERNEL_CMDLINE
2927 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08002928endif
Doug Zongker38a649f2009-06-17 09:07:09 -07002929ifdef BOARD_KERNEL_BASE
2930 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
2931endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07002932ifdef BOARD_KERNEL_PAGESIZE
2933 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
2934endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08002935endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07002936 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
2937 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07002938 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002939 @# Contents of the system image
2940 $(hide) $(call package_files-copy-root, \
2941 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
2942 @# Contents of the data image
2943 $(hide) $(call package_files-copy-root, \
2944 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Ying Wanga0febe52013-03-20 11:02:05 -07002945ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
2946 @# Contents of the vendor image
2947 $(hide) $(call package_files-copy-root, \
2948 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
2949endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002950ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
2951 @# Contents of the product image
2952 $(hide) $(call package_files-copy-root, \
2953 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
2954endif
Dario Freni5f681e12018-05-29 13:09:01 +01002955ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
2956 @# Contents of the product-services image
2957 $(hide) $(call package_files-copy-root, \
2958 $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
2959endif
Alex Light4e358ab2016-06-16 14:47:10 -07002960ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
2961 @# Contents of the system_other image
2962 $(hide) $(call package_files-copy-root, \
2963 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
2964endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002965 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07002966 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07002967 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07002968ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08002969ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07002970 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07002971 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07002972endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08002973endif
Doug Zongker8678df42009-06-15 14:30:14 -07002974 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08002975 @# build them.
2976 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07002977 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
2978ifneq ($(tool_extension),)
2979 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
2980endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07002981 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07002982 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07002983 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08002984 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002985ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07002986 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002987endif
2988ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002989 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002990endif
Tao Baodb45efa2015-10-27 19:25:18 -07002991ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
2992 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
2993endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07002994ifdef BOARD_INCLUDE_RECOVERY_DTBO
2995 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
2996endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002997ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08002998 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07002999endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07003000ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
3001 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
3002 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3003else
3004 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3005endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003006 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07003007 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07003008ifdef PRODUCT_EXTRA_RECOVERY_KEYS
3009 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08003010endif
Jianxun Zhang09849492013-04-17 15:19:19 -07003011 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00003012 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08003013 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08003014 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Ying Wange24e17a2014-10-07 18:42:11 -07003015ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07003016 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07003017 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07003018endif
Tao Baof54216f2016-03-29 15:12:37 -07003019ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003020 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003021 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH))
3022endif
3023ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),)
Dan Willemsen653bea92017-03-21 15:47:37 -07003024 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \
Tao Baof54216f2016-03-29 15:12:37 -07003025 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH))
3026endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003027ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),)
3028 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH) \
3029 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH))
3030endif
Dario Freni5f681e12018-05-29 13:09:01 +01003031ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH),)
3032 $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3033 $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH))
3034endif
Ivan Krasin74b32b82015-09-18 11:54:43 -07003035ifneq ($(strip $(SANITIZE_TARGET)),)
Ying Wang2a048392015-06-25 13:56:53 -07003036 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
3037 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
3038endif
Tao Bao8beab692015-07-22 12:33:18 -07003039ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
3040 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
3041endif
David Zeuthen0eb10972016-09-28 17:55:27 -04003042ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003043 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
3044 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3045 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3046 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
3047 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3048ifdef BOARD_AVB_BOOT_KEY_PATH
3049 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3050 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3051 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3052endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05003053 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3054ifdef BOARD_AVB_RECOVERY_KEY_PATH
3055 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3056 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3057 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
3058endif # BOARD_AVB_RECOVERY_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003059endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04003060ifdef BOARD_BPT_INPUT_FILES
3061 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
3062 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
3063 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
3064endif
3065ifdef BOARD_BPT_DISK_SIZE
3066 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
3067endif
Ying Wangbd93d422011-10-28 17:02:30 -07003068 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07003069ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Per Astrandcab66992015-03-25 14:06:30 +01003070 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08003071 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Tao Baocbc6dc22015-08-18 18:03:56 -07003072endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003073ifeq ($(AB_OTA_UPDATER),true)
3074 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07003075 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07003076 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07003077 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
3078 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08003079 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
3080 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
3081 done
Steve Fung4044b382015-11-05 02:04:04 -08003082 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
3083 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003084 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003085ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07003086 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
3087 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
3088 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07003089endif
Alex Deymo70067ac2015-09-29 19:05:37 -07003090endif
Steve Fungdfbab492015-09-24 18:12:33 -07003091ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07003092 @# If breakpad symbols have been generated, add them to the zip.
Steve Fungdfbab492015-09-24 18:12:33 -07003093 $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
3094endif
Bowgo Tsai6a749792017-09-01 22:55:44 +08003095# BOARD_BUILD_DISABLED_VBMETAIMAGE is used to build a special vbmeta.img
3096# that disables AVB verification. The content is fixed and we can just copy
3097# it to $(zip_root)/IMAGES without passing some info into misc_info.txt for
3098# regeneration.
3099ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
3100 $(hide) mkdir -p $(zip_root)/IMAGES
3101 $(hide) cp $(INSTALLED_VBMETAIMAGE_TARGET) $(zip_root)/IMAGES/
3102endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07003103ifdef BOARD_PREBUILT_VENDORIMAGE
3104 $(hide) mkdir -p $(zip_root)/IMAGES
3105 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
3106endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003107ifdef BOARD_PREBUILT_PRODUCTIMAGE
3108 $(hide) mkdir -p $(zip_root)/IMAGES
3109 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
3110endif
Dario Freni5f681e12018-05-29 13:09:01 +01003111ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
3112 $(hide) mkdir -p $(zip_root)/IMAGES
3113 $(hide) cp $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(zip_root)/IMAGES/
3114endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07003115ifdef BOARD_PREBUILT_BOOTIMAGE
3116 $(hide) mkdir -p $(zip_root)/IMAGES
3117 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
3118endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07003119ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07003120 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
3121 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
3122 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
3123ifeq ($(BOARD_AVB_ENABLE),true)
3124 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003125 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
3126ifdef BOARD_AVB_DTBO_KEY_PATH
3127 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
3128 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
3129 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07003130 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003131endif # BOARD_AVB_DTBO_KEY_PATH
3132endif # BOARD_AVB_ENABLE
3133endif # BOARD_PREBUILT_DTBOIMAGE
Tao Bao95a95c32017-06-16 15:30:23 -07003134 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
3135 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
3136 @# INSTALLED_RADIOIMAGE_TARGET.
3137 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
3138 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003139 @# Run fs_config on all the system, vendor, boot ramdisk,
3140 @# and recovery ramdisk files in the zip, and save the output
3141 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
3142ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
3143 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
3144endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003145ifdef BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE
3146 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
3147endif
Dario Freni5f681e12018-05-29 13:09:01 +01003148ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
3149 $(hide) $(call fs_config,$(zip_root)/PRODUCT_SERVICES,product-services/) > $(zip_root)/META/productservices_filesystem_config.txt
3150endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003151ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Tao Baoda01b212018-02-28 21:20:08 -08003152 @# When using BOARD_BUILD_SYSTEM_ROOT_IMAGE, ROOT always contains the files for the root under
3153 @# normal boot. BOOT/RAMDISK exists only if additionally using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003154 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08003155ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003156 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08003157endif
3158else # BOARD_BUILD_SYSTEM_ROOT_IMAGE != true
3159 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
3160endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003161ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3162 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
3163endif
3164ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET
3165 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
3166endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07003167 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07003168 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Steven Moreland627debe2018-05-01 09:54:21 -07003169 $(hide) cp $(BUILT_ASSEMBLED_SYSTEM_MANIFEST) $(zip_root)/META/system_manifest.xml
3170ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
3171 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07003172endif
Yifan Hongaa212212017-04-14 00:00:46 -07003173ifdef BUILT_VENDOR_MATRIX
3174 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07003175endif
3176
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003177 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08003178 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08003179 @# Zip everything up, preserving symlinks and placing META/ files first to
3180 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003181 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07003182 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003183 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07003184
Ying Wanga0febe52013-03-20 11:02:05 -07003185.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08003186target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
3187
Ying Wang4709d7c2014-04-14 17:25:43 -07003188ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
3189$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
3190endif
Doug Zongker367910f2009-06-15 18:56:51 -07003191
Dan Albert4d323332016-10-14 13:23:06 -07003192# -----------------------------------------------------------------
3193# NDK Sysroot Package
3194NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07003195$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07003196 @echo Package NDK sysroot...
3197 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
3198
3199$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
3200
Ying Wang09c4b682015-08-11 11:24:19 -07003201ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07003202# -----------------------------------------------------------------
3203# OTA update package
3204
Doug Zongker8678df42009-06-15 14:30:14 -07003205name := $(TARGET_PRODUCT)
3206ifeq ($(TARGET_BUILD_TYPE),debug)
3207 name := $(name)_debug
3208endif
3209name := $(name)-ota-$(FILE_NAME_TAG)
3210
3211INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
3212
3213$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
3214
Tao Baoe53c6e72017-04-19 15:54:22 -07003215ifeq ($(AB_OTA_UPDATER),true)
3216$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07003217else
Alex Deymob10e07a2017-11-09 23:53:42 +01003218$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07003219endif
3220
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003221$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Colin Crossfdea8932017-12-06 14:38:40 -08003222 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07003223 @echo "Package OTA: $@"
Ying Wang9d252e12015-02-09 17:20:06 -08003224 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08003225 build/make/tools/releasetools/ota_from_target_files -v \
Doug Zongker26e66192014-02-20 13:22:07 -08003226 --block \
Dan Willemsencea5cd22017-03-21 14:44:27 -07003227 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
Doug Zongker602a84e2009-06-18 08:35:12 -07003228 -p $(HOST_OUT) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05003229 -k $(KEY_CERT_PAIR) \
Michael Runge6e836112014-04-15 17:40:21 -07003230 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
Stephen Smalley56882bf2012-02-09 13:36:21 -05003231 $(BUILT_TARGET_FILES_PACKAGE) $@
Doug Zongker8678df42009-06-15 14:30:14 -07003232
3233.PHONY: otapackage
3234otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
3235
Ying Wang09c4b682015-08-11 11:24:19 -07003236endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07003237
Ying Wang09a00a62010-10-20 14:01:09 -07003238# -----------------------------------------------------------------
3239# The update package
3240
3241name := $(TARGET_PRODUCT)
3242ifeq ($(TARGET_BUILD_TYPE),debug)
3243 name := $(name)_debug
3244endif
3245name := $(name)-img-$(FILE_NAME_TAG)
3246
3247INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
3248
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003249$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
Ying Wang09a00a62010-10-20 14:01:09 -07003250 @echo "Package: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003251 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
3252 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
Ying Wang09a00a62010-10-20 14:01:09 -07003253
3254.PHONY: updatepackage
3255updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
3256
The Android Open Source Project88b60792009-03-03 19:28:42 -08003257# -----------------------------------------------------------------
3258# A zip of the symbols directory. Keep the full paths to make it
3259# more obvious where these files came from.
3260#
3261name := $(TARGET_PRODUCT)
3262ifeq ($(TARGET_BUILD_TYPE),debug)
3263 name := $(name)_debug
3264endif
3265name := $(name)-symbols-$(FILE_NAME_TAG)
3266
3267SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003268# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07003269ifndef TARGET_BUILD_APPS
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003270$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3271 $(INSTALLED_BOOTIMAGE_TARGET) \
3272 $(INSTALLED_USERDATAIMAGE_TARGET) \
3273 $(INSTALLED_VENDORIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003274 $(INSTALLED_PRODUCTIMAGE_TARGET) \
Dario Freni5f681e12018-05-29 13:09:01 +01003275 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003276 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07003277endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003278$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
3279$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003280 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003281 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3282 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
3283 $(hide) find $(TARGET_OUT_UNSTRIPPED) | sort >$(PRIVATE_LIST_FILE)
Dan Willemsen6cf21a72017-01-30 20:42:28 -08003284 $(hide) $(SOONG_ZIP) -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003285# -----------------------------------------------------------------
3286# A zip of the coverage directory.
3287#
3288name := $(TARGET_PRODUCT)
3289ifeq ($(TARGET_BUILD_TYPE),debug)
3290name := $(name)_debug
3291endif
3292name := $(name)-coverage-$(FILE_NAME_TAG)
3293COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
3294ifndef TARGET_BUILD_APPS
3295$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE) \
3296 $(INSTALLED_BOOTIMAGE_TARGET) \
3297 $(INSTALLED_USERDATAIMAGE_TARGET) \
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003298 $(INSTALLED_VENDORIMAGE_TARGET) \
Dario Freni5f681e12018-05-29 13:09:01 +01003299 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3300 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07003301endif
3302$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
3303$(COVERAGE_ZIP): $(SOONG_ZIP)
3304 @echo "Package coverage: $@"
3305 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
3306 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
3307 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
3308 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003309
3310# -----------------------------------------------------------------
3311# A zip of the Android Apps. Not keeping full path so that we don't
3312# include product names when distributing
3313#
3314name := $(TARGET_PRODUCT)
3315ifeq ($(TARGET_BUILD_TYPE),debug)
3316 name := $(name)_debug
3317endif
3318name := $(name)-apps-$(FILE_NAME_TAG)
3319
3320APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Ying Wang5d887702015-11-04 10:06:25 -08003321$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003322 @echo "Package apps: $@"
3323 $(hide) rm -rf $@
3324 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003325 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
3326 if [ -z "$$apps_to_zip" ]; then \
3327 echo "No apps to zip up. Generating empty apps archive." ; \
3328 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
3329 else \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003330 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07003331 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07003332
Ying Wangbc415dd2012-08-15 12:22:44 -07003333ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07003334#------------------------------------------------------------------
3335# An archive of classes for use in generating code-coverage reports
3336# These are the uninstrumented versions of any classes that were
3337# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07003338# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003339
Colin Crossa6bc3a82017-09-27 14:28:41 -07003340JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003341$(JACOCO_REPORT_CLASSES_ALL) :
3342 @echo "Collecting uninstrumented classes"
3343 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
3344 zip -@ -0 -q -X $@
3345# Meaning of these options:
3346# -@ scan stdin for file paths to add to the zip
3347# -0 don't do any compression
3348# -q supress most output
3349# -X skip storing extended file attributes
3350
Ying Wangbc415dd2012-08-15 12:22:44 -07003351endif # EMMA_INSTRUMENT=true
3352
Jeff Gastonaaae43c2017-04-11 16:36:46 -07003353
Ying Wangae9115a2013-08-22 20:52:47 -07003354#------------------------------------------------------------------
3355# A zip of Proguard obfuscation dictionary files.
3356# Only for apps_only build.
3357#
3358ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07003359PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07003360# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07003361$(PROGUARD_DICT_ZIP) :
3362 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07003363 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Ying Wangae9115a2013-08-22 20:52:47 -07003364 if [ -n "$$dict_files" ]; then \
Ying Wang33d64592013-11-25 17:39:50 -08003365 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003366 zip -qX $@ $$dict_files $$unobfuscated_jars; \
Ying Wangae9115a2013-08-22 20:52:47 -07003367 else \
Ying Wangdcd90832015-02-26 09:36:27 -08003368 touch $(dir $@)/zipdummy; \
3369 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
3370 zip -qd $@ zipdummy; \
3371 rm $(dir $@)/zipdummy; \
Ying Wangae9115a2013-08-22 20:52:47 -07003372 fi
3373
3374endif # TARGET_BUILD_APPS
3375
The Android Open Source Project88b60792009-03-03 19:28:42 -08003376# -----------------------------------------------------------------
3377# dalvik something
3378.PHONY: dalvikfiles
3379dalvikfiles: $(INTERNAL_DALVIK_MODULES)
3380
Bo Huf0d50bb2017-08-01 19:02:09 +00003381ifeq ($(BUILD_QEMU_IMAGES),true)
3382INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
3383MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
3384SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
3385$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3386 @echo Create system-qemu.img
3387 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img)
3388
3389systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
3390droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
3391ifeq ($(BOARD_USES_VENDORIMAGE),true)
3392INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
3393$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3394 @echo Create vendor-qemu.img
3395 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img)
3396
3397vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
3398droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
3399endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003400ifeq ($(BOARD_USES_PRODUCTIMAGE),true)
3401INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
3402$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3403 @echo Create product-qemu.img
3404 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img)
3405
3406productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
3407droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
3408endif
Dario Freni5f681e12018-05-29 13:09:01 +01003409ifeq ($(BOARD_USES_PRODUCT_SERVICESIMAGE),true)
3410INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product-services-qemu.img
3411$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
3412 @echo Create product-services-qemu.img
3413 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product-services.img)
3414
3415productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
3416droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
3417endif
Bo Huf0d50bb2017-08-01 19:02:09 +00003418endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003419# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08003420# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07003421ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003422INTERNAL_EMULATOR_PACKAGE_FILES += \
3423 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08003424 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003425 $(INSTALLED_RAMDISK_TARGET) \
3426 $(INSTALLED_SYSTEMIMAGE) \
3427 $(INSTALLED_USERDATAIMAGE_TARGET)
3428
3429name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
3430
3431INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
3432
Ying Wang5d887702015-11-04 10:06:25 -08003433$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003434 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07003435 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003436
Ying Wang7d8c5352012-07-26 10:15:21 -07003437endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003438# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08003439# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08003440# The pdk package (Platform Development Kit)
3441
Keun young Park7fc7aad2012-02-27 15:49:23 -08003442#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
3443# include development/pdk/Pdk.mk
3444#endif
3445
The Android Open Source Project88b60792009-03-03 19:28:42 -08003446
3447# -----------------------------------------------------------------
3448# The SDK
3449
The Android Open Source Project88b60792009-03-03 19:28:42 -08003450# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07003451sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003452
3453# Build a name that looks like:
3454#
3455# linux-x86 --> android-sdk_12345_linux-x86
3456# darwin-x86 --> android-sdk_12345_mac-x86
3457# windows-x86 --> android-sdk_12345_windows
3458#
3459sdk_name := android-sdk_$(FILE_NAME_TAG)
3460ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07003461 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08003462else
Joe Onorato03fbe402009-04-13 08:31:16 -07003463 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003464endif
3465ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07003466 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003467endif
Joe Onorato03fbe402009-04-13 08:31:16 -07003468sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003469
3470sdk_dep_file := $(sdk_dir)/sdk_deps.mk
3471
3472ATREE_FILES :=
3473-include $(sdk_dep_file)
3474
3475# if we don't have a real list, then use "everything"
3476ifeq ($(strip $(ATREE_FILES)),)
3477ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003478 $(ALL_DEFAULT_INSTALLED_MODULES) \
3479 $(INSTALLED_RAMDISK_TARGET) \
3480 $(ALL_DOCS) \
3481 $(ALL_SDK_FILES)
3482endif
3483
3484atree_dir := development/build
3485
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01003486
The Android Open Source Project88b60792009-03-03 19:28:42 -08003487sdk_atree_files := \
3488 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07003489 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08003490
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02003491# development/build/sdk-android-<abi>.atree is used to differentiate
3492# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
3493# files like the kernel image. We use TARGET_CPU_ABI because we don't
3494# have a better way to distinguish between CPU models.
3495ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
3496 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
3497endif
3498
Griff Hazen433febb2014-02-28 08:45:59 -08003499ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES),)
3500sdk_atree_files += $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ATREE_FILES)
3501else
3502sdk_atree_files += $(atree_dir)/sdk.atree
3503endif
3504
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003505include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003506
The Android Open Source Project88b60792009-03-03 19:28:42 -08003507deps := \
3508 $(target_notice_file_txt) \
3509 $(tools_notice_file_txt) \
3510 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07003511 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07003512 $(COVERAGE_ZIP) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003513 $(INSTALLED_SYSTEMIMAGE) \
Bo Huf0d50bb2017-08-01 19:02:09 +00003514 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07003515 $(INSTALLED_QEMU_VENDORIMAGE) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07003516 $(INSTALLED_USERDATAIMAGE_TARGET) \
3517 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003518 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07003519 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003520 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08003521 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003522 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07003523 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003524 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003525
3526INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
3527$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
3528$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
3529$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
3530$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
3531
3532# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
3533#
3534#SDK_GNU_ERROR := true
3535
Ying Wang5d887702015-11-04 10:06:25 -08003536$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003537 @echo "Package SDK: $@"
3538 $(hide) rm -rf $(PRIVATE_DIR) $@
3539 $(hide) for f in $(target_gnu_MODULES); do \
3540 if [ -f $$f ]; then \
3541 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
3542 including GNU target $$f >&2; \
3543 FAIL=$(SDK_GNU_ERROR); \
3544 fi; \
3545 done; \
3546 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07003547 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08003548 $(hide) ( \
Dan Willemsen6f57b282018-06-01 10:53:55 -07003549 ATREE_STRIP="$(HOST_STRIP) -x" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003550 $(HOST_OUT_EXECUTABLES)/atree \
3551 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
3552 -m $(PRIVATE_DEP_FILE) \
3553 -I . \
3554 -I $(PRODUCT_OUT) \
3555 -I $(HOST_OUT) \
3556 -I $(TARGET_COMMON_OUT_ROOT) \
3557 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
Raphael Moll7558ad52011-01-05 14:58:17 -08003558 -v "OUT_DIR=$(OUT_DIR)" \
Raphael2a533172011-11-15 16:29:16 -08003559 -v "HOST_OUT=$(HOST_OUT)" \
Bruce Beare18a130e2011-02-18 15:06:20 -08003560 -v "TARGET_ARCH=$(TARGET_ARCH)" \
3561 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
David 'Digit' Turner557c51f2011-08-25 14:28:03 +02003562 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07003563 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003564 -o $(PRIVATE_DIR) && \
3565 cp -f $(target_notice_file_txt) \
Xavier Ducrohet6de7bc62011-09-21 10:22:19 -07003566 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
Xavier Ducrohet4216a8c2011-03-15 13:28:40 -07003567 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003568 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
Raphael7a6a9c32011-02-01 13:30:00 -08003569 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003570 chmod -R ug+rwX $(PRIVATE_DIR) && \
Dan Willemsen48a621c2015-10-29 16:33:05 -07003571 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003572 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
3573
Raphael3d224a02010-04-16 17:50:09 -07003574
3575# Is a Windows SDK requested? If so, we need some definitions from here
3576# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08003577MAIN_SDK_NAME := $(sdk_name)
3578MAIN_SDK_DIR := $(sdk_dir)
3579MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08003580ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07003581include $(TOPDIR)development/build/tools/windows_sdk.mk
3582endif
3583
The Android Open Source Project88b60792009-03-03 19:28:42 -08003584# -----------------------------------------------------------------
3585# Findbugs
3586INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
3587INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
3588$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
3589 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003590 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08003591 > $@
3592$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
3593 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09003594 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07003595 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08003596
3597# -----------------------------------------------------------------
3598# Findbugs
3599
3600# -----------------------------------------------------------------
3601# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07003602ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003603include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01003604-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07003605-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003606-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07003607# Also the project-specific tasks
3608-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
3609-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07003610-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07003611# Also add test specifc tasks
3612include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07003613include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07003614endif
Raphaelc4d47312011-02-15 16:09:36 -08003615
Ying Wang67132ba2015-10-28 16:42:39 -07003616include $(BUILD_SYSTEM)/product-graph.mk
3617
Raphaelc4d47312011-02-15 16:09:36 -08003618# -----------------------------------------------------------------
3619# Create SDK repository packages. Must be done after tasks/* since
3620# we need the addon rules defined.
3621ifneq ($(sdk_repo_goal),)
3622include $(TOPDIR)development/build/tools/sdk_repo.mk
3623endif
Jayant Chowdhary67e0cc52018-02-23 16:50:39 -08003624
3625#------------------------------------------------------------------
3626# Find lsdump paths
3627FIND_LSDUMPS_FILE := $(PRODUCT_OUT)/lsdump_paths.txt
3628$(FIND_LSDUMPS_FILE) : $(LSDUMP_PATHS)
3629 $(hide) rm -rf $@ && echo "$^" > $@