blob: f41550fbe2194a32a72a66ce7a0822f98a6101f1 [file] [log] [blame]
The Android Open Source Project88b60792009-03-03 19:28:42 -08001# Put some miscellaneous rules here
2
Ying Wang3bbfddd2014-03-01 15:32:04 -08003# HACK: clear LOCAL_PATH from including last build target before calling
4# intermedites-dir-for
5LOCAL_PATH := $(BUILD_SYSTEM)
6
The Android Open Source Project88b60792009-03-03 19:28:42 -08007# -----------------------------------------------------------------
8# Define rules to copy PRODUCT_COPY_FILES defined by the product.
Ying Wang4b0486b2012-09-20 16:35:36 -07009# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>].
The Android Open Source Project88b60792009-03-03 19:28:42 -080010# <dest file> is relative to $(PRODUCT_OUT), so it should look like,
11# e.g., "system/etc/file.xml".
Jean-Baptiste Queru518ce572010-03-01 16:18:59 -080012# The filter part means "only eval the copy-one-file rule if this
Ying Wang462d26b2010-11-02 21:31:47 -070013# src:dest pair is the first one to match the same dest"
Ying Wang68864102011-09-29 13:23:25 -070014#$(1): the src:dest pair
Dan Willemsen7d957c92018-04-30 16:01:33 -070015#$(2): the dest
Ying Wang68864102011-09-29 13:23:25 -070016define check-product-copy-files
Dan Willemsen7d957c92018-04-30 16:01:33 -070017$(if $(filter-out $(TARGET_COPY_OUT_SYSTEM_OTHER)/%,$(2)), \
18 $(if $(filter %.apk, $(2)),$(error \
19 Prebuilt apk found in PRODUCT_COPY_FILES: $(1), use BUILD_PREBUILT instead!)))
Ying Wang68864102011-09-29 13:23:25 -070020endef
Ying Wang619fccf2012-09-05 18:08:29 -070021# filter out the duplicate <source file>:<dest file> pairs.
22unique_product_copy_files_pairs :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080023$(foreach cf,$(PRODUCT_COPY_FILES), \
Ying Wang619fccf2012-09-05 18:08:29 -070024 $(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\
25 $(eval unique_product_copy_files_pairs += $(cf))))
26unique_product_copy_files_destinations :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080027product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070028$(foreach cf,$(unique_product_copy_files_pairs), \
Ying Wang462d26b2010-11-02 21:31:47 -070029 $(eval _src := $(call word-colon,1,$(cf))) \
30 $(eval _dest := $(call word-colon,2,$(cf))) \
Dan Willemsen7d957c92018-04-30 16:01:33 -070031 $(call check-product-copy-files,$(cf),$(_dest)) \
Ying Wang193010c2011-12-16 11:54:25 -080032 $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
Dan Willemsen403b98a2017-11-15 11:13:23 -080033 $(eval product_copy_files_ignored += $(cf)), \
Ying Wang462d26b2010-11-02 21:31:47 -070034 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
Ying Wang3ceecfa2012-05-14 14:39:00 -070035 $(if $(filter %.xml,$(_dest)),\
36 $(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\
Nicolas Geoffraya95fbd12017-09-19 13:10:31 +010037 $(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\
38 $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \
Tom Cherryfc977642018-06-13 14:51:05 -070039 $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\
40 $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\
41 $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \
Ying Wang7e8d4422011-06-17 17:05:35 -070042 $(eval unique_product_copy_files_destinations += $(_dest))))
Dan Willemsen403b98a2017-11-15 11:13:23 -080043
44# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries)
Dan Willemsen7537fd02018-10-16 23:15:08 -070045pcf_ignored_file := $(PRODUCT_OUT)/product_copy_files_ignored.txt
46$(pcf_ignored_file): PRIVATE_IGNORED := $(sort $(product_copy_files_ignored))
47$(pcf_ignored_file):
48 echo "$(PRIVATE_IGNORED)" | tr " " "\n" >$@
Dan Willemsen403b98a2017-11-15 11:13:23 -080049
Dan Willemsen7537fd02018-10-16 23:15:08 -070050$(call dist-for-goals,droidcore,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file)))
51
52pcf_ignored_file :=
Dan Willemsen403b98a2017-11-15 11:13:23 -080053product_copy_files_ignored :=
Ying Wang619fccf2012-09-05 18:08:29 -070054unique_product_copy_files_pairs :=
Ying Wang7e8d4422011-06-17 17:05:35 -070055unique_product_copy_files_destinations :=
The Android Open Source Project88b60792009-03-03 19:28:42 -080056
57# -----------------------------------------------------------------
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +080058# Returns the max allowed size for an image suitable for hash verification
59# (e.g., boot.img, recovery.img, etc).
60# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL).
61# $(1): partition size to flash the image
62define get-hash-image-max-size
63$(if $(1), \
64 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
65 $(eval _hash_meta_size := 69632), \
66 $(eval _hash_meta_size := 0)) \
67 $(1)-$(_hash_meta_size))
68endef
69
70# -----------------------------------------------------------------
Dan Willemsen6f60f022016-02-23 13:40:07 -080071# Define rules to copy headers defined in copy_headers.mk
72# If more than one makefile declared a header, print a warning,
73# then copy the last one defined. This matches the previous make
74# behavior.
Dan Willemsen7f9bd562018-08-15 14:28:01 -070075has_dup_copy_headers :=
Dan Willemsen6f60f022016-02-23 13:40:07 -080076$(foreach dest,$(ALL_COPIED_HEADERS), \
77 $(eval _srcs := $(ALL_COPIED_HEADERS.$(dest).SRC)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -080078 $(eval _src := $(lastword $(_srcs))) \
Dan Willemsen6f60f022016-02-23 13:40:07 -080079 $(if $(call streq,$(_src),$(_srcs)),, \
80 $(warning Duplicate header copy: $(dest)) \
Dan Willemsenf4249d12019-02-07 17:34:57 -080081 $(warning _ Using $(_src)) \
82 $(warning __ from $(lastword $(ALL_COPIED_HEADERS.$(dest).MAKEFILE))) \
83 $(eval _makefiles := $$(wordlist 1,$(call int_subtract,$(words $(ALL_COPIED_HEADERS.$(dest).MAKEFILE)),1),$$(ALL_COPIED_HEADERS.$$(dest).MAKEFILE))) \
84 $(foreach src,$(wordlist 1,$(call int_subtract,$(words $(_srcs)),1),$(_srcs)), \
85 $(warning _ Ignoring $(src)) \
86 $(warning __ from $(firstword $(_makefiles))) \
87 $(eval _makefiles := $$(wordlist 2,9999,$$(_makefiles)))) \
88 $(eval has_dup_copy_headers := true)) \
Dan Willemsen6f60f022016-02-23 13:40:07 -080089 $(eval $(call copy-one-header,$(_src),$(dest))))
90all_copied_headers: $(ALL_COPIED_HEADERS)
91
Dan Willemsen7f9bd562018-08-15 14:28:01 -070092ifdef has_dup_copy_headers
93 has_dup_copy_headers :=
Dan Willemsen1d4a56f2019-04-18 09:38:25 -070094 $(error duplicate header copies are no longer allowed. For more information about headers, see: https://android.googlesource.com/platform/build/soong/+/master/docs/best_practices.md#headers)
Dan Willemsen7f9bd562018-08-15 14:28:01 -070095endif
96
Dan Willemsen6f60f022016-02-23 13:40:07 -080097# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -080098# docs/index.html
Ying Wang3f45b3c2012-04-02 18:21:36 -070099ifeq (,$(TARGET_BUILD_APPS))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800100gen := $(OUT_DOCS)/index.html
101ALL_DOCS += $(gen)
102$(gen): frameworks/base/docs/docs-redirect-index.html
103 @mkdir -p $(dir $@)
104 @cp -f $< $@
Ying Wang3f45b3c2012-04-02 18:21:36 -0700105endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800106
Dan Albert303e6032017-10-04 10:20:20 -0700107ndk_doxygen_out := $(OUT_NDK_DOCS)
108ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include
109ndk_docs_src_dir := frameworks/native/docs
110ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile
111ifneq ($(wildcard $(ndk_docs_src_dir)),)
112ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\
113 $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.))
114$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp
115 @mkdir -p $(ndk_doxygen_out)
116 @echo "Generating NDK docs to $(ndk_doxygen_out)"
117 @( cat $(ndk_doxyfile); \
118 echo "INPUT=$(ndk_headers)"; \
119 echo "HTML_OUTPUT=$(ndk_doxygen_out)" \
120 ) | doxygen -
121
122# Note: Not a part of the docs target because we don't have doxygen available.
123# You can run this target locally if you have doxygen installed.
124ndk-docs: $(ndk_doxygen_out)/index.html
125.PHONY: ndk-docs
126endif
127
Colin Crossd60401a2019-04-18 14:46:48 -0700128$(call dist-for-goals,sdk,$(API_FINGERPRINT))
Dan Willemsenad6a1542018-12-14 01:04:19 -0800129
130# -----------------------------------------------------------------
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900131# property_overrides_split_enabled
132property_overrides_split_enabled :=
133ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true)
134 property_overrides_split_enabled := true
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900135endif
136
137# -----------------------------------------------------------------
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900138# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if
139# property_overrides_split_enabled is true. Otherwise it will be installed in
140# ROOT/default.prop.
141ifdef BOARD_VNDK_VERSION
142 ifeq ($(BOARD_VNDK_VERSION),current)
143 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
144 else
145 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION)
146 endif
Logan Chiend73b94c2018-05-04 19:33:17 +0800147 ifdef BOARD_VNDK_RUNTIME_DISABLE
148 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
149 endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900150else
Logan Chiend73b94c2018-05-04 19:33:17 +0800151 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION)
152 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900153endif
154FINAL_VENDOR_DEFAULT_PROPERTIES += \
155 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
Tao Bao5f999232018-09-04 11:42:53 -0700156
Anton Hansson30851f22019-02-21 11:51:26 +0000157# Add cpu properties for bionic and ART.
Haibo Huangee0531d2018-11-04 09:20:09 -0800158FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH)
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000159FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME)
Haibo Huangee0531d2018-11-04 09:20:09 -0800160FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH)
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000161FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME)
Haibo Huangee0531d2018-11-04 09:20:09 -0800162
Anton Hansson30851f22019-02-21 11:51:26 +0000163FINAL_VENDOR_DEFAULT_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000164FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
Anton Hansson30851f22019-02-21 11:51:26 +0000165ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
166 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
167endif
168
169ifdef TARGET_2ND_ARCH
Anton Hansson71b7f7f2019-02-21 11:36:37 +0000170 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME)
Anton Hansson30851f22019-02-21 11:51:26 +0000171 ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),)
172 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
173 endif
174endif
175
Tao Bao5f999232018-09-04 11:42:53 -0700176# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger
177# mode (via libminui).
178ifdef TARGET_RECOVERY_DEFAULT_ROTATION
179FINAL_VENDOR_DEFAULT_PROPERTIES += \
180 ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION)
181endif
182ifdef TARGET_RECOVERY_OVERSCAN_PERCENT
183FINAL_VENDOR_DEFAULT_PROPERTIES += \
184 ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT)
185endif
186ifdef TARGET_RECOVERY_PIXEL_FORMAT
187FINAL_VENDOR_DEFAULT_PROPERTIES += \
188 ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT)
189endif
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900190FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
191 $(FINAL_VENDOR_DEFAULT_PROPERTIES),=)
192
193# -----------------------------------------------------------------
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800194# prop.default
Anton Hansson1f8729e2018-08-15 12:11:55 +0100195
196BUILDINFO_SH := build/make/tools/buildinfo.sh
197BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
Anton Hanssonee4c9702018-12-21 15:36:00 +0000198
199# Generates a set of sysprops common to all partitions to a file.
Anton Hansson1f8729e2018-08-15 12:11:55 +0100200# $(1): Partition name
201# $(2): Output file name
202define generate-common-build-props
Anton Hanssonee4c9702018-12-21 15:36:00 +0000203 PRODUCT_BRAND="$(PRODUCT_BRAND)" \
204 PRODUCT_DEVICE="$(TARGET_DEVICE)" \
205 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
206 PRODUCT_MODEL="$(PRODUCT_MODEL)" \
207 PRODUCT_NAME="$(TARGET_PRODUCT)" \
208 $(call generate-common-build-props-with-product-vars-set,$(1),$(2))
209endef
210
211# Like the above macro, but requiring the relevant PRODUCT_ environment
212# variables to be set when called.
213define generate-common-build-props-with-product-vars-set
Anton Hansson1f8729e2018-08-15 12:11:55 +0100214 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \
215 BUILD_ID="$(BUILD_ID)" \
216 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
217 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
218 DATE="$(DATE_FROM_FILE)" \
219 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
220 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
Anton Hansson1f8729e2018-08-15 12:11:55 +0100221 TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson1f8729e2018-08-15 12:11:55 +0100222 bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2)
223endef
224
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800225ifdef property_overrides_split_enabled
226INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800227INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop
228ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
229$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800230else
231# legacy path
The Android Open Source Project88b60792009-03-03 19:28:42 -0800232INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800233endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800234ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900235FINAL_DEFAULT_PROPERTIES := \
Jaekyun Seokb31b9ba2017-11-03 15:18:55 +0900236 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \
237 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES))
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900238ifndef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900239 FINAL_DEFAULT_PROPERTIES += \
Jaekyun Seokc227ce72018-02-08 07:19:55 +0900240 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES))
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900241endif
Jaekyun Seok294286d2017-01-20 13:17:12 +0900242FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
243 $(FINAL_DEFAULT_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800244
Andres Moralesb8876e12015-05-06 20:44:22 -0700245intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
246
Anton Hansson1f8729e2018-08-15 12:11:55 +0100247$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800248 @echo Target buildinfo: $@
249 @mkdir -p $(dir $@)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800250 @rm -f $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800251 $(hide) echo "#" > $@; \
252 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \
253 echo "#" >> $@;
Jaekyun Seok294286d2017-01-20 13:17:12 +0900254 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000255 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800256 $(hide) build/make/tools/post_process_props.py $@
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800257ifdef property_overrides_split_enabled
258 $(hide) mkdir -p $(TARGET_ROOT_OUT)
Hung-ying Tyanb260f0d2017-07-13 17:04:10 +0800259 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
Hung-ying Tyanf829b402017-05-01 21:56:26 +0800260endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800261
262# -----------------------------------------------------------------
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900263# vendor default.prop
264INSTALLED_VENDOR_DEFAULT_PROP_TARGET :=
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900265ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900266INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
267ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
268
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900269$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
270 @echo Target buildinfo: $@
271 @mkdir -p $(dir $@)
272 $(hide) echo "#" > $@; \
273 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \
274 echo "#" >> $@;
275 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000276 echo "$(line)" >> $@;)
Colin Crossfdea8932017-12-06 14:38:40 -0800277 $(hide) build/make/tools/post_process_props.py $@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900278
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900279endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900280
281# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800282# build.prop
283INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
284ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900285FINAL_BUILD_PROPERTIES := \
Ying Wang7e8d4422011-06-17 17:05:35 -0700286 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
Jaekyun Seok294286d2017-01-20 13:17:12 +0900287FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
288 $(FINAL_BUILD_PROPERTIES),=)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800289
290# A list of arbitrary tags describing the build configuration.
291# Force ":=" so we can use +=
292BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS)
293ifeq ($(TARGET_BUILD_TYPE),debug)
294 BUILD_VERSION_TAGS += debug
295endif
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700296# The "test-keys" tag marks builds signed with the old test keys,
297# which are available in the SDK. "dev-keys" marks builds signed with
298# non-default dev keys (usually private keys from a vendor directory).
299# Both of these tags will be removed and replaced with "release-keys"
300# when the target-files is signed in a post-build step.
Dan Willemsen0ab1be62019-04-09 21:35:37 -0700301ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey)
Doug Zongkera8608a72013-07-23 11:51:04 -0700302BUILD_KEYS := test-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700303else
Doug Zongkera8608a72013-07-23 11:51:04 -0700304BUILD_KEYS := dev-keys
Doug Zongker49c6a2b2011-10-05 12:41:56 -0700305endif
Doug Zongkera8608a72013-07-23 11:51:04 -0700306BUILD_VERSION_TAGS += $(BUILD_KEYS)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800307BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS)))
308
309# A human-readable string that descibes this build in detail.
Colin Crossf37b4552015-07-16 17:15:19 -0700310build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS)
Andres Moralesb8876e12015-05-06 20:44:22 -0700311$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800312
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700313# 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 -0800314ifeq (,$(strip $(BUILD_FINGERPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800315 ifeq ($(strip $(HAS_BUILD_NUMBER)),false)
Dan Willemsen63e48db2019-01-02 12:27:43 -0800316 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M)
Ying Wang50367cc2014-06-12 18:42:53 -0700317 else
Nan Zhang0abdb582018-02-20 17:00:39 -0800318 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE))
Ying Wang50367cc2014-06-12 18:42:53 -0700319 endif
320 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 -0800321endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800322# unset it for safety.
323BF_BUILD_NUMBER :=
The Android Open Source Project88b60792009-03-03 19:28:42 -0800324
Nan Zhang0abdb582018-02-20 17:00:39 -0800325BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt
326ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE)))
327 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))")
328endif
329BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE))
330# unset it for safety.
331BUILD_FINGERPRINT :=
Colin Crossf37b4552015-07-16 17:15:19 -0700332
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700333# The string used to uniquely identify the system build; used by the OTA server.
334# This purposefully excludes any product-specific variables.
335ifeq (,$(strip $(BUILD_THUMBPRINT)))
Nan Zhang0abdb582018-02-20 17:00:39 -0800336 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700337endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800338
339BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt
340ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE)))
341 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))")
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700342endif
Nan Zhang0abdb582018-02-20 17:00:39 -0800343BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE))
344# unset it for safety.
345BUILD_THUMBPRINT :=
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700346
Ying Wange24e17a2014-10-07 18:42:11 -0700347KNOWN_OEM_THUMBPRINT_PROPERTIES := \
348 ro.product.brand \
349 ro.product.name \
350 ro.product.device
351OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\
Anton Hansson8dab0a62019-03-28 15:45:40 +0000352 $(PRODUCT_OEM_PROPERTIES))
Ying Wange24e17a2014-10-07 18:42:11 -0700353
Sriram Raman7b641242009-03-24 22:40:59 -0700354# Display parameters shown under Settings -> About Phone
355ifeq ($(TARGET_BUILD_VARIANT),user)
356 # User builds should show:
357 # release build number or branch.buld_number non-release builds
358
359 # Dev. branches should have DISPLAY_BUILD_NUMBER set
Colin Cross63fe36a2017-02-21 17:23:02 -0800360 ifeq (true,$(DISPLAY_BUILD_NUMBER))
Colin Crossf37b4552015-07-16 17:15:19 -0700361 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700362 else
Doug Zongkera8608a72013-07-23 11:51:04 -0700363 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS)
Sriram Raman7b641242009-03-24 22:40:59 -0700364 endif
365else
366 # Non-user builds should show detailed build information
367 BUILD_DISPLAY_ID := $(build_desc)
368endif
369
Narayan Kamathbaf3eb92015-01-15 18:16:24 +0000370# Accepts a whitespace separated list of product locales such as
371# (en_US en_AU en_GB...) and returns the first locale in the list with
372# underscores replaced with hyphens. In the example above, this will
373# return "en-US".
374define get-default-product-locale
375$(strip $(subst _,-, $(firstword $(1))))
The Android Open Source Project88b60792009-03-03 19:28:42 -0800376endef
377
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700378# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test
379# harness to distinguish builds. Only add _asan for a sanitized build
380# if it isn't already a part of the flavor (via a dedicated lunch
381# config for example).
Ying Wang21ec03d2015-10-28 18:45:03 -0700382TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)
Ivan Lozano0f71db32017-08-14 07:57:37 -0700383ifneq (, $(filter address, $(SANITIZE_TARGET)))
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700384ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR)))
Ying Wang21ec03d2015-10-28 18:45:03 -0700385TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan
386endif
Vishwath Mohan9ebc2782017-05-09 09:54:49 -0700387endif
Ying Wang21ec03d2015-10-28 18:45:03 -0700388
Andrew Boiefa61ff02012-09-28 09:33:45 -0700389ifdef TARGET_SYSTEM_PROP
390system_prop_file := $(TARGET_SYSTEM_PROP)
391else
392system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
393endif
Colin Crossd60401a2019-04-18 14:46:48 -0700394$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800395 @echo Target buildinfo: $@
396 @mkdir -p $(dir $@)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700397 $(hide) echo > $@
Anton Hansson8dab0a62019-03-28 15:45:40 +0000398ifneq ($(PRODUCT_OEM_PROPERTIES),)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700399 $(hide) echo "#" >> $@; \
400 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \
Jeff Sharkey26e1a282014-03-21 16:20:05 -0700401 echo "#" >> $@;
Anton Hansson8dab0a62019-03-28 15:45:40 +0000402 $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000403 echo "import /oem/oem.prop $(prop)" >> $@;)
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700404endif
Anton Hanssonee4c9702018-12-21 15:36:00 +0000405 $(hide) PRODUCT_BRAND="$(PRODUCT_SYSTEM_BRAND)" \
406 PRODUCT_MANUFACTURER="$(PRODUCT_SYSTEM_MANUFACTURER)" \
407 PRODUCT_MODEL="$(PRODUCT_SYSTEM_MODEL)" \
408 PRODUCT_NAME="$(PRODUCT_SYSTEM_NAME)" \
409 PRODUCT_DEVICE="$(PRODUCT_SYSTEM_DEVICE)" \
410 $(call generate-common-build-props-with-product-vars-set,system,$@)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800411 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000412 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
413 TARGET_DEVICE="$(TARGET_DEVICE)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000414 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
415 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000416 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
417 BUILD_ID="$(BUILD_ID)" \
418 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \
419 DATE="$(DATE_FROM_FILE)" \
Dan Willemsen63e48db2019-01-02 12:27:43 -0800420 BUILD_USERNAME="$(BUILD_USERNAME)" \
421 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000422 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
423 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000424 PLATFORM_VERSION="$(PLATFORM_VERSION)" \
425 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \
426 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \
427 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
428 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \
Colin Crossd60401a2019-04-18 14:46:48 -0700429 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \
Anton Hansson6d814982018-11-26 18:12:05 +0000430 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \
431 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \
432 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \
433 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
Anton Hansson6d814982018-11-26 18:12:05 +0000434 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \
435 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \
436 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \
437 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
438 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
439 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
Jeff Sharkey26d22f72014-03-18 17:20:10 -0700440 bash $(BUILDINFO_SH) >> $@
Johan Redestig674a27d2012-04-12 17:00:58 +0200441 $(hide) $(foreach file,$(system_prop_file), \
Anton Hansson6d814982018-11-26 18:12:05 +0000442 if [ -f "$(file)" ]; then \
443 echo Target buildinfo from: "$(file)"; \
444 echo "" >> $@; \
445 echo "#" >> $@; \
446 echo "# from $(file)" >> $@; \
447 echo "#" >> $@; \
448 cat $(file) >> $@; \
449 echo "# end of $(file)" >> $@; \
450 fi;)
Jaekyun Seok294286d2017-01-20 13:17:12 +0900451 $(if $(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000452 $(hide) echo >> $@; \
453 echo "#" >> $@; \
454 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \
455 echo "#" >> $@; )
Jaekyun Seok294286d2017-01-20 13:17:12 +0900456 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000457 echo "$(line)" >> $@;)
Anton Hansson8dab0a62019-03-28 15:45:40 +0000458 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800459
460build_desc :=
461
Andres Moralesb8876e12015-05-06 20:44:22 -0700462INSTALLED_RECOVERYIMAGE_TARGET :=
Chris Grossa784ef12019-04-22 11:09:57 -0700463ifdef BUILDING_RECOVERY_IMAGE
464ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
465INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
466endif
Andres Moralesb8876e12015-05-06 20:44:22 -0700467endif
468
Jooyung Han72b65ab2019-05-23 19:48:13 +0900469$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop)
Andres Moralesb8876e12015-05-06 20:44:22 -0700470 @echo "Target build info: $@"
Steven Morelandec082652017-10-22 02:11:47 -0700471 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
Andres Moralesb8876e12015-05-06 20:44:22 -0700472
The Android Open Source Project88b60792009-03-03 19:28:42 -0800473# -----------------------------------------------------------------
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700474# vendor build.prop
475#
Alex Naidis47e24e92016-01-10 14:18:54 +0000476# For verifying that the vendor build is what we think it is
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700477INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop
478ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900479
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900480ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900481FINAL_VENDOR_BUILD_PROPERTIES += \
482 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES))
483FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
484 $(FINAL_VENDOR_BUILD_PROPERTIES),=)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900485endif # property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900486
Anton Hansson1f8729e2018-08-15 12:11:55 +0100487$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700488 @echo Target vendor buildinfo: $@
489 @mkdir -p $(dir $@)
490 $(hide) echo > $@
Hridya Valsaraju1fd498d2019-05-07 10:28:49 -0700491ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
492 $(hide) echo ro.boot.dynamic_partitions=true >> $@
493endif
494ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
495 $(hide) echo ro.boot.dynamic_partitions_retrofit=true >> $@
496endif
Sandeep Patil127f5012017-10-23 19:47:43 -0700497 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true
Max Biresa1749982018-03-28 15:48:13 -0700498 $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@
Isaac Chen8d11feb2018-01-31 14:27:37 +0800499 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
500 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
501 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100502 $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@
503 $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@
Anton Hansson45a40da2019-01-18 14:06:34 +0000504ifdef TARGET_SCREEN_DENSITY
505 $(hide) echo ro.sf.lcd_density="$(TARGET_SCREEN_DENSITY)">>$@
506endif
Tao Bao67932ab2019-04-19 00:09:16 -0700507ifeq ($(AB_OTA_UPDATER),true)
508 $(hide) echo ro.build.ab_update=true >> $@
509endif
Anton Hansson1f8729e2018-08-15 12:11:55 +0100510 $(hide) $(call generate-common-build-props,vendor,$@)
Anton Hansson15794ca2019-04-08 17:47:35 +0100511 $(hide) echo "#" >> $@; \
512 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \
513 echo "#" >> $@;
Anton Hanssonf2998892019-04-29 15:39:10 +0100514 $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@
515 $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@
516 $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900517 $(hide) echo "#" >> $@; \
518 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \
519 echo "#" >> $@;
Anton Hanssonc65ebaf2019-04-09 16:21:51 +0100520 $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@
521ifdef property_overrides_split_enabled
Jaekyun Seok8bee1202017-01-31 20:07:02 +0900522 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000523 echo "$(line)" >> $@;)
Jaekyun Seokfbc07f92017-03-03 12:40:21 +0900524endif # property_overrides_split_enabled
Anton Hansson8dab0a62019-03-28 15:45:40 +0000525 $(hide) build/make/tools/post_process_props.py $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700526
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900527# -----------------------------------------------------------------
528# product build.prop
529INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
530ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
531
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000532ifdef TARGET_PRODUCT_PROP
533product_prop_files := $(TARGET_PRODUCT_PROP)
534else
535product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop)
536endif
537
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900538FINAL_PRODUCT_PROPERTIES += \
Yifan Hongaf9e7f02018-07-27 13:11:50 -0700539 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900540FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
541 $(FINAL_PRODUCT_PROPERTIES),=)
542
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000543$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900544 @echo Target product buildinfo: $@
545 @mkdir -p $(dir $@)
546 $(hide) echo > $@
547ifdef BOARD_USES_PRODUCTIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100548 $(hide) $(call generate-common-build-props,product,$@)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900549endif # BOARD_USES_PRODUCTIMAGE
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000550 $(hide) $(foreach file,$(product_prop_files), \
Anton Hansson6d814982018-11-26 18:12:05 +0000551 if [ -f "$(file)" ]; then \
552 echo Target product properties from: "$(file)"; \
553 echo "" >> $@; \
554 echo "#" >> $@; \
555 echo "# from $(file)" >> $@; \
556 echo "#" >> $@; \
557 cat $(file) >> $@; \
558 echo "# end of $(file)" >> $@; \
559 fi;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900560 $(hide) echo "#" >> $@; \
561 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \
Anton Hansson5ac408b2018-11-05 17:29:28 +0000562 echo "#" >> $@; \
Anton Hanssone9ee80e2018-11-22 15:27:35 +0000563 echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900564 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000565 echo "$(line)" >> $@;)
Jaekyun Seokb7735d82017-11-27 17:04:47 +0900566 $(hide) build/make/tools/post_process_props.py $@
567
Andres Morales9c820f82015-01-13 15:30:34 -0800568# ----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800569# odm build.prop
Bowgo Tsai71a4d5c2019-05-17 23:21:48 +0800570INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800571ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
572
573FINAL_ODM_BUILD_PROPERTIES += \
574 $(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES))
575FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
576 $(FINAL_ODM_BUILD_PROPERTIES),=)
577
Anton Hansson1f8729e2018-08-15 12:11:55 +0100578$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800579 @echo Target odm buildinfo: $@
580 @mkdir -p $(dir $@)
581 $(hide) echo > $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800582 $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
583 $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
584 $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
Anton Hansson1f8729e2018-08-15 12:11:55 +0100585 $(hide) $(call generate-common-build-props,odm,$@)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800586 $(hide) echo "#" >> $@; \
587 echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \
588 echo "#" >> $@;
589 $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000590 echo "$(line)" >> $@;)
Bowgo Tsaid624fa62017-11-14 23:42:30 +0800591 $(hide) build/make/tools/post_process_props.py $@
Andres Morales9c820f82015-01-13 15:30:34 -0800592
Daniel Rosenberg40b61ca2014-07-21 17:21:20 -0700593# -----------------------------------------------------------------
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000594# product_services build.prop (unless it's merged into /product)
595ifdef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
596 ifneq (,$(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
597 $(error PRODUCT_PRODUCT_SERVICES_PROPERTIES is not supported in this build.)
598 endif
599else
Dario Freni5f681e12018-05-29 13:09:01 +0100600INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
601ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
602
603FINAL_PRODUCT_SERVICES_PROPERTIES += \
604 $(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
605FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
606 $(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
Anton Hansson1f8729e2018-08-15 12:11:55 +0100607$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
Dario Freni924af7d2018-08-17 00:56:14 +0100608 @echo Target product_services buildinfo: $@
Dario Freni5f681e12018-05-29 13:09:01 +0100609 @mkdir -p $(dir $@)
610 $(hide) echo > $@
611ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Anton Hansson1f8729e2018-08-15 12:11:55 +0100612 $(hide) $(call generate-common-build-props,product_services,$@)
Dario Freni5f681e12018-05-29 13:09:01 +0100613endif # BOARD_USES_PRODUCT_SERVICESIMAGE
614 $(hide) echo "#" >> $@; \
615 echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
616 echo "#" >> $@;
617 $(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
Anton Hansson6d814982018-11-26 18:12:05 +0000618 echo "$(line)" >> $@;)
Dario Freni5f681e12018-05-29 13:09:01 +0100619 $(hide) build/make/tools/post_process_props.py $@
Anton Hanssond26e4ee2019-01-28 17:49:00 +0000620endif # MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Dario Freni5f681e12018-05-29 13:09:01 +0100621
622# ----------------------------------------------------------------
623
624# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800625# sdk-build.prop
626#
627# There are certain things in build.prop that we don't want to
628# ship with the sdk; remove them.
629
630# This must be a list of entire property keys followed by
631# "=" characters, without any internal spaces.
632sdk_build_prop_remove := \
633 ro.build.user= \
634 ro.build.host= \
635 ro.product.brand= \
636 ro.product.manufacturer= \
637 ro.product.device=
638# TODO: Remove this soon-to-be obsolete property
639sdk_build_prop_remove += ro.build.product=
640INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop
641$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET)
642 @echo SDK buildinfo: $@
643 @mkdir -p $(dir $@)
644 $(hide) grep -v "$(subst $(space),\|,$(strip \
Anton Hansson6d814982018-11-26 18:12:05 +0000645 $(sdk_build_prop_remove)))" $< > $@.tmp
The Android Open Source Project88b60792009-03-03 19:28:42 -0800646 $(hide) for x in $(sdk_build_prop_remove); do \
Anton Hansson6d814982018-11-26 18:12:05 +0000647 echo "$$x"generic >> $@.tmp; done
The Android Open Source Project88b60792009-03-03 19:28:42 -0800648 $(hide) mv $@.tmp $@
649
650# -----------------------------------------------------------------
Colin Cross4f60e362019-06-05 11:53:43 -0700651# kernel modules
652
653# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
654DEPMOD_STAGING_SUBDIR :=$= lib/modules/0.0
655
656# $(1): modules list
657# $(2): output dir
658# $(3): mount point
659# $(4): staging dir
660# Returns the a list of src:dest pairs to install the modules using copy-many-files.
661define build-image-kernel-modules
662 $(foreach module,$(1),$(module):$(2)/lib/modules/$(notdir $(module))) \
663 $(eval $(call build-image-kernel-modules-depmod,$(1),$(2),$(3),$(4))) \
664 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep:$(2)/lib/modules/modules.dep \
665 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.alias:$(2)/lib/modules/modules.alias
666endef
667
668# $(1): modules list
669# $(2): output dir
670# $(3): mount point
671# $(4): staging dir
672define build-image-kernel-modules-depmod
673$(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: .KATI_IMPLICIT_OUTPUTS := $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.alias
674$(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(DEPMOD)
675$(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULES := $(1)
676$(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_OUTPUT_DIR := $(2)
677$(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MOUNT_POINT := $(3)
678$(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_STAGING_DIR := $(4)
679$(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1)
680 @echo depmod $$(PRIVATE_STAGING_DIR)
681 rm -rf $$(PRIVATE_STAGING_DIR)
682 mkdir -p $$(PRIVATE_STAGING_DIR)/$$(DEPMOD_STAGING_SUBDIR)/$$(PRIVATE_MOUNT_POINT)/lib/modules
683 cp $$(PRIVATE_MODULES) $$(PRIVATE_STAGING_DIR)/$$(DEPMOD_STAGING_SUBDIR)/$$(PRIVATE_MOUNT_POINT)/lib/modules
684 $(DEPMOD) -b $$(PRIVATE_STAGING_DIR) 0.0
685 # Turn paths in modules.dep into absolute paths
686 sed -i.tmp -e 's|\([^: ]*/lib/modules/[^: ]*\)|/\1|g' $$(PRIVATE_STAGING_DIR)/$$(DEPMOD_STAGING_SUBDIR)/modules.dep
687endef
688
689ifdef BOARD_RECOVERY_KERNEL_MODULES
690 ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
691endif
692
693ifdef BOARD_VENDOR_KERNEL_MODULES
694 ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor,$(call intermediates-dir-for,PACKAGING,depmod_vendor)))
695endif
696
697ifdef BOARD_ODM_KERNEL_MODULES
698 ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm,$(call intermediates-dir-for,PACKAGING,depmod_odm)))
699endif
700
701# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -0800702# package stats
Bill Peckhamd52fd9b2019-04-16 10:06:13 -0700703ifdef BUILDING_SYSTEM_IMAGE
704
The Android Open Source Project88b60792009-03-03 19:28:42 -0800705PACKAGE_STATS_FILE := $(PRODUCT_OUT)/package-stats.txt
706PACKAGES_TO_STAT := \
707 $(sort $(filter $(TARGET_OUT)/% $(TARGET_OUT_DATA)/%, \
708 $(filter %.jar %.apk, $(ALL_DEFAULT_INSTALLED_MODULES))))
709$(PACKAGE_STATS_FILE): $(PACKAGES_TO_STAT)
710 @echo Package stats: $@
711 @mkdir -p $(dir $@)
712 $(hide) rm -f $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700713ifeq ($(PACKAGES_TO_STAT),)
714# Create empty package stats file if target builds no jar(s) or apk(s).
715 $(hide) touch $@
716else
Colin Crossfdea8932017-12-06 14:38:40 -0800717 $(hide) build/make/tools/dump-package-stats $^ > $@
Gaurav Shah67c2ed32015-08-23 09:40:05 -0700718endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800719
720.PHONY: package-stats
721package-stats: $(PACKAGE_STATS_FILE)
722
Bill Peckhamd52fd9b2019-04-16 10:06:13 -0700723endif # BUILDING_SYSTEM_IMAGE
724
The Android Open Source Project88b60792009-03-03 19:28:42 -0800725# -----------------------------------------------------------------
726# Cert-to-package mapping. Used by the post-build signing tools.
Ying Wangd9a88d52012-10-26 09:21:28 -0700727# Use a macro to add newline to each echo command
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100728define _apkcerts_write_line
729$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $5
730$(if $(4), $(hide) echo -n ' compressed="$4"' >> $5)
731$(hide) echo '' >> $5
Ying Wangd9a88d52012-10-26 09:21:28 -0700732
733endef
734
The Android Open Source Project88b60792009-03-03 19:28:42 -0800735name := $(TARGET_PRODUCT)
736ifeq ($(TARGET_BUILD_TYPE),debug)
737 name := $(name)_debug
738endif
739name := $(name)-apkcerts-$(FILE_NAME_TAG)
740intermediates := \
741 $(call intermediates-dir-for,PACKAGING,apkcerts)
742APKCERTS_FILE := $(intermediates)/$(name).txt
Ying Wang15e487a2011-02-15 10:56:18 -0800743# We don't need to really build all the modules.
744# TODO: rebuild APKCERTS_FILE if any app change its cert.
Ying Wangefb21682010-07-23 16:42:13 -0700745$(APKCERTS_FILE):
The Android Open Source Project88b60792009-03-03 19:28:42 -0800746 @echo APK certs list: $@
747 @mkdir -p $(dir $@)
748 @rm -f $@
Chris Grossfabf50a2019-05-02 12:42:09 -0700749 $(foreach p,$(sort $(PACKAGES)),\
Ying Wangd9a88d52012-10-26 09:21:28 -0700750 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\
Narayan Kamath6a4bd692017-08-14 10:53:50 +0100751 $(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
752 $(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
Ying Wangd9a88d52012-10-26 09:21:28 -0700753 # In case value of PACKAGES is empty.
Ying Wangf272cd62011-09-26 12:05:06 -0700754 $(hide) touch $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800755
756.PHONY: apkcerts-list
757apkcerts-list: $(APKCERTS_FILE)
758
Ying Wang15e487a2011-02-15 10:56:18 -0800759ifneq (,$(TARGET_BUILD_APPS))
760 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt)
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900761 $(call dist-for-goals, apps_only, $(SOONG_APEX_KEYS_FILE):apexkeys.txt)
Ying Wang15e487a2011-02-15 10:56:18 -0800762endif
Ying Wangefb21682010-07-23 16:42:13 -0700763
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +0900764
The Android Open Source Project88b60792009-03-03 19:28:42 -0800765# -----------------------------------------------------------------
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700766# build system stats
767BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt
768$(BUILD_SYSTEM_STATS):
769 @rm -f $@
770 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;)
771 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;)
772$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS))
Doug Zongker8678df42009-06-15 14:30:14 -0700773
Dan Willemsen3bf15e72016-07-25 16:03:53 -0700774# -----------------------------------------------------------------
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800775# build /product/etc/security/avb/system_other.avbpubkey if needed
776ifdef BUILDING_SYSTEM_OTHER_IMAGE
Bowgo Tsai8802b712019-03-21 14:24:31 +0800777ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800778INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET := $(TARGET_OUT_PRODUCT_ETC)/security/avb/system_other.avbpubkey
779ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET)
Bowgo Tsai8802b712019-03-21 14:24:31 +0800780endif # BOARD_AVB_ENABLE
Bowgo Tsaie4544b12019-02-27 10:15:51 +0800781endif # BUILDING_SYSTEM_OTHER_IMAGE
782
783# -----------------------------------------------------------------
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700784# Modules ready to be converted to Soong, ordered by how many
785# modules depend on them.
786SOONG_CONV := $(sort $(SOONG_CONV))
787SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data
788$(SOONG_CONV_DATA):
789 @rm -f $@
Colin Cross3277ba32017-12-06 14:37:06 -0800790 @$(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 -0700791
Colin Crossfdea8932017-12-06 14:38:40 -0800792SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py
Dan Willemsenfc92fb22016-08-26 13:27:13 -0700793SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt
794$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT)
795 @rm -f $@
796 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@
797$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT))
798
799# -----------------------------------------------------------------
Chih-Hung Hsieh1876acd2017-11-06 10:47:24 -0800800# Modules use -Wno-error, or added default -Wall -Werror
801WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt
802$(WALL_WERROR):
803 @rm -f $@
804 echo "# Modules using -Wno-error" >> $@
805 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 -0800806 echo "# Modules added default -Wall" >> $@
807 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done
808
809$(call dist-for-goals,droidcore,$(WALL_WERROR))
810
811# -----------------------------------------------------------------
Pirama Arumuga Nainarae959562018-01-29 09:22:24 -0800812# Modules missing profile files
813PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt
814$(PGO_PROFILE_MISSING):
815 @rm -f $@
816 echo "# Modules missing PGO profile files" >> $@
817 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done
818
819$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING))
820
821# -----------------------------------------------------------------
Ying Wang3c21fe52011-10-04 10:50:08 -0700822# The dev key is used to sign this package, and as the key required
Doug Zongker8678df42009-06-15 14:30:14 -0700823# for future OTA packages installed by this system. Actual product
824# deliverables will be re-signed by hand. We expect this file to
825# exist with the suffixes ".x509.pem" and ".pk8".
Colin Cross21122f92018-09-14 21:51:11 -0700826DEFAULT_KEY_CERT_PAIR := $(strip $(DEFAULT_SYSTEM_DEV_CERTIFICATE))
Doug Zongker8678df42009-06-15 14:30:14 -0700827
828
Jeff Browne33ba4c2011-07-11 22:11:46 -0700829# Rules that need to be present for the all targets, even
The Android Open Source Project88b60792009-03-03 19:28:42 -0800830# if they don't do anything.
831.PHONY: systemimage
832systemimage:
833
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800834# -----------------------------------------------------------------
835
836.PHONY: event-log-tags
837
Joe Onoratob7510532010-07-14 10:22:54 -0700838# Produce an event logs tag file for everything we know about, in order
839# to properly allocate numbers. Then produce a file that's filtered
840# for what's going to be installed.
841
842all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt
843
Colin Crossdc8f8e42012-04-12 13:25:54 -0700844event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
845
Joe Onoratob7510532010-07-14 10:22:54 -0700846# Include tags from all packages that we know about
847all_event_log_tags_src := \
848 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
849
Colin Crossdc8f8e42012-04-12 13:25:54 -0700850# PDK builds will already have a full list of tags that needs to get merged
851# in with the ones from source
852pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES)))
853
854$(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 -0800855$(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 -0700856 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900857 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES)
Joe Onoratob7510532010-07-14 10:22:54 -0700858
Doug Zongkera34fa952011-02-23 12:17:29 -0800859# Include tags from all packages included in this product, plus all
860# tags that are part of the system (ie, not in a vendor/ or device/
861# directory).
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800862event_log_tags_src := \
863 $(sort $(foreach m,\
Anton Hansson8dab0a62019-03-28 15:45:40 +0000864 $(PRODUCT_PACKAGES) \
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800865 $(call module-names-for-tag-list,user), \
Doug Zongkera34fa952011-02-23 12:17:29 -0800866 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
867 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800868
Colin Crossdc8f8e42012-04-12 13:25:54 -0700869$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file)
Joe Onoratob7510532010-07-14 10:22:54 -0700870$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
Colin Crossfdea8932017-12-06 14:38:40 -0800871$(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 -0800872 $(hide) mkdir -p $(dir $@)
Shinichiro Hamajid3ce14c2016-03-29 03:29:21 +0900873 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES)
Doug Zongker7e2f13b2010-02-16 16:01:43 -0800874
875event-log-tags: $(event_log_tags_file)
876
877ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
878
Joe Onoratob7510532010-07-14 10:22:54 -0700879
The Android Open Source Project88b60792009-03-03 19:28:42 -0800880# #################################################################
881# Targets for boot/OS images
882# #################################################################
Ying Wangc6349742014-01-13 16:14:20 -0800883ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true)
884 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader
885 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true)
886 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader
887 else
888 INSTALLED_2NDBOOTLOADER_TARGET :=
889 endif
890else
891 INSTALLED_BOOTLOADER_MODULE :=
892 INSTALLED_2NDBOOTLOADER_TARGET :=
893endif # TARGET_NO_BOOTLOADER
894ifneq ($(strip $(TARGET_NO_KERNEL)),true)
895 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel
896else
897 INSTALLED_KERNEL_TARGET :=
898endif
The Android Open Source Project88b60792009-03-03 19:28:42 -0800899
900# -----------------------------------------------------------------
Tom Cherryd14b8952018-08-09 14:26:00 -0700901# the root dir
902INTERNAL_ROOT_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
The Android Open Source Project88b60792009-03-03 19:28:42 -0800903 $(ALL_GENERATED_SOURCES) \
904 $(ALL_DEFAULT_INSTALLED_MODULES))
905
Luis Hector Chavezff489932018-07-03 15:41:40 -0700906INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
907INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
908$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700909$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST)
Luis Hector Chavezff489932018-07-03 15:41:40 -0700910 @echo Installed file list: $@
911 @mkdir -p $(dir $@)
912 @rm -f $@
913 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
914 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
915
916$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
917
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800918#------------------------------------------------------------------
919# dtb
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700920ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800921INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700922ifdef BOARD_PREBUILT_DTBIMAGE_DIR
Hridya Valsarajuc63a7442019-02-07 11:38:18 -0800923$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb))
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800924 cat $^ > $@
925endif
Hridya Valsaraju59eaef02019-05-20 11:10:24 -0700926endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800927
Tom Cherryd14b8952018-08-09 14:26:00 -0700928# -----------------------------------------------------------------
929# the ramdisk
Dan Willemsen67495202019-01-16 12:42:05 -0800930ifdef BUILDING_RAMDISK_IMAGE
Tom Cherryd14b8952018-08-09 14:26:00 -0700931INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \
932 $(ALL_GENERATED_SOURCES) \
933 $(ALL_DEFAULT_INSTALLED_MODULES))
934
935INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt
936INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json)
937$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK)
938$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
939 @echo Installed file list: $@
SzuWei Lin29770fa2019-03-28 11:46:48 +0800940 @mkdir -p $(TARGET_RAMDISK_OUT)
Tom Cherryd14b8952018-08-09 14:26:00 -0700941 @mkdir -p $(dir $@)
942 @rm -f $@
943 $(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json)
944 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
945
946$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
Joe Onorato64d85d02009-04-09 19:31:12 -0700947BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
948
949# We just build this directly to the install location.
950INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
Tom Cherryd14b8952018-08-09 14:26:00 -0700951$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(MINIGZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800952 $(call pretty,"Target ram disk: $@")
Tom Cherryd14b8952018-08-09 14:26:00 -0700953 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -0800954
Ying Wangad7fd292013-08-08 16:34:29 -0700955.PHONY: ramdisk-nodeps
956ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
957 @echo "make $@: ignoring dependencies"
Tom Cherryd14b8952018-08-09 14:26:00 -0700958 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800959
Dan Willemsen67495202019-01-16 12:42:05 -0800960endif # BUILDING_RAMDISK_IMAGE
961
The Android Open Source Project88b60792009-03-03 19:28:42 -0800962# -----------------------------------------------------------------
963# the boot image, which is a collection of other images.
Chris Grossa784ef12019-04-22 11:09:57 -0700964
965# This is defined here since we may be building recovery as boot
966# below and only want to define this once
967BUILT_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
968
969ifneq ($(strip $(TARGET_NO_KERNEL)),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -0800970INTERNAL_BOOTIMAGE_ARGS := \
971 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700972 --kernel $(INSTALLED_KERNEL_TARGET)
973
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -0800974ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
975 INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
976endif
977
Rom Lemarchandf9c92662015-04-08 15:11:47 -0700978ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
979INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET)
980endif
981
The Android Open Source Project88b60792009-03-03 19:28:42 -0800982INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS))
983
Dima Zavin1e0847c2009-05-07 19:43:08 -0700984ifdef BOARD_KERNEL_BASE
985 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
986endif
987
Ying Wangffff0022010-08-23 12:56:25 -0700988ifdef BOARD_KERNEL_PAGESIZE
989 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
990endif
991
Anton Hansson8dab0a62019-03-28 15:45:40 +0000992ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700993ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
Anton Hansson8dab0a62019-03-28 15:45:40 +0000994VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -0700995 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'`
996endif
997endif
998
Anton Hansson72e36f02019-02-26 17:36:30 +0000999INTERNAL_KERNEL_CMDLINE := $(strip $(INTERNAL_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID))
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001000ifdef INTERNAL_KERNEL_CMDLINE
1001INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -07001002endif
Badhri Jagan Sridharanf380da32016-05-27 09:49:49 -07001003
Sami Tolvanen3303d902016-03-15 16:49:30 +00001004INTERNAL_MKBOOTIMG_VERSION_ARGS := \
1005 --os_version $(PLATFORM_VERSION) \
1006 --os_patch_level $(PLATFORM_SECURITY_PATCH)
1007
Chris Grossa784ef12019-04-22 11:09:57 -07001008# Define these only if we are building boot
1009ifdef BUILDING_BOOT_IMAGE
1010INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
1011
The Android Open Source Project88b60792009-03-03 19:28:42 -08001012ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
JP Abgrall7bb75e42015-02-11 15:04:59 -08001013$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
David Zeuthen0eb10972016-09-28 17:55:27 -04001014
1015else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
1016
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001017$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -04001018 $(call pretty,"Target boot image: $@")
1019 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001020 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
David Zeuthen0eb10972016-09-28 17:55:27 -04001021 $(hide) $(AVBTOOL) add_hash_footer \
1022 --image $@ \
1023 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001024 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -04001025 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
1026
1027.PHONY: bootimage-nodeps
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001028bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
David Zeuthen0eb10972016-09-28 17:55:27 -04001029 @echo "make $@: ignoring dependencies"
1030 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001031 $(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 -04001032 $(hide) $(AVBTOOL) add_hash_footer \
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001033 --image $(INSTALLED_BOOTIMAGE_TARGET) \
David Zeuthen0eb10972016-09-28 17:55:27 -04001034 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001035 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \
David Zeuthen0eb10972016-09-28 17:55:27 -04001036 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)
1037
Anton Hansson8dab0a62019-03-28 15:45:40 +00001038else ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true
Geremy Condra740b6632014-07-08 20:07:41 -07001039
1040$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER)
1041 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001042 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Anton Hansson8dab0a62019-03-28 15:45:40 +00001043 $(BOOT_SIGNER) /boot $@ $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $@
Geremy Condra740b6632014-07-08 20:07:41 -07001044 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1045
1046.PHONY: bootimage-nodeps
1047bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
1048 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001049 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001050 $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET)
Geremy Condra740b6632014-07-08 20:07:41 -07001051 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1052
Anton Hansson8dab0a62019-03-28 15:45:40 +00001053else ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
David Riley17be3d32015-03-03 08:54:11 -08001054
Tao Bao4b577412017-02-22 22:54:39 -08001055$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -08001056 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001057 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
Anton Hansson8dab0a62019-03-28 15:45:40 +00001058 $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
David Riley17be3d32015-03-03 08:54:11 -08001059 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1060
1061.PHONY: bootimage-nodeps
Tao Bao4b577412017-02-22 22:54:39 -08001062bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
David Riley17be3d32015-03-03 08:54:11 -08001063 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001064 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned
Anton Hansson8dab0a62019-03-28 15:45:40 +00001065 $(VBOOT_SIGNER) $(FUTILITY) $(INSTALLED_BOOTIMAGE_TARGET).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(INSTALLED_BOOTIMAGE_TARGET).keyblock $(INSTALLED_BOOTIMAGE_TARGET)
David Riley17be3d32015-03-03 08:54:11 -08001066 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
1067
1068else # PRODUCT_SUPPORTS_VBOOT != true
The Android Open Source Project88b60792009-03-03 19:28:42 -08001069
1070$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
1071 $(call pretty,"Target boot image: $@")
Sami Tolvanen3303d902016-03-15 16:49:30 +00001072 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001073 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001074
1075.PHONY: bootimage-nodeps
1076bootimage-nodeps: $(MKBOOTIMG)
1077 @echo "make $@: ignoring dependencies"
Sami Tolvanen3303d902016-03-15 16:49:30 +00001078 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07001079 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
Ying Wangad7fd292013-08-08 16:34:29 -07001080
The Android Open Source Project88b60792009-03-03 19:28:42 -08001081endif # TARGET_BOOTIMAGE_USE_EXT2
Chris Grossa784ef12019-04-22 11:09:57 -07001082endif # BUILDING_BOOT_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08001083
Tao Baob1a2e352018-08-14 16:17:12 -07001084else # TARGET_NO_KERNEL == "true"
Michael Schwartz0dc6f212017-07-18 10:05:13 -07001085ifdef BOARD_PREBUILT_BOOTIMAGE
1086ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
1087# Remove when b/63676296 is resolved.
1088$(error Prebuilt bootimage is only supported for AB targets)
1089endif
1090$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
Tao Baob1a2e352018-08-14 16:17:12 -07001091else # BOARD_PREBUILT_BOOTIMAGE not defined
Tao Baob1a2e352018-08-14 16:17:12 -07001092INSTALLED_BOOTIMAGE_TARGET :=
1093endif # BOARD_PREBUILT_BOOTIMAGE
1094endif # TARGET_NO_KERNEL
The Android Open Source Project88b60792009-03-03 19:28:42 -08001095
1096# -----------------------------------------------------------------
1097# NOTICE files
1098#
Steve Blockd14d3b42012-03-01 11:34:41 +00001099# We are required to publish the licenses for all code under BSD, GPL and
1100# Apache licenses (and possibly other more exotic ones as well). We err on the
1101# side of caution, so the licenses for other third-party code are included here
1102# too.
1103#
The Android Open Source Project88b60792009-03-03 19:28:42 -08001104# This needs to be before the systemimage rules, because it adds to
1105# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
1106# go into the systemimage.
1107
Steve Block495e5852012-02-29 19:18:08 +00001108.PHONY: notice_files
1109
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001110# Create the rule to combine the files into text and html/xml forms
Dario Freniadc972d2018-07-09 18:38:38 +01001111# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001112# $(2) - Plain text output file
1113# $(3) - HTML/XML output file
1114# $(4) - File title
1115# $(5) - Directory to use. Notice files are all $(4)/src. Other
The Android Open Source Project88b60792009-03-03 19:28:42 -08001116# directories in there will be used for scratch
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001117# $(6) - Dependencies for the output files
The Android Open Source Project88b60792009-03-03 19:28:42 -08001118#
1119# The algorithm here is that we go collect a hash for each of the notice
1120# files and write the names of the files that match that hash. Then
1121# to generate the real files, we go print out all of the files and their
1122# hashes.
1123#
1124# These rules are fairly complex, so they depend on this makefile so if
1125# it changes, they'll run again.
1126#
1127# TODO: We could clean this up so that we just record the locations of the
1128# original notice files instead of making rules to copy them somwehere.
1129# Then we could traverse that without quite as much bash drama.
1130define combine-notice-files
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001131$(2) $(3): PRIVATE_MESSAGE := $(4)
1132$(2) $(3): PRIVATE_DIR := $(5)
1133$(2) : $(3)
Colin Crossfdea8932017-12-06 14:38:40 -08001134$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
1135 build/make/tools/generate-notice-files.py --text-output $(2) \
Anton Hansson6d814982018-11-26 18:12:05 +00001136 $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e product_services --xml-output, \
1137 $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
1138 $(if $(filter $(1),xml_product),-i product --xml-output, \
1139 $(if $(filter $(1),xml_product_services),-i product_services --xml-output, \
1140 --html-output)))) $(3) \
1141 -t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001142notice_files: $(2) $(3)
The Android Open Source Project88b60792009-03-03 19:28:42 -08001143endef
1144
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001145# Notice file logic isn't relevant for TARGET_BUILD_APPS
1146ifndef TARGET_BUILD_APPS
1147
The Android Open Source Project88b60792009-03-03 19:28:42 -08001148# TODO These intermediate NOTICE.txt/NOTICE.html files should go into
1149# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from
1150# the src subdirectory.
Steve Block495e5852012-02-29 19:18:08 +00001151target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt
Steve Block495e5852012-02-29 19:18:08 +00001152tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08001153tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001154kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt
1155winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt
1156pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001157
Steven Morelandae69e572017-12-15 14:49:55 -08001158# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior.
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001159ifneq ($(PRODUCT_NOTICE_SPLIT),true)
1160target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html
1161target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz
1162installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz
1163$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001164 $(target_notice_file_txt), \
1165 $(target_notice_file_html), \
1166 "Notices for files contained in the filesystem images in this directory:", \
1167 $(TARGET_OUT_NOTICE_FILES), \
1168 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001169$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP)
1170 $(hide) $(MINIGZIP) -9 < $< > $@
1171$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz)
1172 $(copy-file-to-target)
1173else
1174target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml
1175target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001176installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz
1177
1178target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt
1179target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml
1180target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz
1181installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz
Dario Freniadc972d2018-07-09 18:38:38 +01001182
1183target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt
1184target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml
1185target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
1186installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
Dario Frenicbca1132018-08-28 18:04:03 +01001187
1188target_product_services_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.txt
1189target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml
1190target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz
1191installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001192
Anton Hansson6ad6f6c2018-11-12 23:33:47 +00001193# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
1194# being built. A notice xml file must depend on all modules that could potentially
1195# install a license file relevant to it.
1196license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
1197# Phonys/fakes don't have notice files (though their deps might)
1198license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
1199license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
1200license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
1201license_modules_product_services := $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(license_modules))
1202license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_product_services)
1203license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001204
Dario Frenicbca1132018-08-28 18:04:03 +01001205$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
Anton Hansson6d814982018-11-26 18:12:05 +00001206 $(target_notice_file_txt), \
1207 $(target_notice_file_xml), \
1208 "Notices for files contained in the filesystem images in this directory:", \
1209 $(TARGET_OUT_NOTICE_FILES), \
1210 $(license_modules_rest)))
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001211$(eval $(call combine-notice-files, xml_vendor, \
Anton Hansson6d814982018-11-26 18:12:05 +00001212 $(target_vendor_notice_file_txt), \
1213 $(target_vendor_notice_file_xml), \
1214 "Notices for files contained in the vendor filesystem image in this directory:", \
1215 $(TARGET_OUT_NOTICE_FILES), \
1216 $(license_modules_vendor)))
Dario Freniadc972d2018-07-09 18:38:38 +01001217$(eval $(call combine-notice-files, xml_product, \
Anton Hansson6d814982018-11-26 18:12:05 +00001218 $(target_product_notice_file_txt), \
1219 $(target_product_notice_file_xml), \
1220 "Notices for files contained in the product filesystem image in this directory:", \
1221 $(TARGET_OUT_NOTICE_FILES), \
1222 $(license_modules_product)))
Dario Frenicbca1132018-08-28 18:04:03 +01001223$(eval $(call combine-notice-files, xml_product_services, \
Anton Hansson6d814982018-11-26 18:12:05 +00001224 $(target_product_services_notice_file_txt), \
1225 $(target_product_services_notice_file_xml), \
1226 "Notices for files contained in the product_services filesystem image in this directory:", \
1227 $(TARGET_OUT_NOTICE_FILES), \
1228 $(license_modules_product_services)))
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001229
1230$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
1231 $(hide) $(MINIGZIP) -9 < $< > $@
1232$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP)
1233 $(hide) $(MINIGZIP) -9 < $< > $@
1234$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
1235 $(hide) $(MINIGZIP) -9 < $< > $@
1236$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
1237 $(hide) $(MINIGZIP) -9 < $< > $@
1238$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
1239 $(copy-file-to-target)
1240$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz)
1241 $(copy-file-to-target)
1242$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
1243 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001244
1245# No notice file for product_services if its contents are merged into /product.
1246# The notices will be part of the /product notice file.
1247ifndef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001248$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
1249 $(copy-file-to-target)
Anton Hanssond26e4ee2019-01-28 17:49:00 +00001250endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001251
1252# if we've been run my mm, mmm, etc, don't reinstall this every time
1253ifeq ($(ONE_SHOT_MAKEFILE),)
1254 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
1255 ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
1256 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
1257 ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
Dario Frenicbca1132018-08-28 18:04:03 +01001258endif
Anton Hanssonbfbaa982018-11-12 23:29:13 +00001259endif # PRODUCT_NOTICE_SPLIT
1260
1261ifeq ($(ONE_SHOT_MAKEFILE),)
1262 ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001263endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08001264
Jaekyun Seok3b7560b2017-04-19 15:26:47 +09001265$(eval $(call combine-notice-files, html, \
Anton Hansson6d814982018-11-26 18:12:05 +00001266 $(tools_notice_file_txt), \
1267 $(tools_notice_file_html), \
1268 "Notices for files contained in the tools directory:", \
1269 $(HOST_OUT_NOTICE_FILES), \
1270 $(ALL_DEFAULT_INSTALLED_MODULES) \
1271 $(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001272
Ying Wang62c81f82013-08-22 20:02:03 -07001273endif # TARGET_BUILD_APPS
The Android Open Source Project88b60792009-03-03 19:28:42 -08001274
1275# The kernel isn't really a module, so to get its module file in there, we
1276# make the target NOTICE files depend on this particular file too, which will
1277# then be in the right directory for the find in combine-notice-files to work.
Dan Willemsen288bedf2019-05-28 15:36:47 -07001278$(eval $(call copy-one-file,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,$(kernel_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001279
Dan Willemsen288bedf2019-05-28 15:36:47 -07001280$(eval $(call copy-one-file,$(BUILD_SYSTEM)/WINPTHREADS_COPYING,$(winpthreads_notice_file)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001281
Doug Zongker8678df42009-06-15 14:30:14 -07001282
The Android Open Source Project88b60792009-03-03 19:28:42 -08001283# #################################################################
1284# Targets for user images
1285# #################################################################
1286
Ying Wang933abf12010-06-16 14:31:34 -07001287INTERNAL_USERIMAGES_EXT_VARIANT :=
The Android Open Source Project88b60792009-03-03 19:28:42 -08001288ifeq ($(TARGET_USERIMAGES_USE_EXT2),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001289INTERNAL_USERIMAGES_EXT_VARIANT := ext2
1290else
1291ifeq ($(TARGET_USERIMAGES_USE_EXT3),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001292INTERNAL_USERIMAGES_EXT_VARIANT := ext3
1293else
1294ifeq ($(TARGET_USERIMAGES_USE_EXT4),true)
Colin Cross0a7b2c52010-05-07 02:23:59 -07001295INTERNAL_USERIMAGES_EXT_VARIANT := ext4
1296endif
1297endif
1298endif
1299
JP Abgrall6ea5bd62014-10-22 20:01:22 -07001300# These options tell the recovery updater/installer how to mount the partitions writebale.
1301# <fstype>=<fstype_opts>[|<fstype_opts>]...
1302# fstype_opts := <opt>[,<opt>]...
1303# opt := <name>[=<value>]
JP Abgrall775b1ab2014-10-23 16:27:03 -07001304# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10
1305DEFAULT_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 -07001306
Ying Wang542903a2010-11-17 15:40:38 -08001307ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
1308 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
1309endif
1310
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001311INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
Mark Salyzyn780f5952018-10-19 13:44:36 -07001312INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK) $(TUNE2FS)
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001313ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
1314INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
1315endif
JP Abgrall5bfed5a2014-06-16 14:17:40 -07001316
Chris Friesdf0387d2017-06-21 15:51:46 -05001317ifeq ($(BOARD_AVB_ENABLE),true)
1318INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
1319endif
1320
Todd Poynorb2a555e2015-12-15 18:00:14 -08001321ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
1322 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
1323endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001324ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE) $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
Mohamad Ayyash353265b2015-06-24 15:42:19 -07001325INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
Mohamad Ayyash68946952015-03-03 12:30:37 -08001326endif
1327
Ying Wang178ef922011-10-31 18:13:30 -07001328INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08001329
Anton Hansson8dab0a62019-03-28 15:45:40 +00001330ifeq (true,$(PRODUCT_SUPPORTS_VERITY))
Tao Baob4ec6d72018-03-15 23:21:28 -07001331INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001332ifeq (true,$(PRODUCT_SUPPORTS_VERITY_FEC))
Sami Tolvanenf99b5312015-05-20 07:30:57 +01001333INTERNAL_USERIMAGES_DEPS += $(FEC)
1334endif
Geremy Condrafd6f7512013-06-16 17:26:08 -07001335endif
1336
Alex Klyubin092c9022017-03-13 13:28:34 -07001337SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
Ying Wangfdbd9cb2012-11-21 10:47:00 -08001338INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
1339
Mohamad Ayyashf8765552016-03-02 21:07:23 -08001340INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
1341
Jin Qianabcec5e2017-03-10 16:53:45 -08001342INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
Jin Qianabcec5e2017-03-10 16:53:45 -08001343
Yifan Hongc5c01242018-11-09 10:27:23 -08001344ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001345
Anton Hansson8dab0a62019-03-28 15:45:40 +00001346ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001347 $(error vboot 1.0 doesn't support logical partition)
1348endif
1349
1350# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
1351# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
1352
Yifan Hongc5c01242018-11-09 10:27:23 -08001353endif # PRODUCT_USE_DYNAMIC_PARTITIONS
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001354
Ying Wangbd93d422011-10-28 17:02:30 -07001355# $(1): the path of the output dictionary file
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001356# $(2): a subset of "system vendor cache userdata product product_services oem odm"
Yifan Hong760d3c02018-05-30 11:16:46 -07001357# $(3): additional "key=value" pairs to append to the dictionary file.
1358define generate-image-prop-dictionary
Yifan Hong760d3c02018-05-30 11:16:46 -07001359$(if $(filter $(2),system),\
1360 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
Bowgo Tsai867ab662019-01-29 13:30:18 +08001361 $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001362 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1363 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1364 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1365 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
1366 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1367 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1368 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1369 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001370 $(if $(PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
1371 $(if $(PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCT_SYSTEM_HEADROOM)" >> $(1))
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001372 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001373 $(hide) echo "system_selinux_fc=$(SELINUX_FC)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001374)
Yifan Hong760d3c02018-05-30 11:16:46 -07001375$(if $(filter $(2),userdata),\
1376 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1377 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001378 $(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001379)
Yifan Hong760d3c02018-05-30 11:16:46 -07001380$(if $(filter $(2),cache),\
1381 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1382 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001383 $(hide) echo "cache_selinux_fc=$(SELINUX_FC)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001384)
1385$(if $(filter $(2),vendor),\
1386 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1387 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1388 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
1389 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
1390 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
1391 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1392 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1393 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1394 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001395 $(if $(PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
Yifan Hong749062d2018-06-19 16:23:16 -07001396 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001397 $(hide) echo "vendor_selinux_fc=$(SELINUX_FC)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001398)
1399$(if $(filter $(2),product),\
1400 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1401 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1402 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
1403 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
1404 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
1405 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1406 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1407 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1408 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001409 $(if $(PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
Yifan Hong56a6c3b2018-07-20 15:19:34 -07001410 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001411 $(hide) echo "product_selinux_fc=$(SELINUX_FC)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001412)
Yifan Hongebc041a2018-07-26 16:02:52 -07001413$(if $(filter $(2),product_services),\
1414 $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_services_fs_type=$(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1415 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_services_extfs_inode_count=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1416 $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_services_extfs_rsv_pct=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT)" >> $(1))
1417 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),$(hide) echo "product_services_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)" >> $(1))
1418 $(if $(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE),$(hide) echo "product_services_journal_size=$(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE)" >> $(1))
1419 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_services_squashfs_compressor=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1420 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_services_squashfs_compressor_opt=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1421 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_services_squashfs_block_size=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1422 $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_services_squashfs_disable_4k_align=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
1423 $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_services_reserved_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001424 $(hide) echo "product_services_selinux_fc=$(SELINUX_FC)" >> $(1)
Dario Freni5f681e12018-05-29 13:09:01 +01001425)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001426$(if $(filter $(2),odm),\
1427 $(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
1428 $(if $(BOARD_ODMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_extfs_inode_count=$(BOARD_ODMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1429 $(if $(BOARD_ODMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_extfs_rsv_pct=$(BOARD_ODMIMAGE_EXTFS_RSV_PCT)" >> $(1))
1430 $(if $(BOARD_ODMIMAGE_PARTITION_SIZE),$(hide) echo "odm_size=$(BOARD_ODMIMAGE_PARTITION_SIZE)" >> $(1))
1431 $(if $(BOARD_ODMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_journal_size=$(BOARD_ODMIMAGE_JOURNAL_SIZE)" >> $(1))
1432 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_squashfs_compressor=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
1433 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_squashfs_compressor_opt=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
1434 $(if $(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_squashfs_block_size=$(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
1435 $(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001436 $(if $(PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCT_ODM_BASE_FS_PATH)" >> $(1))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001437 $(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001438 $(hide) echo "odm_selinux_fc=$(SELINUX_FC)" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001439)
Yifan Hong760d3c02018-05-30 11:16:46 -07001440$(if $(filter $(2),oem),\
1441 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
1442 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
1443 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
1444 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
Daniel Norman72c626f2019-05-13 15:58:14 -07001445 $(hide) echo "oem_selinux_fc=$(SELINUX_FC)" >> $(1)
Yifan Hong760d3c02018-05-30 11:16:46 -07001446)
Tao Bao3602eca2018-07-10 10:53:55 -07001447$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001448
Tao Bao3602eca2018-07-10 10:53:55 -07001449$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
Ying Wangbd93d422011-10-28 17:02:30 -07001450$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
Todd Poynorb2a555e2015-12-15 18:00:14 -08001451$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
Tao Bao3602eca2018-07-10 10:53:55 -07001452$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
1453$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
1454$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001455$(if $(PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
1456$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCT_SUPPORTS_VERITY)" >> $(1))
1457$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
1458$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1))
1459$(if $(PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1))
Bowgo Tsai6ceeb1a2017-10-11 16:21:48 +08001460$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001461$(if $(PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
1462$(if $(PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
1463$(if $(PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
1464$(if $(PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION),$(hide) echo "product_services_verity_block_device=$(PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION)" >> $(1))
1465$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCT_SUPPORTS_VBOOT)" >> $(1))
1466$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
1467$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
1468$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1))
1469$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1))
Tao Bao3cba3742017-05-16 16:27:25 -07001470$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001471$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1472$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1473$(if $(BOARD_AVB_ENABLE),\
1474 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
1475 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1)
1476 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1)
1477 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08001478$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1479$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1480$(if $(BOARD_AVB_ENABLE),\
1481 $(if $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH),\
1482 $(hide) echo "avb_system_other_key_path=$(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)" >> $(1)
Bowgo Tsaie4544b12019-02-27 10:15:51 +08001483 $(hide) echo "avb_system_other_algorithm=$(BOARD_AVB_SYSTEM_OTHER_ALGORITHM)" >> $(1)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001484$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1485$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1486$(if $(BOARD_AVB_ENABLE),\
1487 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
1488 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1)
1489 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1)
1490 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09001491$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1492$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1493$(if $(BOARD_AVB_ENABLE),\
1494 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
1495 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
1496 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
1497 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Tao Bao1ebda8d2018-08-01 17:21:14 -07001498$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_services_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1499$(if $(BOARD_AVB_ENABLE),\
1500 $(hide) echo "avb_product_services_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
Dario Freni5f681e12018-05-29 13:09:01 +01001501$(if $(BOARD_AVB_ENABLE),\
1502 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
Yifan Hongebc041a2018-07-26 16:02:52 -07001503 $(hide) echo "avb_product_services_key_path=$(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH)" >> $(1)
1504 $(hide) echo "avb_product_services_algorithm=$(BOARD_AVB_PRODUCT_SERVICES_ALGORITHM)" >> $(1)
1505 $(hide) echo "avb_product_services_rollback_index_location=$(BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001506$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
1507$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
1508$(if $(BOARD_AVB_ENABLE),\
1509 $(if $(BOARD_AVB_ODM_KEY_PATH),\
1510 $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1)
1511 $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1)
1512 $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1)))
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001513$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
1514 $(hide) echo "recovery_as_boot=true" >> $(1))
Ying Wang0eabd4f2015-03-24 19:07:40 -07001515$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
Tom Cherryd14b8952018-08-09 14:26:00 -07001516 $(hide) echo "system_root_image=true" >> $(1))
1517$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1)
Yifan Hong2dae5722018-07-31 12:47:27 -07001518$(if $(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),$(hide) echo "use_dynamic_partition_size=true" >> $(1))
Yifan Hong760d3c02018-05-30 11:16:46 -07001519$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
1520endef
1521
1522# $(1): the path of the output dictionary file
1523# $(2): additional "key=value" pairs to append to the dictionary file.
Daniel Norman72c626f2019-05-13 15:58:14 -07001524PROP_DICTIONARY_IMAGES := oem
1525ifdef BUILDING_CACHE_IMAGE
1526 PROP_DICTIONARY_IMAGES += cache
1527endif
1528ifdef BUILDING_SYSTEM_IMAGE
1529 PROP_DICTIONARY_IMAGES += system
1530endif
1531ifdef BUILDING_USERDATA_IMAGE
1532 PROP_DICTIONARY_IMAGES += userdata
1533endif
1534ifdef BUILDING_VENDOR_IMAGE
1535 PROP_DICTIONARY_IMAGES += vendor
1536endif
1537ifdef BUILDING_PRODUCT_IMAGE
1538 PROP_DICTIONARY_IMAGES += product
1539endif
1540ifdef BUILDING_PRODUCT_SERVICES_IMAGE
1541 PROP_DICTIONARY_IMAGES += product_services
1542endif
1543ifdef BUILDING_ODM_IMAGE
1544 PROP_DICTIONARY_IMAGES += odm
1545endif
Yifan Hong760d3c02018-05-30 11:16:46 -07001546define generate-userimage-prop-dictionary
Daniel Norman72c626f2019-05-13 15:58:14 -07001547 $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2))
Ying Wangbd93d422011-10-28 17:02:30 -07001548endef
1549
Yifan Hongbbcba1e2018-06-18 16:32:35 -07001550# $(1): the path of the input dictionary file, where each line has the format key=value
1551# $(2): the key to look up
1552define read-image-prop-dictionary
1553$$(grep '$(2)=' $(1) | cut -f2- -d'=')
1554endef
1555
The Android Open Source Project88b60792009-03-03 19:28:42 -08001556# -----------------------------------------------------------------
Doug Zongker4647f122009-07-02 09:00:54 -07001557# Recovery image
Doug Zongker8cebf1f2009-07-07 17:14:25 -07001558
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001559# Recovery image exists if we are building recovery, or building recovery as boot.
Chris Grossa784ef12019-04-22 11:09:57 -07001560ifdef BUILDING_RECOVERY_IMAGE
Doug Zongker4647f122009-07-02 09:00:54 -07001561
Ying Wang37526142015-03-10 12:02:57 -07001562INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
1563 $(ALL_DEFAULT_INSTALLED_MODULES))
1564
Tao Bao10fc9492018-08-14 12:17:48 -07001565INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
1566INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
1567
1568# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other
1569# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in
1570# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with
1571# the call to FILELIST.
1572ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Chris Grossa784ef12019-04-22 11:09:57 -07001573INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
Tao Bao10fc9492018-08-14 12:17:48 -07001574$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET)
1575else
1576$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET)
1577endif
1578
1579$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY)
1580$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST)
1581 @echo Installed file list: $@
1582 @mkdir -p $(dir $@)
1583 @rm -f $@
1584 $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
1585 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
1586
Doug Zongker4647f122009-07-02 09:00:54 -07001587recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001588recovery_sepolicy := \
1589 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \
Jeff Vander Stoep4ff042c2017-06-13 08:30:46 -07001590 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \
Bowgo Tsai09f88a62018-02-05 17:32:20 +08001591 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001592 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001593 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts \
Bowgo Tsai99671252017-11-30 22:15:17 +08001594 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \
Tri Vo62d51b62019-02-19 11:23:12 -08001595 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts \
1596 $(TARGET_RECOVERY_ROOT_OUT)/product_file_contexts \
1597 $(TARGET_RECOVERY_ROOT_OUT)/product_property_contexts
Bowgo Tsai99671252017-11-30 22:15:17 +08001598
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001599# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific
1600# SELinux files
1601IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy))
1602
Doug Zongker4647f122009-07-02 09:00:54 -07001603recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
1604recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
Doug Zongker4647f122009-07-02 09:00:54 -07001605recovery_resources_common := $(call include-path-for, recovery)/res
Doug Zongkere1297322013-03-06 15:04:31 -08001606
Anton Hansson45a40da2019-01-18 14:06:34 +00001607# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
1608# or mdpi, in order of preference. We support both specific buckets (e.g. xdpi) and numbers,
1609# which get remapped to a bucket.
1610recovery_density := $(or $(TARGET_SCREEN_DENSITY),$(PRODUCT_AAPT_PREF_CONFIG),mdpi)
Tao Baoe1e829e2018-08-29 20:36:00 -07001611ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density)))
1612recovery_density_value := $(patsubst %dpi,%,$(recovery_density))
Anton Hansson45a40da2019-01-18 14:06:34 +00001613# We roughly use the medium point between the primary densities to split buckets.
Tao Baoe1e829e2018-08-29 20:36:00 -07001614# ------160------240------320----------480------------640------
1615# mdpi hdpi xhdpi xxhdpi xxxhdpi
1616recovery_density := $(strip \
1617 $(or $(if $(filter $(shell echo $$(($(recovery_density_value) >= 560))),1),xxxhdpi),\
1618 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 400))),1),xxhdpi),\
1619 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
1620 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
Doug Zongker8eaeea92014-05-12 15:32:20 -07001621endif
1622
1623ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
1624recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
1625else
Doug Zongker25d55f82014-04-04 13:51:15 -07001626recovery_resources_common := $(recovery_resources_common)-xhdpi
1627endif
1628
Tao Baoe1e829e2018-08-29 20:36:00 -07001629# Select the 18x32 font on high-density devices (xhdpi and up); and the 12x22 font on other devices.
1630# Note that the font selected here can be overridden for a particular device by putting a font.png
1631# in its private recovery resources.
1632ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density)))
Doug Zongkere1297322013-03-06 15:04:31 -08001633recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
1634else
1635recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
1636endif
1637
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001638
1639# We will only generate the recovery background text images if the variable
1640# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the
1641# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for
1642# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their
1643# BoardConfig in order to use this feature.
1644ifeq ($(recovery_density),xxxhdpi)
1645TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440
1646else ifeq ($(recovery_density),xxhdpi)
1647TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080
1648endif
1649
1650ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),)
1651# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative.
1652ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),)
1653 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10))
1654else
1655 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10))
1656endif
1657
1658
1659RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png
1660RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png
1661RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png
1662RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
1663RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
1664
xunchangcc57d312018-12-07 12:12:17 -08001665RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
1666RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
1667RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
1668RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
1669RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
1670
1671generated_recovery_text_files := \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001672 $(RECOVERY_INSTALLING_TEXT_FILE) \
1673 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
1674 $(RECOVERY_ERASING_TEXT_FILE) \
1675 $(RECOVERY_ERROR_TEXT_FILE) \
xunchangcc57d312018-12-07 12:12:17 -08001676 $(RECOVERY_NO_COMMAND_TEXT_FILE) \
1677 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
1678 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
1679 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
1680 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
1681 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001682
1683resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
1684image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
xunchangcc57d312018-12-07 12:12:17 -08001685zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001686$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep)
1687$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files)
1688$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir)
1689$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar)
xunchangcc57d312018-12-07 12:12:17 -08001690$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001691$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width)
xunchangdbe55e12018-12-19 17:15:14 -08001692$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001693 recovery_installing \
1694 recovery_installing_security \
1695 recovery_erasing \
1696 recovery_error \
xunchangdbe55e12018-12-19 17:15:14 -08001697 recovery_no_command
1698$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
xunchangcc57d312018-12-07 12:12:17 -08001699 recovery_cancel_wipe_data \
1700 recovery_factory_data_reset \
1701 recovery_try_again \
1702 recovery_wipe_data_menu_header \
1703 recovery_wipe_data_confirmation
1704$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
1705$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001706 # Prepares the font directory.
1707 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR)
1708 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR)
xunchangcc57d312018-12-07 12:12:17 -08001709 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001710 @rm -rf $(dir $@)
1711 @mkdir -p $(dir $@)
xunchangdbe55e12018-12-19 17:15:14 -08001712 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
xunchangcc57d312018-12-07 12:12:17 -08001713 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
xunchangdbe55e12018-12-19 17:15:14 -08001714 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001715 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
1716 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \
1717 --text_name $(text_name) \
1718 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \
1719 --resource_dir $(PRIVATE_RESOURCE_DIR) \
xunchangdbe55e12018-12-19 17:15:14 -08001720 --output_file $(output_file) $(center_alignment) && \
xunchangcc57d312018-12-07 12:12:17 -08001721 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001722else
1723RECOVERY_INSTALLING_TEXT_FILE :=
1724RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
1725RECOVERY_ERASING_TEXT_FILE :=
1726RECOVERY_ERROR_TEXT_FILE :=
1727RECOVERY_NO_COMMAND_TEXT_FILE :=
xunchangcc57d312018-12-07 12:12:17 -08001728RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
1729RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
1730RECOVERY_TRY_AGAIN_TEXT_FILE :=
1731RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
1732RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001733endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
1734
Ying Wang9a175682015-08-06 11:47:47 -07001735ifndef TARGET_PRIVATE_RES_DIRS
1736TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
1737endif
Doug Zongker4647f122009-07-02 09:00:54 -07001738recovery_resource_deps := $(shell find $(recovery_resources_common) \
Ying Wang9a175682015-08-06 11:47:47 -07001739 $(TARGET_PRIVATE_RES_DIRS) -type f)
xunchangcc57d312018-12-07 12:12:17 -08001740recovery_resource_deps += $(generated_recovery_text_files)
Tianjie Xu81c88ad2018-11-07 11:36:19 -08001741
1742
Andrew Boiefa61ff02012-09-28 09:33:45 -07001743ifdef TARGET_RECOVERY_FSTAB
1744recovery_fstab := $(TARGET_RECOVERY_FSTAB)
1745else
Doug Zongker9ce0fb62010-09-20 18:04:41 -07001746recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab))
Andrew Boiefa61ff02012-09-28 09:33:45 -07001747endif
Tao Baoc3c17532016-06-10 10:11:54 -07001748ifdef TARGET_RECOVERY_WIPE
1749recovery_wipe := $(TARGET_RECOVERY_WIPE)
Tao Bao3051f4f2016-05-31 23:56:23 -07001750else
Tao Baoc3c17532016-06-10 10:11:54 -07001751recovery_wipe :=
Tao Bao3051f4f2016-05-31 23:56:23 -07001752endif
Tao Bao8beab692015-07-22 12:33:18 -07001753
Tao Bao6d5d6232018-03-09 17:04:42 -08001754# Traditionally with non-A/B OTA we have:
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001755# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img.
Tao Bao6d5d6232018-03-09 17:04:42 -08001756# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images
1757# and invoke install-recovery.sh on the first boot post an OTA update.
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001758#
1759# We no longer need that if one of the following conditions holds:
Tao Bao6d5d6232018-03-09 17:04:42 -08001760# a) We carry a full copy of the recovery image - no patching needed
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001761# (BOARD_USES_FULL_RECOVERY_IMAGE = true);
Tao Bao6d5d6232018-03-09 17:04:42 -08001762# b) We build a single image that contains boot and recovery both - no recovery image to install
1763# (BOARD_USES_RECOVERY_AS_BOOT = true);
Tom Cherry2929cad2018-09-20 11:04:37 -07001764# c) We mount the system image as / and therefore do not have a ramdisk in boot.img
Tao Bao6d5d6232018-03-09 17:04:42 -08001765# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true).
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001766# d) We include the recovery DTBO image within recovery - not needing the resource file as we
1767# do bsdiff because boot and recovery will contain different number of entries
1768# (BOARD_INCLUDE_RECOVERY_DTBO = true).
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001769# e) We include the recovery ACPIO image within recovery - not needing the resource file as we
1770# do bsdiff because boot and recovery will contain different number of entries
1771# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001772
Tom Cherry2929cad2018-09-20 11:04:37 -07001773ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001774 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Doug Zongker56588872012-08-20 15:38:58 -07001775# Named '.dat' so we don't attempt to use imgdiff for patching it.
1776RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
Tao Bao8beab692015-07-22 12:33:18 -07001777else
Tao Bao8beab692015-07-22 12:33:18 -07001778RECOVERY_RESOURCE_ZIP :=
1779endif
Doug Zongker4647f122009-07-02 09:00:54 -07001780
Tao Bao139c7272018-07-31 13:26:54 -07001781INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default
1782
1783$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \
Tao Bao139c7272018-07-31 13:26:54 -07001784 TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \
1785 TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \
1786 TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \
1787 TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \
1788 TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE:progress_bar_baseline \
1789 TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD:touch_low_threshold \
1790 TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD:touch_high_threshold \
1791 TARGET_RECOVERY_UI_VR_STEREO_OFFSET:vr_stereo_offset
1792
1793# Parses the given list of build variables and writes their values as build properties if defined.
1794# For example, if a target defines `TARGET_RECOVERY_UI_MARGIN_HEIGHT := 100`,
1795# `ro.recovery.ui.margin_height=100` will be appended to the given output file.
1796# $(1): Map from the build variable names to property names
1797# $(2): Output file
1798define append-recovery-ui-properties
1799echo "#" >> $(2)
1800echo "# RECOVERY UI BUILD PROPERTIES" >> $(2)
1801echo "#" >> $(2)
1802$(foreach prop,$(1), \
1803 $(eval _varname := $(call word-colon,1,$(prop))) \
1804 $(eval _propname := $(call word-colon,2,$(prop))) \
1805 $(eval _value := $($(_varname))) \
1806 $(if $(_value), \
1807 echo ro.recovery.ui.$(_propname)=$(_value) >> $(2) &&)) true
1808endef
1809
1810$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00001811 $(INSTALLED_DEFAULT_PROP_TARGET) \
1812 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
1813 $(intermediate_system_build_prop) \
1814 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
1815 $(INSTALLED_ODM_BUILD_PROP_TARGET) \
1816 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
1817 $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
Tao Bao1edaca12018-09-18 10:22:54 -07001818 @echo "Target recovery buildinfo: $@"
Tao Bao139c7272018-07-31 13:26:54 -07001819 $(hide) mkdir -p $(dir $@)
1820 $(hide) rm -f $@
1821 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@
1822 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@
Tao Bao6eb1a992018-08-06 07:33:45 -07001823 $(hide) cat $(intermediate_system_build_prop) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001824 $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
Bowgo Tsaid624fa62017-11-14 23:42:30 +08001825 $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
Tao Bao139c7272018-07-31 13:26:54 -07001826 $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
1827 $(hide) cat $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET) >> $@
1828 $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
1829
Doug Zongker4647f122009-07-02 09:00:54 -07001830INTERNAL_RECOVERYIMAGE_ARGS := \
1831 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \
1832 --kernel $(recovery_kernel) \
1833 --ramdisk $(recovery_ramdisk)
1834
1835# Assumes this has already been stripped
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07001836ifdef INTERNAL_KERNEL_CMDLINE
1837 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)"
Doug Zongker4647f122009-07-02 09:00:54 -07001838endif
1839ifdef BOARD_KERNEL_BASE
1840 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE)
1841endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07001842ifdef BOARD_KERNEL_PAGESIZE
1843 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE)
1844endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001845ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001846ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1847 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1848else
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07001849 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
1850endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001851endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001852ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1853 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO)
1854endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001855ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1856 INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
1857endif
Doug Zongker4647f122009-07-02 09:00:54 -07001858
Ying Wang747b9f12015-01-30 14:05:22 -08001859# $(1): output file
1860define build-recoveryimage-target
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001861 # Making recovery image
Ying Wang747b9f12015-01-30 14:05:22 -08001862 $(hide) mkdir -p $(TARGET_RECOVERY_OUT)
Tao Bao696bb332018-08-17 16:27:01 -07001863 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001864 # Copying baseline ramdisk...
Alex Klyubin2a7171a2017-03-10 12:53:02 -08001865 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
Tao Bao696bb332018-08-17 16:27:01 -07001866 $(hide) rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
Tomasz Wasilczyk29ec06b2017-11-15 10:34:01 -08001867 # Modifying ramdisk contents...
Tom Cherry3871f0f2018-11-06 14:23:44 -08001868 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
1869 $(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
Bowgo Tsaib5b3bc62017-09-25 17:50:41 +08001870 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
1871 $(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 -08001872 $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
Tao Baocf8853b2018-08-13 14:27:32 -07001873 $(hide) cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ 2> /dev/null || true # Ignore error when the src file doesn't exist.
Ying Wang747b9f12015-01-30 14:05:22 -08001874 $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
1875 $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
1876 $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
xunchangcc57d312018-12-07 12:12:17 -08001877 $(hide) $(foreach recovery_text_file,$(generated_recovery_text_files), \
1878 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
Ying Wang747b9f12015-01-30 14:05:22 -08001879 $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
Ying Wang9a175682015-08-06 11:47:47 -07001880 $(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
1881 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
Ying Wang747b9f12015-01-30 14:05:22 -08001882 $(hide) $(foreach item,$(recovery_fstab), \
Tao Bao696bb332018-08-17 16:27:01 -07001883 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
Tao Baoc3c17532016-06-10 10:11:54 -07001884 $(if $(strip $(recovery_wipe)), \
Tao Bao696bb332018-08-17 16:27:01 -07001885 $(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
Hung-ying Tyanf829b402017-05-01 21:56:26 +08001886 $(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
Andriy Naborskyy53105572016-07-22 11:03:31 -07001887 $(BOARD_RECOVERY_IMAGE_PREPARE)
Thierry Strudel74a81e62015-07-09 09:54:55 -07001888 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001889 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
Sami Tolvanen3303d902016-03-15 16:49:30 +00001890 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
Jooyung Han72b65ab2019-05-23 19:48:13 +09001891 $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1))
Anton Hansson8dab0a62019-03-28 15:45:40 +00001892 $(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001893 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
Anton Hansson8dab0a62019-03-28 15:45:40 +00001894 $(BOOT_SIGNER) /boot $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
1895 $(BOOT_SIGNER) /recovery $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\
Nick Desaulniersd491fcf2016-08-08 10:51:10 -07001896 )\
1897 )
Anton Hansson8dab0a62019-03-28 15:45:40 +00001898 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
1899 $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1))
Bowgo Tsai03b9c8e2017-11-17 15:22:37 +08001900 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1901 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))), \
1902 $(hide) $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))))
David Zeuthen8fecb282017-12-01 16:24:01 -05001903 $(if $(filter true,$(BOARD_AVB_ENABLE)), \
1904 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \
1905 $(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),\
1906 $(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 -08001907endef
1908
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001909ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Anton Hansson8dab0a62019-03-28 15:45:40 +00001910ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER))
Ying Wangbd07ad02016-03-10 12:57:33 -08001911$(INSTALLED_BOOTIMAGE_TARGET) : $(BOOT_SIGNER)
1912endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00001913ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Ying Wangbd07ad02016-03-10 12:57:33 -08001914$(INSTALLED_BOOTIMAGE_TARGET) : $(VBOOT_SIGNER)
1915endif
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001916ifeq (true,$(BOARD_AVB_ENABLE))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08001917$(INSTALLED_BOOTIMAGE_TARGET) : $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH)
Thierry Strudeld7bd1f22017-05-04 13:58:04 -07001918endif
Tao Baof4866c72018-08-22 14:35:09 -07001919ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001920ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1921$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1922else
Tao Baof4866c72018-08-22 14:35:09 -07001923$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
1924endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001925endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001926ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1927$(INSTALLED_BOOTIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1928endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001929ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1930$(INSTALLED_BOOTIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1931endif
Tao Baof4866c72018-08-22 14:35:09 -07001932
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001933$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001934 $(INTERNAL_ROOT_FILES) \
1935 $(INSTALLED_RAMDISK_TARGET) \
1936 $(INTERNAL_RECOVERYIMAGE_FILES) \
1937 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1938 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1939 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1940 $(recovery_resource_deps) \
Colin Cross4f60e362019-06-05 11:53:43 -07001941 $(recovery_fstab)
Tao Baof4866c72018-08-22 14:35:09 -07001942 $(call pretty,"Target boot image from recovery: $@")
1943 $(call build-recoveryimage-target, $@)
1944endif # BOARD_USES_RECOVERY_AS_BOOT
1945
1946ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08001947ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
1948$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE)
1949else
Tao Baof4866c72018-08-22 14:35:09 -07001950$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001951endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08001952endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08001953ifdef BOARD_INCLUDE_RECOVERY_ACPIO
1954$(INSTALLED_RECOVERYIMAGE_TARGET): $(BOARD_RECOVERY_ACPIO)
1955endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08001956ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
1957$(INSTALLED_RECOVERYIMAGE_TARGET): $(INSTALLED_DTBIMAGE_TARGET)
1958endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08001959
Jiyong Parkce3e34f2018-05-24 14:24:50 +09001960$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \
Anton Hansson6d814982018-11-26 18:12:05 +00001961 $(INTERNAL_ROOT_FILES) \
1962 $(INSTALLED_RAMDISK_TARGET) \
1963 $(INSTALLED_BOOTIMAGE_TARGET) \
1964 $(INTERNAL_RECOVERYIMAGE_FILES) \
1965 $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
1966 $(INSTALLED_2NDBOOTLOADER_TARGET) \
1967 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
1968 $(recovery_resource_deps) \
Colin Cross4f60e362019-06-05 11:53:43 -07001969 $(recovery_fstab)
Tao Baof4866c72018-08-22 14:35:09 -07001970 $(call build-recoveryimage-target, $@)
Doug Zongker4647f122009-07-02 09:00:54 -07001971
Tao Bao4594d0e2015-12-22 09:47:46 -08001972ifdef RECOVERY_RESOURCE_ZIP
Dan Willemsen48a621c2015-10-29 16:33:05 -07001973$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
Doug Zongker1a097262012-09-04 14:45:11 -07001974 $(hide) mkdir -p $(dir $@)
Dan Willemsen48a621c2015-10-29 16:33:05 -07001975 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@
1976 $(remove-timestamps-from-package)
Tao Bao8beab692015-07-22 12:33:18 -07001977endif
Doug Zongker56588872012-08-20 15:38:58 -07001978
Ying Wang747b9f12015-01-30 14:05:22 -08001979.PHONY: recoveryimage-nodeps
1980recoveryimage-nodeps:
1981 @echo "make $@: ignoring dependencies"
1982 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
1983
Chris Grossa784ef12019-04-22 11:09:57 -07001984else # BUILDING_RECOVERY_IMAGE
Doug Zongker56588872012-08-20 15:38:58 -07001985RECOVERY_RESOURCE_ZIP :=
Chris Grossa784ef12019-04-22 11:09:57 -07001986endif # BUILDING_RECOVERY_IMAGE
Doug Zongker4647f122009-07-02 09:00:54 -07001987
1988.PHONY: recoveryimage
Doug Zongker56588872012-08-20 15:38:58 -07001989recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP)
Doug Zongker4647f122009-07-02 09:00:54 -07001990
Jiyong Park03eb0612017-10-04 21:22:41 +09001991ifneq ($(BOARD_NAND_PAGE_SIZE),)
1992$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.)
Dima Zavin11818982010-02-05 13:34:34 -08001993endif
1994
Jiyong Park03eb0612017-10-04 21:22:41 +09001995ifneq ($(BOARD_NAND_SPARE_SIZE),)
1996$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
Naseer Ahmed53871882010-08-06 12:19:29 -07001997endif
1998
Doug Zongker4647f122009-07-02 09:00:54 -07001999# -----------------------------------------------------------------
Bowgo Tsai0013f552019-03-20 17:59:52 +08002000# the debug ramdisk, which is the original ramdisk plus additional
2001# files: force_debuggable, adb_debug.prop and userdebug sepolicy.
2002# When /force_debuggable is present, /init will load userdebug sepolicy
2003# and property files to allow adb root, if the device is unlocked.
2004
2005ifdef BUILDING_RAMDISK_IMAGE
2006BUILT_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-debug.img
2007INSTALLED_DEBUG_RAMDISK_TARGET := $(BUILT_DEBUG_RAMDISK_TARGET)
2008
2009INTERNAL_DEBUG_RAMDISK_FILES := $(filter $(TARGET_DEBUG_RAMDISK_OUT)/%, \
2010 $(ALL_GENERATED_SOURCES) \
2011 $(ALL_DEFAULT_INSTALLED_MODULES))
2012
2013# Note: TARGET_DEBUG_RAMDISK_OUT will be $(PRODUCT_OUT)/debug_ramdisk/first_stage_ramdisk,
2014# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/debug_ramdisk.
2015# But the root dir of the ramdisk to build is always $(PRODUCT_OUT)/debug_ramdisk.
2016my_debug_ramdisk_root_dir := $(PRODUCT_OUT)/debug_ramdisk
2017
2018INSTALLED_FILES_FILE_DEBUG_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk-debug.txt
2019INSTALLED_FILES_JSON_DEBUG_RAMDISK := $(INSTALLED_FILES_FILE_DEBUG_RAMDISK:.txt=.json)
2020$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_DEBUG_RAMDISK)
2021$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
2022
2023# Cannot just depend on INTERNAL_DEBUG_RAMDISK_FILES like other INSTALLED_FILES_FILE_* rules.
2024# Because ramdisk-debug.img will rsync from either ramdisk.img or ramdisk-recovery.img.
2025# Need to depend on the built ramdisk-debug.img, to get a complete list of the installed files.
2026$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INSTALLED_DEBUG_RAMDISK_TARGET)
2027$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INTERNAL_DEBUG_RAMDISK_FILES) $(FILESLIST)
2028 echo Installed file list: $@
2029 mkdir -p $(dir $@)
2030 rm -f $@
2031 $(FILESLIST) $(DEBUG_RAMDISK_ROOT_DIR) > $(@:.txt=.json)
2032 build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2033
2034# ramdisk-debug.img will rsync the content from either ramdisk.img or ramdisk-recovery.img,
2035# depending on whether BOARD_USES_RECOVERY_AS_BOOT is set or not.
2036ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2037my_debug_ramdisk_sync_dir := $(TARGET_RECOVERY_ROOT_OUT)
2038else
2039my_debug_ramdisk_sync_dir := $(TARGET_RAMDISK_OUT)
2040endif # BOARD_USES_RECOVERY_AS_BOOT
2041
2042$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir)
2043$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
Bowgo Tsaic3e8cc92019-04-24 12:35:50 +08002044
2045ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2046# ramdisk-recovery.img isn't a make target, need to depend on boot.img if it's for recovery.
Bowgo Tsai0013f552019-03-20 17:59:52 +08002047$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_BOOTIMAGE_TARGET)
Bowgo Tsaic3e8cc92019-04-24 12:35:50 +08002048else
2049# Depends on ramdisk.img, note that some target has ramdisk.img but no boot.img, e.g., emulator.
2050$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET)
2051endif # BOARD_USES_RECOVERY_AS_BOOT
Bowgo Tsai0013f552019-03-20 17:59:52 +08002052$(INSTALLED_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_DEBUG_RAMDISK_FILES) | $(MINIGZIP)
2053 $(call pretty,"Target debug ram disk: $@")
2054 mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
2055 touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
Bowgo Tsai1578e232019-04-24 15:33:03 +08002056 rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
Bowgo Tsai0013f552019-03-20 17:59:52 +08002057 $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $@
2058
2059.PHONY: ramdisk_debug-nodeps
2060ramdisk_debug-nodeps: DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir)
2061ramdisk_debug-nodeps: DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir)
2062ramdisk_debug-nodeps: $(MKBOOTFS) | $(MINIGZIP)
2063 echo "make $@: ignoring dependencies"
2064 mkdir -p $(TARGET_DEBUG_RAMDISK_OUT)
2065 touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable
Bowgo Tsai1578e232019-04-24 15:33:03 +08002066 rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR)
Bowgo Tsai0013f552019-03-20 17:59:52 +08002067 $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(MINIGZIP) > $(INSTALLED_DEBUG_RAMDISK_TARGET)
2068
2069my_debug_ramdisk_sync_dir :=
2070my_debug_ramdisk_root_dir :=
2071
2072endif # BUILDING_RAMDISK_IMAGE
2073
2074# -----------------------------------------------------------------
2075# the boot-debug.img, which is the kernel plus ramdisk-debug.img
2076#
2077# Note: it's intentional to skip signing for boot-debug.img, because it
2078# can only be used if the device is unlocked with verification error.
2079ifneq ($(strip $(TARGET_NO_KERNEL)),true)
2080
2081INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-debug.img
2082
2083# Replace ramdisk.img in $(MKBOOTIMG) ARGS with ramdisk-debug.img to build boot-debug.img
2084ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
2085INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(recovery_ramdisk),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_RECOVERYIMAGE_ARGS))
2086else
2087INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(INSTALLED_RAMDISK_TARGET),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_BOOTIMAGE_ARGS))
2088endif
2089
Bowgo Tsai26b0a262019-05-03 16:38:34 +08002090# If boot.img is chained but boot-debug.img is not signed, libavb in bootloader
2091# will fail to find valid AVB metadata from the end of /boot, thus stop booting.
2092# Using a test key to sign boot-debug.img to continue booting with the mismatched
2093# public key, if the device is unlocked.
2094ifneq ($(BOARD_AVB_BOOT_KEY_PATH),)
2095BOARD_AVB_DEBUG_BOOT_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
2096$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS := \
2097 --algorithm SHA256_RSA2048 --key $(BOARD_AVB_DEBUG_BOOT_KEY_PATH)
2098$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_DEBUG_BOOT_KEY_PATH)
2099endif
2100
Bowgo Tsai0013f552019-03-20 17:59:52 +08002101# Depends on original boot.img and ramdisk-debug.img, to build the new boot-debug.img
2102$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET)
2103 $(call pretty,"Target boot debug image: $@")
2104 $(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
Bowgo Tsai26b0a262019-05-03 16:38:34 +08002105 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
2106 $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))); \
2107 $(AVBTOOL) add_hash_footer \
2108 --image $@ \
2109 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
2110 --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS), \
2111 $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
Bowgo Tsai0013f552019-03-20 17:59:52 +08002112
2113.PHONY: bootimage_debug-nodeps
2114bootimage_debug-nodeps: $(MKBOOTIMG)
2115 echo "make $@: ignoring dependencies"
2116 $(MKBOOTIMG) $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_DEBUG_BOOTIMAGE_TARGET)
Bowgo Tsai26b0a262019-05-03 16:38:34 +08002117 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
2118 $(call assert-max-image-size,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))); \
2119 $(AVBTOOL) add_hash_footer \
2120 --image $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
2121 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
2122 --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS), \
2123 $(call assert-max-image-size,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
Bowgo Tsai0013f552019-03-20 17:59:52 +08002124
2125endif # TARGET_NO_KERNEL
2126
2127# -----------------------------------------------------------------
Ying Wang02352372010-09-27 10:37:25 -07002128# system image
The Android Open Source Project88b60792009-03-03 19:28:42 -08002129#
Ying Wang9c649a72012-08-08 15:27:00 -07002130# Remove overridden packages from $(ALL_PDK_FUSION_FILES)
2131PDK_FUSION_SYSIMG_FILES := \
2132 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \
2133 $(ALL_PDK_FUSION_FILES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002134
Dan Willemsen37a19862018-10-31 16:31:46 -07002135INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \
Ying Wang160b6702012-03-13 18:58:27 -07002136 $(ALL_GENERATED_SOURCES) \
Doug Zongker56588872012-08-20 15:38:58 -07002137 $(ALL_DEFAULT_INSTALLED_MODULES) \
2138 $(PDK_FUSION_SYSIMG_FILES) \
Dan Willemsen0663f682018-03-06 14:07:21 -08002139 $(RECOVERY_RESOURCE_ZIP)) \
Dan Willemsen37a19862018-10-31 16:31:46 -07002140 $(PDK_FUSION_SYMLINK_STAMP))
Ying Wang160b6702012-03-13 18:58:27 -07002141
Ying Wang82cceba2012-08-13 15:03:00 -07002142FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002143
2144# ASAN libraries in the system image - add dependency.
2145ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
Evgenii Stepanov8841a7f2018-07-27 11:54:32 -07002146ifneq (,$(filter address, $(SANITIZE_TARGET)))
Andreas Gampe039b5c72017-03-24 16:06:31 -07002147 ifeq (true,$(SANITIZE_TARGET_SYSTEM))
2148 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED)
2149 endif
2150endif
2151
Tom Cherryd14b8952018-08-09 14:26:00 -07002152FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT)
Luis Hector Chavezff489932018-07-03 15:41:40 -07002153
Ying Wange5e8c5f2011-09-09 16:35:53 -07002154# -----------------------------------------------------------------
Dan Willemsen67495202019-01-16 12:42:05 -08002155ifdef BUILDING_SYSTEM_IMAGE
2156
Ying Wange5e8c5f2011-09-09 16:35:53 -07002157# installed file list
2158# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
2159# We put installed-files.txt ahead of image itself in the dependency graph
2160# so that we can get the size stat even if the build fails due to too large
2161# system image.
2162INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
Colin Cross23dded02018-06-13 14:04:22 -07002163INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
2164$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002165$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002166 @echo Installed file list: $@
2167 @mkdir -p $(dir $@)
2168 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002169 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002170 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wange5e8c5f2011-09-09 16:35:53 -07002171
2172.PHONY: installed-file-list
2173installed-file-list: $(INSTALLED_FILES_FILE)
Ying Wang534fcd72013-03-01 16:45:35 -08002174
2175$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE))
Ying Wange5e8c5f2011-09-09 16:35:53 -07002176
2177systemimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002178 $(call intermediates-dir-for,PACKAGING,systemimage)
Ying Wange5e8c5f2011-09-09 16:35:53 -07002179BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
2180
Ying Wang23898df2014-06-18 20:26:24 -07002181# Create symlink /system/vendor to /vendor if necessary.
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002182ifdef BOARD_USES_VENDORIMAGE
Ying Wang23898df2014-06-18 20:26:24 -07002183define create-system-vendor-symlink
Ying Wang3e72ed12014-07-17 12:56:49 -07002184$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \
2185 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \
2186 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \
2187 exit 1; \
2188fi
Ying Wang23898df2014-06-18 20:26:24 -07002189$(hide) ln -sf /vendor $(TARGET_OUT)/vendor
2190endef
2191else
2192define create-system-vendor-symlink
2193endef
2194endif
2195
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002196# Create symlink /system/product to /product if necessary.
2197ifdef BOARD_USES_PRODUCTIMAGE
2198define create-system-product-symlink
2199$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \
2200 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \
2201 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \
2202 exit 1; \
2203fi
2204$(hide) ln -sf /product $(TARGET_OUT)/product
2205endef
2206else
2207define create-system-product-symlink
2208endef
2209endif
2210
Dario Freni924af7d2018-08-17 00:56:14 +01002211# Create symlink /system/product_services to /product_services if necessary.
Dario Freni5f681e12018-05-29 13:09:01 +01002212ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002213define create-system-product_services-symlink
2214$(hide) if [ -d $(TARGET_OUT)/product_services ] && [ ! -h $(TARGET_OUT)/product_services ]; then \
2215 echo 'Non-symlink $(TARGET_OUT)/product_services detected!' 1>&2; \
2216 echo 'You cannot install files to $(TARGET_OUT)/product_services while building a separate product_services.img!' 1>&2; \
Dario Freni5f681e12018-05-29 13:09:01 +01002217 exit 1; \
2218fi
Dario Freni924af7d2018-08-17 00:56:14 +01002219$(hide) ln -sf /product_services $(TARGET_OUT)/product_services
Dario Freni5f681e12018-05-29 13:09:01 +01002220endef
2221else
Dario Freni924af7d2018-08-17 00:56:14 +01002222define create-system-product_services-symlink
Dario Freni5f681e12018-05-29 13:09:01 +01002223endef
2224endif
2225
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002226# Create symlink /vendor/odm to /odm if necessary.
2227ifdef BOARD_USES_ODMIMAGE
2228define create-vendor-odm-symlink
2229$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
2230 echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
2231 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
2232 exit 1; \
2233fi
2234$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
2235endef
2236else
2237define create-vendor-odm-symlink
2238endef
2239endif
2240
The Android Open Source Project88b60792009-03-03 19:28:42 -08002241# $(1): output file
2242define build-systemimage-target
Ying Wangbd93d422011-10-28 17:02:30 -07002243 @echo "Target system fs image: $(1)"
Ying Wang23898df2014-06-18 20:26:24 -07002244 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002245 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002246 $(call create-system-product_services-symlink)
Martin Stjernholmb0382f02019-04-16 17:49:23 +01002247 $(call check-apex-libs-absence-on-disk)
Ying Wangbd93d422011-10-28 17:02:30 -07002248 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002249 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
Geremy Condra5b5f4952014-05-05 22:19:37 -07002250 skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002251 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002252 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002253 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
Dan Willemsen3e8eb372018-10-20 21:37:44 -07002254 || ( mkdir -p $${DIST_DIR}; cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \
Ying Wang45ff36e2014-08-13 12:36:05 -07002255 exit 1 )
The Android Open Source Project88b60792009-03-03 19:28:42 -08002256endef
2257
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002258$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002259 $(call build-systemimage-target,$@)
2260
Tao Baoe9d61b02018-08-20 21:09:07 -07002261INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img
Ying Wang02352372010-09-27 10:37:25 -07002262SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002263
Tao Baoe9d61b02018-08-20 21:09:07 -07002264# INSTALLED_SYSTEMIMAGE_TARGET used to be named INSTALLED_SYSTEMIMAGE. Create an alias for backward
2265# compatibility, in case device-specific Makefiles still refer to the old name.
2266INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
2267
Doug Zongker73ef8252009-07-23 15:12:53 -07002268# The system partition needs room for the recovery image as well. We
2269# now store the recovery image as a binary patch using the boot image
2270# as the source (since they are very similar). Generate the patch so
2271# we can see how big it's going to be, and include that in the system
2272# image size check calculation.
Tao Baob1a2e352018-08-14 16:17:12 -07002273ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
Sriram Raman1e96ac82009-07-24 13:52:32 -07002274ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Tao Bao8beab692015-07-22 12:33:18 -07002275ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
Chen, ZhiminX752439b2018-09-23 22:10:47 +08002276ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
Tao Bao6d5d6232018-03-09 17:04:42 -08002277diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
2278else
2279diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
2280endif
Doug Zongker73ef8252009-07-23 15:12:53 -07002281intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
2282RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
Tao Bao6d5d6232018-03-09 17:04:42 -08002283$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
2284$(RECOVERY_FROM_BOOT_PATCH): \
Anton Hansson6d814982018-11-26 18:12:05 +00002285 $(INSTALLED_RECOVERYIMAGE_TARGET) \
2286 $(INSTALLED_BOOTIMAGE_TARGET) \
2287 $(diff_tool)
Doug Zongker73ef8252009-07-23 15:12:53 -07002288 @echo "Construct recovery from boot"
2289 mkdir -p $(dir $@)
Tao Bao6d5d6232018-03-09 17:04:42 -08002290 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
Tao Bao8beab692015-07-22 12:33:18 -07002291else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
2292RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
Tao Baob1a2e352018-08-14 16:17:12 -07002293endif # BOARD_USES_FULL_RECOVERY_IMAGE
2294endif # INSTALLED_RECOVERYIMAGE_TARGET
2295endif # INSTALLED_BOOTIMAGE_TARGET
Doug Zongker73ef8252009-07-23 15:12:53 -07002296
Tao Baoe9d61b02018-08-20 21:09:07 -07002297$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002298 @echo "Install system fs image: $@"
2299 $(copy-file-to-target)
Yifan Hong8c3dce02019-04-09 17:03:57 +00002300 $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002301
Tao Baoe9d61b02018-08-20 21:09:07 -07002302systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002303
2304.PHONY: systemimage-nodeps snod
2305systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
Colin Cross144b0282010-05-10 13:04:47 -07002306 | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002307 @echo "make $@: ignoring dependencies"
Tao Baoe9d61b02018-08-20 21:09:07 -07002308 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
Yifan Hong8c3dce02019-04-09 17:03:57 +00002309 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002310
Ying Wangacf01ec2012-02-24 11:05:48 -08002311ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
2312ifeq (true,$(WITH_DEXPREOPT))
2313$(warning Warning: with dexpreopt enabled, you may need a full rebuild.)
2314endif
2315endif
2316
Dan Willemsen67495202019-01-16 12:42:05 -08002317endif # BUILDING_SYSTEM_IMAGE
2318
Anton Hansson30e061b2018-11-12 13:36:46 +00002319.PHONY: sync syncsys
2320sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
Colin Cross91a52272017-06-20 16:57:52 -07002321
The Android Open Source Project88b60792009-03-03 19:28:42 -08002322#######
2323## system tarball
2324define build-systemtarball-target
Ying Wang23898df2014-06-18 20:26:24 -07002325 $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
2326 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002327 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01002328 $(call create-system-product_services-symlink)
Ying Wang23898df2014-06-18 20:26:24 -07002329 $(MKTARBALL) $(FS_GET_STATS) \
2330 $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002331 $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002332endef
2333
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002334ifndef SYSTEM_TARBALL_FORMAT
2335 SYSTEM_TARBALL_FORMAT := bz2
2336endif
2337
The Android Open Source Project88b60792009-03-03 19:28:42 -08002338system_tar := $(PRODUCT_OUT)/system.tar
Bruce Beare69ef5ce2010-06-11 12:05:57 -07002339INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002340$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
2341$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
2342 $(build-systemtarball-target)
2343
2344.PHONY: systemtarball-nodeps
2345systemtarball-nodeps: $(FS_GET_STATS) \
2346 $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
2347 $(build-systemtarball-target)
2348
2349.PHONY: stnod
2350stnod: systemtarball-nodeps
2351
Ying Wang3a61eeb2016-03-11 10:32:01 -08002352# -----------------------------------------------------------------
Ying Wang4534d812012-04-09 17:04:12 -07002353## platform.zip: system, plus other files to be used in PDK fusion build,
2354## in a zip file
keunyoungc0178062013-07-22 14:54:58 -07002355##
2356## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip.
2357## The variable will be typically set from BoardConfig.mk.
2358## Files under out dir will be rejected to prevent possible conflicts with other rules.
Colin Cross53c8f972018-09-28 16:19:42 -07002359ifneq (,$(BUILD_PLATFORM_ZIP))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002360pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002361 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002362pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\
Colin Cross6db5b0e2018-11-16 21:26:33 -08002363 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m))))
Ying Wang3a61eeb2016-03-11 10:32:01 -08002364pdk_classes_dex := $(strip \
2365 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \
2366 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.dex.apk))
2367
2368pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk
2369$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs)
2370$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps)
2371$(pdk_odex_config_mk) :
2372 @echo "PDK odex config makefile: $@"
2373 $(hide) mkdir -p $(dir $@)
2374 $(hide) echo "# Auto-generated. Do not modify." > $@
2375 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@
2376 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@
2377 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\
2378 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\
2379 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2380 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2381 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2382 )
2383 $(foreach m,$(PRIVATE_APPS),\
2384 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.dex.apk)" >> $@$(newline)\
2385 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\
2386 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\
2387 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\
2388 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\
Dan Willemsen05a2b932017-03-20 18:31:17 -07002389 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\
Ying Wang3a61eeb2016-03-11 10:32:01 -08002390 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\
2391 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\
2392 )
2393
keunyoungc0178062013-07-22 14:54:58 -07002394PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))
Keun young Park816b9fd2012-05-16 10:32:41 -07002395INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip
Ying Wang3a61eeb2016-03-11 10:32:01 -08002396
2397$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex)
2398$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk)
Colin Cross7363cde2018-09-14 21:51:11 -07002399$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP)
2400# dependencies for the other partitions are defined below after their file lists
2401# are known
Colin Crossd60401a2019-04-18 14:46:48 -07002402$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(API_FINGERPRINT)
Keun young Park816b9fd2012-05-16 10:32:41 -07002403 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)")
Colin Cross7363cde2018-09-14 21:51:11 -07002404 rm -f $@ $@.lst
2405 echo "-C $(PRODUCT_OUT)" >> $@.lst
2406 echo "-D $(TARGET_OUT)" >> $@.lst
2407 echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst
2408 echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst
Dan Willemsen67495202019-01-16 12:42:05 -08002409ifdef BUILDING_VENDOR_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002410 echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst
Ying Wangcff38622014-07-16 17:46:35 -07002411endif
Dan Willemsen67495202019-01-16 12:42:05 -08002412ifdef BUILDING_PRODUCT_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002413 echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002414endif
Dan Willemsen67495202019-01-16 12:42:05 -08002415ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002416 echo "-D $(TARGET_OUT_PRODUCT_SERVICES)" >> $@.lst
Dario Freni5f681e12018-05-29 13:09:01 +01002417endif
Dan Willemsen67495202019-01-16 12:42:05 -08002418ifdef BUILDING_ODM_IMAGE
Colin Cross7363cde2018-09-14 21:51:11 -07002419 echo "-D $(TARGET_OUT_ODM)" >> $@.lst
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002420endif
Colin Crossc451a372013-12-18 19:36:44 -08002421ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),)
Colin Cross7363cde2018-09-14 21:51:11 -07002422 echo "-C $(OUT_DIR)" >> $@.lst
2423 for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \
2424 if [ -e $$f ]; then \
2425 echo "-f $$f"; \
2426 fi \
2427 done >> $@.lst
Keun young Park816b9fd2012-05-16 10:32:41 -07002428endif
keunyoungc0178062013-07-22 14:54:58 -07002429ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),)
Colin Cross7363cde2018-09-14 21:51:11 -07002430 echo "-C . $(addprefix -f ,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))" >> $@.lst
keunyoungc0178062013-07-22 14:54:58 -07002431endif
Ying Wang3a61eeb2016-03-11 10:32:01 -08002432 @# Add dex-preopt files and config.
Colin Cross7363cde2018-09-14 21:51:11 -07002433 $(if $(PRIVATE_DEX_FILES),\
2434 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst
Colin Crossd60401a2019-04-18 14:46:48 -07002435 echo "-C $(dir $(API_FINGERPRINT)) -f $(API_FINGERPRINT)" >> $@.lst
Colin Cross7363cde2018-09-14 21:51:11 -07002436 touch $(PRODUCT_OUT)/pdk.mk
2437 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst
2438 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst
Ying Wang4c289e52012-03-30 13:52:54 -07002439
2440.PHONY: platform
Keun young Park816b9fd2012-05-16 10:32:41 -07002441platform: $(INSTALLED_PLATFORM_ZIP)
2442
2443.PHONY: platform-java
2444platform-java: platform
Ying Wang4c289e52012-03-30 13:52:54 -07002445
2446# Dist the platform.zip
Keun young Park3e93aea2012-05-29 17:55:46 -07002447ifneq (,$(filter platform platform-java, $(MAKECMDGOALS)))
2448$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP))
Ying Wang4c289e52012-03-30 13:52:54 -07002449endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08002450
Colin Cross53c8f972018-09-28 16:19:42 -07002451endif # BUILD_PLATFORM_ZIP
2452
Ying Wang3a61eeb2016-03-11 10:32:01 -08002453# -----------------------------------------------------------------
Bruce Beare52aac202010-06-04 15:24:49 -07002454## boot tarball
2455define build-boottarball-target
Bruce Beare45ac4342010-06-24 14:02:00 -07002456 $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
Bruce Beare52aac202010-06-04 15:24:49 -07002457 $(hide) mkdir -p $(PRODUCT_OUT)/boot
2458 $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07002459 $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
Bruce Beare52aac202010-06-04 15:24:49 -07002460 $(hide) $(MKTARBALL) $(FS_GET_STATS) \
2461 $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002462 $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
Bruce Beare52aac202010-06-04 15:24:49 -07002463endef
2464
2465ifndef BOOT_TARBALL_FORMAT
2466 BOOT_TARBALL_FORMAT := bz2
2467endif
2468
2469boot_tar := $(PRODUCT_OUT)/boot.tar
2470INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
2471$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
2472$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
2473 $(build-boottarball-target)
2474
2475.PHONY: boottarball-nodeps btnod
2476boottarball-nodeps btnod: $(FS_GET_STATS) \
2477 $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
2478 $(build-boottarball-target)
2479
2480
The Android Open Source Project88b60792009-03-03 19:28:42 -08002481# -----------------------------------------------------------------
2482# data partition image
2483INTERNAL_USERDATAIMAGE_FILES := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002484 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
The Android Open Source Project88b60792009-03-03 19:28:42 -08002485
Dan Willemsen67495202019-01-16 12:42:05 -08002486ifdef BUILDING_USERDATA_IMAGE
Ying Wangbd93d422011-10-28 17:02:30 -07002487userdataimage_intermediates := \
Ying Wang9f8e8db2011-11-04 11:37:01 -07002488 $(call intermediates-dir-for,PACKAGING,userdata)
Joe Onorato64d85d02009-04-09 19:31:12 -07002489BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img
2490
Ying Wangbd93d422011-10-28 17:02:30 -07002491define build-userdataimage-target
2492 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
2493 @mkdir -p $(TARGET_OUT_DATA)
2494 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002495 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
Ying Wangbd93d422011-10-28 17:02:30 -07002496 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002497 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002498 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002499 $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
Ying Wangbd93d422011-10-28 17:02:30 -07002500endef
2501
Joe Onorato64d85d02009-04-09 19:31:12 -07002502# We just build this directly to the install location.
2503INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
Andreas Gampe039b5c72017-03-24 16:06:31 -07002504INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
2505 $(INTERNAL_USERIMAGES_DEPS) \
2506 $(INTERNAL_USERDATAIMAGE_FILES) \
2507 $(BUILD_IMAGE_SRCS)
2508$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002509 $(build-userdataimage-target)
2510
2511.PHONY: userdataimage-nodeps
Colin Cross144b0282010-05-10 13:04:47 -07002512userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002513 $(build-userdataimage-target)
2514
Dan Willemsen67495202019-01-16 12:42:05 -08002515endif # BUILDING_USERDATA_IMAGE
Ying Wange215ed52012-10-15 14:36:22 -07002516
Andreas Gampe039b5c72017-03-24 16:06:31 -07002517# ASAN libraries in the system image - build rule.
2518ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\
2519 $(TARGET_OUT_SHARED_LIBRARIES) \
2520 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \
2521 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \
2522 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES)))
Andreas Gampe2c498a32017-03-30 16:54:23 -07002523# Extra options: Enforce the system user for the files to avoid having to change ownership.
2524ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000
Andreas Gampe039b5c72017-03-24 16:06:31 -07002525# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save
2526# enough space.
2527$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
Andreas Gampe2c498a32017-03-30 16:54:23 -07002528 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 -07002529
The Android Open Source Project88b60792009-03-03 19:28:42 -08002530#######
2531## data partition tarball
2532define build-userdatatarball-target
2533 $(call pretty,"Target userdata fs tarball: " \
2534 "$(INSTALLED_USERDATATARBALL_TARGET)")
2535 $(MKTARBALL) $(FS_GET_STATS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002536 $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
2537 $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08002538endef
2539
2540userdata_tar := $(PRODUCT_OUT)/userdata.tar
2541INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
2542$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
2543$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
2544 $(build-userdatatarball-target)
2545
Dan Willemsen69af2e42016-08-16 16:36:05 -07002546$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
2547
The Android Open Source Project88b60792009-03-03 19:28:42 -08002548.PHONY: userdatatarball-nodeps
2549userdatatarball-nodeps: $(FS_GET_STATS)
2550 $(build-userdatatarball-target)
2551
2552
The Android Open Source Project88b60792009-03-03 19:28:42 -08002553# -----------------------------------------------------------------
David Zeuthen25328622016-04-08 15:08:03 -04002554# partition table image
2555ifdef BOARD_BPT_INPUT_FILES
2556
2557BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002558BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt
David Zeuthen25328622016-04-08 15:08:03 -04002559
2560INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \
2561 --output_gpt $(BUILT_BPTIMAGE_TARGET) \
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002562 --output_json $(BUILT_BPTJSON_TARGET) \
David Zeuthen25328622016-04-08 15:08:03 -04002563 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file))
2564
2565ifdef BOARD_BPT_DISK_SIZE
2566INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE)
2567endif
2568
2569define build-bptimage-target
2570 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)")
2571 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS)
2572endef
2573
2574INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET)
Casey Dahlin04d15dd2016-08-19 10:59:57 -07002575$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET)
2576 $(hide) touch -c $(BUILT_BPTJSON_TARGET)
2577
David Zeuthen25328622016-04-08 15:08:03 -04002578$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES)
2579 $(build-bptimage-target)
2580
2581.PHONY: bptimage-nodeps
2582bptimage-nodeps:
2583 $(build-bptimage-target)
2584
2585endif # BOARD_BPT_INPUT_FILES
2586
2587# -----------------------------------------------------------------
Ying Wang9f8e8db2011-11-04 11:37:01 -07002588# cache partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002589ifdef BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002590INTERNAL_CACHEIMAGE_FILES := \
2591 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
2592
2593cacheimage_intermediates := \
2594 $(call intermediates-dir-for,PACKAGING,cache)
2595BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img
2596
2597define build-cacheimage-target
2598 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
2599 @mkdir -p $(TARGET_OUT_CACHE)
2600 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002601 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002602 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002603 build/make/tools/releasetools/build_image.py \
Thierry Strudel74a81e62015-07-09 09:54:55 -07002604 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
JP Abgrall0ed7cec2014-06-16 14:19:36 -07002605 $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
Ying Wang9f8e8db2011-11-04 11:37:01 -07002606endef
2607
2608# We just build this directly to the install location.
2609INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
Shinichiro Hamaji3deb87d2016-04-19 18:41:27 +09002610$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
Ying Wang9f8e8db2011-11-04 11:37:01 -07002611 $(build-cacheimage-target)
2612
2613.PHONY: cacheimage-nodeps
2614cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2615 $(build-cacheimage-target)
2616
Dan Willemsen67495202019-01-16 12:42:05 -08002617else # BUILDING_CACHE_IMAGE
Patrick Tjinf3b0dc22016-05-13 15:26:09 -07002618# we need to ignore the broken cache link when doing the rsync
2619IGNORE_CACHE_LINK := --exclude=cache
Dan Willemsen67495202019-01-16 12:42:05 -08002620endif # BUILDING_CACHE_IMAGE
Ying Wang9f8e8db2011-11-04 11:37:01 -07002621
David Zeuthen0eb10972016-09-28 17:55:27 -04002622# -----------------------------------------------------------------
Alex Light4e358ab2016-06-16 14:47:10 -07002623# system_other partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002624ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002625ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true)
Alex Light4e358ab2016-06-16 14:47:10 -07002626# Marker file to identify that odex files are installed
2627INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker
2628ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER)
2629$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER):
2630 $(hide) touch $@
2631endif
2632
Alex Light4e358ab2016-06-16 14:47:10 -07002633INTERNAL_SYSTEMOTHERIMAGE_FILES := \
2634 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\
2635 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002636 $(ALL_PDK_FUSION_FILES)) \
2637 $(PDK_FUSION_SYMLINK_STAMP)
Alex Light4e358ab2016-06-16 14:47:10 -07002638
Colin Cross6db5b0e2018-11-16 21:26:33 -08002639# system_other dex files are installed as a side-effect of installing system image files
2640INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES)
2641
Alex Light4e358ab2016-06-16 14:47:10 -07002642INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
Colin Cross23dded02018-06-13 14:04:22 -07002643INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
2644$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002645$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
Alex Light4e358ab2016-06-16 14:47:10 -07002646 @echo Installed file list: $@
2647 @mkdir -p $(dir $@)
2648 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002649 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002650 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Alex Light4e358ab2016-06-16 14:47:10 -07002651
Bowgo Tsai867ab662019-01-29 13:30:18 +08002652# Determines partition size for system_other.img.
2653ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
2654ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),)
2655INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE)
2656endif
2657endif
2658
2659ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE
2660INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE)
2661endif
2662
Alex Light4e358ab2016-06-16 14:47:10 -07002663systemotherimage_intermediates := \
2664 $(call intermediates-dir-for,PACKAGING,system_other)
2665BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img
2666
2667# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image.
2668define build-systemotherimage-target
2669 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
2670 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
2671 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002672 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
Alex Light4e358ab2016-06-16 14:47:10 -07002673 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002674 build/make/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002675 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)
2676 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
Alex Light4e358ab2016-06-16 14:47:10 -07002677endef
2678
2679# We just build this directly to the install location.
2680INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002681ifneq (true,$(SANITIZE_LITE))
2682# Only create system_other when not building the second stage of a SANITIZE_LITE build.
Alex Light4e358ab2016-06-16 14:47:10 -07002683$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
2684 $(build-systemotherimage-target)
Andreas Gampe4ed21d12017-06-16 10:24:54 -07002685endif
Alex Light4e358ab2016-06-16 14:47:10 -07002686
2687.PHONY: systemotherimage-nodeps
2688systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
2689 $(build-systemotherimage-target)
2690
Dan Willemsen67495202019-01-16 12:42:05 -08002691endif # BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07002692
2693
2694# -----------------------------------------------------------------
Ying Wanga0febe52013-03-20 11:02:05 -07002695# vendor partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002696ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07002697INTERNAL_VENDORIMAGE_FILES := \
Ying Wangcff38622014-07-16 17:46:35 -07002698 $(filter $(TARGET_OUT_VENDOR)/%,\
2699 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002700 $(ALL_PDK_FUSION_FILES)) \
2701 $(PDK_FUSION_SYMLINK_STAMP)
Ying Wangcff38622014-07-16 17:46:35 -07002702
Steven Moreland627debe2018-05-01 09:54:21 -07002703# Final Vendor VINTF manifest including fragments. This is not assembled
2704# on the device because it depends on everything in a given device
2705# image which defines a vintf_fragment.
2706ifdef BUILT_VENDOR_MANIFEST
2707BUILT_ASSEMBLED_VENDOR_MANIFEST := $(PRODUCT_OUT)/verified_assembled_vendor_manifest.xml
Anton Hansson8dab0a62019-03-28 15:45:40 +00002708ifeq (true,$(PRODUCT_ENFORCE_VINTF_MANIFEST))
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002709ifneq ($(strip $(DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE) $(DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE)),)
Steven Moreland627debe2018-05-01 09:54:21 -07002710$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS := VINTF_ENFORCE_NO_UNUSED_HALS=true
Yifan Hongab1ec4d2019-01-28 10:32:37 -08002711endif # DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE or DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE
Steven Moreland627debe2018-05-01 09:54:21 -07002712endif # PRODUCT_ENFORCE_VINTF_MANIFEST
2713$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf
2714$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_SYSTEM_MATRIX)
2715$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BUILT_VENDOR_MANIFEST)
2716$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(INTERNAL_VENDORIMAGE_FILES)
Yifan Hong770ab052018-11-02 13:43:30 -07002717
2718$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS :=
2719
2720# -- Kernel version and configurations.
2721ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true)
2722
2723# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted
2724# from INSTALLED_KERNEL_TARGET.
2725ifdef BOARD_KERNEL_CONFIG_FILE
2726ifdef BOARD_KERNEL_VERSION
2727$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(BOARD_KERNEL_CONFIG_FILE)
2728$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $(BOARD_KERNEL_VERSION):$(BOARD_KERNEL_CONFIG_FILE)
2729my_board_extracted_kernel := true
2730endif # BOARD_KERNEL_VERSION
2731endif # BOARD_KERNEL_CONFIG_FILE
2732
2733ifneq ($(my_board_extracted_kernel),true)
2734ifndef INSTALLED_KERNEL_TARGET
2735$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2736 is true. Information about the updated kernel cannot be built into OTA update package. \
2737 You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \
2738 to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \
2739 or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \
2740 BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \
2741 manually.)
2742else
2743intermediates := $(call intermediates-dir-for,ETC,$(notdir $(BUILT_ASSEMBLED_VENDOR_MANIFEST)))
2744
2745# Tools for decompression that is not in PATH.
2746# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script.
2747# Algorithms that are in the script but not in this list will be found in PATH.
2748my_decompress_tools := \
2749 lz4:$(HOST_OUT_EXECUTABLES)/lz4 \
2750
2751my_kernel_configs := $(intermediates)/kernel_configs.txt
2752my_kernel_version := $(intermediates)/kernel_version.txt
2753$(my_kernel_configs): .KATI_IMPLICIT_OUTPUTS := $(my_kernel_version)
2754$(my_kernel_configs): PRIVATE_KERNEL_VERSION_FILE := $(my_kernel_version)
2755$(my_kernel_configs): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools)
2756$(my_kernel_configs): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair)))
2757$(my_kernel_configs): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET)
2758 $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \
2759 --output-configs $@ \
2760 --output-version $(PRIVATE_KERNEL_VERSION_FILE)
2761
2762$(BUILT_ASSEMBLED_VENDOR_MANIFEST): $(my_kernel_configs) $(my_kernel_version)
2763$(BUILT_ASSEMBLED_VENDOR_MANIFEST): PRIVATE_FLAGS += --kernel $$(cat $(my_kernel_version)):$(my_kernel_configs)
2764
2765intermediates :=
2766my_kernel_configs :=
2767my_kernel_version :=
2768my_decompress_tools :=
2769
2770endif # my_board_extracted_kernel
2771my_board_extracted_kernel :=
2772
2773endif # INSTALLED_KERNEL_TARGET
2774endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
2775
2776$(BUILT_ASSEMBLED_VENDOR_MANIFEST):
Steven Moreland627debe2018-05-01 09:54:21 -07002777 @echo "Verifying vendor VINTF manifest."
2778 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2779 $(PRIVATE_SYSTEM_ASSEMBLE_VINTF_ENV_VARS) \
2780 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
Yifan Hong770ab052018-11-02 13:43:30 -07002781 $(PRIVATE_FLAGS) \
Anton Hansson6d814982018-11-26 18:12:05 +00002782 -c $(BUILT_SYSTEM_MATRIX) \
2783 -i $(BUILT_VENDOR_MANIFEST) \
2784 $$([ -d $(TARGET_OUT_VENDOR)/etc/vintf/manifest ] && \
2785 find $(TARGET_OUT_VENDOR)/etc/vintf/manifest -type f -name "*.xml" | \
2786 sed "s/^/-i /" | tr '\n' ' ') -o $@
Steven Moreland627debe2018-05-01 09:54:21 -07002787endif # BUILT_VENDOR_MANIFEST
2788
Ying Wangcff38622014-07-16 17:46:35 -07002789# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES).
2790$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES)
Ying Wanga0febe52013-03-20 11:02:05 -07002791
Ying Wang8da19e32015-09-15 14:22:12 -07002792INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
Colin Cross23dded02018-06-13 14:04:22 -07002793INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
2794$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002795$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
Ying Wang8da19e32015-09-15 14:22:12 -07002796 @echo Installed file list: $@
2797 @mkdir -p $(dir $@)
2798 @rm -f $@
Makoto Onuki9fe97e22017-03-16 09:41:19 -07002799 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
Colin Crossfdea8932017-12-06 14:38:40 -08002800 $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
Ying Wang8da19e32015-09-15 14:22:12 -07002801
Ying Wanga0febe52013-03-20 11:02:05 -07002802vendorimage_intermediates := \
2803 $(call intermediates-dir-for,PACKAGING,vendor)
2804BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
Ying Wanga0febe52013-03-20 11:02:05 -07002805define build-vendorimage-target
2806 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
2807 @mkdir -p $(TARGET_OUT_VENDOR)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002808 $(call create-vendor-odm-symlink)
Ying Wanga0febe52013-03-20 11:02:05 -07002809 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002810 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
Ying Wanga0febe52013-03-20 11:02:05 -07002811 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
Colin Crossfdea8932017-12-06 14:38:40 -08002812 build/make/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002813 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
2814 $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
Ying Wanga0febe52013-03-20 11:02:05 -07002815endef
2816
2817# We just build this directly to the install location.
2818INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
Steven Moreland627debe2018-05-01 09:54:21 -07002819ifdef BUILT_VENDOR_MANIFEST
2820$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
2821endif
Colin Cross4f60e362019-06-05 11:53:43 -07002822$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR) $(BUILD_IMAGE_SRCS)
Ying Wanga0febe52013-03-20 11:02:05 -07002823 $(build-vendorimage-target)
2824
Steven Morelanda2e734d2017-03-07 12:10:09 -08002825.PHONY: vendorimage-nodeps vnod
Colin Cross4f60e362019-06-05 11:53:43 -07002826vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS)
Ying Wanga0febe52013-03-20 11:02:05 -07002827 $(build-vendorimage-target)
2828
Colin Cross91a52272017-06-20 16:57:52 -07002829sync: $(INTERNAL_VENDORIMAGE_FILES)
2830
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07002831else ifdef BOARD_PREBUILT_VENDORIMAGE
2832INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img
2833$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET)))
2834endif
Ying Wanga0febe52013-03-20 11:02:05 -07002835
Ying Wang9f8e8db2011-11-04 11:37:01 -07002836# -----------------------------------------------------------------
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002837# product partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002838ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002839INTERNAL_PRODUCTIMAGE_FILES := \
2840 $(filter $(TARGET_OUT_PRODUCT)/%,\
2841 $(ALL_DEFAULT_INSTALLED_MODULES)\
Dan Willemsen0663f682018-03-06 14:07:21 -08002842 $(ALL_PDK_FUSION_FILES)) \
2843 $(PDK_FUSION_SYMLINK_STAMP)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002844
2845# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES).
2846$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES)
2847
2848INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
Colin Cross23dded02018-06-13 14:04:22 -07002849INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
2850$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002851$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
2852 @echo Installed file list: $@
2853 @mkdir -p $(dir $@)
2854 @rm -f $@
2855 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
2856 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2857
2858productimage_intermediates := \
2859 $(call intermediates-dir-for,PACKAGING,product)
2860BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2861define build-productimage-target
2862 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
2863 @mkdir -p $(TARGET_OUT_PRODUCT)
2864 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
Yifan Hong760d3c02018-05-30 11:16:46 -07002865 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002866 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2867 ./build/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002868 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
2869 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09002870endef
2871
2872# We just build this directly to the install location.
2873INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
2874$(INSTALLED_PRODUCTIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT) $(BUILD_IMAGE_SRCS)
2875 $(build-productimage-target)
2876
2877.PHONY: productimage-nodeps pnod
2878productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
2879 $(build-productimage-target)
2880
2881sync: $(INTERNAL_PRODUCTIMAGE_FILES)
2882
2883else ifdef BOARD_PREBUILT_PRODUCTIMAGE
2884INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img
2885$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET)))
2886endif
2887
2888# -----------------------------------------------------------------
Yifan Hong51e87262019-04-23 17:09:07 -07002889# Final Framework VINTF manifest including fragments. This is not assembled
2890# on the device because it depends on everything in a given device
2891# image which defines a vintf_fragment.
2892
2893ifdef BUILDING_SYSTEM_IMAGE
2894
2895ifndef BOARD_USES_PRODUCTIMAGE
2896 # If no product image at all, check system manifest directly against device matrix.
2897 check_framework_manifest := true
2898else ifdef BUILDING_PRODUCT_IMAGE
2899 # If device has a product image, only check if the product image is built.
2900 check_framework_manifest := true
2901endif
2902
Yifan Hong7e6397c2019-04-26 11:56:08 -07002903# TODO (b/131425279): delete this line once build_mixed script can correctly merge system and
2904# product manifests.
2905check_framework_manifest := true
2906
Yifan Hong51e87262019-04-23 17:09:07 -07002907ifeq ($(check_framework_manifest),true)
2908
2909BUILT_ASSEMBLED_FRAMEWORK_MANIFEST := $(PRODUCT_OUT)/verified_assembled_framework_manifest.xml
2910$(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST): $(HOST_OUT_EXECUTABLES)/assemble_vintf \
2911 $(BUILT_VENDOR_MATRIX) \
2912 $(BUILT_SYSTEM_MANIFEST) \
2913 $(FULL_SYSTEMIMAGE_DEPS) \
2914 $(BUILT_PRODUCT_MANIFEST) \
2915 $(BUILT_PRODUCTIMAGE_TARGET)
2916 @echo "Verifying framework VINTF manifest."
2917 PRODUCT_ENFORCE_VINTF_MANIFEST=$(PRODUCT_ENFORCE_VINTF_MANIFEST) \
2918 $(HOST_OUT_EXECUTABLES)/assemble_vintf \
2919 -o $@ \
2920 -c $(BUILT_VENDOR_MATRIX) \
2921 -i $(BUILT_SYSTEM_MANIFEST) \
2922 $(addprefix -i ,\
2923 $(filter $(TARGET_OUT)/etc/vintf/manifest/%.xml,$(FULL_SYSTEMIMAGE_DEPS)) \
2924 $(BUILT_PRODUCT_MANIFEST) \
2925 $(filter $(TARGET_OUT_PRODUCT)/etc/vintf/manifest/%.xml,$(INTERNAL_PRODUCTIMAGE_FILES)))
2926
2927droidcore: $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST)
2928
2929endif # check_framework_manifest
2930check_framework_manifest :=
2931
2932endif # BUILDING_SYSTEM_IMAGE
2933
2934# -----------------------------------------------------------------
Dario Freni924af7d2018-08-17 00:56:14 +01002935# product_services partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002936ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni5f681e12018-05-29 13:09:01 +01002937INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
2938 $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
2939 $(ALL_DEFAULT_INSTALLED_MODULES)\
2940 $(ALL_PDK_FUSION_FILES)) \
2941 $(PDK_FUSION_SYMLINK_STAMP)
2942
2943# platform.zip depends on $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES).
2944$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2945
Dario Freni924af7d2018-08-17 00:56:14 +01002946INSTALLED_FILES_FILE_PRODUCT_SERVICES := $(PRODUCT_OUT)/installed-files-product_services.txt
Dario Freni5f681e12018-05-29 13:09:01 +01002947INSTALLED_FILES_JSON_PRODUCT_SERVICES := $(INSTALLED_FILES_FILE_PRODUCT_SERVICES:.txt=.json)
2948$(INSTALLED_FILES_FILE_PRODUCT_SERVICES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT_SERVICES)
2949$(INSTALLED_FILES_FILE_PRODUCT_SERVICES) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(FILESLIST)
2950 @echo Installed file list: $@
2951 @mkdir -p $(dir $@)
2952 @rm -f $@
2953 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT_SERVICES) > $(@:.txt=.json)
2954 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
2955
Yifan Hongebc041a2018-07-26 16:02:52 -07002956product_servicesimage_intermediates := \
2957 $(call intermediates-dir-for,PACKAGING,product_services)
Dario Freni924af7d2018-08-17 00:56:14 +01002958BUILT_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
2959define build-product_servicesimage-target
2960 $(call pretty,"Target product_services fs image: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)")
Dario Freni5f681e12018-05-29 13:09:01 +01002961 @mkdir -p $(TARGET_OUT_PRODUCT_SERVICES)
Yifan Hongebc041a2018-07-26 16:02:52 -07002962 @mkdir -p $(product_servicesimage_intermediates) && rm -rf $(product_servicesimage_intermediates)/product_services_image_info.txt
2963 $(call generate-image-prop-dictionary, $(product_servicesimage_intermediates)/product_services_image_info.txt,product_services, skip_fsck=true)
Dario Freni5f681e12018-05-29 13:09:01 +01002964 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
2965 ./build/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00002966 $(TARGET_OUT_PRODUCT_SERVICES) $(product_servicesimage_intermediates)/product_services_image_info.txt $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(TARGET_OUT)
2967 $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE))
Dario Freni5f681e12018-05-29 13:09:01 +01002968endef
2969
2970# We just build this directly to the install location.
2971INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(BUILT_PRODUCT_SERVICESIMAGE_TARGET)
2972$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT_SERVICES) $(BUILD_IMAGE_SRCS)
Dario Freni924af7d2018-08-17 00:56:14 +01002973 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002974
2975.PHONY: productservicesimage-nodeps psnod
2976productservicesimage-nodeps psnod: | $(INTERNAL_USERIMAGES_DEPS)
Dario Freni924af7d2018-08-17 00:56:14 +01002977 $(build-product_servicesimage-target)
Dario Freni5f681e12018-05-29 13:09:01 +01002978
2979sync: $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
2980
2981else ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01002982INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
Dario Freni5f681e12018-05-29 13:09:01 +01002983$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCT_SERVICESIMAGE),$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)))
2984endif
2985
2986# -----------------------------------------------------------------
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002987# odm partition image
Dan Willemsen67495202019-01-16 12:42:05 -08002988ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08002989INTERNAL_ODMIMAGE_FILES := \
2990 $(filter $(TARGET_OUT_ODM)/%,\
2991 $(ALL_DEFAULT_INSTALLED_MODULES)\
2992 $(ALL_PDK_FUSION_FILES)) \
2993 $(PDK_FUSION_SYMLINK_STAMP)
2994# platform.zip depends on $(INTERNAL_ODMIMAGE_FILES).
2995$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODMIMAGE_FILES)
2996
2997INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt
2998INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json)
2999$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM)
3000$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST)
3001 @echo Installed file list: $@
3002 @mkdir -p $(dir $@)
3003 @rm -f $@
3004 $(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json)
3005 $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
3006
3007odmimage_intermediates := \
3008 $(call intermediates-dir-for,PACKAGING,odm)
3009BUILT_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
3010define build-odmimage-target
3011 $(call pretty,"Target odm fs image: $(INSTALLED_ODMIMAGE_TARGET)")
3012 @mkdir -p $(TARGET_OUT_ODM)
3013 @mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt
3014 $(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003015 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
3016 ./build/tools/releasetools/build_image.py \
Yifan Hong8c3dce02019-04-09 17:03:57 +00003017 $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT)
3018 $(hide) $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),$(BOARD_ODMIMAGE_PARTITION_SIZE))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003019endef
3020
3021# We just build this directly to the install location.
3022INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET)
Colin Cross4f60e362019-06-05 11:53:43 -07003023$(INSTALLED_ODMIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_ODMIMAGE_FILES) $(INSTALLED_FILES_FILE_ODM) $(BUILD_IMAGE_SRCS)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003024 $(build-odmimage-target)
3025
3026.PHONY: odmimage-nodeps onod
Colin Cross4f60e362019-06-05 11:53:43 -07003027odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003028 $(build-odmimage-target)
3029
3030sync: $(INTERNAL_ODMIMAGE_FILES)
3031
3032else ifdef BOARD_PREBUILT_ODMIMAGE
3033INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img
3034$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET)))
3035endif
3036
3037# -----------------------------------------------------------------
Yueyao Zhu211c9012017-04-27 00:34:50 -07003038# dtbo image
3039ifdef BOARD_PREBUILT_DTBOIMAGE
3040INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
3041
3042ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003043$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH)
Yueyao Zhu211c9012017-04-27 00:34:50 -07003044 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
3045 $(AVBTOOL) add_hash_footer \
Anton Hansson6d814982018-11-26 18:12:05 +00003046 --image $@ \
3047 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \
3048 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \
3049 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)
Yueyao Zhu211c9012017-04-27 00:34:50 -07003050else
3051$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE)
3052 cp $(BOARD_PREBUILT_DTBOIMAGE) $@
3053endif
3054
Tao Bao0da43472018-08-22 22:53:41 -07003055endif # BOARD_PREBUILT_DTBOIMAGE
3056
3057# Returns a list of image targets corresponding to the given list of partitions. For example, it
3058# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET)
3059# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor".
3060# (1): list of partitions like "system", "vendor" or "system product product_services".
3061define images-for-partitions
3062$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))
3063endef
Yueyao Zhu211c9012017-04-27 00:34:50 -07003064
3065# -----------------------------------------------------------------
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003066# vbmeta image
3067ifeq ($(BOARD_AVB_ENABLE),true)
3068
3069BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003070AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003071
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003072ifdef BOARD_AVB_KEY_PATH
3073$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined))
3074else
3075# If key path isn't specified, use the 4096-bit test key.
3076BOARD_AVB_ALGORITHM := SHA256_RSA4096
3077BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem
3078endif
3079
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08003080# AVB signing for system_other.img.
3081ifdef BUILDING_SYSTEM_OTHER_IMAGE
3082ifdef BOARD_AVB_SYSTEM_OTHER_KEY_PATH
3083$(if $(BOARD_AVB_SYSTEM_OTHER_ALGORITHM),,$(error BOARD_AVB_SYSTEM_OTHER_ALGORITHM is not defined))
3084else
3085# If key path isn't specified, use the same key as BOARD_AVB_KEY_PATH.
3086BOARD_AVB_SYSTEM_OTHER_KEY_PATH := $(BOARD_AVB_KEY_PATH)
3087BOARD_AVB_SYSTEM_OTHER_ALGORITHM := $(BOARD_AVB_ALGORITHM)
3088endif
3089
Bowgo Tsaie4544b12019-02-27 10:15:51 +08003090$(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET): $(AVBTOOL) $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)
3091 @echo Extracting system_other avb key: $@
3092 @rm -f $@
3093 @mkdir -p $(dir $@)
3094 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH) --output $@
Bowgo Tsai45db7ce2019-01-30 14:53:57 +08003095
Bowgo Tsai1e04bf72019-01-23 22:19:19 +08003096ifndef BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX
3097BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
3098endif
3099
3100BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX)
3101endif # end of AVB for BUILDING_SYSTEM_OTHER_IMAGE
3102
Tao Bao744c4c72018-08-20 21:09:07 -07003103INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \
David Anderson7709ab22018-10-15 14:41:34 -07003104 $(BOARD_AVB_VBMETA_SYSTEM) \
Tao Bao744c4c72018-08-20 21:09:07 -07003105 $(BOARD_AVB_VBMETA_VENDOR)
3106
3107# Not allowing the same partition to appear in multiple groups.
3108ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
David Anderson7709ab22018-10-15 14:41:34 -07003109 $(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates)
Tao Bao744c4c72018-08-20 21:09:07 -07003110endif
3111
Bowgo Tsai9b548012019-05-14 16:57:03 +08003112# Appends os version and security patch level as a AVB property descriptor
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003113
3114BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003115 --prop com.android.build.system.os_version:$(PLATFORM_VERSION) \
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003116 --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH)
3117
3118BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003119 --prop com.android.build.product.os_version:$(PLATFORM_VERSION) \
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003120 --prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
3121
3122BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS += \
Bowgo Tsai9b548012019-05-14 16:57:03 +08003123 --prop com.android.build.product_services.os_version:$(PLATFORM_VERSION) \
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003124 --prop com.android.build.product_services.security_patch:$(PLATFORM_SECURITY_PATCH)
3125
Bowgo Tsai9b548012019-05-14 16:57:03 +08003126BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
3127 --prop com.android.build.boot.os_version:$(PLATFORM_VERSION)
3128
3129BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
3130 --prop com.android.build.vendor.os_version:$(PLATFORM_VERSION)
3131
3132BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
3133 --prop com.android.build.odm.os_version:$(PLATFORM_VERSION)
3134
3135# The following vendor- and odm-specific images needs explicit SPL set per board.
Bowgo Tsaicca76dd2019-01-30 21:52:32 +08003136ifdef BOOT_SECURITY_PATCH
3137BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
3138 --prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH)
3139endif
3140
3141ifdef VENDOR_SECURITY_PATCH
3142BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \
3143 --prop com.android.build.vendor.security_patch:$(VENDOR_SECURITY_PATCH)
3144endif
3145
3146ifdef ODM_SECURITY_PATCH
3147BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \
3148 --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH)
3149endif
3150
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003151BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS
3152DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS
3153SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS
3154VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
David Zeuthen8fecb282017-12-01 16:24:01 -05003155RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003156PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
Dario Freni5f681e12018-05-29 13:09:01 +01003157PRODUCT_SERVICES_FOOTER_ARGS := BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003158ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003159
Tao Bao0da43472018-08-22 22:53:41 -07003160# Helper function that checks and sets required build variables for an AVB chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003161# $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system.
Tao Bao0da43472018-08-22 22:53:41 -07003162define _check-and-set-avb-chain-args
3163$(eval part := $(1))
3164$(eval PART=$(call to-upper,$(part)))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003165
3166$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH)
3167$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM)
3168$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX)
3169$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION)
3170$(if $($(_key_path)),,$(error $(_key_path) is not defined))
3171$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined))
3172$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined))
3173$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined))
3174
3175# Set INTERNAL_AVB_(PART)_SIGNING_ARGS
3176$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS)
3177$(eval $(_signing_args) := \
3178 --algorithm $($(_signing_algorithm)) --key $($(_key_path)))
3179
3180$(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3181 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)
3182
Tao Bao744c4c72018-08-20 21:09:07 -07003183# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up
David Anderson7709ab22018-10-15 14:41:34 -07003184# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX).
Tao Bao744c4c72018-08-20 21:09:07 -07003185$(if $(filter $(part),$(part:vbmeta_%=%)),\
3186 $(eval _footer_args := $(PART)_FOOTER_ARGS) \
3187 $(eval $($(_footer_args)) += --rollback_index $($(_rollback_index))))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003188endef
3189
Tao Bao0da43472018-08-22 22:53:41 -07003190# Checks and sets the required build variables for an AVB partition. The partition will be
3191# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the
Tao Bao744c4c72018-08-20 21:09:07 -07003192# image descriptor will be included into vbmeta.img, unless it has been already added to any chained
3193# VBMeta image.
Tao Bao0da43472018-08-22 22:53:41 -07003194# $(1): Partition name, e.g. boot or system.
3195define check-and-set-avb-args
Tao Bao744c4c72018-08-20 21:09:07 -07003196$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES)))
Tao Bao0da43472018-08-22 22:53:41 -07003197$(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\
Tao Bao744c4c72018-08-20 21:09:07 -07003198 $(if $(_in_chained_vbmeta),\
3199 $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \
Tao Bao0da43472018-08-22 22:53:41 -07003200 $(call _check-and-set-avb-chain-args,$(1)),\
Tao Bao744c4c72018-08-20 21:09:07 -07003201 $(if $(_in_chained_vbmeta),,\
3202 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
3203 --include_descriptors_from_image $(call images-for-partitions,$(1)))))
Tao Bao0da43472018-08-22 22:53:41 -07003204endef
3205
Tao Baob1a2e352018-08-14 16:17:12 -07003206ifdef INSTALLED_BOOTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003207$(eval $(call check-and-set-avb-args,boot))
Tao Baob1a2e352018-08-14 16:17:12 -07003208endif
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003209
Tao Bao0da43472018-08-22 22:53:41 -07003210$(eval $(call check-and-set-avb-args,system))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003211
3212ifdef INSTALLED_VENDORIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003213$(eval $(call check-and-set-avb-args,vendor))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003214endif
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003215
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003216ifdef INSTALLED_PRODUCTIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003217$(eval $(call check-and-set-avb-args,product))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003218endif
3219
Tao Baocee6d042018-08-22 23:39:03 -07003220ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003221$(eval $(call check-and-set-avb-args,product_services))
Tao Baocee6d042018-08-22 23:39:03 -07003222endif
3223
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003224ifdef INSTALLED_ODMIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003225$(eval $(call check-and-set-avb-args,odm))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003226endif
3227
Yueyao Zhu211c9012017-04-27 00:34:50 -07003228ifdef INSTALLED_DTBOIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003229$(eval $(call check-and-set-avb-args,dtbo))
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003230endif
Yueyao Zhu211c9012017-04-27 00:34:50 -07003231
David Zeuthen8fecb282017-12-01 16:24:01 -05003232ifdef INSTALLED_RECOVERYIMAGE_TARGET
Tao Bao0da43472018-08-22 22:53:41 -07003233$(eval $(call check-and-set-avb-args,recovery))
David Zeuthen8fecb282017-12-01 16:24:01 -05003234endif
Bowgo Tsai53cf9992017-06-13 11:27:06 +08003235
David Anderson7709ab22018-10-15 14:41:34 -07003236# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet.
3237ifdef BOARD_AVB_VBMETA_SYSTEM
3238$(eval $(call check-and-set-avb-args,vbmeta_system))
Tao Bao744c4c72018-08-20 21:09:07 -07003239endif
3240
3241ifdef BOARD_AVB_VBMETA_VENDOR
3242$(eval $(call check-and-set-avb-args,vbmeta_vendor))
3243endif
3244
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003245# Add kernel cmdline descriptor for kernel to mount system.img as root with
3246# dm-verity. This works when system.img is either chained or not-chained:
3247# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel
3248# cmdline descriptor to system.img
3249# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image
3250# will include the kernel cmdline descriptor from system.img into vbmeta.img
Bowgo Tsai9b377602017-04-14 18:50:11 +08003251ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
David Anderson8916a2a2018-09-18 15:46:59 -07003252ifeq ($(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)),)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003253BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel
Bowgo Tsai9b377602017-04-14 18:50:11 +08003254endif
David Anderson8916a2a2018-09-18 15:46:59 -07003255endif
Bowgo Tsai9b377602017-04-14 18:50:11 +08003256
Tao Bao0da43472018-08-22 22:53:41 -07003257BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096
David Anderson7709ab22018-10-15 14:41:34 -07003258BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += --padding_size 4096
Tao Bao744c4c72018-08-20 21:09:07 -07003259BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += --padding_size 4096
3260
3261ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT)))
Tao Bao240dcb82018-10-22 13:02:53 -07003262# We only need the flag in top-level vbmeta.img.
Tao Bao744c4c72018-08-20 21:09:07 -07003263BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag
Tao Bao744c4c72018-08-20 21:09:07 -07003264endif
Tao Bao0da43472018-08-22 22:53:41 -07003265
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003266ifdef BOARD_AVB_ROLLBACK_INDEX
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003267BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003268endif
3269
David Anderson7709ab22018-10-15 14:41:34 -07003270ifdef BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX
3271BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += \
3272 --rollback_index $(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX)
Tao Bao744c4c72018-08-20 21:09:07 -07003273endif
3274
3275ifdef BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX
3276BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += \
3277 --rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX)
John Reck0588b432018-05-03 13:20:01 -07003278endif
3279
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003280# $(1): the directory to extract public keys to
3281define extract-avb-chain-public-keys
3282 $(if $(BOARD_AVB_BOOT_KEY_PATH),\
3283 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \
3284 --output $(1)/boot.avbpubkey)
3285 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\
3286 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \
3287 --output $(1)/system.avbpubkey)
3288 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\
3289 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \
3290 --output $(1)/vendor.avbpubkey)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003291 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
3292 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
3293 --output $(1)/product.avbpubkey)
Dario Freni5f681e12018-05-29 13:09:01 +01003294 $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
3295 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH) \
Dario Freni924af7d2018-08-17 00:56:14 +01003296 --output $(1)/product_services.avbpubkey)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003297 $(if $(BOARD_AVB_ODM_KEY_PATH),\
3298 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \
3299 --output $(1)/odm.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003300 $(if $(BOARD_AVB_DTBO_KEY_PATH),\
3301 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \
3302 --output $(1)/dtbo.avbpubkey)
David Zeuthen8fecb282017-12-01 16:24:01 -05003303 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\
3304 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \
3305 --output $(1)/recovery.avbpubkey)
David Anderson7709ab22018-10-15 14:41:34 -07003306 $(if $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH),\
3307 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3308 --output $(1)/vbmeta_system.avbpubkey)
Tao Bao744c4c72018-08-20 21:09:07 -07003309 $(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\
3310 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3311 --output $(1)/vbmeta_vendor.avbpubkey)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003312endef
3313
Tao Bao744c4c72018-08-20 21:09:07 -07003314# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
3315# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level
David Anderson7709ab22018-10-15 14:41:34 -07003316# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM
3317# := system product_services`, `vbmeta_system.img` will be created that includes the descriptors
3318# for `system.img` and `product_services.img`. `vbmeta_system.img` itself will be included into
Tao Bao744c4c72018-08-20 21:09:07 -07003319# `vbmeta.img` as a chained partition.
David Anderson7709ab22018-10-15 14:41:34 -07003320# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
Tao Bao744c4c72018-08-20 21:09:07 -07003321# $(2): Output filename.
3322define build-chained-vbmeta-image
3323 $(call pretty,"Target chained vbmeta image: $@")
3324 $(hide) $(AVBTOOL) make_vbmeta_image \
3325 $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \
3326 $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \
3327 $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \
3328 --include_descriptors_from_image $(call images-for-partitions,$(image))) \
3329 --output $@
3330endef
3331
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003332ifdef BUILDING_SYSTEM_IMAGE
David Anderson7709ab22018-10-15 14:41:34 -07003333ifdef BOARD_AVB_VBMETA_SYSTEM
3334INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img
3335$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003336 $(AVBTOOL) \
3337 $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \
3338 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)
David Anderson7709ab22018-10-15 14:41:34 -07003339 $(call build-chained-vbmeta-image,vbmeta_system)
Tao Bao744c4c72018-08-20 21:09:07 -07003340endif
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003341endif # BUILDING_SYSTEM_IMAGE
Tao Bao744c4c72018-08-20 21:09:07 -07003342
3343ifdef BOARD_AVB_VBMETA_VENDOR
3344INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img
3345$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003346 $(AVBTOOL) \
3347 $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \
3348 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)
Tao Bao744c4c72018-08-20 21:09:07 -07003349 $(call build-chained-vbmeta-image,vbmeta_vendor)
3350endif
3351
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003352define build-vbmetaimage-target
3353 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)")
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003354 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR)
3355 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR))
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003356 $(hide) $(AVBTOOL) make_vbmeta_image \
3357 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \
Tao Bao0da43472018-08-22 22:53:41 -07003358 $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003359 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \
3360 --output $@
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08003361 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003362endef
3363
3364INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET)
Tao Bao0da43472018-08-22 22:53:41 -07003365$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \
3366 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH)
3367
David Zeuthen8fecb282017-12-01 16:24:01 -05003368$(INSTALLED_VBMETAIMAGE_TARGET): \
Anton Hansson6d814982018-11-26 18:12:05 +00003369 $(AVBTOOL) \
3370 $(INSTALLED_BOOTIMAGE_TARGET) \
3371 $(INSTALLED_SYSTEMIMAGE_TARGET) \
3372 $(INSTALLED_VENDORIMAGE_TARGET) \
3373 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3374 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3375 $(INSTALLED_ODMIMAGE_TARGET) \
3376 $(INSTALLED_DTBOIMAGE_TARGET) \
3377 $(INSTALLED_RECOVERYIMAGE_TARGET) \
3378 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \
3379 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \
3380 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \
3381 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \
3382 $(BOARD_AVB_KEY_PATH)
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003383 $(build-vbmetaimage-target)
3384
3385.PHONY: vbmetaimage-nodeps
3386vbmetaimage-nodeps:
3387 $(build-vbmetaimage-target)
3388
Bowgo Tsai8ee4a3d2017-03-31 15:21:26 +08003389endif # BOARD_AVB_ENABLE
3390
3391# -----------------------------------------------------------------
Yifan Hong055e6cf2018-11-29 13:51:48 -08003392# Check image sizes <= size of super partition
3393
3394ifeq (,$(TARGET_BUILD_APPS))
3395# Do not check for apps-only build
3396
3397ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003398
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003399# (1): list of items like "system", "vendor", "product", "product_services"
3400# return: map each item into a command ( wrapped in $$() ) that reads the size
3401define read-size-of-partitions
Yifan Hong8c3dce02019-04-09 17:03:57 +00003402$(foreach image,$(call images-for-partitions,$(1)),$$( \
3403 build/make/tools/releasetools/sparse_img.py --get_partition_size $(image)))
Yifan Hong37c0c7c2018-07-24 17:45:08 -07003404endef
3405
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003406# round result to BOARD_SUPER_PARTITION_ALIGNMENT
3407#$(1): the calculated size
3408ifeq (,$(BOARD_SUPER_PARTITION_ALIGNMENT))
3409define round-partition-size
3410$(1)
3411endef
3412else
3413define round-partition-size
3414$$((($(1)+$(BOARD_SUPER_PARTITION_ALIGNMENT)-1)/$(BOARD_SUPER_PARTITION_ALIGNMENT)*$(BOARD_SUPER_PARTITION_ALIGNMENT)))
3415endef
3416endif
3417
David Anderson619fe2d2018-10-30 18:47:59 -07003418define super-slot-suffix
3419$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
3420endef
David Anderson1ef03e22018-08-30 13:11:47 -07003421
Yifan Hongb43012f2018-10-01 17:30:01 -07003422droid_targets: check-all-partition-sizes
Yifan Hong17dd45d2018-07-20 16:45:57 -07003423
Yifan Hongb43012f2018-10-01 17:30:01 -07003424.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
Yifan Hong17dd45d2018-07-20 16:45:57 -07003425
Colin Cross606c9f42019-05-17 15:51:39 -07003426check_all_partition_sizes_file := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/timestamp
3427
3428check-all-partition-sizes: $(check_all_partition_sizes_file)
3429
Yifan Hong17dd45d2018-07-20 16:45:57 -07003430# Add image dependencies so that generated_*_image_info.txt are written before checking.
Colin Cross606c9f42019-05-17 15:51:39 -07003431$(check_all_partition_sizes_file): \
Yifan Hong8c3dce02019-04-09 17:03:57 +00003432 build/make/tools/releasetools/sparse_img.py \
3433 $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
Yifan Hong17dd45d2018-07-20 16:45:57 -07003434
David Anderson619fe2d2018-10-30 18:47:59 -07003435ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
Yifan Hongf39d8af2018-11-19 14:22:43 -08003436# Check sum(super partition block devices) == super partition
David Anderson619fe2d2018-10-30 18:47:59 -07003437# Non-retrofit devices already defines BOARD_SUPER_PARTITION_SUPER_DEVICE_SIZE = BOARD_SUPER_PARTITION_SIZE
3438define check-super-partition-size
3439 size_list="$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),$(BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))"; \
3440 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003441 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003442 if [ $$(( $${sum_sizes_expr} )) -ne $$(( $${max_size_expr} )) ]; then \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003443 echo "The sum of super partition block device sizes is not equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003444 echo $${sum_sizes_expr} '!=' $${max_size_expr}; \
3445 exit 1; \
3446 else \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003447 echo "The sum of super partition block device sizes is equal to BOARD_SUPER_PARTITION_SIZE:"; \
David Anderson619fe2d2018-10-30 18:47:59 -07003448 echo $${sum_sizes_expr} '==' $${max_size_expr}; \
3449 fi
3450endef
3451endif
3452
Yifan Hongb43012f2018-10-01 17:30:01 -07003453# $(1): human-readable max size string
3454# $(2): max size expression
3455# $(3): list of partition names
3456define check-sum-of-partition-sizes
Mark Salyzyn1d8d3be2019-01-29 09:08:21 -08003457 partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
3458 echo $(call round-partition-size,$${i}); \
3459 done)"; \
3460 sum_sizes_expr=$$(tr '\n' '+' <<< "$${partition_size_list}" | sed 's/+$$//'); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003461 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $(2) )) ]; then \
3462 echo "The sum of sizes of [$(strip $(3))] is larger than $(strip $(1)):"; \
3463 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
3464 exit 1; \
3465 else \
3466 echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
3467 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
Yifan Hongd58e70b2019-01-11 13:20:52 -08003468 fi;
Yifan Hongb43012f2018-10-01 17:30:01 -07003469endef
Yifan Hong17dd45d2018-07-20 16:45:57 -07003470
Yifan Hongb43012f2018-10-01 17:30:01 -07003471define check-all-partition-sizes-target
Yifan Hongf39d8af2018-11-19 14:22:43 -08003472 # Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003473 $(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003474 $(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
3475 $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
Yifan Hongb43012f2018-10-01 17:30:01 -07003476
3477 # For each group, check sum(partitions in group) <= group size
3478 $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
3479 $(if $(BOARD_$(group)_SIZE),$(if $(BOARD_$(group)_PARTITION_LIST), \
3480 $(call check-sum-of-partition-sizes,BOARD_$(group)_SIZE,$(BOARD_$(group)_SIZE),$(BOARD_$(group)_PARTITION_LIST)))))
3481
Yifan Hongf39d8af2018-11-19 14:22:43 -08003482 # Check sum(all group sizes) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
Yifan Hongb43012f2018-10-01 17:30:01 -07003483 if [[ ! -z $(BOARD_SUPER_PARTITION_SIZE) ]]; then \
3484 group_size_list="$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_SIZE))"; \
3485 sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${group_size_list}"); \
Yifan Hongf39d8af2018-11-19 14:22:43 -08003486 max_size_tail=$(if $(call super-slot-suffix)," / 2"); \
Yifan Hongb43012f2018-10-01 17:30:01 -07003487 max_size_expr="$(BOARD_SUPER_PARTITION_SIZE)$${max_size_tail}"; \
3488 if [ $$(( $${sum_sizes_expr} )) -gt $$(( $${max_size_expr} )) ]; then \
3489 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is larger than BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3490 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3491 exit 1; \
3492 else \
3493 echo "The sum of sizes of [$(strip $(BOARD_SUPER_PARTITION_GROUPS))] is within BOARD_SUPER_PARTITION_SIZE$${max_size_tail}:"; \
3494 echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $${max_size_expr} '==' $$(( $${max_size_expr} )); \
3495 fi \
3496 fi
3497endef
3498
Colin Cross606c9f42019-05-17 15:51:39 -07003499$(check_all_partition_sizes_file):
3500 $(call check-all-partition-sizes-target)
3501 $(call check-super-partition-size)
3502 touch $@
3503
3504check-all-partition-sizes-nodeps:
Yifan Hongb43012f2018-10-01 17:30:01 -07003505 $(call check-all-partition-sizes-target)
David Anderson619fe2d2018-10-30 18:47:59 -07003506 $(call check-super-partition-size)
Yifan Hongb43012f2018-10-01 17:30:01 -07003507
Yifan Hong2dae5722018-07-31 12:47:27 -07003508endif # PRODUCT_BUILD_SUPER_PARTITION
Yifan Hong17dd45d2018-07-20 16:45:57 -07003509
3510endif # TARGET_BUILD_APPS
3511
3512# -----------------------------------------------------------------
Greg Hartman2ebfef42014-11-04 21:17:06 -08003513# bring in the installer image generation defines if necessary
3514ifeq ($(TARGET_USE_DISKINSTALLER),true)
3515include bootable/diskinstaller/config.mk
3516endif
3517
3518# -----------------------------------------------------------------
Colin Crossc312f312012-04-19 13:54:39 -07003519# host tools needed to build dist and OTA packages
The Android Open Source Project88b60792009-03-03 19:28:42 -08003520
Ying Wangbd2d0242015-09-22 11:17:52 -07003521ifeq ($(BUILD_OS),darwin)
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003522 build_ota_package := false
3523 build_otatools_package := false
3524else
Tao Bao9be20c72019-04-08 21:11:59 -07003525 # Set build_ota_package, and allow opt-out below.
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003526 build_ota_package := true
3527 ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
3528 build_ota_package := false
3529 endif
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003530 ifneq (,$(filter address, $(SANITIZE_TARGET)))
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003531 build_ota_package := false
3532 endif
3533 ifeq ($(TARGET_PRODUCT),sdk)
3534 build_ota_package := false
3535 endif
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003536 ifeq ($(TARGET_BUILD_PDK),true)
3537 build_ota_package := false
3538 endif
Tao Bao9be20c72019-04-08 21:11:59 -07003539 ifneq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
3540 ifneq ($(filter generic%,$(TARGET_DEVICE)),)
3541 build_ota_package := false
3542 endif
3543 ifeq ($(TARGET_NO_KERNEL),true)
3544 build_ota_package := false
3545 endif
3546 ifeq ($(recovery_fstab),)
3547 build_ota_package := false
3548 endif
3549 endif # PRODUCT_BUILD_GENERIC_OTA_PACKAGE
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003550
Tao Bao9be20c72019-04-08 21:11:59 -07003551 # Set build_otatools_package, and allow opt-out below.
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003552 build_otatools_package := true
3553 ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
3554 build_otatools_package := false
3555 endif
Colin Cross481cc5a2016-02-04 15:09:23 -08003556endif
Ying Wangbd2d0242015-09-22 11:17:52 -07003557
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003558ifeq ($(build_otatools_package),true)
Tao Bao96daeeb2019-05-01 21:17:13 -07003559
3560INTERNAL_OTATOOLS_MODULES := \
3561 aapt \
3562 append2simg \
3563 avbtool \
3564 blk_alloc_to_base_fs \
3565 boot_signer \
3566 brillo_update_payload \
3567 brotli \
3568 bsdiff \
3569 build_verity_metadata \
3570 build_verity_tree \
3571 care_map_generator \
3572 checkvintf \
3573 delta_generator \
3574 e2fsck \
3575 e2fsdroid \
3576 fc_sort \
3577 fec \
3578 fs_config \
3579 generate_verity_key \
3580 img2simg \
3581 imgdiff \
3582 libconscrypt_openjdk_jni \
3583 lpmake \
3584 make_f2fs \
3585 minigzip \
3586 mkbootfs \
3587 mkbootimg \
3588 mke2fs \
3589 mke2fs.conf \
3590 mkf2fsuserimg.sh \
3591 mksquashfs \
3592 mksquashfsimage.sh \
3593 mkuserimg_mke2fs \
3594 sefcontext_compile \
3595 shflags \
3596 signapk \
3597 simg2img \
3598 sload_f2fs \
3599 tune2fs \
3600 verity_signer \
3601 verity_verifier \
3602 zipalign \
Tao Bao5e04c382017-02-22 16:38:19 -08003603
Anton Hansson8dab0a62019-03-28 15:45:40 +00003604ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Tao Bao96daeeb2019-05-01 21:17:13 -07003605INTERNAL_OTATOOLS_MODULES += \
3606 futility \
3607 vboot_signer
Tao Bao5e04c382017-02-22 16:38:19 -08003608endif
Tao Baof8e6fbe2016-01-04 09:57:32 -08003609
Tao Bao96daeeb2019-05-01 21:17:13 -07003610INTERNAL_OTATOOLS_FILES := \
3611 $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08003612
Ying Wang06898662010-06-17 17:52:18 -07003613.PHONY: otatools
Tao Bao96daeeb2019-05-01 21:17:13 -07003614otatools: $(INTERNAL_OTATOOLS_FILES)
Ying Wang06898662010-06-17 17:52:18 -07003615
Tao Bao96daeeb2019-05-01 21:17:13 -07003616# For each module, recursively resolve its host shared library dependencies. Then we have a full
3617# list of modules whose installed files need to be packed.
3618INTERNAL_OTATOOLS_MODULES_WITH_DEPS := \
3619 $(sort $(INTERNAL_OTATOOLS_MODULES) \
3620 $(foreach m,$(INTERNAL_OTATOOLS_MODULES),$(call get-all-shared-libs-deps,$(m))))
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003621
Tao Bao96daeeb2019-05-01 21:17:13 -07003622INTERNAL_OTATOOLS_PACKAGE_FILES := \
3623 $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES_WITH_DEPS)))
3624
3625INTERNAL_OTATOOLS_PACKAGE_FILES += \
3626 $(sort $(shell find build/make/target/product/security -type f -name "*.x509.pem" -o \
3627 -name "*.pk8" -o -name verity_key))
Tao Bao93ab8442018-10-12 11:03:04 -07003628
3629ifneq (,$(wildcard device))
Tao Bao96daeeb2019-05-01 21:17:13 -07003630INTERNAL_OTATOOLS_PACKAGE_FILES += \
Dan Willemsen60c66442018-05-01 19:07:27 -07003631 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \
3632 -name "*.x509.pem" -o -name "oem*.prop"))
Tao Bao93ab8442018-10-12 11:03:04 -07003633endif
3634ifneq (,$(wildcard external/avb))
Tao Bao96daeeb2019-05-01 21:17:13 -07003635INTERNAL_OTATOOLS_PACKAGE_FILES += \
Tao Bao93ab8442018-10-12 11:03:04 -07003636 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \
3637 -name "atx_metadata.bin"))
3638endif
3639ifneq (,$(wildcard system/update_engine))
Tao Bao96daeeb2019-05-01 21:17:13 -07003640INTERNAL_OTATOOLS_PACKAGE_FILES += \
Tao Bao93ab8442018-10-12 11:03:04 -07003641 $(sort $(shell find system/update_engine/scripts -name "*.pyc" -prune -o -type f -print))
3642endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00003643ifeq (true,$(PRODUCT_SUPPORTS_VBOOT))
Tao Bao96daeeb2019-05-01 21:17:13 -07003644INTERNAL_OTATOOLS_PACKAGE_FILES += \
Tao Bao5232f092018-02-10 04:03:32 +00003645 $(sort $(shell find external/vboot_reference/tests/devkeys -type f))
Tao Baoe8ef8f702017-05-17 11:41:50 -07003646endif
3647
Tao Bao96daeeb2019-05-01 21:17:13 -07003648INTERNAL_OTATOOLS_RELEASETOOLS := \
3649 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o \
3650 \( -type f -o -type l \) -print))
3651
3652BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip
3653$(BUILT_OTATOOLS_PACKAGE): PRIVATE_ZIP_ROOT := $(call intermediates-dir-for,PACKAGING,otatools)/otatools
3654$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_PACKAGE_FILES := $(INTERNAL_OTATOOLS_PACKAGE_FILES)
3655$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_RELEASETOOLS := $(INTERNAL_OTATOOLS_RELEASETOOLS)
3656$(BUILT_OTATOOLS_PACKAGE): $(INTERNAL_OTATOOLS_PACKAGE_FILES) $(INTERNAL_OTATOOLS_RELEASETOOLS)
3657$(BUILT_OTATOOLS_PACKAGE): $(SOONG_ZIP)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003658 @echo "Package OTA tools: $@"
Tao Bao96daeeb2019-05-01 21:17:13 -07003659 rm -rf $@ $(PRIVATE_ZIP_ROOT)
3660 mkdir -p $(dir $@)
3661 $(call copy-files-with-structure,$(PRIVATE_OTATOOLS_PACKAGE_FILES),$(HOST_OUT)/,$(PRIVATE_ZIP_ROOT))
3662 $(call copy-files-with-structure,$(PRIVATE_OTATOOLS_RELEASETOOLS),build/make/tools/,$(PRIVATE_ZIP_ROOT))
3663 cp $(SOONG_ZIP) $(PRIVATE_ZIP_ROOT)/bin/
3664 $(SOONG_ZIP) -o $@ -C $(PRIVATE_ZIP_ROOT) -D $(PRIVATE_ZIP_ROOT)
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003665
3666.PHONY: otatools-package
3667otatools-package: $(BUILT_OTATOOLS_PACKAGE)
3668
Bowgo Tsaid6ff8972018-10-09 15:46:25 +08003669endif # build_otatools_package
Doug Zongkerf22b0f42014-08-22 08:04:58 -07003670
The Android Open Source Project88b60792009-03-03 19:28:42 -08003671# -----------------------------------------------------------------
3672# A zip of the directories that map to the target filesystem.
3673# This zip can be used to create an OTA package or filesystem image
3674# as a post-build step.
3675#
3676name := $(TARGET_PRODUCT)
3677ifeq ($(TARGET_BUILD_TYPE),debug)
3678 name := $(name)_debug
3679endif
3680name := $(name)-target_files-$(FILE_NAME_TAG)
3681
3682intermediates := $(call intermediates-dir-for,PACKAGING,target_files)
3683BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip
3684$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates)
3685$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003686 zip_root := $(intermediates)/$(name)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003687
3688# $(1): Directory to copy
3689# $(2): Location to copy it to
3690# The "ls -A" is to prevent "acp s/* d" from failing if s is empty.
3691define package_files-copy-root
3692 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \
3693 mkdir -p $(2) && \
3694 $(ACP) -rd $(strip $(1))/* $(2); \
3695 fi
3696endef
3697
Tao Baoa04fca32015-11-30 12:22:24 -08003698built_ota_tools :=
Ying Wange6e544e2015-06-22 18:35:35 -07003699
3700# We can't build static executables when SANITIZE_TARGET=address
Evgenii Stepanov5d06f242018-11-14 14:12:10 -08003701ifeq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wange6e544e2015-06-22 18:35:35 -07003702built_ota_tools += \
Ying Wange6e544e2015-06-22 18:35:35 -07003703 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater
3704endif
3705
The Android Open Source Project88b60792009-03-03 19:28:42 -08003706$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
3707
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003708$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003709$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
Doug Zongkerb1134dd2009-06-17 17:09:40 -07003710
Doug Zongkerc18736b2009-09-30 09:20:32 -07003711ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
3712# default to common dir for device vendor
Dan Willemsen653bea92017-03-21 15:47:37 -07003713tool_extensions := $(TARGET_DEVICE_DIR)/../common
Doug Zongkerc18736b2009-09-30 09:20:32 -07003714else
Dan Willemsen653bea92017-03-21 15:47:37 -07003715tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003716endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003717tool_extension := $(wildcard $(tool_extensions)/releasetools.py)
3718$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions)
3719$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension)
Doug Zongkerc18736b2009-09-30 09:20:32 -07003720
Sen Jiang4438fd92016-03-07 16:51:01 -08003721ifeq ($(AB_OTA_UPDATER),true)
Sen Jiang43935632017-12-19 15:24:43 -08003722updater_dep := system/update_engine/update_engine.conf
Sen Jiang4438fd92016-03-07 16:51:01 -08003723else
Steve Fung48e49f52015-10-01 23:53:31 -07003724# Build OTA tools if not using the AB Updater.
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003725updater_dep := $(built_ota_tools)
Steve Fung48e49f52015-10-01 23:53:31 -07003726endif
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09003727$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep)
Steve Fung48e49f52015-10-01 23:53:31 -07003728
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003729# If we are using recovery as boot, output recovery files to BOOT/.
3730ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
3731$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT
3732else
3733$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY
3734endif
3735
Dan Willemsen653bea92017-03-21 15:47:37 -07003736ifeq ($(AB_OTA_UPDATER),true)
Dan Willemsen653bea92017-03-21 15:47:37 -07003737 ifdef OSRELEASED_DIRECTORY
3738 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id
3739 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version
3740 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version
3741 endif
3742endif
3743
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08003744# Run fs_config while creating the target files package
3745# $1: root directory
3746# $2: add prefix
3747define fs_config
Luis Hector Chavez440da2d2018-02-07 09:49:52 -08003748(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 -08003749endef
3750
Yifan Hong2b891ac2018-11-29 12:06:31 -08003751# $(1): file
3752define dump-dynamic-partitions-info
3753 $(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \
3754 echo "use_dynamic_partitions=true" >> $(1))
3755 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
3756 echo "dynamic_partition_retrofit=true" >> $(1))
Yifan Hong055e6cf2018-11-29 13:51:48 -08003757 echo "lpmake=$(notdir $(LPMAKE))" >> $(1)
3758 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \
3759 echo "build_super_partition=true" >> $(1)))
Tao Bao519d1822018-12-27 12:47:23 -08003760 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \
3761 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08003762 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1)
3763 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3764 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1))
3765 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
3766 echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
3767 $(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
3768 echo "dynamic_partition_list=$(BOARD_SUPER_PARTITION_PARTITION_LIST)" >> $(1))
3769 $(if $(BOARD_SUPER_PARTITION_GROUPS),
3770 echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
3771 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
3772 echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
3773 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
3774 echo "super_$(group)_partition_list=$(BOARD_$(call to-upper,$(group))_PARTITION_LIST)" >> $(1);))
Yifan Hongcb35bd92019-04-02 16:29:59 -07003775 $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)), \
3776 echo "build_non_sparse_super_partition=true" >> $(1))
Yifan Hong0e97dbb2019-04-17 14:28:52 -07003777 $(if $(filter true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE)), \
3778 echo "super_image_in_update_package=true" >> $(1))
Yifan Hong2b891ac2018-11-29 12:06:31 -08003779endef
3780
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07003781# By conditionally including the dependency of the target files package on the
3782# full system image deps, we speed up builds that do not build the system
3783# image.
3784ifdef BUILDING_SYSTEM_IMAGE
3785$(BUILT_TARGET_FILES_PACKAGE): $(FULL_SYSTEMIMAGE_DEPS)
3786endif
3787
The Android Open Source Project88b60792009-03-03 19:28:42 -08003788# Depending on the various images guarantees that the underlying
3789# directories are up-to-date.
3790$(BUILT_TARGET_FILES_PACKAGE): \
Anton Hansson6d814982018-11-26 18:12:05 +00003791 $(INSTALLED_RAMDISK_TARGET) \
3792 $(INSTALLED_BOOTIMAGE_TARGET) \
3793 $(INSTALLED_RADIOIMAGE_TARGET) \
3794 $(INSTALLED_RECOVERYIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00003795 $(INSTALLED_USERDATAIMAGE_TARGET) \
3796 $(INSTALLED_CACHEIMAGE_TARGET) \
3797 $(INSTALLED_VENDORIMAGE_TARGET) \
3798 $(INSTALLED_PRODUCTIMAGE_TARGET) \
3799 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
3800 $(INSTALLED_VBMETAIMAGE_TARGET) \
3801 $(INSTALLED_ODMIMAGE_TARGET) \
3802 $(INSTALLED_DTBOIMAGE_TARGET) \
3803 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
3804 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \
3805 $(INSTALLED_KERNEL_TARGET) \
Hridya Valsaraju59eaef02019-05-20 11:10:24 -07003806 $(INSTALLED_DTBIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00003807 $(INSTALLED_2NDBOOTLOADER_TARGET) \
3808 $(BOARD_PREBUILT_DTBOIMAGE) \
Hridya Valsarajua9418992019-02-04 10:35:25 -08003809 $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003810 $(BOARD_RECOVERY_ACPIO) \
Anton Hansson8dab0a62019-03-28 15:45:40 +00003811 $(PRODUCT_SYSTEM_BASE_FS_PATH) \
3812 $(PRODUCT_VENDOR_BASE_FS_PATH) \
3813 $(PRODUCT_PRODUCT_BASE_FS_PATH) \
3814 $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
3815 $(PRODUCT_ODM_BASE_FS_PATH) \
Anton Hansson6d814982018-11-26 18:12:05 +00003816 $(LPMAKE) \
3817 $(SELINUX_FC) \
3818 $(APKCERTS_FILE) \
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003819 $(SOONG_APEX_KEYS_FILE) \
Anton Hansson6d814982018-11-26 18:12:05 +00003820 $(SOONG_ZIP) \
3821 $(HOST_OUT_EXECUTABLES)/fs_config \
3822 $(HOST_OUT_EXECUTABLES)/imgdiff \
3823 $(HOST_OUT_EXECUTABLES)/bsdiff \
3824 $(HOST_OUT_EXECUTABLES)/care_map_generator \
3825 $(BUILD_IMAGE_SRCS) \
Yifan Hong51e87262019-04-23 17:09:07 -07003826 $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) \
Anton Hansson6d814982018-11-26 18:12:05 +00003827 $(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
3828 $(BUILT_SYSTEM_MATRIX) \
3829 $(BUILT_VENDOR_MATRIX) \
3830 | $(ACP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003831 @echo "Package target files: $@"
Dan Willemsenf75d7fa2017-03-23 13:09:21 -07003832 $(call create-system-vendor-symlink)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003833 $(call create-system-product-symlink)
Dario Freni924af7d2018-08-17 00:56:14 +01003834 $(call create-system-product_services-symlink)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003835 $(call create-vendor-odm-symlink)
Dan Willemsen5e29cad2016-08-06 20:15:06 -07003836 $(hide) rm -rf $@ $@.list $(zip_root)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003837 $(hide) mkdir -p $(dir $@) $(zip_root)
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003838ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)))
The Android Open Source Project88b60792009-03-03 19:28:42 -08003839 @# Components of the recovery image
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003840 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003841 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003842 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003843ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003844 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003845endif
3846ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003847 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003848endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003849ifdef BOARD_INCLUDE_RECOVERY_DTBO
Hridya Valsarajua9418992019-02-04 10:35:25 -08003850ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE
3851 $(hide) cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
3852else
cfig28687402018-08-22 16:21:41 +08003853 $(hide) cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003854endif
Hridya Valsarajua9418992019-02-04 10:35:25 -08003855endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003856ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3857 $(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
3858endif
Hridya Valsaraju59eaef02019-05-20 11:10:24 -07003859ifdef INSTALLED_DTBIMAGE_TARGET
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003860 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
3861endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003862ifdef INTERNAL_KERNEL_CMDLINE
3863 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003864endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003865ifdef BOARD_KERNEL_BASE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003866 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base
Doug Zongker38a649f2009-06-17 09:07:09 -07003867endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003868ifdef BOARD_KERNEL_PAGESIZE
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003869 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
Ying Wang4de6b5b2010-08-25 14:29:34 -07003870endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003871endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
The Android Open Source Project88b60792009-03-03 19:28:42 -08003872 @# Components of the boot image
3873 $(hide) mkdir -p $(zip_root)/BOOT
Tao Bao62bd4792015-07-21 18:01:20 -07003874 $(hide) mkdir -p $(zip_root)/ROOT
3875 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003876 $(TARGET_ROOT_OUT),$(zip_root)/ROOT)
Tom Cherry3871f0f2018-11-06 14:23:44 -08003877 @# If we are using recovery as boot, this is already done when processing recovery.
3878ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherryd14b8952018-08-09 14:26:00 -07003879ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08003880 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003881 $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK)
Tao Bao62bd4792015-07-21 18:01:20 -07003882endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003883ifdef INSTALLED_KERNEL_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003884 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel
The Android Open Source Project88b60792009-03-03 19:28:42 -08003885endif
3886ifdef INSTALLED_2NDBOOTLOADER_TARGET
Dan Willemsen653bea92017-03-21 15:47:37 -07003887 $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second
The Android Open Source Project88b60792009-03-03 19:28:42 -08003888endif
Hridya Valsaraju9683b2f2019-01-22 18:08:59 -08003889ifdef INSTALLED_DTBIMAGE_TARGET
3890 $(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb
3891endif
Dan Willemsenc1f17ff2016-10-05 16:57:27 -07003892ifdef INTERNAL_KERNEL_CMDLINE
3893 $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
The Android Open Source Project88b60792009-03-03 19:28:42 -08003894endif
Doug Zongker38a649f2009-06-17 09:07:09 -07003895ifdef BOARD_KERNEL_BASE
3896 $(hide) echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base
3897endif
Ying Wang4de6b5b2010-08-25 14:29:34 -07003898ifdef BOARD_KERNEL_PAGESIZE
3899 $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
3900endif
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08003901endif # BOARD_USES_RECOVERY_AS_BOOT
Doug Zongkere01100c2009-06-19 17:12:18 -07003902 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
3903 mkdir -p $(zip_root)/RADIO; \
Dan Willemsen653bea92017-03-21 15:47:37 -07003904 cp $(t) $(zip_root)/RADIO/$(notdir $(t));)
Dan Willemsen67495202019-01-16 12:42:05 -08003905ifdef BUILDING_SYSTEM_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003906 @# Contents of the system image
3907 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003908 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM)
Dan Willemsen67495202019-01-16 12:42:05 -08003909endif
3910ifdef BUILDING_USERDATA_IMAGE
The Android Open Source Project88b60792009-03-03 19:28:42 -08003911 @# Contents of the data image
3912 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003913 $(TARGET_OUT_DATA),$(zip_root)/DATA)
Dan Willemsen67495202019-01-16 12:42:05 -08003914endif
3915ifdef BUILDING_VENDOR_IMAGE
Ying Wanga0febe52013-03-20 11:02:05 -07003916 @# Contents of the vendor image
3917 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003918 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR)
Ying Wanga0febe52013-03-20 11:02:05 -07003919endif
Dan Willemsen67495202019-01-16 12:42:05 -08003920ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003921 @# Contents of the product image
3922 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003923 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09003924endif
Dan Willemsen67495202019-01-16 12:42:05 -08003925ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01003926 @# Contents of the product_services image
Dario Freni5f681e12018-05-29 13:09:01 +01003927 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003928 $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
Dario Freni5f681e12018-05-29 13:09:01 +01003929endif
Dan Willemsen67495202019-01-16 12:42:05 -08003930ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003931 @# Contents of the odm image
3932 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003933 $(TARGET_OUT_ODM),$(zip_root)/ODM)
Bowgo Tsaid624fa62017-11-14 23:42:30 +08003934endif
Dan Willemsen67495202019-01-16 12:42:05 -08003935ifdef BUILDING_SYSTEM_OTHER_IMAGE
Alex Light4e358ab2016-06-16 14:47:10 -07003936 @# Contents of the system_other image
3937 $(hide) $(call package_files-copy-root, \
Anton Hansson6d814982018-11-26 18:12:05 +00003938 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER)
Alex Light4e358ab2016-06-16 14:47:10 -07003939endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08003940 @# Extra contents of the OTA package
Steve Fung48e49f52015-10-01 23:53:31 -07003941 $(hide) mkdir -p $(zip_root)/OTA
Dan Willemsen653bea92017-03-21 15:47:37 -07003942 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
Steve Fung48e49f52015-10-01 23:53:31 -07003943ifneq ($(AB_OTA_UPDATER),true)
Ying Wang03b6e8b2015-12-07 10:45:19 -08003944ifneq ($(built_ota_tools),)
Steve Fung48e49f52015-10-01 23:53:31 -07003945 $(hide) mkdir -p $(zip_root)/OTA/bin
Dan Willemsen653bea92017-03-21 15:47:37 -07003946 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
Steve Fung48e49f52015-10-01 23:53:31 -07003947endif
Ying Wang03b6e8b2015-12-07 10:45:19 -08003948endif
Doug Zongker8678df42009-06-15 14:30:14 -07003949 @# Files that do not end up in any images, but are necessary to
The Android Open Source Project88b60792009-03-03 19:28:42 -08003950 @# build them.
3951 $(hide) mkdir -p $(zip_root)/META
Dan Willemsen653bea92017-03-21 15:47:37 -07003952 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt
Jiyong Parkbcc8d8a2019-02-18 15:21:19 +09003953 $(hide) cp $(SOONG_APEX_KEYS_FILE) $(zip_root)/META/apexkeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003954ifneq ($(tool_extension),)
3955 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/
3956endif
Ying Wang0eabd4f2015-03-24 19:07:40 -07003957 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
Dan Willemsen653bea92017-03-21 15:47:37 -07003958 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin
Doug Zongker37974732010-09-16 17:44:38 -07003959 $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt
Ken Sumrall31ce31f2013-02-21 16:27:25 -08003960 $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003961ifdef BOARD_FLASH_BLOCK_SIZE
Doug Zongker37974732010-09-16 17:44:38 -07003962 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003963endif
3964ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003965 $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003966endif
Chris Grossa784ef12019-04-22 11:09:57 -07003967ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
3968 $(hide) echo "no_boot=true" >> $(zip_root)/META/misc_info.txt
3969endif
Tao Baodb45efa2015-10-27 19:25:18 -07003970ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
3971 $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
3972endif
Hridya Valsarajue74a38b2018-03-21 12:15:11 -07003973ifdef BOARD_INCLUDE_RECOVERY_DTBO
3974 $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
3975endif
Chen, ZhiminX752439b2018-09-23 22:10:47 +08003976ifdef BOARD_INCLUDE_RECOVERY_ACPIO
3977 $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
3978endif
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003979ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
Ying Wang00836712011-01-14 11:30:56 -08003980 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Doug Zongkerb4c7d322010-07-01 15:30:11 -07003981endif
JP Abgrall6ea5bd62014-10-22 20:01:22 -07003982ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
3983 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
3984 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3985else
3986 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
3987endif
Dan Willemsen653bea92017-03-21 15:47:37 -07003988 $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt
Ying Wang3c21fe52011-10-04 10:50:08 -07003989 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt
Doug Zongker5d4808d2011-03-16 07:49:13 -07003990ifdef PRODUCT_EXTRA_RECOVERY_KEYS
3991 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt
Doug Zongkere121d6a2011-02-01 14:13:52 -08003992endif
Jianxun Zhang09849492013-04-17 15:19:19 -07003993 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
Sami Tolvanen3303d902016-03-15 16:49:30 +00003994 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
Doug Zongker9b23f2c2013-11-25 14:44:12 -08003995 $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
Tao Bao8fad03e2017-03-01 14:36:26 -08003996 $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
Tao Bao9be20c72019-04-08 21:11:59 -07003997ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
3998 $(hide) echo "build_generic_ota_package=true" >> $(zip_root)/META/misc_info.txt
3999endif
Ying Wange24e17a2014-10-07 18:42:11 -07004000ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
Jeff Sharkey26e1a282014-03-21 16:20:05 -07004001 # OTA scripts are only interested in fingerprint related properties
Ying Wange24e17a2014-10-07 18:42:11 -07004002 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
Vineeta Srivastava27262112014-09-18 14:34:00 -07004003endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004004ifneq ($(PRODUCT_SYSTEM_BASE_FS_PATH),)
4005 $(hide) cp $(PRODUCT_SYSTEM_BASE_FS_PATH) \
4006 $(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_BASE_FS_PATH))
Tao Baof54216f2016-03-29 15:12:37 -07004007endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004008ifneq ($(PRODUCT_VENDOR_BASE_FS_PATH),)
4009 $(hide) cp $(PRODUCT_VENDOR_BASE_FS_PATH) \
4010 $(zip_root)/META/$(notdir $(PRODUCT_VENDOR_BASE_FS_PATH))
Tao Baof54216f2016-03-29 15:12:37 -07004011endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004012ifneq ($(PRODUCT_PRODUCT_BASE_FS_PATH),)
4013 $(hide) cp $(PRODUCT_PRODUCT_BASE_FS_PATH) \
4014 $(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_BASE_FS_PATH))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004015endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004016ifneq ($(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH),)
4017 $(hide) cp $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
4018 $(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH))
Dario Freni5f681e12018-05-29 13:09:01 +01004019endif
Anton Hansson8dab0a62019-03-28 15:45:40 +00004020ifneq ($(PRODUCT_ODM_BASE_FS_PATH),)
4021 $(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \
4022 $(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004023endif
Evgenii Stepanov60beecc2019-01-18 13:53:52 -08004024ifneq (,$(filter address, $(SANITIZE_TARGET)))
Ying Wang2a048392015-06-25 13:56:53 -07004025 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
4026 $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
4027endif
Tao Bao8beab692015-07-22 12:33:18 -07004028ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
4029 $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
4030endif
David Zeuthen0eb10972016-09-28 17:55:27 -04004031ifeq ($(BOARD_AVB_ENABLE),true)
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004032 $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
4033 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4034 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4035 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
4036 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
4037ifdef BOARD_AVB_BOOT_KEY_PATH
4038 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4039 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4040 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4041endif # BOARD_AVB_BOOT_KEY_PATH
David Zeuthen8fecb282017-12-01 16:24:01 -05004042 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
4043ifdef BOARD_AVB_RECOVERY_KEY_PATH
4044 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4045 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4046 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4047endif # BOARD_AVB_RECOVERY_KEY_PATH
David Anderson7709ab22018-10-15 14:41:34 -07004048ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
4049 $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $(zip_root)/META/misc_info.txt
4050 $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
4051 $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4052 $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4053 $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4054endif # BOARD_AVB_VBMETA_SYSTEM
Tao Bao744c4c72018-08-20 21:09:07 -07004055ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
4056 $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $(zip_root)/META/misc_info.txt
David Anderson7709ab22018-10-15 14:41:34 -07004057 $(hide) echo "avb_vbmeta_vendor_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
Tao Bao744c4c72018-08-20 21:09:07 -07004058 $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4059 $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4060 $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
4061endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004062endif # BOARD_AVB_ENABLE
David Zeuthen25328622016-04-08 15:08:03 -04004063ifdef BOARD_BPT_INPUT_FILES
4064 $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
4065 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
4066 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
4067endif
4068ifdef BOARD_BPT_DISK_SIZE
4069 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
4070endif
Ying Wangbd93d422011-10-28 17:02:30 -07004071 $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
Tao Baocbc6dc22015-08-18 18:03:56 -07004072ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
Daniel Normanadf80962019-03-18 14:20:52 -07004073ifdef BUILDING_SYSTEM_IMAGE
Per Astrandcab66992015-03-25 14:06:30 +01004074 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08004075 build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
Daniel Normanadf80962019-03-18 14:20:52 -07004076endif # BUILDING_SYSTEM_IMAGE
Tao Baocbc6dc22015-08-18 18:03:56 -07004077endif
Alex Deymo70067ac2015-09-29 19:05:37 -07004078ifeq ($(AB_OTA_UPDATER),true)
4079 @# When using the A/B updater, include the updater config files in the zip.
Dan Willemsen653bea92017-03-21 15:47:37 -07004080 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt
Alex Deymo49be2b12015-10-22 18:15:27 -07004081 $(hide) for part in $(AB_OTA_PARTITIONS); do \
Alex Deymo8925d332015-10-01 17:38:09 -07004082 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \
4083 done
Sen Jiang8f22e2a2015-11-12 13:53:25 -08004084 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
4085 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
4086 done
Steve Fung4044b382015-11-05 02:04:04 -08004087 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
4088 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
Daniel Rosenbergd80bef22015-11-10 19:21:34 -08004089 $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07004090ifdef OSRELEASED_DIRECTORY
Dan Willemsen653bea92017-03-21 15:47:37 -07004091 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt
4092 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt
4093 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt
Bertrand SIMONNET4af72592015-10-08 15:32:40 -07004094endif
Alex Deymo70067ac2015-09-29 19:05:37 -07004095endif
Steve Fungdfbab492015-09-24 18:12:33 -07004096ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
Alex Deymo70067ac2015-09-29 19:05:37 -07004097 @# If breakpad symbols have been generated, add them to the zip.
Dan Willemsen288bedf2019-05-28 15:36:47 -07004098 $(hide) cp -R $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
Steve Fungdfbab492015-09-24 18:12:33 -07004099endif
Dan Willemsen6c3e79b2016-06-17 14:07:37 -07004100ifdef BOARD_PREBUILT_VENDORIMAGE
4101 $(hide) mkdir -p $(zip_root)/IMAGES
4102 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
4103endif
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004104ifdef BOARD_PREBUILT_PRODUCTIMAGE
4105 $(hide) mkdir -p $(zip_root)/IMAGES
4106 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
4107endif
Dario Freni5f681e12018-05-29 13:09:01 +01004108ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
4109 $(hide) mkdir -p $(zip_root)/IMAGES
4110 $(hide) cp $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(zip_root)/IMAGES/
4111endif
Michael Schwartz0dc6f212017-07-18 10:05:13 -07004112ifdef BOARD_PREBUILT_BOOTIMAGE
4113 $(hide) mkdir -p $(zip_root)/IMAGES
4114 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
4115endif
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004116ifdef BOARD_PREBUILT_ODMIMAGE
4117 $(hide) mkdir -p $(zip_root)/IMAGES
4118 $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/
4119endif
Yueyao Zhu889ee5e2017-05-12 17:50:46 -07004120ifdef BOARD_PREBUILT_DTBOIMAGE
Tao Baoc633ed02017-05-30 21:46:33 -07004121 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
4122 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
4123 $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
4124ifeq ($(BOARD_AVB_ENABLE),true)
4125 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004126 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
4127ifdef BOARD_AVB_DTBO_KEY_PATH
4128 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
4129 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
4130 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
Tao Baoc633ed02017-05-30 21:46:33 -07004131 >> $(zip_root)/META/misc_info.txt
Bowgo Tsai3e599ea2017-05-26 18:30:04 +08004132endif # BOARD_AVB_DTBO_KEY_PATH
4133endif # BOARD_AVB_ENABLE
4134endif # BOARD_PREBUILT_DTBOIMAGE
Yifan Hong2b891ac2018-11-29 12:06:31 -08004135 $(call dump-dynamic-partitions-info,$(zip_root)/META/misc_info.txt)
Tao Bao95a95c32017-06-16 15:30:23 -07004136 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
4137 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
4138 @# INSTALLED_RADIOIMAGE_TARGET.
4139 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \
4140 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;)
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004141 @# Run fs_config on all the system, vendor, boot ramdisk,
4142 @# and recovery ramdisk files in the zip, and save the output
Dan Willemsen67495202019-01-16 12:42:05 -08004143ifdef BUILDING_SYSTEM_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004144 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt
Dan Willemsen67495202019-01-16 12:42:05 -08004145endif
4146ifdef BUILDING_VENDOR_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004147 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt
4148endif
Dan Willemsen67495202019-01-16 12:42:05 -08004149ifdef BUILDING_PRODUCT_IMAGE
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004150 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
4151endif
Dan Willemsen67495202019-01-16 12:42:05 -08004152ifdef BUILDING_PRODUCT_SERVICES_IMAGE
Dario Freni924af7d2018-08-17 00:56:14 +01004153 $(hide) $(call fs_config,$(zip_root)/PRODUCT_SERVICES,product_services/) > $(zip_root)/META/product_services_filesystem_config.txt
Dario Freni5f681e12018-05-29 13:09:01 +01004154endif
Dan Willemsen67495202019-01-16 12:42:05 -08004155ifdef BUILDING_ODM_IMAGE
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004156 $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
4157endif
Tom Cherryd14b8952018-08-09 14:26:00 -07004158 @# ROOT always contains the files for the root under normal boot.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004159 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004160ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
Tom Cherry2929cad2018-09-20 11:04:37 -07004161 @# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT.
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004162 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
Tao Baoda01b212018-02-28 21:20:08 -08004163endif
Tom Cherry2929cad2018-09-20 11:04:37 -07004164ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
4165 @# BOOT/RAMDISK also exists and contains the first stage ramdisk if not using BOARD_BUILD_SYSTEM_ROOT_IMAGE.
Tao Baoda01b212018-02-28 21:20:08 -08004166 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt
4167endif
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004168ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
4169 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt
4170endif
Dan Willemsen67495202019-01-16 12:42:05 -08004171ifdef BUILDING_SYSTEM_OTHER_IMAGE
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004172 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt
4173endif
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004174 @# Metadata for compatibility verification.
Steven Moreland42a0afc2018-05-01 11:06:15 -07004175 $(hide) cp $(BUILT_SYSTEM_MATRIX) $(zip_root)/META/system_matrix.xml
Yifan Hong51e87262019-04-23 17:09:07 -07004176ifdef BUILT_ASSEMBLED_FRAMEWORK_MANIFEST
4177 $(hide) cp $(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) $(zip_root)/META/system_manifest.xml
Bill Peckhamd52fd9b2019-04-16 10:06:13 -07004178endif
Steven Moreland627debe2018-05-01 09:54:21 -07004179ifdef BUILT_ASSEMBLED_VENDOR_MANIFEST
4180 $(hide) cp $(BUILT_ASSEMBLED_VENDOR_MANIFEST) $(zip_root)/META/vendor_manifest.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004181endif
Yifan Hongaa212212017-04-14 00:00:46 -07004182ifdef BUILT_VENDOR_MATRIX
4183 $(hide) cp $(BUILT_VENDOR_MATRIX) $(zip_root)/META/vendor_matrix.xml
Michael Schwartz4d9cb562017-04-04 13:01:18 -07004184endif
Yifan Hong07d3d792018-10-16 15:55:25 -07004185ifneq ($(BOARD_SUPER_PARTITION_GROUPS),)
4186 $(hide) echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" > $(zip_root)/META/dynamic_partitions_info.txt
Tao Bao943fa4c2018-12-19 10:39:34 -08004187 @# Remove 'vendor' from the group partition list if the image is not available. This should only
4188 @# happen to AOSP targets built without vendor.img. We can't remove the partition from the
4189 @# BoardConfig file, as it's still needed elsewhere (e.g. when creating super_empty.img).
Yifan Hong07d3d792018-10-16 15:55:25 -07004190 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
Tao Bao943fa4c2018-12-19 10:39:34 -08004191 $(eval _group_partition_list := $(BOARD_$(call to-upper,$(group))_PARTITION_LIST)) \
4192 $(if $(INSTALLED_VENDORIMAGE_TARGET),,$(eval _group_partition_list := $(filter-out vendor,$(_group_partition_list)))) \
Yifan Hong07d3d792018-10-16 15:55:25 -07004193 echo "$(group)_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(zip_root)/META/dynamic_partitions_info.txt; \
Tao Bao943fa4c2018-12-19 10:39:34 -08004194 $(if $(_group_partition_list), \
4195 echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
4196endif # BOARD_SUPER_PARTITION_GROUPS
Dan Willemsen2a5a34f2017-03-05 19:56:52 -08004197 $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
Colin Crossfdea8932017-12-06 14:38:40 -08004198 build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
Alex Deymo92cfd6f2016-01-26 18:47:44 -08004199 @# Zip everything up, preserving symlinks and placing META/ files first to
4200 @# help early validation of the .zip file while uploading it.
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004201 $(hide) find $(zip_root)/META | sort >$@.list
Nan Zhangcabecd92017-03-20 18:22:43 -07004202 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004203 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list
Doug Zongker283e2a12010-03-15 17:52:32 -07004204
Ying Wanga0febe52013-03-20 11:02:05 -07004205.PHONY: target-files-package
The Android Open Source Project88b60792009-03-03 19:28:42 -08004206target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
4207
Ying Wang4709d7c2014-04-14 17:25:43 -07004208ifneq ($(filter $(MAKECMDGOALS),target-files-package),)
4209$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE))
4210endif
Doug Zongker367910f2009-06-15 18:56:51 -07004211
Dan Albert4d323332016-10-14 13:23:06 -07004212# -----------------------------------------------------------------
4213# NDK Sysroot Package
4214NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2
Dan Willemsen14e10262018-06-17 21:54:21 -07004215$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp
Dan Albert4d323332016-10-14 13:23:06 -07004216 @echo Package NDK sysroot...
4217 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk
4218
4219$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET))
4220
Ying Wang09c4b682015-08-11 11:24:19 -07004221ifeq ($(build_ota_package),true)
Ying Wang09a00a62010-10-20 14:01:09 -07004222# -----------------------------------------------------------------
4223# OTA update package
4224
Yifan Hong50e79542018-11-08 17:44:12 -08004225# $(1): output file
4226# $(2): additional args
4227define build-ota-package-target
4228PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
4229 build/make/tools/releasetools/ota_from_target_files -v \
4230 --block \
4231 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
4232 -p $(HOST_OUT) \
4233 $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
4234 $(2) \
4235 $(BUILT_TARGET_FILES_PACKAGE) $(1)
4236endef
4237
Doug Zongker8678df42009-06-15 14:30:14 -07004238name := $(TARGET_PRODUCT)
4239ifeq ($(TARGET_BUILD_TYPE),debug)
4240 name := $(name)_debug
4241endif
4242name := $(name)-ota-$(FILE_NAME_TAG)
4243
4244INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4245
xunchang3b548b02019-02-19 14:52:33 -08004246INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata
4247
Doug Zongker8678df42009-06-15 14:30:14 -07004248$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4249
Tao Baoe53c6e72017-04-19 15:54:22 -07004250ifeq ($(AB_OTA_UPDATER),true)
4251$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
Tianjie Xub0a29ad2017-07-06 15:13:59 -07004252else
Alex Deymob10e07a2017-11-09 23:53:42 +01004253$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
Tao Baoe53c6e72017-04-19 15:54:22 -07004254endif
4255
xunchang3b548b02019-02-19 14:52:33 -08004256$(INTERNAL_OTA_PACKAGE_TARGET): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_OTA_METADATA)
4257
Shinichiro Hamajiee2d2112016-05-10 16:40:38 +09004258$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004259 build/make/tools/releasetools/ota_from_target_files
Doug Zongker8678df42009-06-15 14:30:14 -07004260 @echo "Package OTA: $@"
xunchang3b548b02019-02-19 14:52:33 -08004261 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --output_metadata_path $(INTERNAL_OTA_METADATA))
Doug Zongker8678df42009-06-15 14:30:14 -07004262
4263.PHONY: otapackage
4264otapackage: $(INTERNAL_OTA_PACKAGE_TARGET)
4265
Tao Bao519d1822018-12-27 12:47:23 -08004266ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true)
Yifan Hong50e79542018-11-08 17:44:12 -08004267name := $(TARGET_PRODUCT)
4268ifeq ($(TARGET_BUILD_TYPE),debug)
4269 name := $(name)_debug
4270endif
4271name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
4272
4273INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4274
4275$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
4276
4277ifeq ($(AB_OTA_UPDATER),true)
4278$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
4279else
4280$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BROTLI)
4281endif
4282
4283$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
Anton Hansson6d814982018-11-26 18:12:05 +00004284 build/make/tools/releasetools/ota_from_target_files
Yifan Hong50e79542018-11-08 17:44:12 -08004285 @echo "Package OTA (retrofit dynamic partitions): $@"
4286 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
4287
4288.PHONY: otardppackage
4289
4290otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET)
4291
Tao Bao519d1822018-12-27 12:47:23 -08004292endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
Yifan Hong50e79542018-11-08 17:44:12 -08004293
Ying Wang09c4b682015-08-11 11:24:19 -07004294endif # build_ota_package
Ying Wangf8824af2014-06-03 14:07:27 -07004295
Ying Wang09a00a62010-10-20 14:01:09 -07004296# -----------------------------------------------------------------
Dario Frenid1011272018-07-23 20:20:15 +01004297# A zip of the appcompat directory containing logs
4298APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip
4299# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
4300ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004301$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004302 $(INSTALLED_RAMDISK_TARGET) \
4303 $(INSTALLED_BOOTIMAGE_TARGET) \
4304 $(INSTALLED_USERDATAIMAGE_TARGET) \
4305 $(INSTALLED_VENDORIMAGE_TARGET) \
4306 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4307 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
Dario Frenid1011272018-07-23 20:20:15 +01004308endif
4309$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
4310$(APPCOMPAT_ZIP): $(SOONG_ZIP)
4311 @echo "appcompat logs: $@"
4312 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4313 $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/appcompat $(dir $(PRIVATE_LIST_FILE))
4314 $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE)
4315 $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE)
4316
Dario Frenid1011272018-07-23 20:20:15 +01004317# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004318# A zip of the symbols directory. Keep the full paths to make it
4319# more obvious where these files came from.
4320#
4321name := $(TARGET_PRODUCT)
4322ifeq ($(TARGET_BUILD_TYPE),debug)
4323 name := $(name)_debug
4324endif
4325name := $(name)-symbols-$(FILE_NAME_TAG)
4326
4327SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004328# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
Ying Wangda3b9722014-10-24 11:36:59 -07004329ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004330$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004331 $(INSTALLED_RAMDISK_TARGET) \
4332 $(INSTALLED_BOOTIMAGE_TARGET) \
4333 $(INSTALLED_USERDATAIMAGE_TARGET) \
4334 $(INSTALLED_VENDORIMAGE_TARGET) \
4335 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4336 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4337 $(INSTALLED_ODMIMAGE_TARGET) \
4338 $(updater_dep)
Ying Wangda3b9722014-10-24 11:36:59 -07004339endif
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004340$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist
4341$(SYMBOLS_ZIP): $(SOONG_ZIP)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004342 @echo "Package symbols: $@"
Dan Willemsen5e29cad2016-08-06 20:15:06 -07004343 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4344 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE))
Jiyong Park88e09802019-03-21 15:19:16 +09004345 $(hide) find -L $(TARGET_OUT_UNSTRIPPED) -type f | sort >$(PRIVATE_LIST_FILE)
Colin Cross8d342442019-05-07 11:47:13 -07004346 $(hide) $(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004347# -----------------------------------------------------------------
4348# A zip of the coverage directory.
4349#
4350name := $(TARGET_PRODUCT)
4351ifeq ($(TARGET_BUILD_TYPE),debug)
4352name := $(name)_debug
4353endif
4354name := $(name)-coverage-$(FILE_NAME_TAG)
4355COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
4356ifndef TARGET_BUILD_APPS
Tao Baoe9d61b02018-08-20 21:09:07 -07004357$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
Anton Hansson6d814982018-11-26 18:12:05 +00004358 $(INSTALLED_RAMDISK_TARGET) \
4359 $(INSTALLED_BOOTIMAGE_TARGET) \
4360 $(INSTALLED_USERDATAIMAGE_TARGET) \
4361 $(INSTALLED_VENDORIMAGE_TARGET) \
4362 $(INSTALLED_PRODUCTIMAGE_TARGET) \
4363 $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
4364 $(INSTALLED_ODMIMAGE_TARGET)
Ryan Campbell81c9d292016-09-12 13:56:50 -07004365endif
4366$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
4367$(COVERAGE_ZIP): $(SOONG_ZIP)
4368 @echo "Package coverage: $@"
4369 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE)
4370 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE))
4371 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE)
4372 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004373
4374# -----------------------------------------------------------------
4375# A zip of the Android Apps. Not keeping full path so that we don't
4376# include product names when distributing
4377#
4378name := $(TARGET_PRODUCT)
4379ifeq ($(TARGET_BUILD_TYPE),debug)
4380 name := $(name)_debug
4381endif
4382name := $(name)-apps-$(FILE_NAME_TAG)
4383
4384APPS_ZIP := $(PRODUCT_OUT)/$(name).zip
Tao Baoe9d61b02018-08-20 21:09:07 -07004385$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004386 @echo "Package apps: $@"
4387 $(hide) rm -rf $@
4388 $(hide) mkdir -p $(dir $@)
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004389 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \
4390 if [ -z "$$apps_to_zip" ]; then \
Anton Hansson6d814982018-11-26 18:12:05 +00004391 echo "No apps to zip up. Generating empty apps archive." ; \
4392 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004393 else \
Anton Hansson6d814982018-11-26 18:12:05 +00004394 zip -qjX $@ $$apps_to_zip; \
Gaurav Shah67c2ed32015-08-23 09:40:05 -07004395 fi
Guang Zhu0198d6e2010-04-23 11:54:37 -07004396
Ying Wangbc415dd2012-08-15 12:22:44 -07004397ifeq (true,$(EMMA_INSTRUMENT))
Colin Crossa6bc3a82017-09-27 14:28:41 -07004398#------------------------------------------------------------------
4399# An archive of classes for use in generating code-coverage reports
4400# These are the uninstrumented versions of any classes that were
4401# to be instrumented.
Colin Cross6cdc5d22017-10-20 11:37:33 -07004402# Any dependencies are set up later in build/make/core/main.mk.
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004403
Colin Crossa6bc3a82017-09-27 14:28:41 -07004404JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004405$(JACOCO_REPORT_CLASSES_ALL) :
4406 @echo "Collecting uninstrumented classes"
4407 $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" | \
Anton Hansson6d814982018-11-26 18:12:05 +00004408 zip -@ -0 -q -X $@
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004409# Meaning of these options:
4410# -@ scan stdin for file paths to add to the zip
4411# -0 don't do any compression
4412# -q supress most output
4413# -X skip storing extended file attributes
4414
Ying Wangbc415dd2012-08-15 12:22:44 -07004415endif # EMMA_INSTRUMENT=true
4416
Jeff Gastonaaae43c2017-04-11 16:36:46 -07004417
Ying Wangae9115a2013-08-22 20:52:47 -07004418#------------------------------------------------------------------
4419# A zip of Proguard obfuscation dictionary files.
4420# Only for apps_only build.
4421#
4422ifdef TARGET_BUILD_APPS
Ying Wangc62c92c2013-08-28 18:38:25 -07004423PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip
Colin Cross6cdc5d22017-10-20 11:37:33 -07004424# the dependency will be set up later in build/make/core/main.mk.
Ying Wangae9115a2013-08-22 20:52:47 -07004425$(PROGUARD_DICT_ZIP) :
4426 @echo "Packaging Proguard obfuscation dictionary files."
Colin Crossa6bc3a82017-09-27 14:28:41 -07004427 $(hide) dict_files=`find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary`; \
Anton Hansson6d814982018-11-26 18:12:05 +00004428 if [ -n "$$dict_files" ]; then \
4429 unobfuscated_jars=$${dict_files//proguard_dictionary/classes.jar}; \
4430 zip -qX $@ $$dict_files $$unobfuscated_jars; \
4431 else \
4432 touch $(dir $@)/zipdummy; \
4433 (cd $(dir $@) && zip -q $(notdir $@) zipdummy); \
4434 zip -qd $@ zipdummy; \
4435 rm $(dir $@)/zipdummy; \
4436 fi
Ying Wangae9115a2013-08-22 20:52:47 -07004437
4438endif # TARGET_BUILD_APPS
4439
The Android Open Source Project88b60792009-03-03 19:28:42 -08004440# -----------------------------------------------------------------
Yifan Hongacd862a2019-04-16 15:44:30 -07004441# super partition image (dist)
Yifan Hong2b891ac2018-11-29 12:06:31 -08004442
4443ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4444
4445# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
4446ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4447
Yifan Hong69e0d612019-03-11 15:55:33 -07004448# Dump variables used by build_super_image.py.
4449define dump-super-image-info
4450 $(call dump-dynamic-partitions-info,$(1))
4451 $(if $(filter true,$(AB_OTA_UPDATER)), \
4452 echo "ab_update=true" >> $(1))
4453endef
4454
Yifan Hong2b891ac2018-11-29 12:06:31 -08004455ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
Yifan Hongacd862a2019-04-16 15:44:30 -07004456
4457# For real devices and for dist builds, build super image from target files to an intermediate directory.
4458INTERNAL_SUPERIMAGE_DIST_TARGET := $(call intermediates-dir-for,PACKAGING,super.img)/super.img
4459$(INTERNAL_SUPERIMAGE_DIST_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
4460$(INTERNAL_SUPERIMAGE_DIST_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
4461 $(call pretty,"Target super fs image from target files: $@")
Tao Bao403a2f92018-12-13 10:45:46 -08004462 PATH=$(dir $(LPMAKE)):$$PATH \
4463 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@
Yifan Hong69e0d612019-03-11 15:55:33 -07004464
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004465# Skip packing it in dist package because it is in update package.
4466ifneq (true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE))
Yifan Hongacd862a2019-04-16 15:44:30 -07004467$(call dist-for-goals,dist_files,$(INTERNAL_SUPERIMAGE_DIST_TARGET))
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004468endif
Yifan Hongacd862a2019-04-16 15:44:30 -07004469
4470.PHONY: superimage_dist
4471superimage_dist: $(INTERNAL_SUPERIMAGE_DIST_TARGET)
Yifan Hong69e0d612019-03-11 15:55:33 -07004472
4473endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true"
Yifan Hongacd862a2019-04-16 15:44:30 -07004474endif # BOARD_SUPER_PARTITION_SIZE != ""
4475endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
Yifan Hong2b891ac2018-11-29 12:06:31 -08004476
Yifan Hongacd862a2019-04-16 15:44:30 -07004477# -----------------------------------------------------------------
4478# super partition image for development
4479
4480ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4481ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
4482ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
4483
4484# Build super.img by using $(INSTALLED_*IMAGE_TARGET) to $(1)
4485# $(1): built image path
4486# $(2): misc_info.txt path; its contents should match expectation of build_super_image.py
4487define build-superimage-target
4488 mkdir -p $(dir $(2))
4489 rm -rf $(2)
4490 $(call dump-super-image-info,$(2))
4491 $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
4492 echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(2);)
4493 mkdir -p $(dir $(1))
4494 PATH=$(dir $(LPMAKE)):$$PATH \
4495 $(BUILD_SUPER_IMAGE) -v $(2) $(1)
4496endef
4497
4498INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
4499INSTALLED_SUPERIMAGE_DEPENDENCIES := $(LPMAKE) $(BUILD_SUPER_IMAGE) \
4500 $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET))
4501
4502# If BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT is set, super.img is built from images in the
4503# $(PRODUCT_OUT) directory, and is built to $(PRODUCT_OUT)/super.img. Also, it will
4504# be built for non-dist builds. This is useful for devices that uses super.img directly, e.g.
4505# virtual devices.
4506ifeq (true,$(BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT))
4507$(INSTALLED_SUPERIMAGE_TARGET): $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
4508 $(call pretty,"Target super fs image for debug: $@")
4509 $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
4510 $(call intermediates-dir-for,PACKAGING,superimage_debug)/misc_info.txt)
4511
4512droidcore: $(INSTALLED_SUPERIMAGE_TARGET)
4513
4514# For devices that uses super image directly, the superimage target points to the file in $(PRODUCT_OUT).
4515.PHONY: superimage
4516superimage: $(INSTALLED_SUPERIMAGE_TARGET)
4517endif # BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT
4518
4519# Build $(PRODUCT_OUT)/super.img without dependencies.
4520.PHONY: superimage-nodeps supernod
4521superimage-nodeps supernod: intermediates :=
4522superimage-nodeps supernod: | $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
4523 $(call pretty,"make $(INSTALLED_SUPERIMAGE_TARGET): ignoring dependencies")
4524 $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
4525 $(call intermediates-dir-for,PACKAGING,superimage-nodeps)/misc_info.txt)
4526
4527endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true"
4528endif # BOARD_SUPER_PARTITION_SIZE != ""
4529endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
4530
4531# -----------------------------------------------------------------
4532# super empty image
4533
4534ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
4535ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
Yifan Hong2b891ac2018-11-29 12:06:31 -08004536
Yifan Hong8b79d162018-11-29 12:32:00 -08004537INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
4538$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty)
4539$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE)
4540 $(call pretty,"Target empty super fs image: $@")
4541 mkdir -p $(intermediates)
4542 rm -rf $(intermediates)/misc_info.txt
Yifan Hong69e0d612019-03-11 15:55:33 -07004543 $(call dump-super-image-info,$(intermediates)/misc_info.txt)
Tao Bao403a2f92018-12-13 10:45:46 -08004544 PATH=$(dir $(LPMAKE)):$$PATH \
4545 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@
Yifan Hong8b79d162018-11-29 12:32:00 -08004546
4547$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
4548
Yifan Hong2b891ac2018-11-29 12:06:31 -08004549endif # BOARD_SUPER_PARTITION_SIZE != ""
4550endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
4551
Yifan Hong0e97dbb2019-04-17 14:28:52 -07004552
4553# -----------------------------------------------------------------
4554# The update package
4555
4556name := $(TARGET_PRODUCT)
4557ifeq ($(TARGET_BUILD_TYPE),debug)
4558 name := $(name)_debug
4559endif
4560name := $(name)-img-$(FILE_NAME_TAG)
4561
4562INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4563
4564$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(ZIP2ZIP)
4565
4566ifeq (true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE))
4567$(INTERNAL_UPDATE_PACKAGE_TARGET): $(INTERNAL_SUPERIMAGE_DIST_TARGET)
4568 @echo "Package: $@"
4569 # Filter out super_empty and images in BOARD_SUPER_PARTITION_PARTITION_LIST.
4570 # Filter out system_other for launch DAP devices because it is in super image.
4571 # Include OTA/super_*.img for retrofit devices and super.img for non-retrofit
4572 # devices.
4573 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
4574 -x IMAGES/super_empty.img \
4575 $(foreach partition,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
4576 -x IMAGES/$(partition).img) \
4577 $(if $(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)), \
4578 $(if $(filter true, $(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),, \
4579 -x IMAGES/system_other.img)) \
4580 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
4581 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
4582 OTA/super_$(device).img:super_$(device).img)) \
4583 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
4584 $(if $(INTERNAL_SUPERIMAGE_DIST_TARGET), zip -q -j -u $@ $(INTERNAL_SUPERIMAGE_DIST_TARGET))
4585else
4586$(INTERNAL_UPDATE_PACKAGE_TARGET):
4587 @echo "Package: $@"
4588 $(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
4589 OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
4590endif # BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE
4591
4592.PHONY: updatepackage
4593updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
4594
4595
Yifan Hong2b891ac2018-11-29 12:06:31 -08004596# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004597# dalvik something
4598.PHONY: dalvikfiles
4599dalvikfiles: $(INTERNAL_DALVIK_MODULES)
4600
Bo Huf0d50bb2017-08-01 19:02:09 +00004601ifeq ($(BUILD_QEMU_IMAGES),true)
Bo Huf0d50bb2017-08-01 19:02:09 +00004602MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
bohu9492ee32019-03-07 10:03:41 -08004603MK_COMBINE_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_combined_img.py
Bo Huf0d50bb2017-08-01 19:02:09 +00004604SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
Roman Kiryanove64998f2019-02-14 16:45:33 -08004605
4606ifdef INSTALLED_SYSTEMIMAGE_TARGET
4607INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
bohu9492ee32019-03-07 10:03:41 -08004608INSTALLED_SYSTEM_QEMU_CONFIG := $(PRODUCT_OUT)/system-qemu-config.txt
4609$(INSTALLED_SYSTEM_QEMU_CONFIG): $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_VBMETAIMAGE_TARGET)
4610 @echo "$(PRODUCT_OUT)/vbmeta.img vbmeta 1" > $@
4611 @echo "$(INSTALLED_SUPERIMAGE_TARGET) super 2" >> $@
4612$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_VBMETAIMAGE_TARGET) $(MK_COMBINE_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) \
4613 $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SYSTEM_QEMU_CONFIG)
4614 @echo Create system-qemu.img now
4615 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); \
4616 $(MK_COMBINE_QEMU_IMAGE_SH) -i $(INSTALLED_SYSTEM_QEMU_CONFIG) -o $@)
Bo Huf0d50bb2017-08-01 19:02:09 +00004617
4618systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
4619droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
Roman Kiryanove64998f2019-02-14 16:45:33 -08004620endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004621ifdef INSTALLED_VENDORIMAGE_TARGET
Bo Huf0d50bb2017-08-01 19:02:09 +00004622INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004623$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Bo Huf0d50bb2017-08-01 19:02:09 +00004624 @echo Create vendor-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004625 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET))
Bo Huf0d50bb2017-08-01 19:02:09 +00004626
4627vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
4628droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
4629endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004630ifdef INSTALLED_PRODUCTIMAGE_TARGET
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004631INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004632$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004633 @echo Create product-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004634 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET))
Jaekyun Seokb7735d82017-11-27 17:04:47 +09004635
4636productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
4637droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
4638endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004639ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
Dario Freni924af7d2018-08-17 00:56:14 +01004640INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img
Isaac Chenb9b51b12018-08-03 18:34:55 +00004641$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
Dario Freni924af7d2018-08-17 00:56:14 +01004642 @echo Create product_services-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004643 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET))
Dario Freni5f681e12018-05-29 13:09:01 +01004644
4645productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4646droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
4647endif
Anton Hansson32c76fe2018-12-13 14:34:18 +00004648ifdef INSTALLED_ODMIMAGE_TARGET
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004649INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
4650$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
4651 @echo Create odm-qemu.img
Roman Kiryanov4985cc82019-02-15 10:22:45 -08004652 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET))
Bowgo Tsaid624fa62017-11-14 23:42:30 +08004653
4654odmimage: $(INSTALLED_QEMU_ODMIMAGE)
4655droidcore: $(INSTALLED_QEMU_ODMIMAGE)
4656endif
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004657
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004658QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
bohu9492ee32019-03-07 10:03:41 -08004659MK_VBMETA_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_vbmeta_boot_params.sh
4660$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \
4661 $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(AVBTOOL)
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004662 @echo Creating $@
bohu9492ee32019-03-07 10:03:41 -08004663 (export AVBTOOL=$(AVBTOOL); $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) \
4664 $(INSTALLED_SYSTEMIMAGE_TARGET) $(QEMU_VERIFIED_BOOT_PARAMS))
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004665
4666systemimage: $(QEMU_VERIFIED_BOOT_PARAMS)
4667droidcore: $(QEMU_VERIFIED_BOOT_PARAMS)
bohu9492ee32019-03-07 10:03:41 -08004668
Bo Huf0d50bb2017-08-01 19:02:09 +00004669endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004670# -----------------------------------------------------------------
The Android Open Source Project88b60792009-03-03 19:28:42 -08004671# The emulator package
Ying Wang7d8c5352012-07-26 10:15:21 -07004672ifeq ($(BUILD_EMULATOR),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004673INTERNAL_EMULATOR_PACKAGE_FILES += \
4674 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
Jean-Baptiste Queru5ea72ef2012-01-06 16:44:06 -08004675 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004676 $(INSTALLED_RAMDISK_TARGET) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004677 $(INSTALLED_SYSTEMIMAGE_TARGET) \
4678 $(INSTALLED_USERDATAIMAGE_TARGET)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004679
4680name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG)
4681
4682INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
4683
Ying Wang5d887702015-11-04 10:06:25 -08004684$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004685 @echo "Package: $@"
Dan Willemsen48a621c2015-10-29 16:33:05 -07004686 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004687
Ying Wang7d8c5352012-07-26 10:15:21 -07004688endif
The Android Open Source Project88b60792009-03-03 19:28:42 -08004689# -----------------------------------------------------------------
Keun young Park7fc7aad2012-02-27 15:49:23 -08004690# Old PDK stuffs, retired
The Android Open Source Project88b60792009-03-03 19:28:42 -08004691# The pdk package (Platform Development Kit)
4692
Keun young Park7fc7aad2012-02-27 15:49:23 -08004693#ifneq (,$(filter pdk,$(MAKECMDGOALS)))
4694# include development/pdk/Pdk.mk
4695#endif
4696
The Android Open Source Project88b60792009-03-03 19:28:42 -08004697
4698# -----------------------------------------------------------------
4699# The SDK
4700
The Android Open Source Project88b60792009-03-03 19:28:42 -08004701# The SDK includes host-specific components, so it belongs under HOST_OUT.
Ying Wangd7af1762014-06-02 16:16:53 -07004702sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004703
4704# Build a name that looks like:
4705#
4706# linux-x86 --> android-sdk_12345_linux-x86
4707# darwin-x86 --> android-sdk_12345_mac-x86
4708# windows-x86 --> android-sdk_12345_windows
4709#
4710sdk_name := android-sdk_$(FILE_NAME_TAG)
4711ifeq ($(HOST_OS),darwin)
Joe Onorato03fbe402009-04-13 08:31:16 -07004712 INTERNAL_SDK_HOST_OS_NAME := mac
The Android Open Source Project88b60792009-03-03 19:28:42 -08004713else
Joe Onorato03fbe402009-04-13 08:31:16 -07004714 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004715endif
4716ifneq ($(HOST_OS),windows)
Ying Wang2713fce2014-06-09 12:31:12 -07004717 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004718endif
Joe Onorato03fbe402009-04-13 08:31:16 -07004719sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004720
4721sdk_dep_file := $(sdk_dir)/sdk_deps.mk
4722
4723ATREE_FILES :=
4724-include $(sdk_dep_file)
4725
4726# if we don't have a real list, then use "everything"
4727ifeq ($(strip $(ATREE_FILES)),)
4728ATREE_FILES := \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004729 $(ALL_DEFAULT_INSTALLED_MODULES) \
4730 $(INSTALLED_RAMDISK_TARGET) \
4731 $(ALL_DOCS) \
Nan Zhangcb0a6882018-08-07 15:26:32 -07004732 $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/api-stubs-docs_annotations.zip \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004733 $(ALL_SDK_FILES)
4734endif
4735
4736atree_dir := development/build
4737
David 'Digit' Turner74b0c362011-03-23 11:20:14 +01004738
The Android Open Source Project88b60792009-03-03 19:28:42 -08004739sdk_atree_files := \
4740 $(atree_dir)/sdk.exclude.atree \
Ying Wang2713fce2014-06-09 12:31:12 -07004741 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree
The Android Open Source Project88b60792009-03-03 19:28:42 -08004742
David 'Digit' Turner77ec16a2011-06-23 12:49:02 +02004743# development/build/sdk-android-<abi>.atree is used to differentiate
4744# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
4745# files like the kernel image. We use TARGET_CPU_ABI because we don't
4746# have a better way to distinguish between CPU models.
4747ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
4748 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
4749endif
4750
Anton Hansson8dab0a62019-03-28 15:45:40 +00004751ifneq ($(PRODUCT_SDK_ATREE_FILES),)
4752sdk_atree_files += $(PRODUCT_SDK_ATREE_FILES)
Griff Hazen433febb2014-02-28 08:45:59 -08004753else
4754sdk_atree_files += $(atree_dir)/sdk.atree
4755endif
4756
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004757include $(BUILD_SYSTEM)/sdk_font.mk
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004758
The Android Open Source Project88b60792009-03-03 19:28:42 -08004759deps := \
4760 $(target_notice_file_txt) \
4761 $(tools_notice_file_txt) \
4762 $(OUT_DOCS)/offline-sdk-timestamp \
Ying Wang139e3322010-03-31 17:29:04 -07004763 $(SYMBOLS_ZIP) \
Ryan Campbell81c9d292016-09-12 13:56:50 -07004764 $(COVERAGE_ZIP) \
Dario Frenid1011272018-07-23 20:20:15 +01004765 $(APPCOMPAT_ZIP) \
Tao Baoe9d61b02018-08-20 21:09:07 -07004766 $(INSTALLED_SYSTEMIMAGE_TARGET) \
Bo Huf0d50bb2017-08-01 19:02:09 +00004767 $(INSTALLED_QEMU_SYSTEMIMAGE) \
bohu18d18682017-08-14 14:52:20 -07004768 $(INSTALLED_QEMU_VENDORIMAGE) \
Matt Wachowski9e4d5152018-08-07 16:29:22 -07004769 $(QEMU_VERIFIED_BOOT_PARAMS) \
Doug Zongkerdddd9572009-06-15 21:25:32 -07004770 $(INSTALLED_USERDATAIMAGE_TARGET) \
4771 $(INSTALLED_RAMDISK_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004772 $(INSTALLED_SDK_BUILD_PROP_TARGET) \
Ying Wang139e3322010-03-31 17:29:04 -07004773 $(INSTALLED_BUILD_PROP_TARGET) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004774 $(ATREE_FILES) \
Ying Wang0c0a4ce2014-02-18 14:29:59 -08004775 $(sdk_atree_files) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004776 $(HOST_OUT_EXECUTABLES)/atree \
Deepanshu Gupta4e5e5822014-08-01 10:14:15 -07004777 $(HOST_OUT_EXECUTABLES)/line_endings \
Deepanshu Gupta7a864ea2014-08-11 15:20:02 -07004778 $(SDK_FONT_DEPS)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004779
4780INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
4781$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
4782$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name)
4783$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
4784$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
4785
4786# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
4787#
4788#SDK_GNU_ERROR := true
4789
Ying Wang5d887702015-11-04 10:06:25 -08004790$(INTERNAL_SDK_TARGET): $(deps)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004791 @echo "Package SDK: $@"
4792 $(hide) rm -rf $(PRIVATE_DIR) $@
4793 $(hide) for f in $(target_gnu_MODULES); do \
4794 if [ -f $$f ]; then \
4795 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \
4796 including GNU target $$f >&2; \
4797 FAIL=$(SDK_GNU_ERROR); \
4798 fi; \
4799 done; \
4800 if [ $$FAIL ]; then exit 1; fi
Deepanshu Gupta88a307e2014-08-12 10:23:58 -07004801 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
The Android Open Source Project88b60792009-03-03 19:28:42 -08004802 $(hide) ( \
Anton Hansson6d814982018-11-26 18:12:05 +00004803 ATREE_STRIP="$(HOST_STRIP) -x" \
4804 $(HOST_OUT_EXECUTABLES)/atree \
4805 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \
4806 -m $(PRIVATE_DEP_FILE) \
4807 -I . \
4808 -I $(PRODUCT_OUT) \
4809 -I $(HOST_OUT) \
4810 -I $(TARGET_COMMON_OUT_ROOT) \
4811 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \
4812 -v "OUT_DIR=$(OUT_DIR)" \
4813 -v "HOST_OUT=$(HOST_OUT)" \
4814 -v "TARGET_ARCH=$(TARGET_ARCH)" \
4815 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
4816 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
4817 -v "FONT_OUT=$(SDK_FONT_TEMP)" \
4818 -o $(PRIVATE_DIR) && \
4819 cp -f $(target_notice_file_txt) \
4820 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
4821 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
4822 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
4823 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
4824 chmod -R ug+rwX $(PRIVATE_DIR) && \
4825 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004826 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 )
4827
Raphael3d224a02010-04-16 17:50:09 -07004828
4829# Is a Windows SDK requested? If so, we need some definitions from here
4830# in order to find the Linux SDK used to create the Windows one.
Raphaelc4d47312011-02-15 16:09:36 -08004831MAIN_SDK_NAME := $(sdk_name)
4832MAIN_SDK_DIR := $(sdk_dir)
4833MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET)
Ying Wangff1fe682015-01-27 12:47:10 -08004834ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),)
Raphael3d224a02010-04-16 17:50:09 -07004835include $(TOPDIR)development/build/tools/windows_sdk.mk
4836endif
4837
The Android Open Source Project88b60792009-03-03 19:28:42 -08004838# -----------------------------------------------------------------
4839# Findbugs
4840INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
4841INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html
4842$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES)
4843 @echo UnionBugs: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004844 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \
The Android Open Source Project88b60792009-03-03 19:28:42 -08004845 > $@
4846$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET)
4847 @echo ConvertXmlToText: $@
Yuncheol Heo623d7062014-05-20 17:04:16 +09004848 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \
Ying Wangad7fd292013-08-08 16:34:29 -07004849 $(INTERNAL_FINDBUGS_XML_TARGET) > $@
The Android Open Source Project88b60792009-03-03 19:28:42 -08004850
4851# -----------------------------------------------------------------
4852# Findbugs
4853
4854# -----------------------------------------------------------------
4855# These are some additional build tasks that need to be run.
Ying Wangad7fd292013-08-08 16:34:29 -07004856ifneq ($(dont_bother),true)
The Android Open Source Project88b60792009-03-03 19:28:42 -08004857include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk))
Claes Elgemarke22ad672010-11-12 15:46:00 +01004858-include $(sort $(wildcard vendor/*/build/tasks/*.mk))
Andrew Boief34a9ba2012-04-16 10:03:16 -07004859-include $(sort $(wildcard device/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004860-include $(sort $(wildcard product/*/build/tasks/*.mk))
Ying Wang66c78e42014-09-05 17:47:34 -07004861# Also the project-specific tasks
4862-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk))
4863-include $(sort $(wildcard device/*/*/build/tasks/*.mk))
Lee Campbell04ba3122015-08-20 15:39:56 -07004864-include $(sort $(wildcard product/*/*/build/tasks/*.mk))
Guang Zhu8322be72016-06-20 22:03:24 -07004865# Also add test specifc tasks
4866include $(sort $(wildcard platform_testing/build/tasks/*.mk))
Keun Soo Yim199a7102016-08-31 09:20:51 -07004867include $(sort $(wildcard test/vts/tools/build/tasks/*.mk))
Ying Wangad7fd292013-08-08 16:34:29 -07004868endif
Raphaelc4d47312011-02-15 16:09:36 -08004869
Ying Wang67132ba2015-10-28 16:42:39 -07004870include $(BUILD_SYSTEM)/product-graph.mk
4871
Raphaelc4d47312011-02-15 16:09:36 -08004872# -----------------------------------------------------------------
4873# Create SDK repository packages. Must be done after tasks/* since
4874# we need the addon rules defined.
4875ifneq ($(sdk_repo_goal),)
4876include $(TOPDIR)development/build/tools/sdk_repo.mk
4877endif