1# Put some miscellaneous rules here 2 3# HACK: clear LOCAL_PATH from including last build target before calling 4# intermedites-dir-for 5LOCAL_PATH := $(BUILD_SYSTEM) 6 7# ----------------------------------------------------------------- 8# Define rules to copy PRODUCT_COPY_FILES defined by the product. 9# PRODUCT_COPY_FILES contains words like <source file>:<dest file>[:<owner>]. 10# <dest file> is relative to $(PRODUCT_OUT), so it should look like, 11# e.g., "system/etc/file.xml". 12# The filter part means "only eval the copy-one-file rule if this 13# src:dest pair is the first one to match the same dest" 14#$(1): the src:dest pair 15#$(2): the dest 16define check-product-copy-files 17$(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!))) \ 20$(if $(filter true,$(BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES)),, \ 21 $(if $(filter $(TARGET_COPY_OUT_SYSTEM)/etc/vintf/% \ 22 $(TARGET_COPY_OUT_SYSTEM)/manifest.xml \ 23 $(TARGET_COPY_OUT_SYSTEM)/compatibility_matrix.xml,$(2)), \ 24 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), use vintf_fragments instead!)) \ 25 $(if $(filter $(TARGET_COPY_OUT_PRODUCT)/etc/vintf/%,$(2)), \ 26 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \ 27 use PRODUCT_MANIFEST_FILES / DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \ 28 $(if $(filter $(TARGET_COPY_OUT_SYSTEM_EXT)/etc/vintf/%,$(2)), \ 29 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \ 30 use vintf_compatibility_matrix / vintf_fragments instead!)) \ 31 $(if $(filter $(TARGET_COPY_OUT_VENDOR)/etc/vintf/% \ 32 $(TARGET_COPY_OUT_VENDOR)/manifest.xml \ 33 $(TARGET_COPY_OUT_VENDOR)/compatibility_matrix.xml,$(2)), \ 34 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \ 35 use DEVICE_MANIFEST_FILE / DEVICE_MATRIX_FILE / vintf_compatibility_matrix / vintf_fragments instead!)) \ 36 $(if $(filter $(TARGET_COPY_OUT_ODM)/etc/vintf/% \ 37 $(TARGET_COPY_OUT_ODM)/etc/manifest%,$(2)), \ 38 $(error VINTF metadata found in PRODUCT_COPY_FILES: $(1), \ 39 use ODM_MANIFEST_FILES / vintf_fragments instead!)) \ 40) 41endef 42# filter out the duplicate <source file>:<dest file> pairs. 43unique_product_copy_files_pairs := 44$(foreach cf,$(PRODUCT_COPY_FILES), \ 45 $(if $(filter $(unique_product_copy_files_pairs),$(cf)),,\ 46 $(eval unique_product_copy_files_pairs += $(cf)))) 47unique_product_copy_files_destinations := 48product_copy_files_ignored := 49$(foreach cf,$(unique_product_copy_files_pairs), \ 50 $(eval _src := $(call word-colon,1,$(cf))) \ 51 $(eval _dest := $(call word-colon,2,$(cf))) \ 52 $(call check-product-copy-files,$(cf),$(_dest)) \ 53 $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \ 54 $(eval product_copy_files_ignored += $(cf)), \ 55 $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \ 56 $(if $(filter %.xml,$(_dest)),\ 57 $(eval $(call copy-xml-file-checked,$(_src),$(_fulldest))),\ 58 $(if $(and $(filter %.jar,$(_dest)),$(filter $(basename $(notdir $(_dest))),$(PRODUCT_LOADED_BY_PRIVILEGED_MODULES))),\ 59 $(eval $(call copy-and-uncompress-dexs,$(_src),$(_fulldest))), \ 60 $(if $(filter init%rc,$(notdir $(_dest)))$(filter %/etc/init,$(dir $(_dest))),\ 61 $(eval $(call copy-init-script-file-checked,$(_src),$(_fulldest))),\ 62 $(eval $(call copy-one-file,$(_src),$(_fulldest)))))) \ 63 $(eval unique_product_copy_files_destinations += $(_dest)))) 64 65# Dump a list of overriden (and ignored PRODUCT_COPY_FILES entries) 66pcf_ignored_file := $(PRODUCT_OUT)/product_copy_files_ignored.txt 67$(pcf_ignored_file): PRIVATE_IGNORED := $(sort $(product_copy_files_ignored)) 68$(pcf_ignored_file): 69 echo "$(PRIVATE_IGNORED)" | tr " " "\n" >$@ 70 71$(call dist-for-goals,droidcore,$(pcf_ignored_file):logs/$(notdir $(pcf_ignored_file))) 72 73pcf_ignored_file := 74product_copy_files_ignored := 75unique_product_copy_files_pairs := 76unique_product_copy_files_destinations := 77 78# ----------------------------------------------------------------- 79# Returns the max allowed size for an image suitable for hash verification 80# (e.g., boot.img, recovery.img, etc). 81# The value 69632 derives from MAX_VBMETA_SIZE + MAX_FOOTER_SIZE in $(AVBTOOL). 82# $(1): partition size to flash the image 83define get-hash-image-max-size 84$(if $(1), \ 85 $(if $(filter true,$(BOARD_AVB_ENABLE)), \ 86 $(eval _hash_meta_size := 69632), \ 87 $(eval _hash_meta_size := 0)) \ 88 $(1)-$(_hash_meta_size)) 89endef 90 91# ----------------------------------------------------------------- 92# Define rules to copy headers defined in copy_headers.mk 93# If more than one makefile declared a header, print a warning, 94# then copy the last one defined. This matches the previous make 95# behavior. 96has_dup_copy_headers := 97$(foreach dest,$(ALL_COPIED_HEADERS), \ 98 $(eval _srcs := $(ALL_COPIED_HEADERS.$(dest).SRC)) \ 99 $(eval _src := $(lastword $(_srcs))) \ 100 $(if $(call streq,$(_src),$(_srcs)),, \ 101 $(warning Duplicate header copy: $(dest)) \ 102 $(warning _ Using $(_src)) \ 103 $(warning __ from $(lastword $(ALL_COPIED_HEADERS.$(dest).MAKEFILE))) \ 104 $(eval _makefiles := $$(wordlist 1,$(call int_subtract,$(words $(ALL_COPIED_HEADERS.$(dest).MAKEFILE)),1),$$(ALL_COPIED_HEADERS.$$(dest).MAKEFILE))) \ 105 $(foreach src,$(wordlist 1,$(call int_subtract,$(words $(_srcs)),1),$(_srcs)), \ 106 $(warning _ Ignoring $(src)) \ 107 $(warning __ from $(firstword $(_makefiles))) \ 108 $(eval _makefiles := $$(wordlist 2,9999,$$(_makefiles)))) \ 109 $(eval has_dup_copy_headers := true)) \ 110 $(eval $(call copy-one-header,$(_src),$(dest)))) 111all_copied_headers: $(ALL_COPIED_HEADERS) 112 113ifdef has_dup_copy_headers 114 has_dup_copy_headers := 115 $(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) 116endif 117 118$(file >$(PRODUCT_OUT)/.copied_headers_list,$(TARGET_OUT_HEADERS) $(ALL_COPIED_HEADERS)) 119 120# ----------------------------------------------------------------- 121# docs/index.html 122ifeq (,$(TARGET_BUILD_APPS)) 123gen := $(OUT_DOCS)/index.html 124ALL_DOCS += $(gen) 125$(gen): frameworks/base/docs/docs-redirect-index.html 126 @mkdir -p $(dir $@) 127 @cp -f $< $@ 128endif 129 130ndk_doxygen_out := $(OUT_NDK_DOCS) 131ndk_headers := $(SOONG_OUT_DIR)/ndk/sysroot/usr/include 132ndk_docs_src_dir := frameworks/native/docs 133ndk_doxyfile := $(ndk_docs_src_dir)/Doxyfile 134ifneq ($(wildcard $(ndk_docs_src_dir)),) 135ndk_docs_srcs := $(addprefix $(ndk_docs_src_dir)/,\ 136 $(call find-files-in-subdirs,$(ndk_docs_src_dir),"*",.)) 137$(ndk_doxygen_out)/index.html: $(ndk_docs_srcs) $(SOONG_OUT_DIR)/ndk.timestamp 138 @mkdir -p $(ndk_doxygen_out) 139 @echo "Generating NDK docs to $(ndk_doxygen_out)" 140 @( cat $(ndk_doxyfile); \ 141 echo "INPUT=$(ndk_headers)"; \ 142 echo "HTML_OUTPUT=$(ndk_doxygen_out)" \ 143 ) | doxygen - 144 145# Note: Not a part of the docs target because we don't have doxygen available. 146# You can run this target locally if you have doxygen installed. 147ndk-docs: $(ndk_doxygen_out)/index.html 148.PHONY: ndk-docs 149endif 150 151$(call dist-for-goals,sdk,$(API_FINGERPRINT)) 152 153# ----------------------------------------------------------------- 154# property_overrides_split_enabled 155property_overrides_split_enabled := 156ifeq ($(BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED), true) 157 property_overrides_split_enabled := true 158endif 159 160# ----------------------------------------------------------------- 161# FINAL_VENDOR_DEFAULT_PROPERTIES will be installed in vendor/default.prop if 162# property_overrides_split_enabled is true. Otherwise it will be installed in 163# ROOT/default.prop. 164ifdef BOARD_VNDK_VERSION 165 ifeq ($(BOARD_VNDK_VERSION),current) 166 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION) 167 else 168 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(BOARD_VNDK_VERSION) 169 endif 170 ifdef BOARD_VNDK_RUNTIME_DISABLE 171 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true 172 endif 173else 174 FINAL_VENDOR_DEFAULT_PROPERTIES := ro.vndk.version=$(PLATFORM_VNDK_VERSION) 175 FINAL_VENDOR_DEFAULT_PROPERTIES += ro.vndk.lite=true 176endif 177FINAL_VENDOR_DEFAULT_PROPERTIES += \ 178 $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES)) 179 180# Add cpu properties for bionic and ART. 181FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.arch=$(TARGET_ARCH) 182FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.cpu_variant=$(TARGET_CPU_VARIANT_RUNTIME) 183FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_arch=$(TARGET_2ND_ARCH) 184FINAL_VENDOR_DEFAULT_PROPERTIES += ro.bionic.2nd_cpu_variant=$(TARGET_2ND_CPU_VARIANT_RUNTIME) 185 186FINAL_VENDOR_DEFAULT_PROPERTIES += persist.sys.dalvik.vm.lib.2=libart.so 187FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).variant=$(DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) 188ifneq ($(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) 189 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_ARCH).features=$(DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) 190endif 191 192ifdef TARGET_2ND_ARCH 193 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).variant=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_CPU_VARIANT_RUNTIME) 194 ifneq ($($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES),) 195 FINAL_VENDOR_DEFAULT_PROPERTIES += dalvik.vm.isa.$(TARGET_2ND_ARCH).features=$($(TARGET_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) 196 endif 197endif 198 199# Although these variables are prefixed with TARGET_RECOVERY_, they are also needed under charger 200# mode (via libminui). 201ifdef TARGET_RECOVERY_DEFAULT_ROTATION 202FINAL_VENDOR_DEFAULT_PROPERTIES += \ 203 ro.minui.default_rotation=$(TARGET_RECOVERY_DEFAULT_ROTATION) 204endif 205ifdef TARGET_RECOVERY_OVERSCAN_PERCENT 206FINAL_VENDOR_DEFAULT_PROPERTIES += \ 207 ro.minui.overscan_percent=$(TARGET_RECOVERY_OVERSCAN_PERCENT) 208endif 209ifdef TARGET_RECOVERY_PIXEL_FORMAT 210FINAL_VENDOR_DEFAULT_PROPERTIES += \ 211 ro.minui.pixel_format=$(TARGET_RECOVERY_PIXEL_FORMAT) 212endif 213FINAL_VENDOR_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \ 214 $(FINAL_VENDOR_DEFAULT_PROPERTIES),=) 215 216# ----------------------------------------------------------------- 217# prop.default 218 219BUILDINFO_SH := build/make/tools/buildinfo.sh 220BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh 221POST_PROCESS_PROPS :=$= build/make/tools/post_process_props.py 222 223# Generates a set of sysprops common to all partitions to a file. 224# $(1): Partition name 225# $(2): Output file name 226define generate-common-build-props 227 PRODUCT_BRAND="$(PRODUCT_BRAND)" \ 228 PRODUCT_DEVICE="$(TARGET_DEVICE)" \ 229 PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \ 230 PRODUCT_MODEL="$(PRODUCT_MODEL)" \ 231 PRODUCT_NAME="$(TARGET_PRODUCT)" \ 232 $(call generate-common-build-props-with-product-vars-set,$(1),$(2)) 233endef 234 235# Like the above macro, but requiring the relevant PRODUCT_ environment 236# variables to be set when called. 237define generate-common-build-props-with-product-vars-set 238 BUILD_FINGERPRINT="$(BUILD_FINGERPRINT_FROM_FILE)" \ 239 BUILD_ID="$(BUILD_ID)" \ 240 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \ 241 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ 242 DATE="$(DATE_FROM_FILE)" \ 243 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ 244 PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \ 245 PLATFORM_VERSION="$(PLATFORM_VERSION)" \ 246 TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ 247 bash $(BUILDINFO_COMMON_SH) "$(1)" >> $(2) 248endef 249 250ifdef property_overrides_split_enabled 251INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_OUT)/etc/prop.default 252INSTALLED_DEFAULT_PROP_OLD_TARGET := $(TARGET_ROOT_OUT)/default.prop 253ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_OLD_TARGET) 254$(INSTALLED_DEFAULT_PROP_OLD_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET) 255else 256# legacy path 257INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop 258endif 259ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET) 260FINAL_DEFAULT_PROPERTIES := \ 261 $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES)) \ 262 $(call collapse-pairs, $(PRODUCT_SYSTEM_DEFAULT_PROPERTIES)) 263ifndef property_overrides_split_enabled 264 FINAL_DEFAULT_PROPERTIES += \ 265 $(call collapse-pairs, $(FINAL_VENDOR_DEFAULT_PROPERTIES)) 266endif 267FINAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \ 268 $(FINAL_DEFAULT_PROPERTIES),=) 269 270intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop 271 272$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop) 273 @echo Target buildinfo: $@ 274 @mkdir -p $(dir $@) 275 @rm -f $@ 276 $(hide) echo "#" > $@; \ 277 echo "# ADDITIONAL_DEFAULT_PROPERTIES" >> $@; \ 278 echo "#" >> $@; 279 $(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \ 280 echo "$(line)" >> $@;) 281 $(hide) $(POST_PROCESS_PROPS) $@ 282ifdef property_overrides_split_enabled 283 $(hide) mkdir -p $(TARGET_ROOT_OUT) 284 $(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET) 285endif 286 287# ----------------------------------------------------------------- 288# vendor default.prop 289INSTALLED_VENDOR_DEFAULT_PROP_TARGET := 290ifdef property_overrides_split_enabled 291INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop 292ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) 293 294$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET) $(POST_PROCESS_PROPS) 295 @echo Target buildinfo: $@ 296 @mkdir -p $(dir $@) 297 $(hide) echo "#" > $@; \ 298 echo "# ADDITIONAL VENDOR DEFAULT PROPERTIES" >> $@; \ 299 echo "#" >> $@; 300 $(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \ 301 echo "$(line)" >> $@;) 302 $(hide) $(POST_PROCESS_PROPS) $@ 303 304endif # property_overrides_split_enabled 305 306# ----------------------------------------------------------------- 307# build.prop 308INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop 309ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET) 310FINAL_BUILD_PROPERTIES := \ 311 $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES)) 312FINAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ 313 $(FINAL_BUILD_PROPERTIES),=) 314 315# A list of arbitrary tags describing the build configuration. 316# Force ":=" so we can use += 317BUILD_VERSION_TAGS := $(BUILD_VERSION_TAGS) 318ifeq ($(TARGET_BUILD_TYPE),debug) 319 BUILD_VERSION_TAGS += debug 320endif 321# The "test-keys" tag marks builds signed with the old test keys, 322# which are available in the SDK. "dev-keys" marks builds signed with 323# non-default dev keys (usually private keys from a vendor directory). 324# Both of these tags will be removed and replaced with "release-keys" 325# when the target-files is signed in a post-build step. 326ifeq ($(DEFAULT_SYSTEM_DEV_CERTIFICATE),build/make/target/product/security/testkey) 327BUILD_KEYS := test-keys 328else 329BUILD_KEYS := dev-keys 330endif 331BUILD_VERSION_TAGS += $(BUILD_KEYS) 332BUILD_VERSION_TAGS := $(subst $(space),$(comma),$(sort $(BUILD_VERSION_TAGS))) 333 334# A human-readable string that descibes this build in detail. 335build_desc := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) $(PLATFORM_VERSION) $(BUILD_ID) $(BUILD_NUMBER_FROM_FILE) $(BUILD_VERSION_TAGS) 336$(intermediate_system_build_prop): PRIVATE_BUILD_DESC := $(build_desc) 337 338# The string used to uniquely identify the combined build and product; used by the OTA server. 339ifeq (,$(strip $(BUILD_FINGERPRINT))) 340 ifeq ($(strip $(HAS_BUILD_NUMBER)),false) 341 BF_BUILD_NUMBER := $(BUILD_USERNAME)$$($(DATE_FROM_FILE) +%m%d%H%M) 342 else 343 BF_BUILD_NUMBER := $(file <$(BUILD_NUMBER_FILE)) 344 endif 345 BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BF_BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) 346endif 347# unset it for safety. 348BF_BUILD_NUMBER := 349 350BUILD_FINGERPRINT_FILE := $(PRODUCT_OUT)/build_fingerprint.txt 351ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_FINGERPRINT) >$(BUILD_FINGERPRINT_FILE) && grep " " $(BUILD_FINGERPRINT_FILE))) 352 $(error BUILD_FINGERPRINT cannot contain spaces: "$(file <$(BUILD_FINGERPRINT_FILE))") 353endif 354BUILD_FINGERPRINT_FROM_FILE := $$(cat $(BUILD_FINGERPRINT_FILE)) 355# unset it for safety. 356BUILD_FINGERPRINT := 357 358# The string used to uniquely identify the system build; used by the OTA server. 359# This purposefully excludes any product-specific variables. 360ifeq (,$(strip $(BUILD_THUMBPRINT))) 361 BUILD_THUMBPRINT := $(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER_FROM_FILE):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS) 362endif 363 364BUILD_THUMBPRINT_FILE := $(PRODUCT_OUT)/build_thumbprint.txt 365ifneq (,$(shell mkdir -p $(PRODUCT_OUT) && echo $(BUILD_THUMBPRINT) >$(BUILD_THUMBPRINT_FILE) && grep " " $(BUILD_THUMBPRINT_FILE))) 366 $(error BUILD_THUMBPRINT cannot contain spaces: "$(file <$(BUILD_THUMBPRINT_FILE))") 367endif 368BUILD_THUMBPRINT_FROM_FILE := $$(cat $(BUILD_THUMBPRINT_FILE)) 369# unset it for safety. 370BUILD_THUMBPRINT := 371 372KNOWN_OEM_THUMBPRINT_PROPERTIES := \ 373 ro.product.brand \ 374 ro.product.name \ 375 ro.product.device 376OEM_THUMBPRINT_PROPERTIES := $(filter $(KNOWN_OEM_THUMBPRINT_PROPERTIES),\ 377 $(PRODUCT_OEM_PROPERTIES)) 378 379# Display parameters shown under Settings -> About Phone 380ifeq ($(TARGET_BUILD_VARIANT),user) 381 # User builds should show: 382 # release build number or branch.buld_number non-release builds 383 384 # Dev. branches should have DISPLAY_BUILD_NUMBER set 385 ifeq (true,$(DISPLAY_BUILD_NUMBER)) 386 BUILD_DISPLAY_ID := $(BUILD_ID).$(BUILD_NUMBER_FROM_FILE) $(BUILD_KEYS) 387 else 388 BUILD_DISPLAY_ID := $(BUILD_ID) $(BUILD_KEYS) 389 endif 390else 391 # Non-user builds should show detailed build information 392 BUILD_DISPLAY_ID := $(build_desc) 393endif 394 395# Accepts a whitespace separated list of product locales such as 396# (en_US en_AU en_GB...) and returns the first locale in the list with 397# underscores replaced with hyphens. In the example above, this will 398# return "en-US". 399define get-default-product-locale 400$(strip $(subst _,-, $(firstword $(1)))) 401endef 402 403# TARGET_BUILD_FLAVOR and ro.build.flavor are used only by the test 404# harness to distinguish builds. Only add _asan for a sanitized build 405# if it isn't already a part of the flavor (via a dedicated lunch 406# config for example). 407TARGET_BUILD_FLAVOR := $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT) 408ifneq (, $(filter address, $(SANITIZE_TARGET))) 409ifeq (,$(findstring _asan,$(TARGET_BUILD_FLAVOR))) 410TARGET_BUILD_FLAVOR := $(TARGET_BUILD_FLAVOR)_asan 411endif 412endif 413 414ifdef TARGET_SYSTEM_PROP 415system_prop_file := $(TARGET_SYSTEM_PROP) 416else 417system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop) 418endif 419$(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) $(POST_PROCESS_PROPS) 420 @echo Target buildinfo: $@ 421 @mkdir -p $(dir $@) 422 $(hide) echo > $@ 423ifneq ($(PRODUCT_OEM_PROPERTIES),) 424 $(hide) echo "#" >> $@; \ 425 echo "# PRODUCT_OEM_PROPERTIES" >> $@; \ 426 echo "#" >> $@; 427 $(hide) $(foreach prop,$(PRODUCT_OEM_PROPERTIES), \ 428 echo "import /oem/oem.prop $(prop)" >> $@;) 429endif 430 $(hide) PRODUCT_BRAND="$(PRODUCT_SYSTEM_BRAND)" \ 431 PRODUCT_MANUFACTURER="$(PRODUCT_SYSTEM_MANUFACTURER)" \ 432 PRODUCT_MODEL="$(PRODUCT_SYSTEM_MODEL)" \ 433 PRODUCT_NAME="$(PRODUCT_SYSTEM_NAME)" \ 434 PRODUCT_DEVICE="$(PRODUCT_SYSTEM_DEVICE)" \ 435 $(call generate-common-build-props-with-product-vars-set,system,$@) 436 $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ 437 TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \ 438 TARGET_DEVICE="$(TARGET_DEVICE)" \ 439 PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \ 440 PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \ 441 PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \ 442 BUILD_ID="$(BUILD_ID)" \ 443 BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ 444 DATE="$(DATE_FROM_FILE)" \ 445 BUILD_USERNAME="$(BUILD_USERNAME)" \ 446 BUILD_HOSTNAME="$(BUILD_HOSTNAME)" \ 447 BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \ 448 BOARD_BUILD_SYSTEM_ROOT_IMAGE="$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)" \ 449 PLATFORM_VERSION="$(PLATFORM_VERSION)" \ 450 PLATFORM_VERSION_LAST_STABLE="$(PLATFORM_VERSION_LAST_STABLE)" \ 451 PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \ 452 PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \ 453 PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ 454 PLATFORM_PREVIEW_SDK_VERSION="$(PLATFORM_PREVIEW_SDK_VERSION)" \ 455 PLATFORM_PREVIEW_SDK_FINGERPRINT="$$(cat $(API_FINGERPRINT))" \ 456 PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ 457 PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ 458 PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION="$(PLATFORM_MIN_SUPPORTED_TARGET_SDK_VERSION)" \ 459 BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \ 460 $(if $(OEM_THUMBPRINT_PROPERTIES),BUILD_THUMBPRINT="$(BUILD_THUMBPRINT_FROM_FILE)") \ 461 TARGET_CPU_ABI_LIST="$(TARGET_CPU_ABI_LIST)" \ 462 TARGET_CPU_ABI_LIST_32_BIT="$(TARGET_CPU_ABI_LIST_32_BIT)" \ 463 TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \ 464 TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \ 465 TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \ 466 bash $(BUILDINFO_SH) >> $@ 467 $(hide) $(foreach file,$(system_prop_file), \ 468 if [ -f "$(file)" ]; then \ 469 echo Target buildinfo from: "$(file)"; \ 470 echo "" >> $@; \ 471 echo "#" >> $@; \ 472 echo "# from $(file)" >> $@; \ 473 echo "#" >> $@; \ 474 cat $(file) >> $@; \ 475 echo "# end of $(file)" >> $@; \ 476 fi;) 477 $(if $(FINAL_BUILD_PROPERTIES), \ 478 $(hide) echo >> $@; \ 479 echo "#" >> $@; \ 480 echo "# ADDITIONAL_BUILD_PROPERTIES" >> $@; \ 481 echo "#" >> $@; ) 482 $(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \ 483 echo "$(line)" >> $@;) 484 $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST) 485 486build_desc := 487 488INSTALLED_RECOVERYIMAGE_TARGET := 489ifdef BUILDING_RECOVERY_IMAGE 490ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 491INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img 492endif 493endif 494 495$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) 496 @echo "Target build info: $@" 497 $(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@ 498 499# ----------------------------------------------------------------- 500# vendor build.prop 501# 502# For verifying that the vendor build is what we think it is 503INSTALLED_VENDOR_BUILD_PROP_TARGET := $(TARGET_OUT_VENDOR)/build.prop 504ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_BUILD_PROP_TARGET) 505 506ifdef TARGET_VENDOR_PROP 507vendor_prop_files := $(TARGET_VENDOR_PROP) 508else 509vendor_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/vendor.prop) 510endif 511 512ifdef property_overrides_split_enabled 513FINAL_VENDOR_BUILD_PROPERTIES += \ 514 $(call collapse-pairs, $(PRODUCT_PROPERTY_OVERRIDES)) 515FINAL_VENDOR_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ 516 $(FINAL_VENDOR_BUILD_PROPERTIES),=) 517endif # property_overrides_split_enabled 518 519$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop) $(vendor_prop_files) 520 @echo Target vendor buildinfo: $@ 521 @mkdir -p $(dir $@) 522 $(hide) echo > $@ 523ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true) 524 $(hide) echo ro.boot.dynamic_partitions=true >> $@ 525endif 526ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true) 527 $(hide) echo ro.boot.dynamic_partitions_retrofit=true >> $@ 528endif 529 $(hide) grep 'ro.product.first_api_level' $(intermediate_system_build_prop) >> $@ || true 530 $(hide) echo ro.vendor.build.security_patch="$(VENDOR_SECURITY_PATCH)">>$@ 531 $(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@ 532 $(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@ 533 $(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@ 534 $(hide) echo ro.product.board="$(TARGET_BOOTLOADER_BOARD_NAME)">>$@ 535 $(hide) echo ro.board.platform="$(TARGET_BOARD_PLATFORM)">>$@ 536 $(hide) echo ro.hwui.use_vulkan="$(TARGET_USES_VULKAN)">>$@ 537ifdef TARGET_SCREEN_DENSITY 538 $(hide) echo ro.sf.lcd_density="$(TARGET_SCREEN_DENSITY)">>$@ 539endif 540ifeq ($(AB_OTA_UPDATER),true) 541 $(hide) echo ro.build.ab_update=true >> $@ 542endif 543 $(hide) $(call generate-common-build-props,vendor,$@) 544 $(hide) echo "#" >> $@; \ 545 echo "# BOOTIMAGE_BUILD_PROPERTIES" >> $@; \ 546 echo "#" >> $@; 547 $(hide) echo ro.bootimage.build.date=`$(DATE_FROM_FILE)`>>$@ 548 $(hide) echo ro.bootimage.build.date.utc=`$(DATE_FROM_FILE) +%s`>>$@ 549 $(hide) echo ro.bootimage.build.fingerprint="$(BUILD_FINGERPRINT_FROM_FILE)">>$@ 550 $(hide) echo "#" >> $@; \ 551 echo "# ADDITIONAL VENDOR BUILD PROPERTIES" >> $@; \ 552 echo "#" >> $@; 553 $(hide) cat $(INSTALLED_ANDROID_INFO_TXT_TARGET) | grep 'require version-' | sed -e 's/require version-/ro.build.expect./g' >> $@ 554ifdef property_overrides_split_enabled 555 $(hide) $(foreach file,$(vendor_prop_files), \ 556 if [ -f "$(file)" ]; then \ 557 echo Target vendor properties from: "$(file)"; \ 558 echo "" >> $@; \ 559 echo "#" >> $@; \ 560 echo "# from $(file)" >> $@; \ 561 echo "#" >> $@; \ 562 cat $(file) >> $@; \ 563 echo "# end of $(file)" >> $@; \ 564 fi;) 565 $(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \ 566 echo "$(line)" >> $@;) 567endif # property_overrides_split_enabled 568 $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST) 569 570# ----------------------------------------------------------------- 571# product build.prop 572INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop 573ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) 574 575ifdef TARGET_PRODUCT_PROP 576product_prop_files := $(TARGET_PRODUCT_PROP) 577else 578product_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/product.prop) 579endif 580 581FINAL_PRODUCT_PROPERTIES += \ 582 $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES)) 583FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \ 584 $(FINAL_PRODUCT_PROPERTIES),=) 585 586$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(product_prop_files) 587 @echo Target product buildinfo: $@ 588 @mkdir -p $(dir $@) 589 $(hide) echo > $@ 590 $(hide) $(call generate-common-build-props,product,$@) 591 $(hide) $(foreach file,$(product_prop_files), \ 592 if [ -f "$(file)" ]; then \ 593 echo Target product properties from: "$(file)"; \ 594 echo "" >> $@; \ 595 echo "#" >> $@; \ 596 echo "# from $(file)" >> $@; \ 597 echo "#" >> $@; \ 598 cat $(file) >> $@; \ 599 echo "# end of $(file)" >> $@; \ 600 fi;) 601 $(hide) echo "#" >> $@; \ 602 echo "# ADDITIONAL PRODUCT PROPERTIES" >> $@; \ 603 echo "#" >> $@; \ 604 echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@; 605 $(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \ 606 echo "$(line)" >> $@;) 607 $(hide) $(POST_PROCESS_PROPS) $@ 608 609# ---------------------------------------------------------------- 610# odm build.prop 611INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop 612ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET) 613 614ifdef TARGET_ODM_PROP 615odm_prop_files := $(TARGET_ODM_PROP) 616else 617odm_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/odm.prop) 618endif 619 620FINAL_ODM_BUILD_PROPERTIES += \ 621 $(call collapse-pairs, $(PRODUCT_ODM_PROPERTIES)) 622FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \ 623 $(FINAL_ODM_BUILD_PROPERTIES),=) 624 625$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(odm_prop_files) 626 @echo Target odm buildinfo: $@ 627 @mkdir -p $(dir $@) 628 $(hide) echo > $@ 629 $(hide) echo ro.odm.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@ 630 $(hide) echo ro.odm.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@ 631 $(hide) echo ro.odm.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@ 632 $(hide) $(call generate-common-build-props,odm,$@) 633 $(hide) $(foreach file,$(odm_prop_files), \ 634 if [ -f "$(file)" ]; then \ 635 echo Target odm properties from: "$(file)"; \ 636 echo "" >> $@; \ 637 echo "#" >> $@; \ 638 echo "# from $(file)" >> $@; \ 639 echo "#" >> $@; \ 640 cat $(file) >> $@; \ 641 echo "# end of $(file)" >> $@; \ 642 fi;) 643 $(hide) echo "#" >> $@; \ 644 echo "# ADDITIONAL ODM BUILD PROPERTIES" >> $@; \ 645 echo "#" >> $@; 646 $(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \ 647 echo "$(line)" >> $@;) 648 $(hide) $(POST_PROCESS_PROPS) $@ 649 650# ----------------------------------------------------------------- 651# system_ext build.prop 652INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop 653ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) 654 655ifdef TARGET_SYSTEM_EXT_PROP 656system_ext_prop_files := $(TARGET_SYSTEM_EXT_PROP) 657else 658system_ext_prop_files := $(wildcard $(TARGET_DEVICE_DIR)/system_ext.prop) 659endif 660 661FINAL_SYSTEM_EXT_PROPERTIES += \ 662 $(call collapse-pairs, $(PRODUCT_SYSTEM_EXT_PROPERTIES)) 663FINAL_SYSTEM_EXT_PROPERTIES := $(call uniq-pairs-by-first-component, \ 664 $(FINAL_SYSTEM_EXT_PROPERTIES),=) 665 666$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(system_ext_prop_files) 667 @echo Target system_ext buildinfo: $@ 668 @mkdir -p $(dir $@) 669 $(hide) echo > $@ 670 $(hide) $(call generate-common-build-props,system_ext,$@) 671 $(hide) $(foreach file,$(system_ext_prop_files), \ 672 if [ -f "$(file)" ]; then \ 673 echo Target system_ext properties from: "$(file)"; \ 674 echo "" >> $@; \ 675 echo "#" >> $@; \ 676 echo "# from $(file)" >> $@; \ 677 echo "#" >> $@; \ 678 cat $(file) >> $@; \ 679 echo "# end of $(file)" >> $@; \ 680 fi;) 681 $(hide) echo "#" >> $@; \ 682 echo "# ADDITIONAL SYSTEM_EXT BUILD PROPERTIES" >> $@; \ 683 echo "#" >> $@; 684 $(hide) $(foreach line,$(FINAL_SYSTEM_EXT_PROPERTIES), \ 685 echo "$(line)" >> $@;) 686 $(hide) $(POST_PROCESS_PROPS) $@ 687 688# ---------------------------------------------------------------- 689 690# ----------------------------------------------------------------- 691# sdk-build.prop 692# 693# There are certain things in build.prop that we don't want to 694# ship with the sdk; remove them. 695 696# This must be a list of entire property keys followed by 697# "=" characters, without any internal spaces. 698sdk_build_prop_remove := \ 699 ro.build.user= \ 700 ro.build.host= \ 701 ro.product.brand= \ 702 ro.product.manufacturer= \ 703 ro.product.device= 704# TODO: Remove this soon-to-be obsolete property 705sdk_build_prop_remove += ro.build.product= 706INSTALLED_SDK_BUILD_PROP_TARGET := $(PRODUCT_OUT)/sdk/sdk-build.prop 707$(INSTALLED_SDK_BUILD_PROP_TARGET): $(INSTALLED_BUILD_PROP_TARGET) 708 @echo SDK buildinfo: $@ 709 @mkdir -p $(dir $@) 710 $(hide) grep -v "$(subst $(space),\|,$(strip \ 711 $(sdk_build_prop_remove)))" $< > $@.tmp 712 $(hide) for x in $(sdk_build_prop_remove); do \ 713 echo "$$x"generic >> $@.tmp; done 714 $(hide) mv $@.tmp $@ 715 716# ----------------------------------------------------------------- 717# kernel modules 718 719# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder. 720DEPMOD_STAGING_SUBDIR :=$= lib/modules/0.0 721 722define copy-and-strip-kernel-module 723$(2): $(1) 724 $(LLVM_STRIP) -o $(2) --strip-debug $(1) 725endef 726 727# $(1): modules list 728# $(2): output dir 729# $(3): mount point 730# $(4): staging dir 731# $(5): module load list 732# $(6): module load list filename 733# $(7): module archive 734# $(8): staging dir for stripped modules 735# $(9): module directory name 736# Returns the a list of src:dest pairs to install the modules using copy-many-files. 737define build-image-kernel-modules 738 $(if $(9), \ 739 $(eval _dir := $(9)/), \ 740 $(eval _dir :=)) \ 741 $(foreach module,$(1), \ 742 $(eval _src := $(module)) \ 743 $(if $(8), \ 744 $(eval _src := $(8)/$(notdir $(module))) \ 745 $(eval $(call copy-and-strip-kernel-module,$(module),$(_src)))) \ 746 $(_src):$(2)/lib/modules/$(_dir)$(notdir $(module))) \ 747 $(eval $(call build-image-kernel-modules-depmod,$(1),$(3),$(4),$(5),$(6),$(7),$(2),$(9))) \ 748 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep:$(2)/lib/modules/$(_dir)modules.dep \ 749 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.alias:$(2)/lib/modules/$(_dir)modules.alias \ 750 $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep:$(2)/lib/modules/$(_dir)modules.softdep \ 751 $(4)/$(DEPMOD_STAGING_SUBDIR)/$(6):$(2)/lib/modules/$(_dir)$(6) 752endef 753 754# $(1): modules list 755# $(2): mount point 756# $(3): staging dir 757# $(4): module load list 758# $(5): module load list filename 759# $(6): module archive 760# $(7): output dir 761# $(8): module directory name 762# TODO(b/144844424): If a module archive is being used, this step (which 763# generates obj/PACKAGING/.../modules.dep) also unzips the module archive into 764# the output directory. This should be moved to a module with a 765# LOCAL_POST_INSTALL_CMD so that if modules.dep is removed from the output dir, 766# the archive modules are restored along with modules.dep. 767define build-image-kernel-modules-depmod 768$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: .KATI_IMPLICIT_OUTPUTS := $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.alias $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5) 769$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(DEPMOD) 770$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULES := $(1) 771$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MOUNT_POINT := $(2) 772$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_DIR := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules/$(8) 773$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_STAGING_DIR := $(3) 774$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_MODULES := $(4) 775$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_FILE := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5) 776$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_ARCHIVE := $(6) 777$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_OUTPUT_DIR := $(7) 778$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1) $(6) 779 @echo depmod $$(PRIVATE_STAGING_DIR) 780 rm -rf $$(PRIVATE_STAGING_DIR) 781 mkdir -p $$(PRIVATE_MODULE_DIR) 782 $(if $(6),\ 783 unzip -qoDD -d $$(PRIVATE_MODULE_DIR) $$(PRIVATE_MODULE_ARCHIVE); \ 784 mkdir -p $$(PRIVATE_OUTPUT_DIR)/lib; \ 785 cp -r $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules $$(PRIVATE_OUTPUT_DIR)/lib/; \ 786 find $$(PRIVATE_MODULE_DIR) -type f -name *.ko | xargs basename -a > $$(PRIVATE_LOAD_FILE); \ 787 ) 788 $(if $(1),\ 789 cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/; \ 790 for MODULE in $$(PRIVATE_LOAD_MODULES); do \ 791 basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); \ 792 done; \ 793 ) 794 $(DEPMOD) -b $$(PRIVATE_STAGING_DIR) 0.0 795 # Turn paths in modules.dep into absolute paths 796 sed -i.tmp -e 's|\([^: ]*lib/modules/[^: ]*\)|/\1|g' $$(PRIVATE_STAGING_DIR)/$$(DEPMOD_STAGING_SUBDIR)/modules.dep 797 touch $$(PRIVATE_LOAD_FILE) 798endef 799 800# $(1): staging dir 801# $(2): modules list 802# $(3): module load list 803# $(4): module load list filename 804# $(5): output dir 805define module-load-list-copy-paths 806 $(eval $(call build-image-module-load-list,$(1),$(2),$(3),$(4))) \ 807 $(1)/$(DEPMOD_STAGING_SUBDIR)/$(4):$(5)/lib/modules/$(4) 808endef 809 810# $(1): staging dir 811# $(2): modules list 812# $(3): module load list 813# $(4): module load list filename 814define build-image-module-load-list 815$(1)/$(DEPMOD_STAGING_SUBDIR)/$(4): PRIVATE_LOAD_MODULES := $(3) 816$(1)/$(DEPMOD_STAGING_SUBDIR)/$(4): $(2) 817 @echo load-list $$(@) 818 @echo '$$(strip $$(notdir $$(PRIVATE_LOAD_MODULES)))' | tr ' ' '\n' > $$(@) 819endef 820 821# $(1): image name 822# $(2): build output directory (TARGET_OUT_VENDOR, TARGET_RECOVERY_ROOT_OUT, etc) 823# $(3): mount point 824# $(4): module load filename 825# $(5): stripped staging directory 826# $(6): kernel module directory name (top is an out of band value for no directory) 827define build-image-kernel-modules-dir 828$(if $(filter top,$(6)),\ 829 $(eval _kver :=)$(eval _sep :=),\ 830 $(eval _kver := $(6))$(eval _sep :=_))\ 831$(if $(5),\ 832 $(eval _stripped_staging_dir := $(5)$(_sep)$(_kver)),\ 833 $(eval _stripped_staging_dir :=))\ 834$(if $(strip $(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver))$(BOARD_$(1)_KERNEL_MODULES_ARCHIVE$(_sep)$(_kver))),\ 835 $(if $(BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver)),,\ 836 $(eval BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver) := $(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver)))) \ 837 $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_$(1)_KERNEL_MODULES$(_sep)$(_kver)),$(2),$(3),$(call intermediates-dir-for,PACKAGING,depmod_$(1)$(_sep)$(_kver)),$(BOARD_$(1)_KERNEL_MODULES_LOAD$(_sep)$(_kver)),$(4),$(BOARD_$(1)_KERNEL_MODULES_ARCHIVE$(_sep)$(_kver)),$(_stripped_staging_dir),$(_kver)))) 838endef 839 840# $(1): kernel module directory name (top is an out of band value for no directory) 841define build-recovery-as-boot-load 842$(if $(filter top,$(1)),\ 843 $(eval _kver :=)$(eval _sep :=),\ 844 $(eval _kver := $(1))$(eval _sep :=_))\ 845 $(if $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD$(_sep)$(_kver)),\ 846 $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,ramdisk_module_list$(_sep)$(_kver)),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES$(_sep)$(_kver)),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD$(_sep)$(_kver)),modules.load,$(TARGET_RECOVERY_ROOT_OUT)))) 847endef 848 849# $(1): kernel module directory name (top is an out of band value for no directory) 850define build-vendor-ramdisk-recovery-load 851$(if $(filter top,$(1)),\ 852 $(eval _kver :=)$(eval _sep :=),\ 853 $(eval _kver := $(1))$(eval _sep :=_))\ 854 $(if $(BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD$(_sep)$(_kver)),\ 855 $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,vendor_ramdisk_recovery_module_list$(_sep)$(_kver)),$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES$(_sep)$(_kver)),$(BOARD_VENDOR_RAMDISK_RECOVERY_KERNEL_MODULES_LOAD$(_sep)$(_kver)),modules.load.recovery,$(TARGET_VENDOR_RAMDISK_OUT)))) 856endef 857 858ifneq ($(BUILDING_VENDOR_BOOT_IMAGE),true) 859 # If there is no vendor boot partition, store vendor ramdisk kernel modules in the 860 # boot ramdisk. 861 BOARD_GENERIC_RAMDISK_KERNEL_MODULES += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES) 862 BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD) 863endif 864 865ifeq ($(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),) 866 BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD := $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES) 867endif 868 869ifneq ($(strip $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)),) 870 ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true) 871 BOARD_RECOVERY_KERNEL_MODULES += $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES) 872 endif 873endif 874 875ifneq ($(BOARD_DO_NOT_STRIP_VENDOR_MODULES),true) 876 VENDOR_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_vendor_stripped) 877else 878 VENDOR_STRIPPED_MODULE_STAGING_DIR := 879endif 880 881ifneq ($(BOARD_DO_NOT_STRIP_VENDOR_RAMDISK_MODULES),true) 882 VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_vendor_ramdisk_stripped) 883else 884 VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR := 885endif 886 887BOARD_KERNEL_MODULE_DIRS += top 888$(foreach dir,$(BOARD_KERNEL_MODULE_DIRS), \ 889 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,RECOVERY,$(TARGET_RECOVERY_ROOT_OUT),,modules.load.recovery,,$(dir))) \ 890 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR_RAMDISK,$(TARGET_VENDOR_RAMDISK_OUT),,modules.load,$(VENDOR_RAMDISK_STRIPPED_MODULE_STAGING_DIR),$(dir))) \ 891 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-vendor-ramdisk-recovery-load,$(dir))) \ 892 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,VENDOR,$(TARGET_OUT_VENDOR),vendor,modules.load,$(VENDOR_STRIPPED_MODULE_STAGING_DIR),$(dir))) \ 893 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,ODM,$(TARGET_OUT_ODM),odm,modules.load,,$(dir))) \ 894 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\ 895 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-recovery-as-boot-load,$(dir))),\ 896 $(eval ALL_DEFAULT_INSTALLED_MODULES += $(call build-image-kernel-modules-dir,GENERIC_RAMDISK,$(TARGET_RAMDISK_OUT),,modules.load,,$(dir))))) 897 898# ----------------------------------------------------------------- 899# Cert-to-package mapping. Used by the post-build signing tools. 900# Use a macro to add newline to each echo command 901# $1 stem name of the package 902# $2 certificate 903# $3 private key 904# $4 compressed 905# $5 partition tag 906# $6 output file 907define _apkcerts_write_line 908$(hide) echo -n 'name="$(1).apk" certificate="$2" private_key="$3"' >> $6 909$(if $(4), $(hide) echo -n ' compressed="$4"' >> $6) 910$(if $(5), $(hide) echo -n ' partition="$5"' >> $6) 911$(hide) echo '' >> $6 912 913endef 914 915# ----------------------------------------------------------------- 916# Merge an individual apkcerts output into the final apkcerts.txt output. 917# Use a macro to make it compatible with _apkcerts_write_line 918# $1 apkcerts file to be merged 919# $2 output file 920define _apkcerts_merge 921$(hide) cat $1 >> $2 922 923endef 924 925name := $(TARGET_PRODUCT) 926ifeq ($(TARGET_BUILD_TYPE),debug) 927 name := $(name)_debug 928endif 929name := $(name)-apkcerts-$(FILE_NAME_TAG) 930intermediates := \ 931 $(call intermediates-dir-for,PACKAGING,apkcerts) 932APKCERTS_FILE := $(intermediates)/$(name).txt 933all_apkcerts_files := $(sort $(foreach p,$(PACKAGES),$(PACKAGES.$(p).APKCERTS_FILE))) 934$(APKCERTS_FILE): $(all_apkcerts_files) 935# We don't need to really build all the modules. 936# TODO: rebuild APKCERTS_FILE if any app change its cert. 937$(APKCERTS_FILE): 938 @echo APK certs list: $@ 939 @mkdir -p $(dir $@) 940 @rm -f $@ 941 $(foreach p,$(sort $(PACKAGES)),\ 942 $(if $(PACKAGES.$(p).APKCERTS_FILE),\ 943 $(call _apkcerts_merge,$(PACKAGES.$(p).APKCERTS_FILE), $@),\ 944 $(if $(PACKAGES.$(p).EXTERNAL_KEY),\ 945 $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@),\ 946 $(call _apkcerts_write_line,$(PACKAGES.$(p).STEM),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$(PACKAGES.$(p).PARTITION),$@)))) 947 # In case value of PACKAGES is empty. 948 $(hide) touch $@ 949 950.PHONY: apkcerts-list 951apkcerts-list: $(APKCERTS_FILE) 952 953ifneq (,$(TARGET_BUILD_APPS)) 954 $(call dist-for-goals, apps_only, $(APKCERTS_FILE):apkcerts.txt) 955 $(call dist-for-goals, apps_only, $(SOONG_APEX_KEYS_FILE):apexkeys.txt) 956endif 957 958 959# ----------------------------------------------------------------- 960# build system stats 961BUILD_SYSTEM_STATS := $(PRODUCT_OUT)/build_system_stats.txt 962$(BUILD_SYSTEM_STATS): 963 @rm -f $@ 964 @$(foreach s,$(STATS.MODULE_TYPE),echo "modules_type_make,$(s),$(words $(STATS.MODULE_TYPE.$(s)))" >>$@;) 965 @$(foreach s,$(STATS.SOONG_MODULE_TYPE),echo "modules_type_soong,$(s),$(STATS.SOONG_MODULE_TYPE.$(s))" >>$@;) 966$(call dist-for-goals,droidcore,$(BUILD_SYSTEM_STATS)) 967 968# ----------------------------------------------------------------- 969# build /product/etc/security/avb/system_other.avbpubkey if needed 970ifdef BUILDING_SYSTEM_OTHER_IMAGE 971ifeq ($(BOARD_AVB_ENABLE),true) 972INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET := $(TARGET_OUT_PRODUCT_ETC)/security/avb/system_other.avbpubkey 973ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET) 974endif # BOARD_AVB_ENABLE 975endif # BUILDING_SYSTEM_OTHER_IMAGE 976 977# ----------------------------------------------------------------- 978# Modules ready to be converted to Soong, ordered by how many 979# modules depend on them. 980SOONG_CONV := $(sort $(SOONG_CONV)) 981SOONG_CONV_DATA := $(call intermediates-dir-for,PACKAGING,soong_conversion)/soong_conv_data 982$(SOONG_CONV_DATA): 983 @rm -f $@ 984 @$(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)))" >>$@;) 985 986SOONG_TO_CONVERT_SCRIPT := build/make/tools/soong_to_convert.py 987SOONG_TO_CONVERT := $(PRODUCT_OUT)/soong_to_convert.txt 988$(SOONG_TO_CONVERT): $(SOONG_CONV_DATA) $(SOONG_TO_CONVERT_SCRIPT) 989 @rm -f $@ 990 $(hide) $(SOONG_TO_CONVERT_SCRIPT) $< >$@ 991$(call dist-for-goals,droidcore,$(SOONG_TO_CONVERT)) 992 993# ----------------------------------------------------------------- 994# Modules use -Wno-error, or added default -Wall -Werror 995WALL_WERROR := $(PRODUCT_OUT)/wall_werror.txt 996$(WALL_WERROR): 997 @rm -f $@ 998 echo "# Modules using -Wno-error" >> $@ 999 for m in $(sort $(SOONG_MODULES_USING_WNO_ERROR) $(MODULES_USING_WNO_ERROR)); do echo $$m >> $@; done 1000 echo "# Modules added default -Wall" >> $@ 1001 for m in $(sort $(SOONG_MODULES_ADDED_WALL) $(MODULES_ADDED_WALL)); do echo $$m >> $@; done 1002 1003$(call dist-for-goals,droidcore,$(WALL_WERROR)) 1004 1005# ----------------------------------------------------------------- 1006# C/C++ flag information for modules 1007$(call dist-for-goals,droidcore,$(SOONG_MODULES_CFLAG_ARTIFACTS)) 1008 1009# ----------------------------------------------------------------- 1010# Modules missing profile files 1011PGO_PROFILE_MISSING := $(PRODUCT_OUT)/pgo_profile_file_missing.txt 1012$(PGO_PROFILE_MISSING): 1013 @rm -f $@ 1014 echo "# Modules missing PGO profile files" >> $@ 1015 for m in $(SOONG_MODULES_MISSING_PGO_PROFILE_FILE); do echo $$m >> $@; done 1016 1017$(call dist-for-goals,droidcore,$(PGO_PROFILE_MISSING)) 1018 1019# ----------------------------------------------------------------- 1020# The dev key is used to sign this package, and as the key required 1021# for future OTA packages installed by this system. Actual product 1022# deliverables will be re-signed by hand. We expect this file to 1023# exist with the suffixes ".x509.pem" and ".pk8". 1024DEFAULT_KEY_CERT_PAIR := $(strip $(DEFAULT_SYSTEM_DEV_CERTIFICATE)) 1025 1026 1027# Rules that need to be present for the all targets, even 1028# if they don't do anything. 1029.PHONY: systemimage 1030systemimage: 1031 1032# ----------------------------------------------------------------- 1033 1034.PHONY: event-log-tags 1035 1036# Produce an event logs tag file for everything we know about, in order 1037# to properly allocate numbers. Then produce a file that's filtered 1038# for what's going to be installed. 1039 1040all_event_log_tags_file := $(TARGET_OUT_COMMON_INTERMEDIATES)/all-event-log-tags.txt 1041 1042event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags 1043 1044# Include tags from all packages that we know about 1045all_event_log_tags_src := \ 1046 $(sort $(foreach m, $(ALL_MODULES), $(ALL_MODULES.$(m).EVENT_LOG_TAGS))) 1047 1048# PDK builds will already have a full list of tags that needs to get merged 1049# in with the ones from source 1050pdk_fusion_log_tags_file := $(patsubst $(PRODUCT_OUT)/%,$(_pdk_fusion_intermediates)/%,$(filter $(event_log_tags_file),$(ALL_PDK_FUSION_FILES))) 1051 1052$(all_event_log_tags_file): PRIVATE_SRC_FILES := $(all_event_log_tags_src) $(pdk_fusion_log_tags_file) 1053$(all_event_log_tags_file): $(all_event_log_tags_src) $(pdk_fusion_log_tags_file) $(MERGETAGS) build/make/tools/event_log_tags.py 1054 $(hide) mkdir -p $(dir $@) 1055 $(hide) $(MERGETAGS) -o $@ $(PRIVATE_SRC_FILES) 1056 1057# Include tags from all packages included in this product, plus all 1058# tags that are part of the system (ie, not in a vendor/ or device/ 1059# directory). 1060event_log_tags_src := \ 1061 $(sort $(foreach m,\ 1062 $(PRODUCT_PACKAGES) \ 1063 $(call module-names-for-tag-list,user), \ 1064 $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \ 1065 $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src))) 1066 1067$(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src) $(pdk_fusion_log_tags_file) 1068$(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file) 1069$(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 1070 $(hide) mkdir -p $(dir $@) 1071 $(hide) $(MERGETAGS) -o $@ -m $(PRIVATE_MERGED_FILE) $(PRIVATE_SRC_FILES) 1072 1073event-log-tags: $(event_log_tags_file) 1074 1075ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file) 1076 1077 1078# ################################################################# 1079# Targets for boot/OS images 1080# ################################################################# 1081ifneq ($(strip $(TARGET_NO_BOOTLOADER)),true) 1082 INSTALLED_BOOTLOADER_MODULE := $(PRODUCT_OUT)/bootloader 1083 ifeq ($(strip $(TARGET_BOOTLOADER_IS_2ND)),true) 1084 INSTALLED_2NDBOOTLOADER_TARGET := $(PRODUCT_OUT)/2ndbootloader 1085 else 1086 INSTALLED_2NDBOOTLOADER_TARGET := 1087 endif 1088else 1089 INSTALLED_BOOTLOADER_MODULE := 1090 INSTALLED_2NDBOOTLOADER_TARGET := 1091endif # TARGET_NO_BOOTLOADER 1092ifneq ($(strip $(TARGET_NO_KERNEL)),true) 1093 ifneq ($(strip $(BOARD_KERNEL_BINARIES)),) 1094 INSTALLED_KERNEL_TARGET := $(foreach k,$(BOARD_KERNEL_BINARIES), \ 1095 $(PRODUCT_OUT)/$(k)) 1096 else 1097 INSTALLED_KERNEL_TARGET := $(PRODUCT_OUT)/kernel 1098 endif 1099else 1100 INSTALLED_KERNEL_TARGET := 1101endif 1102 1103# ----------------------------------------------------------------- 1104# the root dir 1105INTERNAL_ROOT_FILES := $(filter $(TARGET_ROOT_OUT)/%, \ 1106 $(ALL_GENERATED_SOURCES) \ 1107 $(ALL_DEFAULT_INSTALLED_MODULES)) 1108 1109INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt 1110INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json) 1111$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT) 1112$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST) $(FILESLIST_UTIL) 1113 @echo Installed file list: $@ 1114 @mkdir -p $(dir $@) 1115 @rm -f $@ 1116 $(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json) 1117 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 1118 1119$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT)) 1120 1121#------------------------------------------------------------------ 1122# dtb 1123ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG 1124INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img 1125ifdef BOARD_PREBUILT_DTBIMAGE_DIR 1126$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb)) 1127 cat $^ > $@ 1128endif 1129endif 1130 1131# ----------------------------------------------------------------- 1132# the ramdisk 1133ifdef BUILDING_RAMDISK_IMAGE 1134INTERNAL_RAMDISK_FILES := $(filter $(TARGET_RAMDISK_OUT)/%, \ 1135 $(ALL_GENERATED_SOURCES) \ 1136 $(ALL_DEFAULT_INSTALLED_MODULES)) 1137 1138INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt 1139INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json) 1140$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK) 1141$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL) 1142 @echo Installed file list: $@ 1143 @mkdir -p $(TARGET_RAMDISK_OUT) 1144 @mkdir -p $(dir $@) 1145 @rm -f $@ 1146 $(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json) 1147 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 1148 1149$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK)) 1150BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img 1151 1152ifeq ($(BOARD_RAMDISK_USE_LZ4),true) 1153# -l enables the legacy format used by the Linux kernel 1154COMPRESSION_COMMAND_DEPS := $(LZ4) 1155COMPRESSION_COMMAND := $(LZ4) -l -12 --favor-decSpeed 1156RAMDISK_EXT := .lz4 1157else 1158COMPRESSION_COMMAND_DEPS := $(MINIGZIP) 1159COMPRESSION_COMMAND := $(MINIGZIP) 1160RAMDISK_EXT := .gz 1161endif 1162 1163# We just build this directly to the install location. 1164INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET) 1165$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) $(INSTALLED_FILES_FILE_RAMDISK) | $(COMPRESSION_COMMAND_DEPS) 1166 $(call pretty,"Target ram disk: $@") 1167 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $@ 1168 1169.PHONY: ramdisk-nodeps 1170ramdisk-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS) 1171 @echo "make $@: ignoring dependencies" 1172 $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $(INSTALLED_RAMDISK_TARGET) 1173 1174endif # BUILDING_RAMDISK_IMAGE 1175 1176# ----------------------------------------------------------------- 1177# the boot image, which is a collection of other images. 1178 1179# This is defined here since we may be building recovery as boot 1180# below and only want to define this once 1181ifneq ($(strip $(BOARD_KERNEL_BINARIES)),) 1182 BUILT_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot,$(BOARD_KERNEL_BINARIES)), $(PRODUCT_OUT)/$(k).img) 1183else 1184 BUILT_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img 1185endif 1186 1187ifdef BOARD_BOOTIMAGE_PARTITION_SIZE 1188 BOARD_KERNEL_BOOTIMAGE_PARTITION_SIZE := $(BOARD_BOOTIMAGE_PARTITION_SIZE) 1189endif 1190 1191# $1: boot image file name 1192# $2: boot image variant (boot, boot-debug) 1193define get-bootimage-partition-size 1194 $(BOARD_$(call to-upper,$(subst .img,,$(subst $(2),kernel,$(notdir $(1)))))_BOOTIMAGE_PARTITION_SIZE) 1195endef 1196 1197ifneq ($(strip $(TARGET_NO_KERNEL)),true) 1198INTERNAL_BOOTIMAGE_ARGS := \ 1199 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ 1200 --kernel $(INSTALLED_KERNEL_TARGET) 1201 1202ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 1203INTERNAL_BOOTIMAGE_ARGS += --ramdisk $(INSTALLED_RAMDISK_TARGET) 1204endif 1205 1206ifndef BUILDING_VENDOR_BOOT_IMAGE 1207ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG 1208 INTERNAL_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET) 1209endif 1210endif 1211 1212INTERNAL_BOOTIMAGE_FILES := $(filter-out --%,$(INTERNAL_BOOTIMAGE_ARGS)) 1213 1214ifeq ($(PRODUCT_SUPPORTS_VERITY),true) 1215ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 1216VERITY_KEYID := veritykeyid=id:`openssl x509 -in $(PRODUCT_VERITY_SIGNING_KEY).x509.pem -text \ 1217 | grep keyid | sed 's/://g' | tr -d '[:space:]' | tr '[:upper:]' '[:lower:]' | sed 's/keyid//g'` 1218endif 1219endif 1220 1221INTERNAL_KERNEL_CMDLINE := $(strip $(INTERNAL_KERNEL_CMDLINE) buildvariant=$(TARGET_BUILD_VARIANT) $(VERITY_KEYID)) 1222 1223ifndef BUILDING_VENDOR_BOOT_IMAGE 1224ifdef BOARD_KERNEL_BASE 1225 INTERNAL_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) 1226endif 1227ifdef BOARD_KERNEL_PAGESIZE 1228 INTERNAL_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) 1229endif 1230ifdef INTERNAL_KERNEL_CMDLINE 1231 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)" 1232endif 1233else 1234# building vendor boot image, dtb/base/pagesize go there 1235ifdef GENERIC_KERNEL_CMDLINE 1236 INTERNAL_BOOTIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)" 1237endif 1238endif 1239 1240INTERNAL_MKBOOTIMG_VERSION_ARGS := \ 1241 --os_version $(PLATFORM_VERSION_LAST_STABLE) \ 1242 --os_patch_level $(PLATFORM_SECURITY_PATCH) 1243 1244# Define these only if we are building boot 1245ifdef BUILDING_BOOT_IMAGE 1246INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET) 1247 1248ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true) 1249$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore) 1250 1251else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true 1252 1253$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH) 1254 $(call pretty,"Target boot image: $@") 1255 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ 1256 $(hide) $(call assert-max-image-size,$@,$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))) 1257 $(hide) $(AVBTOOL) add_hash_footer \ 1258 --image $@ \ 1259 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \ 1260 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \ 1261 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS) 1262 1263.PHONY: bootimage-nodeps 1264bootimage-nodeps: $(MKBOOTIMG) $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH) 1265 @echo "make $@: ignoring dependencies" 1266 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET) 1267 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(call get-hash-image-max-size,$(BOARD_BOOTIMAGE_PARTITION_SIZE))) 1268 $(hide) $(AVBTOOL) add_hash_footer \ 1269 --image $(INSTALLED_BOOTIMAGE_TARGET) \ 1270 --partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \ 1271 --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) \ 1272 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS) 1273 1274else ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)) # BOARD_AVB_ENABLE != true 1275 1276$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOT_SIGNER) 1277 $(call pretty,"Target boot image: $@") 1278 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ 1279 $(BOOT_SIGNER) /boot $@ $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $@ 1280 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)) 1281 1282.PHONY: bootimage-nodeps 1283bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER) 1284 @echo "make $@: ignoring dependencies" 1285 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET) 1286 $(BOOT_SIGNER) /boot $(INSTALLED_BOOTIMAGE_TARGET) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(INSTALLED_BOOTIMAGE_TARGET) 1287 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)) 1288 1289else ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true 1290 1291$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY) 1292 $(call pretty,"Target boot image: $@") 1293 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned 1294 $(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@ 1295 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)) 1296 1297.PHONY: bootimage-nodeps 1298bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY) 1299 @echo "make $@: ignoring dependencies" 1300 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET).unsigned 1301 $(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) 1302 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)) 1303 1304else # PRODUCT_SUPPORTS_VBOOT != true 1305 1306$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) 1307 $(call pretty,"Target boot image: $@") 1308 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ 1309 $(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)) 1310 1311.PHONY: bootimage-nodeps 1312bootimage-nodeps: $(MKBOOTIMG) 1313 @echo "make $@: ignoring dependencies" 1314 $(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET) 1315 $(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)) 1316 1317endif # TARGET_BOOTIMAGE_USE_EXT2 1318endif # BUILDING_BOOT_IMAGE 1319 1320else # TARGET_NO_KERNEL == "true" 1321ifdef BOARD_PREBUILT_BOOTIMAGE 1322ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 1323# Remove when b/63676296 is resolved. 1324$(error Prebuilt bootimage is only supported for AB targets) 1325endif 1326INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img 1327$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET))) 1328else # BOARD_PREBUILT_BOOTIMAGE not defined 1329INSTALLED_BOOTIMAGE_TARGET := 1330endif # BOARD_PREBUILT_BOOTIMAGE 1331endif # TARGET_NO_KERNEL 1332 1333# ----------------------------------------------------------------- 1334# vendor boot image 1335ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true) 1336 1337ifeq ($(PRODUCT_SUPPORTS_VERITY),true) 1338 $(error vboot 1.0 does not support vendor_boot partition) 1339endif 1340 1341INTERNAL_VENDOR_RAMDISK_FILES := $(filter $(TARGET_VENDOR_RAMDISK_OUT)/%, \ 1342 $(ALL_GENERATED_SOURCES) \ 1343 $(ALL_DEFAULT_INSTALLED_MODULES)) 1344 1345INTERNAL_VENDOR_RAMDISK_TARGET := $(call intermediates-dir-for,PACKAGING,vendor-boot)/vendor-ramdisk.cpio.gz 1346$(INTERNAL_VENDOR_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_VENDOR_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS) 1347 $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_VENDOR_RAMDISK_OUT) | $(COMPRESSION_COMMAND) > $@ 1348 1349ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG 1350 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET) 1351endif 1352ifdef BOARD_KERNEL_BASE 1353 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) 1354endif 1355ifdef BOARD_KERNEL_PAGESIZE 1356 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) 1357endif 1358ifdef INTERNAL_KERNEL_CMDLINE 1359 INTERNAL_VENDOR_BOOTIMAGE_ARGS += --vendor_cmdline "$(INTERNAL_KERNEL_CMDLINE)" 1360endif 1361 1362INSTALLED_VENDOR_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot.img 1363$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_DTBIMAGE_TARGET) 1364ifeq ($(BOARD_AVB_ENABLE),true) 1365$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOTIMAGE_KEY_PATH) 1366 $(call pretty,"Target vendor_boot image: $@") 1367 $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@ 1368 $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)) 1369 $(AVBTOOL) add_hash_footer \ 1370 --image $@ \ 1371 --partition_size $(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE) \ 1372 --partition_name vendor_boot $(INTERNAL_AVB_VENDOR_BOOT_SIGNING_ARGS) \ 1373 $(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS) 1374else 1375$(INSTALLED_VENDOR_BOOTIMAGE_TARGET): 1376 $(call pretty,"Target vendor_boot image: $@") 1377 $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INTERNAL_VENDOR_RAMDISK_TARGET) --vendor_boot $@ 1378 $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)) 1379endif 1380endif # BUILDING_VENDOR_BOOT_IMAGE 1381 1382# ----------------------------------------------------------------- 1383# NOTICE files 1384# 1385# We are required to publish the licenses for all code under BSD, GPL and 1386# Apache licenses (and possibly other more exotic ones as well). We err on the 1387# side of caution, so the licenses for other third-party code are included here 1388# too. 1389# 1390# This needs to be before the systemimage rules, because it adds to 1391# ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files 1392# go into the systemimage. 1393 1394.PHONY: notice_files 1395 1396# Create the rule to combine the files into text and html/xml forms 1397# $(1) - xml_excluded_system_product_odm|xml_excluded_vendor_product_odm 1398# xml_product|xml_odm|xml_system_ext|xml_system|html 1399# $(2) - Plain text output file 1400# $(3) - HTML/XML output file 1401# $(4) - File title 1402# $(5) - Directory to use. Notice files are all $(5)/src. Other 1403# directories in there will be used for scratch 1404# $(6) - Dependencies for the output files 1405# 1406# The algorithm here is that we go collect a hash for each of the notice 1407# files and write the names of the files that match that hash. Then 1408# to generate the real files, we go print out all of the files and their 1409# hashes. 1410# 1411# These rules are fairly complex, so they depend on this makefile so if 1412# it changes, they'll run again. 1413# 1414# TODO: We could clean this up so that we just record the locations of the 1415# original notice files instead of making rules to copy them somwehere. 1416# Then we could traverse that without quite as much bash drama. 1417define combine-notice-files 1418$(2) $(3): PRIVATE_MESSAGE := $(4) 1419$(2) $(3): PRIVATE_DIR := $(5) 1420$(2) : $(3) 1421$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py 1422 build/make/tools/generate-notice-files.py --text-output $(2) \ 1423 $(if $(filter $(1),xml_excluded_vendor_product_odm),-e vendor -e product -e system_ext -e odm --xml-output, \ 1424 $(if $(filter $(1),xml_excluded_system_product_odm),-e system -e product -e system_ext -e odm --xml-output, \ 1425 $(if $(filter $(1),xml_product),-i product --xml-output, \ 1426 $(if $(filter $(1),xml_system_ext),-i system_ext --xml-output, \ 1427 $(if $(filter $(1),xml_system),-i system --xml-output, \ 1428 $(if $(filter $(1),xml_odm),-i odm --xml-output, \ 1429 --html-output)))))) $(3) \ 1430 -t $$(PRIVATE_MESSAGE) $$(foreach dir,$$(sort $$(PRIVATE_DIR)), -s $$(dir)/src) 1431notice_files: $(2) $(3) 1432endef 1433 1434# Notice file logic isn't relevant for TARGET_BUILD_APPS 1435ifndef TARGET_BUILD_APPS 1436 1437# TODO These intermediate NOTICE.txt/NOTICE.html files should go into 1438# TARGET_OUT_NOTICE_FILES now that the notice files are gathered from 1439# the src subdirectory. 1440target_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE.txt 1441tools_notice_file_txt := $(HOST_OUT_INTERMEDIATES)/NOTICE.txt 1442tools_notice_file_html := $(HOST_OUT_INTERMEDIATES)/NOTICE.html 1443kernel_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/kernel.txt 1444winpthreads_notice_file := $(TARGET_OUT_NOTICE_FILES)/src/winpthreads.txt 1445pdk_fusion_notice_files := $(filter $(TARGET_OUT_NOTICE_FILES)/%, $(ALL_PDK_FUSION_FILES)) 1446 1447# TODO(b/69865032): Make PRODUCT_NOTICE_SPLIT the default behavior. 1448ifneq ($(PRODUCT_NOTICE_SPLIT),true) 1449target_notice_file_html := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html 1450target_notice_file_html_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.html.gz 1451installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.html.gz 1452$(eval $(call combine-notice-files, html, \ 1453 $(target_notice_file_txt), \ 1454 $(target_notice_file_html), \ 1455 "Notices for files contained in the filesystem images in this directory:", \ 1456 $(TARGET_OUT_NOTICE_FILES), \ 1457 $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files))) 1458$(target_notice_file_html_gz): $(target_notice_file_html) | $(MINIGZIP) 1459 $(hide) $(MINIGZIP) -9 < $< > $@ 1460$(installed_notice_html_or_xml_gz): $(target_notice_file_html_gz) 1461 $(copy-file-to-target) 1462else 1463target_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml 1464target_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE.xml.gz 1465installed_notice_html_or_xml_gz := $(TARGET_OUT)/etc/NOTICE.xml.gz 1466 1467target_vendor_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.txt 1468target_vendor_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml 1469target_vendor_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_VENDOR.xml.gz 1470installed_vendor_notice_xml_gz := $(TARGET_OUT_VENDOR)/etc/NOTICE.xml.gz 1471 1472target_product_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.txt 1473target_product_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml 1474target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz 1475installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz 1476 1477target_system_ext_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.txt 1478target_system_ext_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.xml 1479target_system_ext_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.xml.gz 1480installed_system_ext_notice_xml_gz := $(TARGET_OUT_SYSTEM_EXT)/etc/NOTICE.xml.gz 1481 1482target_odm_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.txt 1483target_odm_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml 1484target_odm_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml.gz 1485installed_odm_notice_xml_gz := $(TARGET_OUT_ODM)/etc/NOTICE.xml.gz 1486 1487# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module 1488# being built. A notice xml file must depend on all modules that could potentially 1489# install a license file relevant to it. 1490license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files) 1491# Phonys/fakes don't have notice files (though their deps might) 1492license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules)) 1493# testcases are not relevant to the system image. 1494license_modules := $(filter-out $(TARGET_OUT_TESTCASES)/%,$(license_modules)) 1495license_modules_system := $(filter $(TARGET_OUT)/%,$(license_modules)) 1496# system_other is relevant to system partition. 1497license_modules_system += $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,$(license_modules)) 1498license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules)) 1499license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules)) 1500license_modules_system_ext := $(filter $(TARGET_OUT_SYSTEM_EXT)/%,$(license_modules)) 1501license_modules_odm := $(filter $(TARGET_OUT_ODM)/%,$(license_modules)) 1502license_modules_agg := $(license_modules_system) \ 1503 $(license_modules_vendor) \ 1504 $(license_modules_product) \ 1505 $(license_modules_system_ext) \ 1506 $(license_modules_odm) 1507license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules)) 1508 1509# If we are building in a configuration that includes a prebuilt vendor.img, we can't 1510# update its notice file, so include those notices in the system partition instead 1511ifdef BOARD_PREBUILT_VENDORIMAGE 1512license_modules_system += $(license_modules_rest) 1513system_xml_directories := xml_excluded_vendor_product_odm 1514system_notice_file_message := "Notices for files contained in all filesystem images except vendor/system_ext/product/odm in this directory:" 1515else 1516license_modules_vendor += $(license_modules_rest) 1517system_xml_directories := xml_system 1518system_notice_file_message := "Notices for files contained in the system filesystem image in this directory:" 1519endif 1520 1521$(eval $(call combine-notice-files, $(system_xml_directories), \ 1522 $(target_notice_file_txt), \ 1523 $(target_notice_file_xml), \ 1524 $(system_notice_file_message), \ 1525 $(TARGET_OUT_NOTICE_FILES), \ 1526 $(license_modules_system))) 1527$(eval $(call combine-notice-files, xml_excluded_system_product_odm, \ 1528 $(target_vendor_notice_file_txt), \ 1529 $(target_vendor_notice_file_xml), \ 1530 "Notices for files contained in all filesystem images except system/system_ext/product/odm in this directory:", \ 1531 $(TARGET_OUT_NOTICE_FILES), \ 1532 $(license_modules_vendor))) 1533$(eval $(call combine-notice-files, xml_product, \ 1534 $(target_product_notice_file_txt), \ 1535 $(target_product_notice_file_xml), \ 1536 "Notices for files contained in the product filesystem image in this directory:", \ 1537 $(TARGET_OUT_NOTICE_FILES), \ 1538 $(license_modules_product))) 1539$(eval $(call combine-notice-files, xml_system_ext, \ 1540 $(target_system_ext_notice_file_txt), \ 1541 $(target_system_ext_notice_file_xml), \ 1542 "Notices for files contained in the system_ext filesystem image in this directory:", \ 1543 $(TARGET_OUT_NOTICE_FILES), \ 1544 $(license_modules_system_ext))) 1545$(eval $(call combine-notice-files, xml_odm, \ 1546 $(target_odm_notice_file_txt), \ 1547 $(target_odm_notice_file_xml), \ 1548 "Notices for files contained in the odm filesystem image in this directory:", \ 1549 $(TARGET_OUT_NOTICE_FILES), \ 1550 $(license_modules_odm))) 1551 1552$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP) 1553 $(hide) $(MINIGZIP) -9 < $< > $@ 1554$(target_vendor_notice_file_xml_gz): $(target_vendor_notice_file_xml) | $(MINIGZIP) 1555 $(hide) $(MINIGZIP) -9 < $< > $@ 1556$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP) 1557 $(hide) $(MINIGZIP) -9 < $< > $@ 1558$(target_system_ext_notice_file_xml_gz): $(target_system_ext_notice_file_xml) | $(MINIGZIP) 1559 $(hide) $(MINIGZIP) -9 < $< > $@ 1560$(target_odm_notice_file_xml_gz): $(target_odm_notice_file_xml) | $(MINIGZIP) 1561 $(hide) $(MINIGZIP) -9 < $< > $@ 1562$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz) 1563 $(copy-file-to-target) 1564$(installed_vendor_notice_xml_gz): $(target_vendor_notice_file_xml_gz) 1565 $(copy-file-to-target) 1566$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz) 1567 $(copy-file-to-target) 1568$(installed_system_ext_notice_xml_gz): $(target_system_ext_notice_file_xml_gz) 1569 $(copy-file-to-target) 1570$(installed_odm_notice_xml_gz): $(target_odm_notice_file_xml_gz) 1571 $(copy-file-to-target) 1572 1573ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz) 1574ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz) 1575ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz) 1576ALL_DEFAULT_INSTALLED_MODULES += $(installed_system_ext_notice_xml_gz) 1577ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_notice_xml_gz) 1578endif # PRODUCT_NOTICE_SPLIT 1579 1580ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz) 1581 1582$(eval $(call combine-notice-files, html, \ 1583 $(tools_notice_file_txt), \ 1584 $(tools_notice_file_html), \ 1585 "Notices for files contained in the tools directory:", \ 1586 $(HOST_OUT_NOTICE_FILES), \ 1587 $(ALL_DEFAULT_INSTALLED_MODULES) \ 1588 $(winpthreads_notice_file))) 1589 1590endif # TARGET_BUILD_APPS 1591 1592# The kernel isn't really a module, so to get its module file in there, we 1593# make the target NOTICE files depend on this particular file too, which will 1594# then be in the right directory for the find in combine-notice-files to work. 1595$(eval $(call copy-one-file,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,$(kernel_notice_file))) 1596 1597$(eval $(call copy-one-file,$(BUILD_SYSTEM)/WINPTHREADS_COPYING,$(winpthreads_notice_file))) 1598 1599 1600# ################################################################# 1601# Targets for user images 1602# ################################################################# 1603 1604INTERNAL_USERIMAGES_EXT_VARIANT := 1605ifeq ($(TARGET_USERIMAGES_USE_EXT2),true) 1606INTERNAL_USERIMAGES_EXT_VARIANT := ext2 1607else 1608ifeq ($(TARGET_USERIMAGES_USE_EXT3),true) 1609INTERNAL_USERIMAGES_EXT_VARIANT := ext3 1610else 1611ifeq ($(TARGET_USERIMAGES_USE_EXT4),true) 1612INTERNAL_USERIMAGES_EXT_VARIANT := ext4 1613endif 1614endif 1615endif 1616 1617# These options tell the recovery updater/installer how to mount the partitions writebale. 1618# <fstype>=<fstype_opts>[|<fstype_opts>]... 1619# fstype_opts := <opt>[,<opt>]... 1620# opt := <name>[=<value>] 1621# The following worked on Nexus devices with Kernel 3.1, 3.4, 3.10 1622DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS := ext4=max_batch_time=0,commit=1,data=ordered,barrier=1,errors=panic,nodelalloc 1623 1624ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)) 1625 INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s 1626endif 1627ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED)) 1628 INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s 1629endif 1630ifneq (true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)) 1631 INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG := -S 1632endif 1633 1634INTERNAL_USERIMAGES_DEPS := \ 1635 $(BUILD_IMAGE) \ 1636 $(MKE2FS_CONF) \ 1637 $(MKEXTUSERIMG) 1638 1639ifeq ($(TARGET_USERIMAGES_USE_F2FS),true) 1640INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) 1641endif 1642 1643ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),) 1644INTERNAL_USERIMAGES_DEPS += $(MKSQUASHFSUSERIMG) 1645endif 1646 1647ifeq (true,$(PRODUCT_SUPPORTS_VERITY)) 1648INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER) 1649ifeq (true,$(PRODUCT_SUPPORTS_VERITY_FEC)) 1650INTERNAL_USERIMAGES_DEPS += $(FEC) 1651endif 1652endif 1653 1654ifeq ($(BOARD_AVB_ENABLE),true) 1655INTERNAL_USERIMAGES_DEPS += $(AVBTOOL) 1656endif 1657 1658# Get a colon-separated list of search paths. 1659INTERNAL_USERIMAGES_BINARY_PATHS := $(subst $(space),:,$(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))) 1660 1661SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin 1662INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC) 1663 1664ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)) 1665 1666ifeq ($(PRODUCT_SUPPORTS_VERITY),true) 1667 $(error vboot 1.0 doesn't support logical partition) 1668endif 1669 1670endif # PRODUCT_USE_DYNAMIC_PARTITIONS 1671 1672# $(1): the path of the output dictionary file 1673# $(2): a subset of "system vendor cache userdata product system_ext oem odm" 1674# $(3): additional "key=value" pairs to append to the dictionary file. 1675define generate-image-prop-dictionary 1676$(if $(filter $(2),system),\ 1677 $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1)) 1678 $(if $(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE),$(hide) echo "system_other_size=$(INTERNAL_SYSTEM_OTHER_PARTITION_SIZE)" >> $(1)) 1679 $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) 1680 $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) 1681 $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1)) 1682 $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1)) 1683 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) 1684 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) 1685 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) 1686 $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) 1687 $(if $(PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1)) 1688 $(if $(PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCT_SYSTEM_HEADROOM)" >> $(1)) 1689 $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) 1690 $(hide) echo "system_selinux_fc=$(SELINUX_FC)" >> $(1) 1691) 1692$(if $(filter $(2),userdata),\ 1693 $(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) 1694 $(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1)) 1695 $(if $(PRODUCT_FS_CASEFOLD),$(hide) echo "needs_casefold=$(PRODUCT_FS_CASEFOLD)" >> $(1)) 1696 $(if $(PRODUCT_QUOTA_PROJID),$(hide) echo "needs_projid=$(PRODUCT_QUOTA_PROJID)" >> $(1)) 1697 $(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1) 1698) 1699$(if $(filter $(2),cache),\ 1700 $(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) 1701 $(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1)) 1702 $(hide) echo "cache_selinux_fc=$(SELINUX_FC)" >> $(1) 1703) 1704$(if $(filter $(2),vendor),\ 1705 $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) 1706 $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1)) 1707 $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1)) 1708 $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1)) 1709 $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1)) 1710 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) 1711 $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) 1712 $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) 1713 $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) 1714 $(if $(PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1)) 1715 $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) 1716 $(hide) echo "vendor_selinux_fc=$(SELINUX_FC)" >> $(1) 1717) 1718$(if $(filter $(2),product),\ 1719 $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) 1720 $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1)) 1721 $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1)) 1722 $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1)) 1723 $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1)) 1724 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) 1725 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) 1726 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) 1727 $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) 1728 $(if $(PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1)) 1729 $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) 1730 $(hide) echo "product_selinux_fc=$(SELINUX_FC)" >> $(1) 1731) 1732$(if $(filter $(2),system_ext),\ 1733 $(if $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_ext_fs_type=$(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) 1734 $(if $(BOARD_SYSTEM_EXTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_ext_extfs_inode_count=$(BOARD_SYSTEM_EXTIMAGE_EXTFS_INODE_COUNT)" >> $(1)) 1735 $(if $(BOARD_SYSTEM_EXTIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_ext_extfs_rsv_pct=$(BOARD_SYSTEM_EXTIMAGE_EXTFS_RSV_PCT)" >> $(1)) 1736 $(if $(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE),$(hide) echo "system_ext_size=$(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE)" >> $(1)) 1737 $(if $(BOARD_SYSTEM_EXTIMAGE_JOURNAL_SIZE),$(hide) echo "system_ext_journal_size=$(BOARD_SYSTEM_EXTIMAGE_JOURNAL_SIZE)" >> $(1)) 1738 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_ext_squashfs_compressor=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) 1739 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_ext_squashfs_compressor_opt=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) 1740 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_ext_squashfs_block_size=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) 1741 $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_ext_squashfs_disable_4k_align=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) 1742 $(if $(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_ext_reserved_size=$(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) 1743 $(hide) echo "system_ext_selinux_fc=$(SELINUX_FC)" >> $(1) 1744) 1745$(if $(filter $(2),odm),\ 1746 $(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) 1747 $(if $(BOARD_ODMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_extfs_inode_count=$(BOARD_ODMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) 1748 $(if $(BOARD_ODMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_extfs_rsv_pct=$(BOARD_ODMIMAGE_EXTFS_RSV_PCT)" >> $(1)) 1749 $(if $(BOARD_ODMIMAGE_PARTITION_SIZE),$(hide) echo "odm_size=$(BOARD_ODMIMAGE_PARTITION_SIZE)" >> $(1)) 1750 $(if $(BOARD_ODMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_journal_size=$(BOARD_ODMIMAGE_JOURNAL_SIZE)" >> $(1)) 1751 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_squashfs_compressor=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) 1752 $(if $(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_squashfs_compressor_opt=$(BOARD_ODMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) 1753 $(if $(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_squashfs_block_size=$(BOARD_ODMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) 1754 $(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) 1755 $(if $(PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCT_ODM_BASE_FS_PATH)" >> $(1)) 1756 $(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) 1757 $(hide) echo "odm_selinux_fc=$(SELINUX_FC)" >> $(1) 1758) 1759$(if $(filter $(2),oem),\ 1760 $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1)) 1761 $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1)) 1762 $(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) 1763 $(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1)) 1764 $(hide) echo "oem_selinux_fc=$(SELINUX_FC)" >> $(1) 1765) 1766$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1) 1767 1768$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1)) 1769$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1)) 1770$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1)) 1771$(if $(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG),$(hide) echo "f2fs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_F2FS_FLAG)" >> $(1)) 1772$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1)) 1773$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1)) 1774$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1)) 1775$(if $(PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1)) 1776$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCT_SUPPORTS_VERITY)" >> $(1)) 1777$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCT_VERITY_SIGNING_KEY)" >> $(1)) 1778$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_signer_cmd=$(notdir $(VERITY_SIGNER))" >> $(1)) 1779$(if $(PRODUCT_SUPPORTS_VERITY_FEC),$(hide) echo "verity_fec=$(PRODUCT_SUPPORTS_VERITY_FEC)" >> $(1)) 1780$(if $(filter eng, $(TARGET_BUILD_VARIANT)),$(hide) echo "verity_disable=true" >> $(1)) 1781$(if $(PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1)) 1782$(if $(PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1)) 1783$(if $(PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1)) 1784$(if $(PRODUCT_SYSTEM_EXT_VERITY_PARTITION),$(hide) echo "system_ext_verity_block_device=$(PRODUCT_SYSTEM_EXT_VERITY_PARTITION)" >> $(1)) 1785$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCT_SUPPORTS_VBOOT)" >> $(1)) 1786$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCT_VBOOT_SIGNING_KEY)" >> $(1)) 1787$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1)) 1788$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "futility=$(notdir $(FUTILITY))" >> $(1)) 1789$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_signer_cmd=$(VBOOT_SIGNER)" >> $(1)) 1790$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_avbtool=$(notdir $(AVBTOOL))" >> $(1)) 1791$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) 1792$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) 1793$(if $(BOARD_AVB_ENABLE),\ 1794 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\ 1795 $(hide) echo "avb_system_key_path=$(BOARD_AVB_SYSTEM_KEY_PATH)" >> $(1) 1796 $(hide) echo "avb_system_algorithm=$(BOARD_AVB_SYSTEM_ALGORITHM)" >> $(1) 1797 $(hide) echo "avb_system_rollback_index_location=$(BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(1))) 1798$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) 1799$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_other_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) 1800$(if $(BOARD_AVB_ENABLE),\ 1801 $(if $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH),\ 1802 $(hide) echo "avb_system_other_key_path=$(BOARD_AVB_SYSTEM_OTHER_KEY_PATH)" >> $(1) 1803 $(hide) echo "avb_system_other_algorithm=$(BOARD_AVB_SYSTEM_OTHER_ALGORITHM)" >> $(1))) 1804$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) 1805$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) 1806$(if $(BOARD_AVB_ENABLE),\ 1807 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\ 1808 $(hide) echo "avb_vendor_key_path=$(BOARD_AVB_VENDOR_KEY_PATH)" >> $(1) 1809 $(hide) echo "avb_vendor_algorithm=$(BOARD_AVB_VENDOR_ALGORITHM)" >> $(1) 1810 $(hide) echo "avb_vendor_rollback_index_location=$(BOARD_AVB_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(1))) 1811$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) 1812$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) 1813$(if $(BOARD_AVB_ENABLE),\ 1814 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\ 1815 $(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1) 1816 $(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1) 1817 $(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1))) 1818$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_ext_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) 1819$(if $(BOARD_AVB_ENABLE),\ 1820 $(hide) echo "avb_system_ext_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) 1821$(if $(BOARD_AVB_ENABLE),\ 1822 $(if $(BOARD_AVB_SYSTEM_EXT_KEY_PATH),\ 1823 $(hide) echo "avb_system_ext_key_path=$(BOARD_AVB_SYSTEM_EXT_KEY_PATH)" >> $(1) 1824 $(hide) echo "avb_system_ext_algorithm=$(BOARD_AVB_SYSTEM_EXT_ALGORITHM)" >> $(1) 1825 $(hide) echo "avb_system_ext_rollback_index_location=$(BOARD_AVB_SYSTEM_EXT_ROLLBACK_INDEX_LOCATION)" >> $(1))) 1826$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) 1827$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) 1828$(if $(BOARD_AVB_ENABLE),\ 1829 $(if $(BOARD_AVB_ODM_KEY_PATH),\ 1830 $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1) 1831 $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1) 1832 $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1))) 1833$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\ 1834 $(hide) echo "recovery_as_boot=true" >> $(1)) 1835$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\ 1836 $(hide) echo "system_root_image=true" >> $(1)) 1837$(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1) 1838$(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITION_SIZE)),\ 1839 $(hide) echo "use_dynamic_partition_size=true" >> $(1)) 1840$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);)) 1841endef 1842 1843# $(1): the path of the output dictionary file 1844# $(2): additional "key=value" pairs to append to the dictionary file. 1845PROP_DICTIONARY_IMAGES := oem 1846ifdef BUILDING_CACHE_IMAGE 1847 PROP_DICTIONARY_IMAGES += cache 1848endif 1849ifdef BUILDING_SYSTEM_IMAGE 1850 PROP_DICTIONARY_IMAGES += system 1851endif 1852ifdef BUILDING_USERDATA_IMAGE 1853 PROP_DICTIONARY_IMAGES += userdata 1854endif 1855ifdef BUILDING_VENDOR_IMAGE 1856 PROP_DICTIONARY_IMAGES += vendor 1857endif 1858ifdef BUILDING_PRODUCT_IMAGE 1859 PROP_DICTIONARY_IMAGES += product 1860endif 1861ifdef BUILDING_SYSTEM_EXT_IMAGE 1862 PROP_DICTIONARY_IMAGES += system_ext 1863endif 1864ifdef BUILDING_ODM_IMAGE 1865 PROP_DICTIONARY_IMAGES += odm 1866endif 1867define generate-userimage-prop-dictionary 1868 $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2)) 1869endef 1870 1871# $(1): the path of the input dictionary file, where each line has the format key=value 1872# $(2): the key to look up 1873define read-image-prop-dictionary 1874$$(grep '$(2)=' $(1) | cut -f2- -d'=') 1875endef 1876 1877# ----------------------------------------------------------------- 1878# Recovery image 1879 1880# Recovery image exists if we are building recovery, or building recovery as boot. 1881ifdef BUILDING_RECOVERY_IMAGE 1882 1883INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \ 1884 $(ALL_DEFAULT_INSTALLED_MODULES)) 1885 1886INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt 1887INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json) 1888 1889# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other 1890# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in 1891# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with 1892# the call to FILELIST. 1893ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 1894INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET) 1895$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET) 1896else 1897$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET) 1898endif 1899 1900$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY) 1901$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) 1902 @echo Installed file list: $@ 1903 @mkdir -p $(dir $@) 1904 @rm -f $@ 1905 $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json) 1906 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 1907 1908recovery_sepolicy := \ 1909 $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \ 1910 $(TARGET_RECOVERY_ROOT_OUT)/plat_file_contexts \ 1911 $(TARGET_RECOVERY_ROOT_OUT)/plat_property_contexts \ 1912 $(TARGET_RECOVERY_ROOT_OUT)/system_ext_file_contexts \ 1913 $(TARGET_RECOVERY_ROOT_OUT)/system_ext_property_contexts \ 1914 $(TARGET_RECOVERY_ROOT_OUT)/vendor_file_contexts \ 1915 $(TARGET_RECOVERY_ROOT_OUT)/vendor_property_contexts \ 1916 $(TARGET_RECOVERY_ROOT_OUT)/odm_file_contexts \ 1917 $(TARGET_RECOVERY_ROOT_OUT)/odm_property_contexts \ 1918 $(TARGET_RECOVERY_ROOT_OUT)/product_file_contexts \ 1919 $(TARGET_RECOVERY_ROOT_OUT)/product_property_contexts 1920 1921# Passed into rsync from non-recovery root to recovery root, to avoid overwriting recovery-specific 1922# SELinux files 1923IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(recovery_sepolicy)) 1924 1925recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system 1926recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img 1927recovery_resources_common := $(call include-path-for, recovery)/res 1928 1929# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG, 1930# or mdpi, in order of preference. We support both specific buckets (e.g. xdpi) and numbers, 1931# which get remapped to a bucket. 1932recovery_density := $(or $(TARGET_SCREEN_DENSITY),$(PRODUCT_AAPT_PREF_CONFIG),mdpi) 1933ifeq (,$(filter xxxhdpi xxhdpi xhdpi hdpi mdpi,$(recovery_density))) 1934recovery_density_value := $(patsubst %dpi,%,$(recovery_density)) 1935# We roughly use the medium point between the primary densities to split buckets. 1936# ------160------240------320----------480------------640------ 1937# mdpi hdpi xhdpi xxhdpi xxxhdpi 1938recovery_density := $(strip \ 1939 $(or $(if $(filter $(shell echo $$(($(recovery_density_value) >= 560))),1),xxxhdpi),\ 1940 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 400))),1),xxhdpi),\ 1941 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\ 1942 $(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi))) 1943endif 1944 1945ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density))) 1946recovery_resources_common := $(recovery_resources_common)-$(recovery_density) 1947else 1948recovery_resources_common := $(recovery_resources_common)-xhdpi 1949endif 1950 1951# Select the 18x32 font on high-density devices (xhdpi and up); and the 12x22 font on other devices. 1952# Note that the font selected here can be overridden for a particular device by putting a font.png 1953# in its private recovery resources. 1954ifneq (,$(filter xxxhdpi xxhdpi xhdpi,$(recovery_density))) 1955recovery_font := $(call include-path-for, recovery)/fonts/18x32.png 1956else 1957recovery_font := $(call include-path-for, recovery)/fonts/12x22.png 1958endif 1959 1960 1961# We will only generate the recovery background text images if the variable 1962# TARGET_RECOVERY_UI_SCREEN_WIDTH is defined. For devices with xxxhdpi and xxhdpi, we set the 1963# variable to the commonly used values here, if it hasn't been intialized elsewhere. While for 1964# devices with lower density, they must have TARGET_RECOVERY_UI_SCREEN_WIDTH defined in their 1965# BoardConfig in order to use this feature. 1966ifeq ($(recovery_density),xxxhdpi) 1967TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1440 1968else ifeq ($(recovery_density),xxhdpi) 1969TARGET_RECOVERY_UI_SCREEN_WIDTH ?= 1080 1970endif 1971 1972ifneq ($(TARGET_RECOVERY_UI_SCREEN_WIDTH),) 1973# Subtracts the margin width and menu indent from the screen width; it's safe to be conservative. 1974ifeq ($(TARGET_RECOVERY_UI_MARGIN_WIDTH),) 1975 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - 10)) 1976else 1977 recovery_image_width := $$(($(TARGET_RECOVERY_UI_SCREEN_WIDTH) - $(TARGET_RECOVERY_UI_MARGIN_WIDTH) - 10)) 1978endif 1979 1980 1981RECOVERY_INSTALLING_TEXT_FILE := $(call intermediates-dir-for,PACKAGING,recovery_text_res)/installing_text.png 1982RECOVERY_INSTALLING_SECURITY_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/installing_security_text.png 1983RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_text.png 1984RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png 1985RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png 1986 1987RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png 1988RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png 1989RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png 1990RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png 1991RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png 1992 1993generated_recovery_text_files := \ 1994 $(RECOVERY_INSTALLING_TEXT_FILE) \ 1995 $(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \ 1996 $(RECOVERY_ERASING_TEXT_FILE) \ 1997 $(RECOVERY_ERROR_TEXT_FILE) \ 1998 $(RECOVERY_NO_COMMAND_TEXT_FILE) \ 1999 $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \ 2000 $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \ 2001 $(RECOVERY_TRY_AGAIN_TEXT_FILE) \ 2002 $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \ 2003 $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE) 2004 2005resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/ 2006image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar 2007zopflipng := $(HOST_OUT_EXECUTABLES)/zopflipng 2008$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_SOURCE_FONTS := $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) 2009$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_FONT_FILES_DIR := $(call intermediates-dir-for,PACKAGING,recovery_font_files) 2010$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RESOURCE_DIR := $(resource_dir) 2011$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_IMAGE_GENERATOR_JAR := $(image_generator_jar) 2012$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_ZOPFLIPNG := $(zopflipng) 2013$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_IMAGE_WIDTH := $(recovery_image_width) 2014$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \ 2015 recovery_installing \ 2016 recovery_installing_security \ 2017 recovery_erasing \ 2018 recovery_error \ 2019 recovery_no_command 2020$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \ 2021 recovery_cancel_wipe_data \ 2022 recovery_factory_data_reset \ 2023 recovery_try_again \ 2024 recovery_wipe_data_menu_header \ 2025 recovery_wipe_data_confirmation 2026$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files)) 2027$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng) 2028 # Prepares the font directory. 2029 @rm -rf $(PRIVATE_RECOVERY_FONT_FILES_DIR) 2030 @mkdir -p $(PRIVATE_RECOVERY_FONT_FILES_DIR) 2031 $(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true 2032 @rm -rf $(dir $@) 2033 @mkdir -p $(dir $@) 2034 $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \ 2035 $(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \ 2036 $(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \ 2037 java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \ 2038 --image_width $(PRIVATE_RECOVERY_IMAGE_WIDTH) \ 2039 --text_name $(text_name) \ 2040 --font_dir $(PRIVATE_RECOVERY_FONT_FILES_DIR) \ 2041 --resource_dir $(PRIVATE_RESOURCE_DIR) \ 2042 --output_file $(output_file) $(center_alignment) && \ 2043 $(PRIVATE_ZOPFLIPNG) -y --iterations=1 --filters=0 $(output_file) $(output_file) > /dev/null &&) true 2044else 2045RECOVERY_INSTALLING_TEXT_FILE := 2046RECOVERY_INSTALLING_SECURITY_TEXT_FILE := 2047RECOVERY_ERASING_TEXT_FILE := 2048RECOVERY_ERROR_TEXT_FILE := 2049RECOVERY_NO_COMMAND_TEXT_FILE := 2050RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := 2051RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := 2052RECOVERY_TRY_AGAIN_TEXT_FILE := 2053RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := 2054RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := 2055endif # TARGET_RECOVERY_UI_SCREEN_WIDTH 2056 2057ifndef TARGET_PRIVATE_RES_DIRS 2058TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res) 2059endif 2060recovery_resource_deps := $(shell find $(recovery_resources_common) \ 2061 $(TARGET_PRIVATE_RES_DIRS) -type f) 2062recovery_resource_deps += $(generated_recovery_text_files) 2063 2064 2065ifdef TARGET_RECOVERY_FSTAB 2066recovery_fstab := $(TARGET_RECOVERY_FSTAB) 2067else 2068recovery_fstab := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery.fstab)) 2069endif 2070ifdef TARGET_RECOVERY_WIPE 2071recovery_wipe := $(TARGET_RECOVERY_WIPE) 2072else 2073recovery_wipe := 2074endif 2075 2076# Traditionally with non-A/B OTA we have: 2077# boot.img + recovery-from-boot.p + recovery-resource.dat = recovery.img. 2078# recovery-resource.dat is needed only if we carry an imgdiff patch of the boot and recovery images 2079# and invoke install-recovery.sh on the first boot post an OTA update. 2080# 2081# We no longer need that if one of the following conditions holds: 2082# a) We carry a full copy of the recovery image - no patching needed 2083# (BOARD_USES_FULL_RECOVERY_IMAGE = true); 2084# b) We build a single image that contains boot and recovery both - no recovery image to install 2085# (BOARD_USES_RECOVERY_AS_BOOT = true); 2086# c) We mount the system image as / and therefore do not have a ramdisk in boot.img 2087# (BOARD_BUILD_SYSTEM_ROOT_IMAGE = true). 2088# d) We include the recovery DTBO image within recovery - not needing the resource file as we 2089# do bsdiff because boot and recovery will contain different number of entries 2090# (BOARD_INCLUDE_RECOVERY_DTBO = true). 2091# e) We include the recovery ACPIO image within recovery - not needing the resource file as we 2092# do bsdiff because boot and recovery will contain different number of entries 2093# (BOARD_INCLUDE_RECOVERY_ACPIO = true). 2094 2095ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \ 2096 $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO))) 2097# Named '.dat' so we don't attempt to use imgdiff for patching it. 2098RECOVERY_RESOURCE_ZIP := $(TARGET_OUT_VENDOR)/etc/recovery-resource.dat 2099ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_RESOURCE_ZIP) 2100else 2101RECOVERY_RESOURCE_ZIP := 2102endif 2103 2104INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default 2105 2106$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \ 2107 TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \ 2108 TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \ 2109 TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \ 2110 TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \ 2111 TARGET_RECOVERY_UI_PROGRESS_BAR_BASELINE:progress_bar_baseline \ 2112 TARGET_RECOVERY_UI_TOUCH_LOW_THRESHOLD:touch_low_threshold \ 2113 TARGET_RECOVERY_UI_TOUCH_HIGH_THRESHOLD:touch_high_threshold \ 2114 TARGET_RECOVERY_UI_VR_STEREO_OFFSET:vr_stereo_offset 2115 2116# Parses the given list of build variables and writes their values as build properties if defined. 2117# For example, if a target defines `TARGET_RECOVERY_UI_MARGIN_HEIGHT := 100`, 2118# `ro.recovery.ui.margin_height=100` will be appended to the given output file. 2119# $(1): Map from the build variable names to property names 2120# $(2): Output file 2121define append-recovery-ui-properties 2122echo "#" >> $(2) 2123echo "# RECOVERY UI BUILD PROPERTIES" >> $(2) 2124echo "#" >> $(2) 2125$(foreach prop,$(1), \ 2126 $(eval _varname := $(call word-colon,1,$(prop))) \ 2127 $(eval _propname := $(call word-colon,2,$(prop))) \ 2128 $(eval _value := $($(_varname))) \ 2129 $(if $(_value), \ 2130 echo ro.recovery.ui.$(_propname)=$(_value) >> $(2) &&)) true 2131endef 2132 2133$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \ 2134 $(INSTALLED_DEFAULT_PROP_TARGET) \ 2135 $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \ 2136 $(intermediate_system_build_prop) \ 2137 $(INSTALLED_VENDOR_BUILD_PROP_TARGET) \ 2138 $(INSTALLED_ODM_BUILD_PROP_TARGET) \ 2139 $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \ 2140 $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) 2141 @echo "Target recovery buildinfo: $@" 2142 $(hide) mkdir -p $(dir $@) 2143 $(hide) rm -f $@ 2144 $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) > $@ 2145 $(hide) cat $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) >> $@ 2146 $(hide) cat $(intermediate_system_build_prop) >> $@ 2147 $(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@ 2148 $(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@ 2149 $(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@ 2150 $(hide) cat $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) >> $@ 2151 $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@) 2152 2153ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER))) 2154 INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk) 2155ifdef GENERIC_KERNEL_CMDLINE 2156 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(GENERIC_KERNEL_CMDLINE)" 2157endif 2158else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER) 2159 INTERNAL_RECOVERYIMAGE_ARGS := \ 2160 $(addprefix --second ,$(INSTALLED_2NDBOOTLOADER_TARGET)) \ 2161 --ramdisk $(recovery_ramdisk) 2162# Assumes this has already been stripped 2163ifdef INTERNAL_KERNEL_CMDLINE 2164 INTERNAL_RECOVERYIMAGE_ARGS += --cmdline "$(INTERNAL_KERNEL_CMDLINE)" 2165endif 2166ifdef BOARD_KERNEL_BASE 2167 INTERNAL_RECOVERYIMAGE_ARGS += --base $(BOARD_KERNEL_BASE) 2168endif 2169ifdef BOARD_KERNEL_PAGESIZE 2170 INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) 2171endif 2172ifdef BOARD_INCLUDE_RECOVERY_DTBO 2173ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE 2174 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) 2175else 2176 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE) 2177endif 2178endif # BOARD_INCLUDE_RECOVERY_DTBO 2179ifdef BOARD_INCLUDE_RECOVERY_ACPIO 2180 INTERNAL_RECOVERYIMAGE_ARGS += --recovery_acpio $(BOARD_RECOVERY_ACPIO) 2181endif 2182ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG 2183 INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET) 2184endif 2185endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined 2186ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS 2187 BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS) 2188endif 2189 2190$(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \ 2191 $(INTERNAL_ROOT_FILES) \ 2192 $(INSTALLED_RAMDISK_TARGET) \ 2193 $(INTERNAL_RECOVERYIMAGE_FILES) \ 2194 $(recovery_sepolicy) \ 2195 $(INSTALLED_2NDBOOTLOADER_TARGET) \ 2196 $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \ 2197 $(recovery_resource_deps) \ 2198 $(recovery_fstab) 2199 # Making recovery image 2200 mkdir -p $(TARGET_RECOVERY_OUT) 2201 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp 2202 # Copying baseline ramdisk... 2203 # Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac. 2204 rsync -a --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) 2205 # Modifying ramdisk contents... 2206 $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \ 2207 ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init) 2208 # Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc. 2209 find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f 2210 cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ 2> /dev/null || true # Ignore error when the src file doesn't exist. 2211 mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res 2212 rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/* 2213 cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res 2214 $(foreach recovery_text_file,$(generated_recovery_text_files), \ 2215 cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true 2216 cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png 2217 $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \ 2218 cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline)) 2219 $(foreach item,$(recovery_fstab), \ 2220 cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab) 2221 $(if $(strip $(recovery_wipe)), \ 2222 cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe) 2223 ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop 2224 $(BOARD_RECOVERY_IMAGE_PREPARE) 2225 $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk) 2226 2227# $(1): output file 2228# $(2): kernel file 2229define build-recoveryimage-target 2230 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \ 2231 $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \ 2232 $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \ 2233 --output $(1).unsigned, \ 2234 $(MKBOOTIMG) --kernel $(2) $(INTERNAL_RECOVERYIMAGE_ARGS) \ 2235 $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_RECOVERY_MKBOOTIMG_ARGS) \ 2236 --output $(1)) 2237 $(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\ 2238 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\ 2239 $(BOOT_SIGNER) /boot $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\ 2240 $(BOOT_SIGNER) /recovery $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1)\ 2241 )\ 2242 ) 2243 $(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \ 2244 $(VBOOT_SIGNER) $(FUTILITY) $(1).unsigned $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $(1).keyblock $(1)) 2245 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \ 2246 $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(call get-bootimage-partition-size,$(1),boot))), \ 2247 $(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)))) 2248 $(if $(filter true,$(BOARD_AVB_ENABLE)), \ 2249 $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)), \ 2250 $(AVBTOOL) add_hash_footer --image $(1) --partition_size $(call get-bootimage-partition-size,$(1),boot) --partition_name boot $(INTERNAL_AVB_BOOT_SIGNING_ARGS) $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS),\ 2251 $(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))) 2252endef 2253 2254recoveryimage-deps := $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) 2255ifeq (true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)) 2256 recoveryimage-deps += $(BOOT_SIGNER) 2257endif 2258ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) 2259 recoveryimage-deps += $(VBOOT_SIGNER) 2260endif 2261ifeq (true,$(BOARD_AVB_ENABLE)) 2262 recoveryimage-deps += $(AVBTOOL) $(BOARD_AVB_BOOT_KEY_PATH) 2263endif 2264ifdef BOARD_INCLUDE_RECOVERY_DTBO 2265 ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE 2266 recoveryimage-deps += $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) 2267 else 2268 recoveryimage-deps += $(BOARD_PREBUILT_DTBOIMAGE) 2269 endif 2270endif 2271ifdef BOARD_INCLUDE_RECOVERY_ACPIO 2272 recoveryimage-deps += $(BOARD_RECOVERY_ACPIO) 2273endif 2274ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG 2275 recoveryimage-deps += $(INSTALLED_DTBIMAGE_TARGET) 2276endif 2277 2278ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 2279$(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps) 2280 $(call pretty,"Target boot image from recovery: $@") 2281 $(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@)))) 2282endif # BOARD_USES_RECOVERY_AS_BOOT 2283 2284$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps) 2285 $(call build-recoveryimage-target, $@, $(recovery_kernel)) 2286 2287ifdef RECOVERY_RESOURCE_ZIP 2288$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME) 2289 $(hide) mkdir -p $(dir $@) 2290 $(hide) find $(TARGET_RECOVERY_ROOT_OUT)/res -type f | sort | zip -0qrjX $@ -@ 2291 $(remove-timestamps-from-package) 2292endif 2293 2294.PHONY: recoveryimage-nodeps 2295recoveryimage-nodeps: 2296 @echo "make $@: ignoring dependencies" 2297 $(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET)) 2298 2299else # BUILDING_RECOVERY_IMAGE 2300RECOVERY_RESOURCE_ZIP := 2301endif # BUILDING_RECOVERY_IMAGE 2302 2303.PHONY: recoveryimage 2304recoveryimage: $(INSTALLED_RECOVERYIMAGE_TARGET) $(RECOVERY_RESOURCE_ZIP) 2305 2306ifneq ($(BOARD_NAND_PAGE_SIZE),) 2307$(error MTD device is no longer supported and thus BOARD_NAND_PAGE_SIZE is deprecated.) 2308endif 2309 2310ifneq ($(BOARD_NAND_SPARE_SIZE),) 2311$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.) 2312endif 2313 2314ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 2315# ----------------------------------------------------------------- 2316# the debug ramdisk, which is the original ramdisk plus additional 2317# files: force_debuggable, adb_debug.prop and userdebug sepolicy. 2318# When /force_debuggable is present, /init will load userdebug sepolicy 2319# and property files to allow adb root, if the device is unlocked. 2320 2321ifdef BUILDING_RAMDISK_IMAGE 2322BUILT_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-debug.img 2323INSTALLED_DEBUG_RAMDISK_TARGET := $(BUILT_DEBUG_RAMDISK_TARGET) 2324 2325INTERNAL_DEBUG_RAMDISK_FILES := $(filter $(TARGET_DEBUG_RAMDISK_OUT)/%, \ 2326 $(ALL_GENERATED_SOURCES) \ 2327 $(ALL_DEFAULT_INSTALLED_MODULES)) 2328 2329# Note: TARGET_DEBUG_RAMDISK_OUT will be $(PRODUCT_OUT)/debug_ramdisk/first_stage_ramdisk, 2330# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/debug_ramdisk. 2331# But the root dir of the ramdisk to build is always $(PRODUCT_OUT)/debug_ramdisk. 2332my_debug_ramdisk_root_dir := $(PRODUCT_OUT)/debug_ramdisk 2333 2334INSTALLED_FILES_FILE_DEBUG_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk-debug.txt 2335INSTALLED_FILES_JSON_DEBUG_RAMDISK := $(INSTALLED_FILES_FILE_DEBUG_RAMDISK:.txt=.json) 2336$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_DEBUG_RAMDISK) 2337$(INSTALLED_FILES_FILE_DEBUG_RAMDISK): DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir) 2338 2339# Cannot just depend on INTERNAL_DEBUG_RAMDISK_FILES like other INSTALLED_FILES_FILE_* rules. 2340# Because ramdisk-debug.img will rsync from either ramdisk.img or ramdisk-recovery.img. 2341# Need to depend on the built ramdisk-debug.img, to get a complete list of the installed files. 2342$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INSTALLED_DEBUG_RAMDISK_TARGET) 2343$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INTERNAL_DEBUG_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL) 2344 echo Installed file list: $@ 2345 mkdir -p $(dir $@) 2346 rm -f $@ 2347 $(FILESLIST) $(DEBUG_RAMDISK_ROOT_DIR) > $(@:.txt=.json) 2348 $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 2349 2350# ramdisk-debug.img will rsync the content from either ramdisk.img or ramdisk-recovery.img, 2351# depending on whether BOARD_USES_RECOVERY_AS_BOOT is set or not. 2352ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 2353my_debug_ramdisk_sync_dir := $(TARGET_RECOVERY_ROOT_OUT) 2354else 2355my_debug_ramdisk_sync_dir := $(TARGET_RAMDISK_OUT) 2356endif # BOARD_USES_RECOVERY_AS_BOOT 2357 2358$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir) 2359$(INSTALLED_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir) 2360 2361ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 2362# ramdisk-recovery.img isn't a make target, need to depend on boot.img if it's for recovery. 2363$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_BOOTIMAGE_TARGET) 2364else 2365# Depends on ramdisk.img, note that some target has ramdisk.img but no boot.img, e.g., emulator. 2366$(INSTALLED_DEBUG_RAMDISK_TARGET): $(INSTALLED_RAMDISK_TARGET) 2367endif # BOARD_USES_RECOVERY_AS_BOOT 2368$(INSTALLED_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_DEBUG_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS) 2369 $(call pretty,"Target debug ram disk: $@") 2370 mkdir -p $(TARGET_DEBUG_RAMDISK_OUT) 2371 touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable 2372 rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR) 2373 $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $@ 2374 2375.PHONY: ramdisk_debug-nodeps 2376ramdisk_debug-nodeps: DEBUG_RAMDISK_SYNC_DIR := $(my_debug_ramdisk_sync_dir) 2377ramdisk_debug-nodeps: DEBUG_RAMDISK_ROOT_DIR := $(my_debug_ramdisk_root_dir) 2378ramdisk_debug-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS) 2379 echo "make $@: ignoring dependencies" 2380 mkdir -p $(TARGET_DEBUG_RAMDISK_OUT) 2381 touch $(TARGET_DEBUG_RAMDISK_OUT)/force_debuggable 2382 rsync -a $(DEBUG_RAMDISK_SYNC_DIR)/ $(DEBUG_RAMDISK_ROOT_DIR) 2383 $(MKBOOTFS) -d $(TARGET_OUT) $(DEBUG_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_DEBUG_RAMDISK_TARGET) 2384 2385my_debug_ramdisk_sync_dir := 2386my_debug_ramdisk_root_dir := 2387 2388endif # BUILDING_RAMDISK_IMAGE 2389 2390# ----------------------------------------------------------------- 2391# the boot-debug.img, which is the kernel plus ramdisk-debug.img 2392# 2393# Note: it's intentional to skip signing for boot-debug.img, because it 2394# can only be used if the device is unlocked with verification error. 2395ifneq ($(strip $(TARGET_NO_KERNEL)),true) 2396ifneq ($(strip $(BOARD_KERNEL_BINARIES)),) 2397 INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-debug,$(BOARD_KERNEL_BINARIES)), \ 2398 $(PRODUCT_OUT)/$(k).img) 2399else 2400 INSTALLED_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-debug.img 2401endif 2402 2403# Replace ramdisk.img in $(MKBOOTIMG) ARGS with ramdisk-debug.img to build boot-debug.img 2404ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 2405INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(recovery_ramdisk),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_RECOVERYIMAGE_ARGS)) 2406else 2407INTERNAL_DEBUG_BOOTIMAGE_ARGS := $(subst $(INSTALLED_RAMDISK_TARGET),$(INSTALLED_DEBUG_RAMDISK_TARGET), $(INTERNAL_BOOTIMAGE_ARGS)) 2408endif 2409 2410# If boot.img is chained but boot-debug.img is not signed, libavb in bootloader 2411# will fail to find valid AVB metadata from the end of /boot, thus stop booting. 2412# Using a test key to sign boot-debug.img to continue booting with the mismatched 2413# public key, if the device is unlocked. 2414ifneq ($(BOARD_AVB_BOOT_KEY_PATH),) 2415$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH) 2416endif 2417 2418BOARD_AVB_BOOT_TEST_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem 2419INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS := --algorithm SHA256_RSA2048 --key $(BOARD_AVB_BOOT_TEST_KEY_PATH) 2420# $(1): the bootimage to sign 2421define test-key-sign-bootimage 2422$(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(call get-bootimage-partition-size,$(1),boot-debug))) 2423$(AVBTOOL) add_hash_footer \ 2424 --image $(1) \ 2425 --partition_size $(call get-bootimage-partition-size,$(1),boot-debug)\ 2426 --partition_name boot $(INTERNAL_AVB_BOOT_TEST_SIGNING_ARGS) \ 2427 $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS) 2428$(call assert-max-image-size,$(1),$(call get-bootimage-partition-size,$(1),boot-debug)) 2429endef 2430 2431# $(1): output file 2432define build-debug-bootimage-target 2433 $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-debug,kernel,$(notdir $(1)))) \ 2434 $(INTERNAL_DEBUG_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $1 2435 $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$1)) 2436endef 2437 2438# Depends on original boot.img and ramdisk-debug.img, to build the new boot-debug.img 2439$(INSTALLED_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET) 2440 $(call pretty,"Target boot debug image: $@") 2441 $(call build-debug-bootimage-target, $@) 2442 2443.PHONY: bootimage_debug-nodeps 2444bootimage_debug-nodeps: $(MKBOOTIMG) 2445 echo "make $@: ignoring dependencies" 2446 $(foreach b,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(call build-debug-bootimage-target,$b)) 2447 2448endif # TARGET_NO_KERNEL 2449 2450ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true) 2451ifeq ($(BUILDING_RAMDISK_IMAGE),true) 2452# ----------------------------------------------------------------- 2453# vendor debug ramdisk 2454# Combines vendor ramdisk files and debug ramdisk files to build the vendor debug ramdisk. 2455INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET := $(PRODUCT_OUT)/vendor-ramdisk-debug.cpio$(RAMDISK_EXT) 2456$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): DEBUG_RAMDISK_FILES := $(INTERNAL_DEBUG_RAMDISK_FILES) 2457$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): VENDOR_RAMDISK_DIR := $(TARGET_VENDOR_RAMDISK_OUT) 2458 2459INTERNAL_VENDOR_DEBUG_RAMDISK_FILES := $(filter $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)/%, \ 2460 $(ALL_GENERATED_SOURCES) \ 2461 $(ALL_DEFAULT_INSTALLED_MODULES)) 2462 2463# Note: TARGET_VENDOR_DEBUG_RAMDISK_OUT will be $(PRODUCT_OUT)/vendor_debug_ramdisk/first_stage_ramdisk, 2464# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/vendor_debug_ramdisk. 2465# But the path of $(VENDOR_DEBUG_RAMDISK_DIR) to build the vendor debug ramdisk, is always 2466# $(PRODUCT_OUT)/vendor_debug_ramdisk. 2467$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): VENDOR_DEBUG_RAMDISK_DIR := $(PRODUCT_OUT)/vendor_debug_ramdisk 2468$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_DEBUG_RAMDISK_TARGET) 2469$(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_VENDOR_DEBUG_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS) 2470 $(call pretty,"Target vendor debug ram disk: $@") 2471 mkdir -p $(TARGET_VENDOR_DEBUG_RAMDISK_OUT) 2472 touch $(TARGET_VENDOR_DEBUG_RAMDISK_OUT)/force_debuggable 2473 $(foreach debug_file,$(DEBUG_RAMDISK_FILES), \ 2474 cp -f $(debug_file) $(subst $(PRODUCT_OUT)/debug_ramdisk,$(PRODUCT_OUT)/vendor_debug_ramdisk,$(debug_file)) &&) true 2475 rsync -a $(VENDOR_RAMDISK_DIR)/ $(VENDOR_DEBUG_RAMDISK_DIR) 2476 $(MKBOOTFS) -d $(TARGET_OUT) $(VENDOR_DEBUG_RAMDISK_DIR) | $(COMPRESSION_COMMAND) > $@ 2477 2478INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK := $(PRODUCT_OUT)/installed-files-vendor-ramdisk-debug.txt 2479INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK := $(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK:.txt=.json) 2480$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR_DEBUG_RAMDISK) 2481$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): VENDOR_DEBUG_RAMDISK_DIR := $(PRODUCT_OUT)/vendor_debug_ramdisk 2482 2483# The vendor debug ramdisk will rsync from $(TARGET_VENDOR_RAMDISK_OUT) and $(INTERNAL_DEBUG_RAMDISK_FILES), 2484# so we have to wait for the vendor debug ramdisk to be built before generating the installed file list. 2485$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) 2486$(INSTALLED_FILES_FILE_VENDOR_DEBUG_RAMDISK): $(INTERNAL_VENDOR_DEBUG_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL) 2487 echo Installed file list: $@ 2488 mkdir -p $(dir $@) 2489 rm -f $@ 2490 $(FILESLIST) $(VENDOR_DEBUG_RAMDISK_DIR) > $(@:.txt=.json) 2491 $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 2492 2493# ----------------------------------------------------------------- 2494# vendor_boot-debug.img. 2495INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/vendor_boot-debug.img 2496 2497# The util to sign vendor_boot-debug.img with a test key. 2498BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem 2499INTERNAL_AVB_VENDOR_BOOT_TEST_SIGNING_ARGS := --algorithm SHA256_RSA2048 --key $(BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH) 2500# $(1): the vendor bootimage to sign 2501define test-key-sign-vendor-bootimage 2502$(call assert-max-image-size,$(1),$(call get-hash-image-max-size,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE))) 2503$(AVBTOOL) add_hash_footer \ 2504 --image $(1) \ 2505 --partition_size $(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE) \ 2506 --partition_name vendor_boot $(INTERNAL_AVB_VENDOR_BOOT_TEST_SIGNING_ARGS) \ 2507 $(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS) 2508$(call assert-max-image-size,$(1),$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)) 2509endef 2510 2511ifneq ($(BOARD_AVB_VENDOR_BOOT_KEY_PATH),) 2512$(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_VENDOR_BOOT_TEST_KEY_PATH) 2513endif 2514 2515# Depends on vendor_boot.img and vendor-ramdisk-debug.cpio.gz to build the new vendor_boot-debug.img 2516$(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) 2517 $(call pretty,"Target vendor_boot debug image: $@") 2518 $(MKBOOTIMG) $(INTERNAL_VENDOR_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --vendor_ramdisk $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) --vendor_boot $@ 2519 $(call assert-max-image-size,$@,$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)) 2520 $(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),$(call test-key-sign-vendor-bootimage,$@)) 2521 2522endif # BUILDING_RAMDISK_IMAGE 2523endif # BUILDING_VENDOR_BOOT_IMAGE 2524 2525# ----------------------------------------------------------------- 2526# The test harness ramdisk, which is based off debug_ramdisk, plus a 2527# few additional test-harness-specific properties in adb_debug.prop. 2528 2529ifdef BUILDING_RAMDISK_IMAGE 2530BUILT_TEST_HARNESS_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk-test-harness.img 2531INSTALLED_TEST_HARNESS_RAMDISK_TARGET := $(BUILT_TEST_HARNESS_RAMDISK_TARGET) 2532 2533# rsync the content from ramdisk-debug.img to ramdisk-test-harness.img, then 2534# appends a few test harness specific properties into the adb_debug.prop. 2535TEST_HARNESS_RAMDISK_SYNC_DIR := $(PRODUCT_OUT)/debug_ramdisk 2536TEST_HARNESS_RAMDISK_ROOT_DIR := $(PRODUCT_OUT)/test_harness_ramdisk 2537 2538# The following TARGET_TEST_HARNESS_RAMDISK_OUT will be $(PRODUCT_OUT)/test_harness_ramdisk/first_stage_ramdisk, 2539# if BOARD_USES_RECOVERY_AS_BOOT is true. Otherwise, it will be $(PRODUCT_OUT)/test_harness_ramdisk. 2540TEST_HARNESS_PROP_TARGET := $(TARGET_TEST_HARNESS_RAMDISK_OUT)/adb_debug.prop 2541ADDITIONAL_TEST_HARNESS_PROPERTIES := ro.audio.silent=1 2542ADDITIONAL_TEST_HARNESS_PROPERTIES += ro.test_harness=1 2543 2544# $(1): a list of key=value pairs for additional property assignments 2545# $(2): the target .prop file to append the properties from $(1) 2546define append-test-harness-props 2547 echo "#" >> $(2); \ 2548 echo "# ADDITIONAL TEST HARNESS_PROPERTIES" >> $(2); \ 2549 echo "#" >> $(2); 2550 $(foreach line,$(1), echo "$(line)" >> $(2);) 2551endef 2552 2553$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(INSTALLED_DEBUG_RAMDISK_TARGET) 2554$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_TEST_HARNESS_RAMDISK_FILES) | $(COMPRESSION_COMMAND_DEPS) 2555 $(call pretty,"Target test harness ram disk: $@") 2556 rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR) 2557 $(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET)) 2558 $(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $@ 2559 2560.PHONY: ramdisk_test_harness-nodeps 2561ramdisk_test_harness-nodeps: $(MKBOOTFS) | $(COMPRESSION_COMMAND_DEPS) 2562 echo "make $@: ignoring dependencies" 2563 rsync -a $(TEST_HARNESS_RAMDISK_SYNC_DIR)/ $(TEST_HARNESS_RAMDISK_ROOT_DIR) 2564 $(call append-test-harness-props,$(ADDITIONAL_TEST_HARNESS_PROPERTIES),$(TEST_HARNESS_PROP_TARGET)) 2565 $(MKBOOTFS) -d $(TARGET_OUT) $(TEST_HARNESS_RAMDISK_ROOT_DIR) | $(COMPRESSION_COMMAND) > $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) 2566 2567endif # BUILDING_RAMDISK_IMAGE 2568 2569# ----------------------------------------------------------------- 2570# the boot-test-harness.img, which is the kernel plus ramdisk-test-harness.img 2571# 2572# Note: it's intentional to skip signing for boot-test-harness.img, because it 2573# can only be used if the device is unlocked with verification error. 2574ifneq ($(strip $(TARGET_NO_KERNEL)),true) 2575 2576ifneq ($(strip $(BOARD_KERNEL_BINARIES)),) 2577 INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(foreach k,$(subst kernel,boot-test-harness,$(BOARD_KERNEL_BINARIES)), \ 2578 $(PRODUCT_OUT)/$(k).img) 2579else 2580 INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot-test-harness.img 2581endif 2582 2583# Replace ramdisk-debug.img in $(MKBOOTIMG) ARGS with ramdisk-test-harness.img to build boot-test-harness.img 2584INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS := $(subst $(INSTALLED_DEBUG_RAMDISK_TARGET),$(INSTALLED_TEST_HARNESS_RAMDISK_TARGET),$(INTERNAL_DEBUG_BOOTIMAGE_ARGS)) 2585 2586# If boot.img is chained but boot-test-harness.img is not signed, libavb in bootloader 2587# will fail to find valid AVB metadata from the end of /boot, thus stop booting. 2588# Using a test key to sign boot-test-harness.img to continue booting with the mismatched 2589# public key, if the device is unlocked. 2590ifneq ($(BOARD_AVB_BOOT_KEY_PATH),) 2591$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(AVBTOOL) $(BOARD_AVB_BOOT_TEST_KEY_PATH) 2592endif 2593 2594# $(1): output file 2595define build-boot-test-harness-target 2596 $(MKBOOTIMG) --kernel $(PRODUCT_OUT)/$(subst .img,,$(subst boot-test-harness,kernel,$(notdir $(1)))) \ 2597 $(INTERNAL_TEST_HARNESS_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ 2598 $(if $(BOARD_AVB_BOOT_KEY_PATH),$(call test-key-sign-bootimage,$@)) 2599endef 2600 2601# Build the new boot-test-harness.img, based on boot-debug.img and ramdisk-test-harness.img. 2602$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) $(INSTALLED_TEST_HARNESS_RAMDISK_TARGET) 2603 $(call pretty,"Target boot test harness image: $@") 2604 $(call build-boot-test-harness-target,$@) 2605 2606.PHONY: bootimage_test_harness-nodeps 2607bootimage_test_harness-nodeps: $(MKBOOTIMG) 2608 echo "make $@: ignoring dependencies" 2609 $(foreach b,$(INSTALLED_TEST_HARNESS_BOOTIMAGE_TARGET),$(call build-boot-test-harness-target,$b)) 2610 2611endif # TARGET_NO_KERNEL 2612endif # BOARD_BUILD_SYSTEM_ROOT_IMAGE is not true 2613 2614# ----------------------------------------------------------------- 2615# system image 2616# 2617# Remove overridden packages from $(ALL_PDK_FUSION_FILES) 2618PDK_FUSION_SYSIMG_FILES := \ 2619 $(filter-out $(foreach p,$(overridden_packages),$(p) %/$(p).apk), \ 2620 $(ALL_PDK_FUSION_FILES)) 2621 2622INTERNAL_SYSTEMIMAGE_FILES := $(sort $(filter $(TARGET_OUT)/%, \ 2623 $(ALL_GENERATED_SOURCES) \ 2624 $(ALL_DEFAULT_INSTALLED_MODULES) \ 2625 $(PDK_FUSION_SYSIMG_FILES)) \ 2626 $(PDK_FUSION_SYMLINK_STAMP)) 2627 2628FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS) 2629 2630# ASAN libraries in the system image - add dependency. 2631ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2 2632ifneq (,$(filter address, $(SANITIZE_TARGET))) 2633 ifeq (true,$(SANITIZE_TARGET_SYSTEM)) 2634 FULL_SYSTEMIMAGE_DEPS += $(ASAN_IN_SYSTEM_INSTALLED) 2635 endif 2636endif 2637 2638FULL_SYSTEMIMAGE_DEPS += $(INTERNAL_ROOT_FILES) $(INSTALLED_FILES_FILE_ROOT) 2639 2640# ----------------------------------------------------------------- 2641ifdef BUILDING_SYSTEM_IMAGE 2642 2643# installed file list 2644# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on. 2645# We put installed-files.txt ahead of image itself in the dependency graph 2646# so that we can get the size stat even if the build fails due to too large 2647# system image. 2648INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt 2649INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json) 2650$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON) 2651$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST) $(FILESLIST_UTIL) 2652 @echo Installed file list: $@ 2653 @mkdir -p $(dir $@) 2654 @rm -f $@ 2655 $(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json) 2656 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 2657 2658.PHONY: installed-file-list 2659installed-file-list: $(INSTALLED_FILES_FILE) 2660 2661$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE)) 2662 2663systemimage_intermediates := \ 2664 $(call intermediates-dir-for,PACKAGING,systemimage) 2665BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img 2666 2667# Create symlink /system/vendor to /vendor if necessary. 2668ifdef BOARD_USES_VENDORIMAGE 2669define create-system-vendor-symlink 2670$(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \ 2671 echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \ 2672 echo 'You cannot install files to $(TARGET_OUT)/vendor while building a separate vendor.img!' 1>&2; \ 2673 exit 1; \ 2674fi 2675$(hide) ln -sf /vendor $(TARGET_OUT)/vendor 2676endef 2677else 2678define create-system-vendor-symlink 2679endef 2680endif 2681 2682# Create symlink /system/product to /product if necessary. 2683ifdef BOARD_USES_PRODUCTIMAGE 2684define create-system-product-symlink 2685$(hide) if [ -d $(TARGET_OUT)/product ] && [ ! -h $(TARGET_OUT)/product ]; then \ 2686 echo 'Non-symlink $(TARGET_OUT)/product detected!' 1>&2; \ 2687 echo 'You cannot install files to $(TARGET_OUT)/product while building a separate product.img!' 1>&2; \ 2688 exit 1; \ 2689fi 2690$(hide) ln -sf /product $(TARGET_OUT)/product 2691endef 2692else 2693define create-system-product-symlink 2694endef 2695endif 2696 2697# Create symlink /system/system_ext to /system_ext if necessary. 2698ifdef BOARD_USES_SYSTEM_EXTIMAGE 2699define create-system-system_ext-symlink 2700$(hide) if [ -d $(TARGET_OUT)/system_ext ] && [ ! -h $(TARGET_OUT)/system_ext ]; then \ 2701 echo 'Non-symlink $(TARGET_OUT)/system_ext detected!' 1>&2; \ 2702 echo 'You cannot install files to $(TARGET_OUT)/system_ext while building a separate system_ext.img!' 1>&2; \ 2703 exit 1; \ 2704fi 2705$(hide) ln -sf /system_ext $(TARGET_OUT)/system_ext 2706endef 2707else 2708define create-system-system_ext-symlink 2709endef 2710endif 2711 2712# $(1): output file 2713define build-systemimage-target 2714 @echo "Target system fs image: $(1)" 2715 $(call create-system-vendor-symlink) 2716 $(call create-system-product-symlink) 2717 $(call create-system-system_ext-symlink) 2718 @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt 2719 $(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \ 2720 skip_fsck=true) 2721 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 2722 $(BUILD_IMAGE) \ 2723 $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \ 2724 || ( mkdir -p $${DIST_DIR}; \ 2725 cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \ 2726 exit 1 ) 2727endef 2728 2729ifeq ($(BOARD_AVB_ENABLE),true) 2730$(BUILT_SYSTEMIMAGE): $(BOARD_AVB_SYSTEM_KEY_PATH) 2731endif 2732$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) 2733 $(call build-systemimage-target,$@) 2734 2735INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img 2736SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) 2737 2738# INSTALLED_SYSTEMIMAGE_TARGET used to be named INSTALLED_SYSTEMIMAGE. Create an alias for backward 2739# compatibility, in case device-specific Makefiles still refer to the old name. 2740INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET) 2741 2742# The system partition needs room for the recovery image as well. We 2743# now store the recovery image as a binary patch using the boot image 2744# as the source (since they are very similar). Generate the patch so 2745# we can see how big it's going to be, and include that in the system 2746# image size check calculation. 2747ifneq ($(INSTALLED_BOOTIMAGE_TARGET),) 2748ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) 2749ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) 2750ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO))) 2751diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff 2752else 2753diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff 2754endif 2755intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch) 2756RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p 2757$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool) 2758$(RECOVERY_FROM_BOOT_PATCH): \ 2759 $(INSTALLED_RECOVERYIMAGE_TARGET) \ 2760 $(INSTALLED_BOOTIMAGE_TARGET) \ 2761 $(diff_tool) 2762 @echo "Construct recovery from boot" 2763 mkdir -p $(dir $@) 2764 $(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@ 2765else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true 2766RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET) 2767endif # BOARD_USES_FULL_RECOVERY_IMAGE 2768endif # INSTALLED_RECOVERYIMAGE_TARGET 2769endif # INSTALLED_BOOTIMAGE_TARGET 2770 2771$(INSTALLED_SYSTEMIMAGE_TARGET): $(BUILT_SYSTEMIMAGE) 2772 @echo "Install system fs image: $@" 2773 $(copy-file-to-target) 2774 $(hide) $(call assert-max-image-size,$@,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) 2775 2776systemimage: $(INSTALLED_SYSTEMIMAGE_TARGET) 2777 2778.PHONY: systemimage-nodeps snod 2779systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \ 2780 | $(INTERNAL_USERIMAGES_DEPS) 2781 @echo "make $@: ignoring dependencies" 2782 $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET)) 2783 $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) 2784 2785ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS))) 2786ifeq (true,$(WITH_DEXPREOPT)) 2787$(warning Warning: with dexpreopt enabled, you may need a full rebuild.) 2788endif 2789endif 2790 2791endif # BUILDING_SYSTEM_IMAGE 2792 2793.PHONY: sync syncsys 2794sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES) 2795 2796# ----------------------------------------------------------------- 2797## platform.zip: system, plus other files to be used in PDK fusion build, 2798## in a zip file 2799## 2800## PDK_PLATFORM_ZIP_PRODUCT_BINARIES is used to store specified files to platform.zip. 2801## The variable will be typically set from BoardConfig.mk. 2802## Files under out dir will be rejected to prevent possible conflicts with other rules. 2803ifneq (,$(BUILD_PLATFORM_ZIP)) 2804pdk_odex_javalibs := $(strip $(foreach m,$(DEXPREOPT.MODULES.JAVA_LIBRARIES),\ 2805 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m)))) 2806pdk_odex_apps := $(strip $(foreach m,$(DEXPREOPT.MODULES.APPS),\ 2807 $(if $(filter $(DEXPREOPT.$(m).INSTALLED_STRIPPED),$(ALL_DEFAULT_INSTALLED_MODULES)),$(m)))) 2808pdk_classes_dex := $(strip \ 2809 $(foreach m,$(pdk_odex_javalibs),$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar) \ 2810 $(foreach m,$(pdk_odex_apps),$(call intermediates-dir-for,APPS,$(m))/package.apk)) 2811 2812pdk_odex_config_mk := $(PRODUCT_OUT)/pdk_dexpreopt_config.mk 2813$(pdk_odex_config_mk): PRIVATE_JAVA_LIBRARIES := $(pdk_odex_javalibs) 2814$(pdk_odex_config_mk): PRIVATE_APPS := $(pdk_odex_apps) 2815$(pdk_odex_config_mk) : 2816 @echo "PDK odex config makefile: $@" 2817 $(hide) mkdir -p $(dir $@) 2818 $(hide) echo "# Auto-generated. Do not modify." > $@ 2819 $(hide) echo "PDK.DEXPREOPT.JAVA_LIBRARIES:=$(PRIVATE_JAVA_LIBRARIES)" >> $@ 2820 $(hide) echo "PDK.DEXPREOPT.APPS:=$(PRIVATE_APPS)" >> $@ 2821 $(foreach m,$(PRIVATE_JAVA_LIBRARIES),\ 2822 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,JAVA_LIBRARIES,$(m),,COMMON)/javalib.jar)" >> $@$(newline)\ 2823 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\ 2824 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\ 2825 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\ 2826 ) 2827 $(foreach m,$(PRIVATE_APPS),\ 2828 $(hide) echo "PDK.DEXPREOPT.$(m).SRC:=$(patsubst $(OUT_DIR)/%,%,$(call intermediates-dir-for,APPS,$(m))/package.apk)" >> $@$(newline)\ 2829 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT:=$(DEXPREOPT.$(m).DEX_PREOPT)" >> $@$(newline)\ 2830 $(hide) echo "PDK.DEXPREOPT.$(m).MULTILIB:=$(DEXPREOPT.$(m).MULTILIB)" >> $@$(newline)\ 2831 $(hide) echo "PDK.DEXPREOPT.$(m).DEX_PREOPT_FLAGS:=$(DEXPREOPT.$(m).DEX_PREOPT_FLAGS)" >> $@$(newline)\ 2832 $(hide) echo "PDK.DEXPREOPT.$(m).PRIVILEGED_MODULE:=$(DEXPREOPT.$(m).PRIVILEGED_MODULE)" >> $@$(newline)\ 2833 $(hide) echo "PDK.DEXPREOPT.$(m).VENDOR_MODULE:=$(DEXPREOPT.$(m).VENDOR_MODULE)" >> $@$(newline)\ 2834 $(hide) echo "PDK.DEXPREOPT.$(m).TARGET_ARCH:=$(DEXPREOPT.$(m).TARGET_ARCH)" >> $@$(newline)\ 2835 $(hide) echo "PDK.DEXPREOPT.$(m).STRIPPED_SRC:=$(patsubst $(PRODUCT_OUT)/%,%,$(DEXPREOPT.$(m).INSTALLED_STRIPPED))" >> $@$(newline)\ 2836 ) 2837 2838PDK_PLATFORM_ZIP_PRODUCT_BINARIES := $(filter-out $(OUT_DIR)/%,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES)) 2839INSTALLED_PLATFORM_ZIP := $(PRODUCT_OUT)/platform.zip 2840 2841$(INSTALLED_PLATFORM_ZIP): PRIVATE_DEX_FILES := $(pdk_classes_dex) 2842$(INSTALLED_PLATFORM_ZIP): PRIVATE_ODEX_CONFIG := $(pdk_odex_config_mk) 2843$(INSTALLED_PLATFORM_ZIP) : $(SOONG_ZIP) 2844# dependencies for the other partitions are defined below after their file lists 2845# are known 2846$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES) $(pdk_classes_dex) $(pdk_odex_config_mk) $(API_FINGERPRINT) 2847 $(call pretty,"Platform zip package: $(INSTALLED_PLATFORM_ZIP)") 2848 rm -f $@ $@.lst 2849 echo "-C $(PRODUCT_OUT)" >> $@.lst 2850 echo "-D $(TARGET_OUT)" >> $@.lst 2851 echo "-D $(TARGET_OUT_NOTICE_FILES)" >> $@.lst 2852 echo "$(addprefix -f $(TARGET_OUT_UNSTRIPPED)/,$(PDK_SYMBOL_FILES_LIST))" >> $@.lst 2853ifdef BUILDING_VENDOR_IMAGE 2854 echo "-D $(TARGET_OUT_VENDOR)" >> $@.lst 2855endif 2856ifdef BUILDING_PRODUCT_IMAGE 2857 echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst 2858endif 2859ifdef BUILDING_SYSTEM_EXT_IMAGE 2860 echo "-D $(TARGET_OUT_SYSTEM_EXT)" >> $@.lst 2861endif 2862ifdef BUILDING_ODM_IMAGE 2863 echo "-D $(TARGET_OUT_ODM)" >> $@.lst 2864endif 2865ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),) 2866 echo "-C $(OUT_DIR)" >> $@.lst 2867 for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \ 2868 if [ -e $$f ]; then \ 2869 echo "-f $$f"; \ 2870 fi \ 2871 done >> $@.lst 2872endif 2873ifneq ($(PDK_PLATFORM_ZIP_PRODUCT_BINARIES),) 2874 echo "-C . $(addprefix -f ,$(PDK_PLATFORM_ZIP_PRODUCT_BINARIES))" >> $@.lst 2875endif 2876 @# Add dex-preopt files and config. 2877 $(if $(PRIVATE_DEX_FILES),\ 2878 echo "-C $(OUT_DIR) $(addprefix -f ,$(PRIVATE_DEX_FILES))") >> $@.lst 2879 echo "-C $(dir $(API_FINGERPRINT)) -f $(API_FINGERPRINT)" >> $@.lst 2880 touch $(PRODUCT_OUT)/pdk.mk 2881 echo "-C $(PRODUCT_OUT) -f $(PRIVATE_ODEX_CONFIG) -f $(PRODUCT_OUT)/pdk.mk" >> $@.lst 2882 $(SOONG_ZIP) --ignore_missing_files -o $@ @$@.lst 2883 2884.PHONY: platform 2885platform: $(INSTALLED_PLATFORM_ZIP) 2886 2887.PHONY: platform-java 2888platform-java: platform 2889 2890# Dist the platform.zip 2891ifneq (,$(filter platform platform-java, $(MAKECMDGOALS))) 2892$(call dist-for-goals, platform platform-java, $(INSTALLED_PLATFORM_ZIP)) 2893endif 2894 2895endif # BUILD_PLATFORM_ZIP 2896 2897# ----------------------------------------------------------------- 2898# data partition image 2899INTERNAL_USERDATAIMAGE_FILES := \ 2900 $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) 2901 2902ifdef BUILDING_USERDATA_IMAGE 2903userdataimage_intermediates := \ 2904 $(call intermediates-dir-for,PACKAGING,userdata) 2905BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img 2906 2907define build-userdataimage-target 2908 $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") 2909 @mkdir -p $(TARGET_OUT_DATA) 2910 @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt 2911 $(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true) 2912 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 2913 $(BUILD_IMAGE) \ 2914 $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt \ 2915 $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT) 2916 $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE)) 2917endef 2918 2919# We just build this directly to the install location. 2920INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET) 2921INSTALLED_USERDATAIMAGE_TARGET_DEPS := \ 2922 $(INTERNAL_USERIMAGES_DEPS) \ 2923 $(INTERNAL_USERDATAIMAGE_FILES) 2924$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS) 2925 $(build-userdataimage-target) 2926 2927.PHONY: userdataimage-nodeps 2928userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) 2929 $(build-userdataimage-target) 2930 2931endif # BUILDING_USERDATA_IMAGE 2932 2933# ASAN libraries in the system image - build rule. 2934ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL := $(sort $(patsubst $(PRODUCT_OUT)/%,%,\ 2935 $(TARGET_OUT_SHARED_LIBRARIES) \ 2936 $(2ND_TARGET_OUT_SHARED_LIBRARIES) \ 2937 $(TARGET_OUT_VENDOR_SHARED_LIBRARIES) \ 2938 $(2ND_TARGET_OUT_VENDOR_SHARED_LIBRARIES))) 2939# Extra options: Enforce the system user for the files to avoid having to change ownership. 2940ASAN_SYSTEM_INSTALL_OPTIONS := --owner=1000 --group=1000 2941# Note: experimentally, it seems not worth it to try to get "best" compression. We don't save 2942# enough space. 2943$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS) 2944 tar cfj $(ASAN_IN_SYSTEM_INSTALLED) $(ASAN_SYSTEM_INSTALL_OPTIONS) -C $(TARGET_OUT_DATA)/.. $(ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL) >/dev/null 2945 2946# ----------------------------------------------------------------- 2947# partition table image 2948ifdef BOARD_BPT_INPUT_FILES 2949 2950BUILT_BPTIMAGE_TARGET := $(PRODUCT_OUT)/partition-table.img 2951BUILT_BPTJSON_TARGET := $(PRODUCT_OUT)/partition-table.bpt 2952 2953INTERNAL_BVBTOOL_MAKE_TABLE_ARGS := \ 2954 --output_gpt $(BUILT_BPTIMAGE_TARGET) \ 2955 --output_json $(BUILT_BPTJSON_TARGET) \ 2956 $(foreach file, $(BOARD_BPT_INPUT_FILES), --input $(file)) 2957 2958ifdef BOARD_BPT_DISK_SIZE 2959INTERNAL_BVBTOOL_MAKE_TABLE_ARGS += --disk_size $(BOARD_BPT_DISK_SIZE) 2960endif 2961 2962define build-bptimage-target 2963 $(call pretty,"Target partition table image: $(INSTALLED_BPTIMAGE_TARGET)") 2964 $(hide) $(BPTTOOL) make_table $(INTERNAL_BVBTOOL_MAKE_TABLE_ARGS) $(BOARD_BPT_MAKE_TABLE_ARGS) 2965endef 2966 2967INSTALLED_BPTIMAGE_TARGET := $(BUILT_BPTIMAGE_TARGET) 2968$(BUILT_BPTJSON_TARGET): $(INSTALLED_BPTIMAGE_TARGET) 2969 $(hide) touch -c $(BUILT_BPTJSON_TARGET) 2970 2971$(INSTALLED_BPTIMAGE_TARGET): $(BPTTOOL) $(BOARD_BPT_INPUT_FILES) 2972 $(build-bptimage-target) 2973 2974.PHONY: bptimage-nodeps 2975bptimage-nodeps: 2976 $(build-bptimage-target) 2977 2978endif # BOARD_BPT_INPUT_FILES 2979 2980# ----------------------------------------------------------------- 2981# cache partition image 2982ifdef BUILDING_CACHE_IMAGE 2983INTERNAL_CACHEIMAGE_FILES := \ 2984 $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) 2985 2986cacheimage_intermediates := \ 2987 $(call intermediates-dir-for,PACKAGING,cache) 2988BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img 2989 2990define build-cacheimage-target 2991 $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)") 2992 @mkdir -p $(TARGET_OUT_CACHE) 2993 @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt 2994 $(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true) 2995 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 2996 $(BUILD_IMAGE) \ 2997 $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt \ 2998 $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT) 2999 $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE)) 3000endef 3001 3002# We just build this directly to the install location. 3003INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET) 3004$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) 3005 $(build-cacheimage-target) 3006 3007.PHONY: cacheimage-nodeps 3008cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) 3009 $(build-cacheimage-target) 3010 3011else # BUILDING_CACHE_IMAGE 3012# we need to ignore the broken cache link when doing the rsync 3013IGNORE_CACHE_LINK := --exclude=cache 3014endif # BUILDING_CACHE_IMAGE 3015 3016# ----------------------------------------------------------------- 3017# system_other partition image 3018ifdef BUILDING_SYSTEM_OTHER_IMAGE 3019ifeq ($(BOARD_USES_SYSTEM_OTHER_ODEX),true) 3020# Marker file to identify that odex files are installed 3021INSTALLED_SYSTEM_OTHER_ODEX_MARKER := $(TARGET_OUT_SYSTEM_OTHER)/system-other-odex-marker 3022ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_OTHER_ODEX_MARKER) 3023$(INSTALLED_SYSTEM_OTHER_ODEX_MARKER): 3024 $(hide) touch $@ 3025endif 3026 3027INTERNAL_SYSTEMOTHERIMAGE_FILES := \ 3028 $(filter $(TARGET_OUT_SYSTEM_OTHER)/%,\ 3029 $(ALL_DEFAULT_INSTALLED_MODULES)\ 3030 $(ALL_PDK_FUSION_FILES)) \ 3031 $(PDK_FUSION_SYMLINK_STAMP) 3032 3033# system_other dex files are installed as a side-effect of installing system image files 3034INTERNAL_SYSTEMOTHERIMAGE_FILES += $(INTERNAL_SYSTEMIMAGE_FILES) 3035 3036INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt 3037INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json) 3038$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER) 3039$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) 3040 @echo Installed file list: $@ 3041 @mkdir -p $(dir $@) 3042 @rm -f $@ 3043 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json) 3044 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 3045 3046# Determines partition size for system_other.img. 3047ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true) 3048ifneq ($(filter system,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)),) 3049INTERNAL_SYSTEM_OTHER_PARTITION_SIZE := $(BOARD_SUPER_PARTITION_SYSTEM_DEVICE_SIZE) 3050endif 3051endif 3052 3053ifndef INTERNAL_SYSTEM_OTHER_PARTITION_SIZE 3054INTERNAL_SYSTEM_OTHER_PARTITION_SIZE:= $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) 3055endif 3056 3057systemotherimage_intermediates := \ 3058 $(call intermediates-dir-for,PACKAGING,system_other) 3059BUILT_SYSTEMOTHERIMAGE_TARGET := $(PRODUCT_OUT)/system_other.img 3060 3061# Note that we assert the size is SYSTEMIMAGE_PARTITION_SIZE since this is the 'b' system image. 3062define build-systemotherimage-target 3063 $(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)") 3064 @mkdir -p $(TARGET_OUT_SYSTEM_OTHER) 3065 @mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt 3066 $(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true) 3067 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 3068 $(BUILD_IMAGE) \ 3069 $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt \ 3070 $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT) 3071 $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) 3072endef 3073 3074# We just build this directly to the install location. 3075INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET) 3076ifneq (true,$(SANITIZE_LITE)) 3077# Only create system_other when not building the second stage of a SANITIZE_LITE build. 3078$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER) 3079 $(build-systemotherimage-target) 3080endif 3081 3082.PHONY: systemotherimage-nodeps 3083systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) 3084 $(build-systemotherimage-target) 3085 3086endif # BUILDING_SYSTEM_OTHER_IMAGE 3087 3088 3089# ----------------------------------------------------------------- 3090# vendor partition image 3091ifdef BUILDING_VENDOR_IMAGE 3092INTERNAL_VENDORIMAGE_FILES := \ 3093 $(filter $(TARGET_OUT_VENDOR)/%,\ 3094 $(ALL_DEFAULT_INSTALLED_MODULES)\ 3095 $(ALL_PDK_FUSION_FILES)) \ 3096 $(PDK_FUSION_SYMLINK_STAMP) 3097 3098# platform.zip depends on $(INTERNAL_VENDORIMAGE_FILES). 3099$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDORIMAGE_FILES) 3100 3101INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt 3102INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json) 3103$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR) 3104$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) 3105 @echo Installed file list: $@ 3106 @mkdir -p $(dir $@) 3107 @rm -f $@ 3108 $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json) 3109 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 3110 3111# Create symlink /vendor/odm to /odm if necessary. 3112ifdef BOARD_USES_ODMIMAGE 3113define create-vendor-odm-symlink 3114$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \ 3115 echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \ 3116 echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \ 3117 exit 1; \ 3118fi 3119$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm 3120endef 3121else 3122define create-vendor-odm-symlink 3123endef 3124endif 3125 3126vendorimage_intermediates := \ 3127 $(call intermediates-dir-for,PACKAGING,vendor) 3128BUILT_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img 3129define build-vendorimage-target 3130 $(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)") 3131 @mkdir -p $(TARGET_OUT_VENDOR) 3132 $(call create-vendor-odm-symlink) 3133 @mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt 3134 $(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true) 3135 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 3136 $(BUILD_IMAGE) \ 3137 $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt \ 3138 $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) 3139 $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET) $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_VENDORIMAGE_PARTITION_SIZE)) 3140endef 3141 3142# We just build this directly to the install location. 3143INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET) 3144$(INSTALLED_VENDORIMAGE_TARGET): \ 3145 $(INTERNAL_USERIMAGES_DEPS) \ 3146 $(INTERNAL_VENDORIMAGE_FILES) \ 3147 $(INSTALLED_FILES_FILE_VENDOR) \ 3148 $(RECOVERY_FROM_BOOT_PATCH) 3149 $(build-vendorimage-target) 3150 3151.PHONY: vendorimage-nodeps vnod 3152vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) 3153 $(build-vendorimage-target) 3154 3155sync: $(INTERNAL_VENDORIMAGE_FILES) 3156 3157else ifdef BOARD_PREBUILT_VENDORIMAGE 3158INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img 3159$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET))) 3160endif 3161 3162# ----------------------------------------------------------------- 3163# product partition image 3164ifdef BUILDING_PRODUCT_IMAGE 3165INTERNAL_PRODUCTIMAGE_FILES := \ 3166 $(filter $(TARGET_OUT_PRODUCT)/%,\ 3167 $(ALL_DEFAULT_INSTALLED_MODULES)\ 3168 $(ALL_PDK_FUSION_FILES)) \ 3169 $(PDK_FUSION_SYMLINK_STAMP) 3170 3171# platform.zip depends on $(INTERNAL_PRODUCTIMAGE_FILES). 3172$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCTIMAGE_FILES) 3173 3174INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt 3175INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json) 3176$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT) 3177$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) 3178 @echo Installed file list: $@ 3179 @mkdir -p $(dir $@) 3180 @rm -f $@ 3181 $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json) 3182 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 3183 3184productimage_intermediates := \ 3185 $(call intermediates-dir-for,PACKAGING,product) 3186BUILT_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img 3187define build-productimage-target 3188 $(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)") 3189 @mkdir -p $(TARGET_OUT_PRODUCT) 3190 @mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt 3191 $(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true) 3192 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 3193 $(BUILD_IMAGE) \ 3194 $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt \ 3195 $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT) 3196 $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)) 3197endef 3198 3199# We just build this directly to the install location. 3200INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET) 3201$(INSTALLED_PRODUCTIMAGE_TARGET): \ 3202 $(INTERNAL_USERIMAGES_DEPS) \ 3203 $(INTERNAL_PRODUCTIMAGE_FILES) \ 3204 $(INSTALLED_FILES_FILE_PRODUCT) 3205 $(build-productimage-target) 3206 3207.PHONY: productimage-nodeps pnod 3208productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS) 3209 $(build-productimage-target) 3210 3211sync: $(INTERNAL_PRODUCTIMAGE_FILES) 3212 3213else ifdef BOARD_PREBUILT_PRODUCTIMAGE 3214INSTALLED_PRODUCTIMAGE_TARGET := $(PRODUCT_OUT)/product.img 3215$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCTIMAGE),$(INSTALLED_PRODUCTIMAGE_TARGET))) 3216endif 3217 3218# ----------------------------------------------------------------- 3219# system_ext partition image 3220ifdef BUILDING_SYSTEM_EXT_IMAGE 3221INTERNAL_SYSTEM_EXTIMAGE_FILES := \ 3222 $(filter $(TARGET_OUT_SYSTEM_EXT)/%,\ 3223 $(ALL_DEFAULT_INSTALLED_MODULES)\ 3224 $(ALL_PDK_FUSION_FILES)) \ 3225 $(PDK_FUSION_SYMLINK_STAMP) 3226 3227# platform.zip depends on $(INTERNAL_SYSTEM_EXTIMAGE_FILES). 3228$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEM_EXTIMAGE_FILES) 3229 3230INSTALLED_FILES_FILE_SYSTEM_EXT := $(PRODUCT_OUT)/installed-files-system_ext.txt 3231INSTALLED_FILES_JSON_SYSTEM_EXT := $(INSTALLED_FILES_FILE_SYSTEM_EXT:.txt=.json) 3232$(INSTALLED_FILES_FILE_SYSTEM_EXT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEM_EXT) 3233$(INSTALLED_FILES_FILE_SYSTEM_EXT) : $(INTERNAL_SYSTEM_EXTIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) 3234 @echo Installed file list: $@ 3235 @mkdir -p $(dir $@) 3236 @rm -f $@ 3237 $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_EXT) > $(@:.txt=.json) 3238 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 3239 3240system_extimage_intermediates := \ 3241 $(call intermediates-dir-for,PACKAGING,system_ext) 3242BUILT_SYSTEM_EXTIMAGE_TARGET := $(PRODUCT_OUT)/system_ext.img 3243define build-system_extimage-target 3244 $(call pretty,"Target system_ext fs image: $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)") 3245 @mkdir -p $(TARGET_OUT_SYSTEM_EXT) 3246 @mkdir -p $(system_extimage_intermediates) && rm -rf $(system_extimage_intermediates)/system_ext_image_info.txt 3247 $(call generate-image-prop-dictionary, $(system_extimage_intermediates)/system_ext_image_info.txt,system_ext, skip_fsck=true) 3248 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 3249 $(BUILD_IMAGE) \ 3250 $(TARGET_OUT_SYSTEM_EXT) \ 3251 $(system_extimage_intermediates)/system_ext_image_info.txt \ 3252 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ 3253 $(TARGET_OUT) 3254 $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)) 3255endef 3256 3257# We just build this directly to the install location. 3258INSTALLED_SYSTEM_EXTIMAGE_TARGET := $(BUILT_SYSTEM_EXTIMAGE_TARGET) 3259$(INSTALLED_SYSTEM_EXTIMAGE_TARGET): \ 3260 $(INTERNAL_USERIMAGES_DEPS) \ 3261 $(INTERNAL_SYSTEM_EXTIMAGE_FILES) \ 3262 $(INSTALLED_FILES_FILE_SYSTEM_EXT) 3263 $(build-system_extimage-target) 3264 3265.PHONY: systemextimage-nodeps senod 3266systemextimage-nodeps senod: | $(INTERNAL_USERIMAGES_DEPS) 3267 $(build-system_extimage-target) 3268 3269sync: $(INTERNAL_SYSTEM_EXTIMAGE_FILES) 3270 3271else ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE 3272INSTALLED_SYSTEM_EXTIMAGE_TARGET := $(PRODUCT_OUT)/system_ext.img 3273$(eval $(call copy-one-file,$(BOARD_PREBUILT_SYSTEM_EXTIMAGE),$(INSTALLED_SYSTEM_EXTIMAGE_TARGET))) 3274endif 3275 3276# ----------------------------------------------------------------- 3277# odm partition image 3278ifdef BUILDING_ODM_IMAGE 3279INTERNAL_ODMIMAGE_FILES := \ 3280 $(filter $(TARGET_OUT_ODM)/%,\ 3281 $(ALL_DEFAULT_INSTALLED_MODULES)\ 3282 $(ALL_PDK_FUSION_FILES)) \ 3283 $(PDK_FUSION_SYMLINK_STAMP) 3284# platform.zip depends on $(INTERNAL_ODMIMAGE_FILES). 3285$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODMIMAGE_FILES) 3286 3287INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt 3288INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json) 3289$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM) 3290$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) 3291 @echo Installed file list: $@ 3292 @mkdir -p $(dir $@) 3293 @rm -f $@ 3294 $(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json) 3295 $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ 3296 3297odmimage_intermediates := \ 3298 $(call intermediates-dir-for,PACKAGING,odm) 3299BUILT_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img 3300define build-odmimage-target 3301 $(call pretty,"Target odm fs image: $(INSTALLED_ODMIMAGE_TARGET)") 3302 @mkdir -p $(TARGET_OUT_ODM) 3303 @mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt 3304 $(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true) 3305 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 3306 $(BUILD_IMAGE) \ 3307 $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt \ 3308 $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT) 3309 $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),$(BOARD_ODMIMAGE_PARTITION_SIZE)) 3310endef 3311 3312# We just build this directly to the install location. 3313INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET) 3314$(INSTALLED_ODMIMAGE_TARGET): \ 3315 $(INTERNAL_USERIMAGES_DEPS) \ 3316 $(INTERNAL_ODMIMAGE_FILES) \ 3317 $(INSTALLED_FILES_FILE_ODM) 3318 $(build-odmimage-target) 3319 3320.PHONY: odmimage-nodeps onod 3321odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS) 3322 $(build-odmimage-target) 3323 3324sync: $(INTERNAL_ODMIMAGE_FILES) 3325 3326else ifdef BOARD_PREBUILT_ODMIMAGE 3327INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img 3328$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET))) 3329endif 3330 3331# ----------------------------------------------------------------- 3332# dtbo image 3333ifdef BOARD_PREBUILT_DTBOIMAGE 3334INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img 3335 3336ifeq ($(BOARD_AVB_ENABLE),true) 3337$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) $(AVBTOOL) $(BOARD_AVB_DTBO_KEY_PATH) 3338 cp $(BOARD_PREBUILT_DTBOIMAGE) $@ 3339 $(AVBTOOL) add_hash_footer \ 3340 --image $@ \ 3341 --partition_size $(BOARD_DTBOIMG_PARTITION_SIZE) \ 3342 --partition_name dtbo $(INTERNAL_AVB_DTBO_SIGNING_ARGS) \ 3343 $(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS) 3344else 3345$(INSTALLED_DTBOIMAGE_TARGET): $(BOARD_PREBUILT_DTBOIMAGE) 3346 cp $(BOARD_PREBUILT_DTBOIMAGE) $@ 3347endif 3348 3349endif # BOARD_PREBUILT_DTBOIMAGE 3350 3351# Returns a list of image targets corresponding to the given list of partitions. For example, it 3352# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET) 3353# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor". 3354# (1): list of partitions like "system", "vendor" or "system product system_ext". 3355define images-for-partitions 3356$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET))) 3357endef 3358 3359# ----------------------------------------------------------------- 3360# custom images 3361INSTALLED_CUSTOMIMAGES_TARGET := 3362 3363ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),) 3364INTERNAL_AVB_CUSTOMIMAGES_SIGNING_ARGS := 3365 3366# Sign custom image. 3367# $(1): the prebuilt custom image. 3368# $(2): the mount point of the prebuilt custom image. 3369# $(3): the signed custom image target. 3370define sign_custom_image 3371$(3): $(1) $(INTERNAL_USERIMAGES_DEPS) 3372 @echo Target custom image: $(3) 3373 mkdir -p $(dir $(3)) 3374 cp $(1) $(3) 3375ifeq ($(BOARD_AVB_ENABLE),true) 3376 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$$$PATH \ 3377 $(AVBTOOL) add_hashtree_footer \ 3378 --image $(3) \ 3379 --key $(BOARD_AVB_$(call to-upper,$(2))_KEY_PATH) \ 3380 --algorithm $(BOARD_AVB_$(call to-upper,$(2))_ALGORITHM) \ 3381 --partition_size $(BOARD_AVB_$(call to-upper,$(2))_PARTITION_SIZE) \ 3382 --partition_name $(2) \ 3383 $(INTERNAL_AVB_CUSTOMIMAGES_SIGNING_ARGS) \ 3384 $(BOARD_AVB_$(call to-upper,$(2))_ADD_HASHTREE_FOOTER_ARGS) 3385endif 3386INSTALLED_CUSTOMIMAGES_TARGET += $(3) 3387endef 3388 3389$(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \ 3390 $(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST), \ 3391 $(eval $(call sign_custom_image,$(image),$(partition),$(PRODUCT_OUT)/$(notdir $(image)))))) 3392endif 3393 3394# ----------------------------------------------------------------- 3395# vbmeta image 3396ifeq ($(BOARD_AVB_ENABLE),true) 3397 3398BUILT_VBMETAIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta.img 3399AVB_CHAIN_KEY_DIR := $(TARGET_OUT_INTERMEDIATES)/avb_chain_keys 3400 3401ifdef BOARD_AVB_KEY_PATH 3402$(if $(BOARD_AVB_ALGORITHM),,$(error BOARD_AVB_ALGORITHM is not defined)) 3403else 3404# If key path isn't specified, use the 4096-bit test key. 3405BOARD_AVB_ALGORITHM := SHA256_RSA4096 3406BOARD_AVB_KEY_PATH := external/avb/test/data/testkey_rsa4096.pem 3407endif 3408 3409# AVB signing for system_other.img. 3410ifdef BUILDING_SYSTEM_OTHER_IMAGE 3411ifdef BOARD_AVB_SYSTEM_OTHER_KEY_PATH 3412$(if $(BOARD_AVB_SYSTEM_OTHER_ALGORITHM),,$(error BOARD_AVB_SYSTEM_OTHER_ALGORITHM is not defined)) 3413else 3414# If key path isn't specified, use the same key as BOARD_AVB_KEY_PATH. 3415BOARD_AVB_SYSTEM_OTHER_KEY_PATH := $(BOARD_AVB_KEY_PATH) 3416BOARD_AVB_SYSTEM_OTHER_ALGORITHM := $(BOARD_AVB_ALGORITHM) 3417endif 3418 3419$(INSTALLED_PRODUCT_SYSTEM_OTHER_AVBKEY_TARGET): $(AVBTOOL) $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH) 3420 @echo Extracting system_other avb key: $@ 3421 @rm -f $@ 3422 @mkdir -p $(dir $@) 3423 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_OTHER_KEY_PATH) --output $@ 3424 3425ifndef BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX 3426BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP) 3427endif 3428 3429BOARD_AVB_SYSTEM_OTHER_ADD_HASHTREE_FOOTER_ARGS += --rollback_index $(BOARD_AVB_SYSTEM_OTHER_ROLLBACK_INDEX) 3430endif # end of AVB for BUILDING_SYSTEM_OTHER_IMAGE 3431 3432INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES := \ 3433 $(BOARD_AVB_VBMETA_SYSTEM) \ 3434 $(BOARD_AVB_VBMETA_VENDOR) 3435 3436# Not allowing the same partition to appear in multiple groups. 3437ifneq ($(words $(sort $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))),$(words $(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))) 3438 $(error BOARD_AVB_VBMETA_SYSTEM and BOARD_AVB_VBMETA_VENDOR cannot have duplicates) 3439endif 3440 3441# When building a standalone recovery image for non-A/B devices, recovery image must be self-signed 3442# to be verified independently, and cannot be chained into vbmeta.img. See the link below for 3443# details. 3444ifeq ($(TARGET_OTA_ALLOW_NON_AB),true) 3445ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) 3446$(if $(BOARD_AVB_RECOVERY_KEY_PATH),,\ 3447 $(error BOARD_AVB_RECOVERY_KEY_PATH must be defined for if non-A/B is supported. \ 3448 See https://android.googlesource.com/platform/external/avb/+/master/README.md#booting-into-recovery)) 3449endif 3450endif 3451 3452# Appends os version and security patch level as a AVB property descriptor 3453 3454BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += \ 3455 --prop com.android.build.system.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ 3456 --prop com.android.build.system.os_version:$(PLATFORM_VERSION_LAST_STABLE) \ 3457 --prop com.android.build.system.security_patch:$(PLATFORM_SECURITY_PATCH) 3458 3459BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS += \ 3460 --prop com.android.build.product.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ 3461 --prop com.android.build.product.os_version:$(PLATFORM_VERSION_LAST_STABLE) \ 3462 --prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH) 3463 3464BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS += \ 3465 --prop com.android.build.system_ext.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ 3466 --prop com.android.build.system_ext.os_version:$(PLATFORM_VERSION_LAST_STABLE) \ 3467 --prop com.android.build.system_ext.security_patch:$(PLATFORM_SECURITY_PATCH) 3468 3469BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \ 3470 --prop com.android.build.boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ 3471 --prop com.android.build.boot.os_version:$(PLATFORM_VERSION_LAST_STABLE) 3472 3473BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS += \ 3474 --prop com.android.build.vendor_boot.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ 3475 3476BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS += \ 3477 --prop com.android.build.recovery.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) 3478 3479BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \ 3480 --prop com.android.build.vendor.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ 3481 --prop com.android.build.vendor.os_version:$(PLATFORM_VERSION_LAST_STABLE) 3482 3483BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \ 3484 --prop com.android.build.odm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ 3485 --prop com.android.build.odm.os_version:$(PLATFORM_VERSION_LAST_STABLE) 3486 3487BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \ 3488 --prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) 3489 3490# The following vendor- and odm-specific images needs explicit SPL set per board. 3491ifdef BOOT_SECURITY_PATCH 3492BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \ 3493 --prop com.android.build.boot.security_patch:$(BOOT_SECURITY_PATCH) 3494endif 3495 3496ifdef VENDOR_SECURITY_PATCH 3497BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS += \ 3498 --prop com.android.build.vendor.security_patch:$(VENDOR_SECURITY_PATCH) 3499endif 3500 3501ifdef ODM_SECURITY_PATCH 3502BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \ 3503 --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH) 3504endif 3505 3506BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS 3507VENDOR_BOOT_FOOTER_ARGS := BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS 3508DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS 3509SYSTEM_FOOTER_ARGS := BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS 3510VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS 3511RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS 3512PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS 3513SYSTEM_EXT_FOOTER_ARGS := BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS 3514ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS 3515 3516# Helper function that checks and sets required build variables for an AVB chained partition. 3517# $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system. 3518define _check-and-set-avb-chain-args 3519$(eval part := $(1)) 3520$(eval PART=$(call to-upper,$(part))) 3521 3522$(eval _key_path := BOARD_AVB_$(PART)_KEY_PATH) 3523$(eval _signing_algorithm := BOARD_AVB_$(PART)_ALGORITHM) 3524$(eval _rollback_index := BOARD_AVB_$(PART)_ROLLBACK_INDEX) 3525$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION) 3526$(if $($(_key_path)),,$(error $(_key_path) is not defined)) 3527$(if $($(_signing_algorithm)),,$(error $(_signing_algorithm) is not defined)) 3528$(if $($(_rollback_index)),,$(error $(_rollback_index) is not defined)) 3529$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined)) 3530 3531# Set INTERNAL_AVB_(PART)_SIGNING_ARGS 3532$(eval _signing_args := INTERNAL_AVB_$(PART)_SIGNING_ARGS) 3533$(eval $(_signing_args) := \ 3534 --algorithm $($(_signing_algorithm)) --key $($(_key_path))) 3535 3536# The recovery partition in non-A/B devices should be verified separately. Skip adding the chain 3537# partition descriptor for recovery partition into vbmeta.img. 3538$(if $(or $(filter-out true,$(TARGET_OTA_ALLOW_NON_AB)),$(filter-out recovery,$(part))),\ 3539 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ 3540 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey)) 3541 3542# Set rollback_index via footer args for non-chained vbmeta image. Chained vbmeta image will pick up 3543# the index via a separate flag (e.g. BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX). 3544$(if $(filter $(part),$(part:vbmeta_%=%)),\ 3545 $(eval _footer_args := $(PART)_FOOTER_ARGS) \ 3546 $(eval $($(_footer_args)) += --rollback_index $($(_rollback_index)))) 3547endef 3548 3549# Checks and sets the required build variables for an AVB partition. The partition will be 3550# configured as a chained partition, if BOARD_AVB_<partition>_KEY_PATH is defined. Otherwise the 3551# image descriptor will be included into vbmeta.img, unless it has been already added to any chained 3552# VBMeta image. 3553# Multiple boot images can be generated based on BOARD_KERNEL_BINARIES 3554# but vbmeta would capture the image descriptor of only the first boot 3555# image specified in BUILT_BOOTIMAGE_TARGET. 3556# $(1): Partition name, e.g. boot or system. 3557define check-and-set-avb-args 3558$(eval _in_chained_vbmeta := $(filter $(1),$(INTERNAL_AVB_PARTITIONS_IN_CHAINED_VBMETA_IMAGES))) 3559$(if $(BOARD_AVB_$(call to-upper,$(1))_KEY_PATH),\ 3560 $(if $(_in_chained_vbmeta),\ 3561 $(error Chaining partition "$(1)" in chained VBMeta image is not supported)) \ 3562 $(call _check-and-set-avb-chain-args,$(1)),\ 3563 $(if $(_in_chained_vbmeta),,\ 3564 $(if $(filter boot,$(1)),\ 3565 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ 3566 --include_descriptors_from_image $(firstword $(call images-for-partitions,$(1)))),\ 3567 $(eval INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ 3568 --include_descriptors_from_image $(call images-for-partitions,$(1)))))) 3569endef 3570 3571# Checks and sets build variables for a custom chained partition to include it into vbmeta.img. 3572# $(1): the custom partition to enable AVB chain. 3573define check-and-set-custom-avb-chain-args 3574$(eval part := $(1)) 3575$(eval PART=$(call to-upper,$(part))) 3576$(eval _rollback_index_location := BOARD_AVB_$(PART)_ROLLBACK_INDEX_LOCATION) 3577$(if $($(_rollback_index_location)),,$(error $(_rollback_index_location) is not defined)) 3578 3579INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \ 3580 --chain_partition $(part):$($(_rollback_index_location)):$(AVB_CHAIN_KEY_DIR)/$(part).avbpubkey 3581endef 3582 3583ifdef INSTALLED_BOOTIMAGE_TARGET 3584$(eval $(call check-and-set-avb-args,boot)) 3585endif 3586 3587ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET 3588$(eval $(call check-and-set-avb-args,vendor_boot)) 3589endif 3590 3591$(eval $(call check-and-set-avb-args,system)) 3592 3593ifdef INSTALLED_VENDORIMAGE_TARGET 3594$(eval $(call check-and-set-avb-args,vendor)) 3595endif 3596 3597ifdef INSTALLED_PRODUCTIMAGE_TARGET 3598$(eval $(call check-and-set-avb-args,product)) 3599endif 3600 3601ifdef INSTALLED_SYSTEM_EXTIMAGE_TARGET 3602$(eval $(call check-and-set-avb-args,system_ext)) 3603endif 3604 3605ifdef INSTALLED_ODMIMAGE_TARGET 3606$(eval $(call check-and-set-avb-args,odm)) 3607endif 3608 3609ifdef INSTALLED_DTBOIMAGE_TARGET 3610$(eval $(call check-and-set-avb-args,dtbo)) 3611endif 3612 3613ifdef INSTALLED_RECOVERYIMAGE_TARGET 3614$(eval $(call check-and-set-avb-args,recovery)) 3615endif 3616 3617# Not using INSTALLED_VBMETA_SYSTEMIMAGE_TARGET as it won't be set yet. 3618ifdef BOARD_AVB_VBMETA_SYSTEM 3619$(eval $(call check-and-set-avb-args,vbmeta_system)) 3620endif 3621 3622ifdef BOARD_AVB_VBMETA_VENDOR 3623$(eval $(call check-and-set-avb-args,vbmeta_vendor)) 3624endif 3625 3626ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),) 3627$(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \ 3628 $(eval $(call check-and-set-custom-avb-chain-args,$(partition)))) 3629endif 3630 3631# Add kernel cmdline descriptor for kernel to mount system.img as root with 3632# dm-verity. This works when system.img is either chained or not-chained: 3633# - chained: The --setup_as_rootfs_from_kernel option will add dm-verity kernel 3634# cmdline descriptor to system.img 3635# - not-chained: The --include_descriptors_from_image option for make_vbmeta_image 3636# will include the kernel cmdline descriptor from system.img into vbmeta.img 3637ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 3638ifeq ($(filter system, $(BOARD_SUPER_PARTITION_PARTITION_LIST)),) 3639BOARD_AVB_SYSTEM_ADD_HASHTREE_FOOTER_ARGS += --setup_as_rootfs_from_kernel 3640endif 3641endif 3642 3643BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --padding_size 4096 3644BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += --padding_size 4096 3645BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += --padding_size 4096 3646 3647ifeq (eng,$(filter eng, $(TARGET_BUILD_VARIANT))) 3648# We only need the flag in top-level vbmeta.img. 3649BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --set_hashtree_disabled_flag 3650endif 3651 3652ifdef BOARD_AVB_ROLLBACK_INDEX 3653BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX) 3654endif 3655 3656ifdef BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX 3657BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS += \ 3658 --rollback_index $(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX) 3659endif 3660 3661ifdef BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX 3662BOARD_AVB_MAKE_VBMETA_VENDOR_IMAGE_ARGS += \ 3663 --rollback_index $(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX) 3664endif 3665 3666# $(1): the directory to extract public keys to 3667define extract-avb-chain-public-keys 3668 $(if $(BOARD_AVB_BOOT_KEY_PATH),\ 3669 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_BOOT_KEY_PATH) \ 3670 --output $(1)/boot.avbpubkey) 3671 $(if $(BOARD_AVB_VENDOR_BOOT_KEY_PATH),\ 3672 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_BOOT_KEY_PATH) \ 3673 --output $(1)/vendor_boot.avbpubkey) 3674 $(if $(BOARD_AVB_SYSTEM_KEY_PATH),\ 3675 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_KEY_PATH) \ 3676 --output $(1)/system.avbpubkey) 3677 $(if $(BOARD_AVB_VENDOR_KEY_PATH),\ 3678 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_KEY_PATH) \ 3679 --output $(1)/vendor.avbpubkey) 3680 $(if $(BOARD_AVB_PRODUCT_KEY_PATH),\ 3681 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \ 3682 --output $(1)/product.avbpubkey) 3683 $(if $(BOARD_AVB_SYSTEM_EXT_KEY_PATH),\ 3684 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_EXT_KEY_PATH) \ 3685 --output $(1)/system_ext.avbpubkey) 3686 $(if $(BOARD_AVB_ODM_KEY_PATH),\ 3687 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \ 3688 --output $(1)/odm.avbpubkey) 3689 $(if $(BOARD_AVB_DTBO_KEY_PATH),\ 3690 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \ 3691 --output $(1)/dtbo.avbpubkey) 3692 $(if $(BOARD_AVB_RECOVERY_KEY_PATH),\ 3693 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_RECOVERY_KEY_PATH) \ 3694 --output $(1)/recovery.avbpubkey) 3695 $(if $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH),\ 3696 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \ 3697 --output $(1)/vbmeta_system.avbpubkey) 3698 $(if $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH),\ 3699 $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \ 3700 --output $(1)/vbmeta_vendor.avbpubkey) 3701 $(if $(BOARD_CUSTOMIMAGES_PARTITION_LIST),\ 3702 $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \ 3703 $(AVBTOOL) extract_public_key --key $(BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH) \ 3704 --output $(1)/$(partition).avbpubkey;)) 3705endef 3706 3707# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions 3708# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level 3709# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM 3710# := system system_ext`, `vbmeta_system.img` will be created that includes the descriptors for 3711# `system.img` and `system_ext.img`. `vbmeta_system.img` itself will be included into 3712# `vbmeta.img` as a chained partition. 3713# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc. 3714# $(2): Output filename. 3715define build-chained-vbmeta-image 3716 $(call pretty,"Target chained vbmeta image: $@") 3717 $(hide) $(AVBTOOL) make_vbmeta_image \ 3718 $(INTERNAL_AVB_$(call to-upper,$(1))_SIGNING_ARGS) \ 3719 $(BOARD_AVB_MAKE_$(call to-upper,$(1))_IMAGE_ARGS) \ 3720 $(foreach image,$(BOARD_AVB_$(call to-upper,$(1))), \ 3721 --include_descriptors_from_image $(call images-for-partitions,$(image))) \ 3722 --output $@ 3723endef 3724 3725ifdef BUILDING_SYSTEM_IMAGE 3726ifdef BOARD_AVB_VBMETA_SYSTEM 3727INSTALLED_VBMETA_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_system.img 3728$(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET): \ 3729 $(AVBTOOL) \ 3730 $(call images-for-partitions,$(BOARD_AVB_VBMETA_SYSTEM)) \ 3731 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) 3732 $(call build-chained-vbmeta-image,vbmeta_system) 3733endif 3734endif # BUILDING_SYSTEM_IMAGE 3735 3736ifdef BOARD_AVB_VBMETA_VENDOR 3737INSTALLED_VBMETA_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vbmeta_vendor.img 3738$(INSTALLED_VBMETA_VENDORIMAGE_TARGET): \ 3739 $(AVBTOOL) \ 3740 $(call images-for-partitions,$(BOARD_AVB_VBMETA_VENDOR)) \ 3741 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) 3742 $(call build-chained-vbmeta-image,vbmeta_vendor) 3743endif 3744 3745define build-vbmetaimage-target 3746 $(call pretty,"Target vbmeta image: $(INSTALLED_VBMETAIMAGE_TARGET)") 3747 $(hide) mkdir -p $(AVB_CHAIN_KEY_DIR) 3748 $(call extract-avb-chain-public-keys, $(AVB_CHAIN_KEY_DIR)) 3749 $(hide) $(AVBTOOL) make_vbmeta_image \ 3750 $(INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS) \ 3751 $(PRIVATE_AVB_VBMETA_SIGNING_ARGS) \ 3752 $(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS) \ 3753 --output $@ 3754 $(hide) rm -rf $(AVB_CHAIN_KEY_DIR) 3755endef 3756 3757ifdef BUILDING_VBMETA_IMAGE 3758INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_VBMETAIMAGE_TARGET) 3759$(INSTALLED_VBMETAIMAGE_TARGET): PRIVATE_AVB_VBMETA_SIGNING_ARGS := \ 3760 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH) 3761 3762$(INSTALLED_VBMETAIMAGE_TARGET): \ 3763 $(AVBTOOL) \ 3764 $(INSTALLED_BOOTIMAGE_TARGET) \ 3765 $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \ 3766 $(INSTALLED_SYSTEMIMAGE_TARGET) \ 3767 $(INSTALLED_VENDORIMAGE_TARGET) \ 3768 $(INSTALLED_PRODUCTIMAGE_TARGET) \ 3769 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ 3770 $(INSTALLED_ODMIMAGE_TARGET) \ 3771 $(INSTALLED_DTBOIMAGE_TARGET) \ 3772 $(INSTALLED_CUSTOMIMAGES_TARGET) \ 3773 $(INSTALLED_RECOVERYIMAGE_TARGET) \ 3774 $(INSTALLED_VBMETA_SYSTEMIMAGE_TARGET) \ 3775 $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) \ 3776 $(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH) \ 3777 $(BOARD_AVB_VBMETA_VENDOR_KEY_PATH) \ 3778 $(BOARD_AVB_KEY_PATH) 3779 $(build-vbmetaimage-target) 3780 3781.PHONY: vbmetaimage-nodeps 3782vbmetaimage-nodeps: PRIVATE_AVB_VBMETA_SIGNING_ARGS := \ 3783 --algorithm $(BOARD_AVB_ALGORITHM) --key $(BOARD_AVB_KEY_PATH) 3784vbmetaimage-nodeps: 3785 $(build-vbmetaimage-target) 3786endif # BUILDING_VBMETA_IMAGE 3787 3788endif # BOARD_AVB_ENABLE 3789 3790# ----------------------------------------------------------------- 3791# Check VINTF of build 3792 3793ifndef TARGET_BUILD_APPS 3794intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all) 3795check_vintf_all_deps := 3796 3797# The build system only writes VINTF metadata to */etc/vintf paths. Legacy paths aren't needed here 3798# because they are only used for prebuilt images. 3799check_vintf_common_srcs_patterns := \ 3800 $(TARGET_OUT)/etc/vintf/% \ 3801 $(TARGET_OUT_VENDOR)/etc/vintf/% \ 3802 $(TARGET_OUT_ODM)/etc/vintf/% \ 3803 $(TARGET_OUT_PRODUCT)/etc/vintf/% \ 3804 $(TARGET_OUT_SYSTEM_EXT)/etc/vintf/% \ 3805 3806check_vintf_common_srcs := $(sort $(filter $(check_vintf_common_srcs_patterns), \ 3807 $(INTERNAL_SYSTEMIMAGE_FILES) \ 3808 $(INTERNAL_VENDORIMAGE_FILES) \ 3809 $(INTERNAL_ODMIMAGE_FILES) \ 3810 $(INTERNAL_PRODUCTIMAGE_FILES) \ 3811 $(INTERNAL_SYSTEM_EXTIMAGE_FILES) \ 3812)) 3813check_vintf_common_srcs_patterns := 3814 3815check_vintf_has_system := 3816check_vintf_has_vendor := 3817 3818ifneq (,$(filter EMPTY_ODM_SKU_PLACEHOLDER,$(ODM_MANIFEST_SKUS))) 3819$(error EMPTY_ODM_SKU_PLACEHOLDER is an internal variable and cannot be used for ODM_MANIFEST_SKUS) 3820endif 3821ifneq (,$(filter EMPTY_VENDOR_SKU_PLACEHOLDER,$(DEVICE_MANIFEST_SKUS))) 3822$(error EMPTY_VENDOR_SKU_PLACEHOLDER is an internal variable and cannot be used for DEIVCE_MANIFEST_SKUS) 3823endif 3824 3825# -- Check system manifest / matrix including fragments (excluding other framework manifests / matrices, e.g. product); 3826check_vintf_system_deps := $(filter $(TARGET_OUT)/etc/vintf/%, $(check_vintf_common_srcs)) 3827ifneq ($(check_vintf_system_deps),) 3828check_vintf_has_system := true 3829check_vintf_system_log := $(intermediates)/check_vintf_system_log 3830check_vintf_all_deps += $(check_vintf_system_log) 3831$(check_vintf_system_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_system_deps) 3832 @( $< --check-one --dirmap /system:$(TARGET_OUT) > $@ 2>&1 ) || ( cat $@ && exit 1 ) 3833check_vintf_system_log := 3834endif # check_vintf_system_deps 3835check_vintf_system_deps := 3836 3837# -- Check vendor manifest / matrix including fragments (excluding other device manifests / matrices) 3838check_vintf_vendor_deps := $(filter $(TARGET_OUT_VENDOR)/etc/vintf/%, $(check_vintf_common_srcs)) 3839ifneq ($(check_vintf_vendor_deps),) 3840check_vintf_has_vendor := true 3841check_vintf_vendor_log := $(intermediates)/check_vintf_vendor_log 3842check_vintf_all_deps += $(check_vintf_vendor_log) 3843# Check vendor SKU=(empty) case when: 3844# - DEVICE_MANIFEST_FILE is not empty; OR 3845# - DEVICE_MANIFEST_FILE is empty AND DEVICE_MANIFEST_SKUS is empty (only vendor manifest fragments are used) 3846$(check_vintf_vendor_log): PRIVATE_VENDOR_SKUS := \ 3847 $(if $(DEVICE_MANIFEST_FILE),EMPTY_VENDOR_SKU_PLACEHOLDER,\ 3848 $(if $(DEVICE_MANIFEST_SKUS),,EMPTY_VENDOR_SKU_PLACEHOLDER)) \ 3849 $(DEVICE_MANIFEST_SKUS) 3850$(check_vintf_vendor_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_vendor_deps) 3851 $(foreach vendor_sku,$(PRIVATE_VENDOR_SKUS), \ 3852 ( $< --check-one --dirmap /vendor:$(TARGET_OUT_VENDOR) \ 3853 --property ro.boot.product.vendor.sku=$(filter-out EMPTY_VENDOR_SKU_PLACEHOLDER,$(vendor_sku)) \ 3854 > $@ 2>&1 ) || ( cat $@ && exit 1 ); ) 3855check_vintf_vendor_log := 3856endif # check_vintf_vendor_deps 3857check_vintf_vendor_deps := 3858 3859# -- Check VINTF compatibility of build. 3860# Skip partial builds; only check full builds. Only check if: 3861# - PRODUCT_ENFORCE_VINTF_MANIFEST is true 3862# - system / vendor VINTF metadata exists 3863# - Building product / system_ext / odm images if board has product / system_ext / odm images 3864ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true) 3865ifeq ($(check_vintf_has_system),true) 3866ifeq ($(check_vintf_has_vendor),true) 3867ifeq ($(filter true,$(BUILDING_ODM_IMAGE)),$(filter true,$(BOARD_USES_ODMIMAGE))) 3868ifeq ($(filter true,$(BUILDING_PRODUCT_IMAGE)),$(filter true,$(BOARD_USES_PRODUCTIMAGE))) 3869ifeq ($(filter true,$(BUILDING_SYSTEM_EXT_IMAGE)),$(filter true,$(BOARD_USES_SYSTEM_EXTIMAGE))) 3870 3871check_vintf_compatible_log := $(intermediates)/check_vintf_compatible_log 3872check_vintf_all_deps += $(check_vintf_compatible_log) 3873 3874check_vintf_compatible_args := 3875check_vintf_compatible_deps := $(check_vintf_common_srcs) 3876 3877# -- Kernel version and configurations. 3878ifeq ($(PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS),true) 3879 3880BUILT_KERNEL_CONFIGS_FILE := $(intermediates)/kernel_configs.txt 3881BUILT_KERNEL_VERSION_FILE := $(intermediates)/kernel_version.txt 3882 3883my_board_extracted_kernel := 3884 3885# BOARD_KERNEL_CONFIG_FILE and BOARD_KERNEL_VERSION can be used to override the values extracted 3886# from INSTALLED_KERNEL_TARGET. 3887ifdef BOARD_KERNEL_CONFIG_FILE 3888ifdef BOARD_KERNEL_VERSION 3889$(BUILT_KERNEL_CONFIGS_FILE): $(BOARD_KERNEL_CONFIG_FILE) 3890 cp $< $@ 3891$(BUILT_KERNEL_VERSION_FILE): 3892 echo $(BOARD_KERNEL_VERSION) > $@ 3893 3894my_board_extracted_kernel := true 3895endif # BOARD_KERNEL_VERSION 3896endif # BOARD_KERNEL_CONFIG_FILE 3897 3898ifneq ($(my_board_extracted_kernel),true) 3899ifndef INSTALLED_KERNEL_TARGET 3900$(warning No INSTALLED_KERNEL_TARGET is defined when PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \ 3901 is true. Information about the updated kernel cannot be built into OTA update package. \ 3902 You can fix this by: (1) setting TARGET_NO_KERNEL to false and installing the built kernel \ 3903 to $(PRODUCT_OUT)/kernel, so that kernel information will be extracted from the built kernel; \ 3904 or (2) extracting kernel configuration and defining BOARD_KERNEL_CONFIG_FILE and \ 3905 BOARD_KERNEL_VERSION manually; or (3) unsetting PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS \ 3906 manually.) 3907else 3908 3909# Tools for decompression that is not in PATH. 3910# Check $(EXTRACT_KERNEL) for decompression algorithms supported by the script. 3911# Algorithms that are in the script but not in this list will be found in PATH. 3912my_decompress_tools := \ 3913 lz4:$(HOST_OUT_EXECUTABLES)/lz4 \ 3914 3915$(BUILT_KERNEL_CONFIGS_FILE): .KATI_IMPLICIT_OUTPUTS := $(BUILT_KERNEL_VERSION_FILE) 3916$(BUILT_KERNEL_CONFIGS_FILE): PRIVATE_DECOMPRESS_TOOLS := $(my_decompress_tools) 3917$(BUILT_KERNEL_CONFIGS_FILE): $(foreach pair,$(my_decompress_tools),$(call word-colon,2,$(pair))) 3918$(BUILT_KERNEL_CONFIGS_FILE): $(EXTRACT_KERNEL) $(INSTALLED_KERNEL_TARGET) 3919 $< --tools $(PRIVATE_DECOMPRESS_TOOLS) --input $(INSTALLED_KERNEL_TARGET) \ 3920 --output-configs $@ \ 3921 --output-version $(BUILT_KERNEL_VERSION_FILE) 3922 3923my_decompress_tools := 3924 3925endif # my_board_extracted_kernel 3926my_board_extracted_kernel := 3927 3928endif # INSTALLED_KERNEL_TARGET 3929 3930check_vintf_compatible_args += --kernel $$(cat $(BUILT_KERNEL_VERSION_FILE)):$(BUILT_KERNEL_CONFIGS_FILE) 3931check_vintf_compatible_deps += $(BUILT_KERNEL_CONFIGS_FILE) $(BUILT_KERNEL_VERSION_FILE) 3932 3933endif # PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS 3934 3935check_vintf_compatible_args += \ 3936 --dirmap /system:$(TARGET_OUT) \ 3937 --dirmap /vendor:$(TARGET_OUT_VENDOR) \ 3938 --dirmap /odm:$(TARGET_OUT_ODM) \ 3939 --dirmap /product:$(TARGET_OUT_PRODUCT) \ 3940 --dirmap /system_ext:$(TARGET_OUT_SYSTEM_EXT) \ 3941 3942ifdef PRODUCT_SHIPPING_API_LEVEL 3943check_vintf_compatible_args += --property ro.product.first_api_level=$(PRODUCT_SHIPPING_API_LEVEL) 3944endif # PRODUCT_SHIPPING_API_LEVEL 3945 3946$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_ARGS := $(check_vintf_compatible_args) 3947$(check_vintf_compatible_log): PRIVATE_CHECK_VINTF_DEPS := $(check_vintf_compatible_deps) 3948# Check ODM SKU=(empty) case when: 3949# - ODM_MANIFEST_FILES is not empty; OR 3950# - ODM_MANIFEST_FILES is empty AND ODM_MANIFEST_SKUS is empty (only ODM manifest fragments are used) 3951$(check_vintf_compatible_log): PRIVATE_ODM_SKUS := \ 3952 $(if $(ODM_MANIFEST_FILES),EMPTY_ODM_SKU_PLACEHOLDER,\ 3953 $(if $(ODM_MANIFEST_SKUS),,EMPTY_ODM_SKU_PLACEHOLDER)) \ 3954 $(ODM_MANIFEST_SKUS) 3955# Check vendor SKU=(empty) case when: 3956# - DEVICE_MANIFEST_FILE is not empty; OR 3957# - DEVICE_MANIFEST_FILE is empty AND DEVICE_MANIFEST_SKUS is empty (only vendor manifest fragments are used) 3958$(check_vintf_compatible_log): PRIVATE_VENDOR_SKUS := \ 3959 $(if $(DEVICE_MANIFEST_FILE),EMPTY_VENDOR_SKU_PLACEHOLDER,\ 3960 $(if $(DEVICE_MANIFEST_SKUS),,EMPTY_VENDOR_SKU_PLACEHOLDER)) \ 3961 $(DEVICE_MANIFEST_SKUS) 3962$(check_vintf_compatible_log): $(HOST_OUT_EXECUTABLES)/checkvintf $(check_vintf_compatible_deps) 3963 @echo -n -e 'Deps: \n ' > $@ 3964 @sed 's/ /\n /g' <<< "$(PRIVATE_CHECK_VINTF_DEPS)" >> $@ 3965 @echo -n -e 'Args: \n ' >> $@ 3966 @cat <<< "$(PRIVATE_CHECK_VINTF_ARGS)" >> $@ 3967 $(foreach odm_sku,$(PRIVATE_ODM_SKUS), $(foreach vendor_sku,$(PRIVATE_VENDOR_SKUS), \ 3968 echo "For ODM SKU = $(odm_sku), vendor SKU = $(vendor_sku)" >> $@; \ 3969 ( $< --check-compat $(PRIVATE_CHECK_VINTF_ARGS) \ 3970 --property ro.boot.product.hardware.sku=$(filter-out EMPTY_ODM_SKU_PLACEHOLDER,$(odm_sku)) \ 3971 --property ro.boot.product.vendor.sku=$(filter-out EMPTY_VENDOR_SKU_PLACEHOLDER,$(vendor_sku)) \ 3972 >> $@ 2>&1 ) || (cat $@ && exit 1); )) 3973 3974check_vintf_compatible_log := 3975check_vintf_compatible_args := 3976check_vintf_compatible_deps := 3977 3978endif # BUILDING_SYSTEM_EXT_IMAGE equals BOARD_USES_SYSTEM_EXTIMAGE 3979endif # BUILDING_PRODUCT_IMAGE equals BOARD_USES_PRODUCTIMAGE 3980endif # BUILDING_ODM_IMAGE equals BOARD_USES_ODMIMAGE 3981endif # check_vintf_has_vendor 3982endif # check_vintf_has_system 3983endif # PRODUCT_ENFORCE_VINTF_MANIFEST 3984 3985# Add all logs of VINTF checks to dist builds 3986droid_targets: $(check_vintf_all_deps) 3987$(call dist-for-goals, droid_targets, $(check_vintf_all_deps)) 3988 3989# Helper alias to check all VINTF of current build. 3990.PHONY: check-vintf-all 3991check-vintf-all: $(check_vintf_all_deps) 3992 $(foreach file,$^,echo "$(file)"; cat "$(file)"; echo;) 3993 3994check_vintf_has_vendor := 3995check_vintf_has_system := 3996check_vintf_common_srcs := 3997check_vintf_all_deps := 3998intermediates := 3999endif # !TARGET_BUILD_APPS 4000 4001# ----------------------------------------------------------------- 4002# Check image sizes <= size of super partition 4003 4004ifeq (,$(TARGET_BUILD_APPS)) 4005# Do not check for apps-only build 4006 4007ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION)) 4008 4009# $(1): misc_info.txt 4010# #(2): optional log file 4011define check-all-partition-sizes-target 4012 mkdir -p $(dir $(1)) 4013 rm -f $(1) 4014 $(call dump-super-image-info, $(1)) 4015 $(foreach partition,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \ 4016 echo "$(partition)_image="$(call images-for-partitions,$(partition)) >> $(1);) 4017 $(CHECK_PARTITION_SIZES) $(if $(2),--logfile $(2),-v) $(1) 4018endef 4019 4020check_all_partition_sizes_log := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/check_all_partition_sizes_log 4021droid_targets: $(check_all_partition_sizes_log) 4022$(call dist-for-goals, droid_targets, $(check_all_partition_sizes_log)) 4023 4024$(check_all_partition_sizes_log): \ 4025 $(CHECK_PARTITION_SIZES) \ 4026 $(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST)) 4027 $(call check-all-partition-sizes-target, \ 4028 $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/misc_info.txt, \ 4029 $@) 4030 4031.PHONY: check-all-partition-sizes 4032check-all-partition-sizes: $(check_all_partition_sizes_log) 4033 4034.PHONY: check-all-partition-sizes-nodeps 4035check-all-partition-sizes-nodeps: 4036 $(call check-all-partition-sizes-target, \ 4037 $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes-nodeps)/misc_info.txt) 4038 4039endif # PRODUCT_BUILD_SUPER_PARTITION 4040 4041endif # TARGET_BUILD_APPS 4042 4043# ----------------------------------------------------------------- 4044# bring in the installer image generation defines if necessary 4045ifeq ($(TARGET_USE_DISKINSTALLER),true) 4046include bootable/diskinstaller/config.mk 4047endif 4048 4049# ----------------------------------------------------------------- 4050# host tools needed to build dist and OTA packages 4051 4052ifeq ($(BUILD_OS),darwin) 4053 build_ota_package := false 4054 build_otatools_package := false 4055else 4056 # Set build_ota_package, and allow opt-out below. 4057 build_ota_package := true 4058 ifeq ($(TARGET_SKIP_OTA_PACKAGE),true) 4059 build_ota_package := false 4060 endif 4061 ifneq (,$(filter address, $(SANITIZE_TARGET))) 4062 build_ota_package := false 4063 endif 4064 ifeq ($(TARGET_PRODUCT),sdk) 4065 build_ota_package := false 4066 endif 4067 ifeq ($(TARGET_BUILD_PDK),true) 4068 build_ota_package := false 4069 endif 4070 ifneq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true) 4071 ifneq ($(filter generic%,$(TARGET_DEVICE)),) 4072 build_ota_package := false 4073 endif 4074 ifeq ($(TARGET_NO_KERNEL),true) 4075 build_ota_package := false 4076 endif 4077 ifeq ($(recovery_fstab),) 4078 build_ota_package := false 4079 endif 4080 endif # PRODUCT_BUILD_GENERIC_OTA_PACKAGE 4081 4082 # Set build_otatools_package, and allow opt-out below. 4083 build_otatools_package := true 4084 ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true) 4085 build_otatools_package := false 4086 endif 4087endif 4088 4089ifeq ($(build_otatools_package),true) 4090 4091INTERNAL_OTATOOLS_MODULES := \ 4092 aapt2 \ 4093 add_img_to_target_files \ 4094 apksigner \ 4095 append2simg \ 4096 avbtool \ 4097 blk_alloc_to_base_fs \ 4098 boot_signer \ 4099 brillo_update_payload \ 4100 brotli \ 4101 bsdiff \ 4102 build_image \ 4103 build_super_image \ 4104 build_verity_metadata \ 4105 build_verity_tree \ 4106 care_map_generator \ 4107 check_ota_package_signature \ 4108 check_target_files_signatures \ 4109 check_target_files_vintf \ 4110 checkvintf \ 4111 delta_generator \ 4112 e2fsck \ 4113 e2fsdroid \ 4114 fc_sort \ 4115 fec \ 4116 fs_config \ 4117 generate_verity_key \ 4118 img2simg \ 4119 img_from_target_files \ 4120 imgdiff \ 4121 libconscrypt_openjdk_jni \ 4122 lpmake \ 4123 lpunpack \ 4124 lz4 \ 4125 make_f2fs \ 4126 merge_target_files \ 4127 minigzip \ 4128 mk_combined_img \ 4129 mkbootfs \ 4130 mkbootimg \ 4131 mke2fs \ 4132 mke2fs.conf \ 4133 mkf2fsuserimg.sh \ 4134 mksquashfs \ 4135 mksquashfsimage.sh \ 4136 mkuserimg_mke2fs \ 4137 ota_from_target_files \ 4138 sefcontext_compile \ 4139 sgdisk \ 4140 shflags \ 4141 sign_apex \ 4142 sign_target_files_apks \ 4143 signapk \ 4144 simg2img \ 4145 sload_f2fs \ 4146 tune2fs \ 4147 unpack_bootimg \ 4148 update_host_simulator \ 4149 validate_target_files \ 4150 verity_signer \ 4151 verity_verifier \ 4152 zipalign \ 4153 4154# Additional tools to unpack and repack the apex file. 4155INTERNAL_OTATOOLS_MODULES += \ 4156 apexer \ 4157 deapexer \ 4158 debugfs_static \ 4159 merge_zips \ 4160 resize2fs \ 4161 soong_zip \ 4162 4163ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) 4164INTERNAL_OTATOOLS_MODULES += \ 4165 futility \ 4166 vboot_signer 4167endif 4168 4169INTERNAL_OTATOOLS_FILES := \ 4170 $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES))) 4171 4172.PHONY: otatools 4173otatools: $(INTERNAL_OTATOOLS_FILES) 4174 4175# For each module, recursively resolve its host shared library dependencies. Then we have a full 4176# list of modules whose installed files need to be packed. 4177INTERNAL_OTATOOLS_MODULES_WITH_DEPS := \ 4178 $(sort $(INTERNAL_OTATOOLS_MODULES) \ 4179 $(foreach m,$(INTERNAL_OTATOOLS_MODULES),$(call get-all-shared-libs-deps,$(m)))) 4180 4181INTERNAL_OTATOOLS_PACKAGE_FILES := \ 4182 $(filter $(HOST_OUT)/%,$(call module-installed-files,$(INTERNAL_OTATOOLS_MODULES_WITH_DEPS))) 4183 4184INTERNAL_OTATOOLS_PACKAGE_FILES += \ 4185 $(sort $(shell find build/make/target/product/security -type f -name "*.x509.pem" -o \ 4186 -name "*.pk8" -o -name verity_key)) 4187 4188ifneq (,$(wildcard device)) 4189INTERNAL_OTATOOLS_PACKAGE_FILES += \ 4190 $(sort $(shell find device $(wildcard vendor) -type f -name "*.pk8" -o -name "verifiedboot*" -o \ 4191 -name "*.pem" -o -name "oem*.prop" -o -name "*.avbpubkey")) 4192endif 4193ifneq (,$(wildcard external/avb)) 4194INTERNAL_OTATOOLS_PACKAGE_FILES += \ 4195 $(sort $(shell find external/avb/test/data -type f -name "testkey_*.pem" -o \ 4196 -name "atx_metadata.bin")) 4197endif 4198ifeq (true,$(PRODUCT_SUPPORTS_VBOOT)) 4199INTERNAL_OTATOOLS_PACKAGE_FILES += \ 4200 $(sort $(shell find external/vboot_reference/tests/devkeys -type f)) 4201endif 4202 4203INTERNAL_OTATOOLS_RELEASETOOLS := \ 4204 $(sort $(shell find build/make/tools/releasetools -name "*.pyc" -prune -o \ 4205 \( -type f -o -type l \) -print)) 4206 4207BUILT_OTATOOLS_PACKAGE := $(PRODUCT_OUT)/otatools.zip 4208$(BUILT_OTATOOLS_PACKAGE): PRIVATE_ZIP_ROOT := $(call intermediates-dir-for,PACKAGING,otatools)/otatools 4209$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_PACKAGE_FILES := $(INTERNAL_OTATOOLS_PACKAGE_FILES) 4210$(BUILT_OTATOOLS_PACKAGE): PRIVATE_OTATOOLS_RELEASETOOLS := $(INTERNAL_OTATOOLS_RELEASETOOLS) 4211$(BUILT_OTATOOLS_PACKAGE): $(INTERNAL_OTATOOLS_PACKAGE_FILES) $(INTERNAL_OTATOOLS_RELEASETOOLS) 4212$(BUILT_OTATOOLS_PACKAGE): $(SOONG_ZIP) $(ZIP2ZIP) 4213 @echo "Package OTA tools: $@" 4214 rm -rf $@ $(PRIVATE_ZIP_ROOT) 4215 mkdir -p $(dir $@) 4216 $(call copy-files-with-structure,$(PRIVATE_OTATOOLS_PACKAGE_FILES),$(HOST_OUT)/,$(PRIVATE_ZIP_ROOT)) 4217 $(call copy-files-with-structure,$(PRIVATE_OTATOOLS_RELEASETOOLS),build/make/tools/,$(PRIVATE_ZIP_ROOT)) 4218 cp $(SOONG_ZIP) $(ZIP2ZIP) $(MERGE_ZIPS) $(PRIVATE_ZIP_ROOT)/bin/ 4219 $(SOONG_ZIP) -o $@ -C $(PRIVATE_ZIP_ROOT) -D $(PRIVATE_ZIP_ROOT) 4220 4221.PHONY: otatools-package 4222otatools-package: $(BUILT_OTATOOLS_PACKAGE) 4223 4224endif # build_otatools_package 4225 4226# ----------------------------------------------------------------- 4227# misc_info.txt 4228 4229INSTALLED_MISC_INFO_TARGET := $(PRODUCT_OUT)/misc_info.txt 4230 4231ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),) 4232# default to common dir for device vendor 4233tool_extensions := $(TARGET_DEVICE_DIR)/../common 4234else 4235tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) 4236endif 4237.KATI_READONLY := tool_extensions 4238 4239# $1: boot image file name 4240define misc_boot_size 4241$(subst .img,_size,$(1))=$(BOARD_KERNEL$(call to-upper,$(subst boot,,$(subst .img,,$(1))))_BOOTIMAGE_PARTITION_SIZE) 4242endef 4243 4244$(INSTALLED_MISC_INFO_TARGET): 4245 rm -f $@ 4246 $(call pretty,"Target misc_info.txt: $@") 4247 $(hide) echo "recovery_api_version=$(RECOVERY_API_VERSION)" >> $@ 4248 $(hide) echo "fstab_version=$(RECOVERY_FSTAB_VERSION)" >> $@ 4249ifdef BOARD_FLASH_BLOCK_SIZE 4250 $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $@ 4251endif 4252ifneq ($(strip $(BOARD_BOOTIMAGE_PARTITION_SIZE))$(strip $(BOARD_KERNEL_BINARIES)),) 4253 $(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),\ 4254 echo "$(call misc_boot_size,$(notdir $(b)))" >> $@;) 4255endif 4256ifeq ($(INSTALLED_BOOTIMAGE_TARGET),) 4257 $(hide) echo "no_boot=true" >> $@ 4258else 4259 echo "boot_images=$(foreach b,$(INSTALLED_BOOTIMAGE_TARGET),$(notdir $(b)))" >> $@ 4260endif 4261ifeq ($(BOARD_RAMDISK_USE_LZ4),true) 4262 echo "lz4_ramdisks=true" >> $@ 4263endif 4264ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),) 4265 echo "vendor_boot=true" >> $@ 4266 echo "vendor_boot_size=$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)" >> $@ 4267endif 4268ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),) 4269 $(hide) echo "no_recovery=true" >> $@ 4270endif 4271ifdef BOARD_INCLUDE_RECOVERY_DTBO 4272 $(hide) echo "include_recovery_dtbo=true" >> $@ 4273endif 4274ifdef BOARD_INCLUDE_RECOVERY_ACPIO 4275 $(hide) echo "include_recovery_acpio=true" >> $@ 4276endif 4277ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE 4278 $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $@ 4279endif 4280ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS 4281 @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used. 4282 $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $@ 4283else 4284 $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $@ 4285endif 4286 $(hide) echo "tool_extensions=$(tool_extensions)" >> $@ 4287 $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $@ 4288ifdef PRODUCT_EXTRA_RECOVERY_KEYS 4289 $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $@ 4290endif 4291 $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $@ 4292 $(hide) echo 'recovery_mkbootimg_args=$(BOARD_RECOVERY_MKBOOTIMG_ARGS)' >> $@ 4293 $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $@ 4294 $(hide) echo "multistage_support=1" >> $@ 4295 $(hide) echo "blockimgdiff_versions=3,4" >> $@ 4296ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true) 4297 $(hide) echo "build_generic_ota_package=true" >> $@ 4298endif 4299ifneq ($(OEM_THUMBPRINT_PROPERTIES),) 4300 # OTA scripts are only interested in fingerprint related properties 4301 $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $@ 4302endif 4303ifneq (,$(filter address, $(SANITIZE_TARGET))) 4304 # We need to create userdata.img with real data because the instrumented libraries are in userdata.img. 4305 $(hide) echo "userdata_img_with_data=true" >> $@ 4306endif 4307ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true) 4308 $(hide) echo "full_recovery_image=true" >> $@ 4309endif 4310ifdef BOARD_USES_VENDORIMAGE 4311 $(hide) echo "board_uses_vendorimage=true" >> $@ 4312endif 4313ifeq ($(BOARD_AVB_ENABLE),true) 4314 $(hide) echo "avb_enable=true" >> $@ 4315 $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $@ 4316 $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $@ 4317 $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $@ 4318 $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $@ 4319ifdef BOARD_AVB_BOOT_KEY_PATH 4320 $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $@ 4321 $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $@ 4322 $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $@ 4323endif # BOARD_AVB_BOOT_KEY_PATH 4324 echo "avb_vendor_boot_add_hash_footer_args=$(BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS)" >> $@ 4325ifdef BOARD_AVB_VENDOR_BOOT_KEY_PATH 4326 echo "avb_vendor_boot_key_path=$(BOARD_AVB_VENDOR_BOOT_KEY_PATH)" >> $@ 4327 echo "avb_vendor_boot_algorithm=$(BOARD_AVB_VENDOR_BOOT_ALGORITHM)" >> $@ 4328 echo "avb_vendor_boot_rollback_index_location=$(BOARD_AVB_VENDOR_BOOT_ROLLBACK_INDEX_LOCATION)" >> $@ 4329endif # BOARD_AVB_VENDOR_BOOT_KEY_PATH 4330 $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $@ 4331ifdef BOARD_AVB_RECOVERY_KEY_PATH 4332 $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $@ 4333 $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $@ 4334 $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $@ 4335endif # BOARD_AVB_RECOVERY_KEY_PATH 4336ifneq (,$(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST))) 4337 $(hide) echo "avb_custom_images_partition_list=$(BOARD_CUSTOMIMAGES_PARTITION_LIST)" >> $@ 4338 $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \ 4339 echo "avb_$(partition)_key_path=$(BOARD_AVB_$(call to-upper,$(partition))_KEY_PATH)" >> $@; \ 4340 echo "avb_$(partition)_algorithm=$(BOARD_AVB_$(call to-upper,$(partition))_ALGORITHM)" >> $@; \ 4341 echo "avb_$(partition)_add_hashtree_footer_args=$(BOARD_AVB_$(call to-upper,$(partition))_ADD_HASHTREE_FOOTER_ARGS)" >> $@; \ 4342 echo "avb_$(partition)_rollback_index_location=$(BOARD_AVB_$(call to-upper,$(partition))_ROLLBACK_INDEX_LOCATION)" >> $@; \ 4343 echo "avb_$(partition)_partition_size=$(BOARD_AVB_$(call to-upper,$(partition))_PARTITION_SIZE)" >> $@; \ 4344 echo "avb_$(partition)_image_list=$(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST),$(notdir $(image)))" >> $@;) 4345endif # BOARD_CUSTOMIMAGES_PARTITION_LIST 4346ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM))) 4347 $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $@ 4348 $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $@ 4349 $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $@ 4350 $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $@ 4351 $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $@ 4352endif # BOARD_AVB_VBMETA_SYSTEM 4353ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR))) 4354 $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $@ 4355 $(hide) echo "avb_vbmeta_vendor_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $@ 4356 $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $@ 4357 $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $@ 4358 $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $@ 4359endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH 4360endif # BOARD_AVB_ENABLE 4361ifdef BOARD_BPT_INPUT_FILES 4362 $(hide) echo "board_bpt_enable=true" >> $@ 4363 $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $@ 4364 $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $@ 4365endif 4366ifdef BOARD_BPT_DISK_SIZE 4367 $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $@ 4368endif 4369 $(call generate-userimage-prop-dictionary, $@) 4370ifeq ($(AB_OTA_UPDATER),true) 4371 @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds. 4372 $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $@ 4373 $(hide) echo "ab_update=true" >> $@ 4374endif 4375ifeq ($(TARGET_OTA_ALLOW_NON_AB),true) 4376 $(hide) echo "allow_non_ab=true" >> $@ 4377endif 4378ifdef BOARD_PREBUILT_DTBOIMAGE 4379 $(hide) echo "has_dtbo=true" >> $@ 4380ifeq ($(BOARD_AVB_ENABLE),true) 4381 $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $@ 4382 $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $@ 4383ifdef BOARD_AVB_DTBO_KEY_PATH 4384 $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $@ 4385 $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $@ 4386 $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" >> $@ 4387endif # BOARD_AVB_DTBO_KEY_PATH 4388endif # BOARD_AVB_ENABLE 4389endif # BOARD_PREBUILT_DTBOIMAGE 4390 $(call dump-dynamic-partitions-info,$@) 4391 @# VINTF checks 4392ifeq ($(PRODUCT_ENFORCE_VINTF_MANIFEST),true) 4393 $(hide) echo "vintf_enforce=true" >> $@ 4394endif 4395ifdef ODM_MANIFEST_SKUS 4396 $(hide) echo "vintf_odm_manifest_skus=$(ODM_MANIFEST_SKUS)" >> $@ 4397endif 4398ifdef ODM_MANIFEST_FILES 4399 $(hide) echo "vintf_include_empty_odm_sku=true" >> $@ 4400endif 4401ifdef DEVICE_MANIFEST_SKUS 4402 $(hide) echo "vintf_vendor_manifest_skus=$(DEVICE_MANIFEST_SKUS)" >> $@ 4403endif 4404ifdef DEVICE_MANIFEST_FILE 4405 $(hide) echo "vintf_include_empty_vendor_sku=true" >> $@ 4406endif 4407 4408.PHONY: misc_info 4409misc_info: $(INSTALLED_MISC_INFO_TARGET) 4410 4411droidcore: $(INSTALLED_MISC_INFO_TARGET) 4412 4413# ----------------------------------------------------------------- 4414# A zip of the directories that map to the target filesystem. 4415# This zip can be used to create an OTA package or filesystem image 4416# as a post-build step. 4417# 4418name := $(TARGET_PRODUCT) 4419ifeq ($(TARGET_BUILD_TYPE),debug) 4420 name := $(name)_debug 4421endif 4422name := $(name)-target_files-$(FILE_NAME_TAG) 4423 4424intermediates := $(call intermediates-dir-for,PACKAGING,target_files) 4425BUILT_TARGET_FILES_PACKAGE := $(intermediates)/$(name).zip 4426$(BUILT_TARGET_FILES_PACKAGE): intermediates := $(intermediates) 4427$(BUILT_TARGET_FILES_PACKAGE): \ 4428 zip_root := $(intermediates)/$(name) 4429 4430# $(1): Directory to copy 4431# $(2): Location to copy it to 4432# The "ls -A" is to prevent "acp s/* d" from failing if s is empty. 4433define package_files-copy-root 4434 if [ -d "$(strip $(1))" -a "$$(ls -A $(1))" ]; then \ 4435 mkdir -p $(2) && \ 4436 $(ACP) -rd $(strip $(1))/* $(2); \ 4437 fi 4438endef 4439 4440built_ota_tools := 4441 4442# We can't build static executables when SANITIZE_TARGET=address 4443ifeq (,$(filter address, $(SANITIZE_TARGET))) 4444built_ota_tools += \ 4445 $(call intermediates-dir-for,EXECUTABLES,updater,,,$(TARGET_PREFER_32_BIT))/updater 4446endif 4447 4448$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools) 4449 4450tool_extension := $(wildcard $(tool_extensions)/releasetools.py) 4451$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension) 4452 4453ifeq ($(AB_OTA_UPDATER),true) 4454updater_dep := system/update_engine/update_engine.conf 4455endif 4456 4457# Build OTA tools if non-A/B is allowed 4458ifeq ($(TARGET_OTA_ALLOW_NON_AB),true) 4459updater_dep := $(built_ota_tools) 4460endif 4461 4462$(BUILT_TARGET_FILES_PACKAGE): $(updater_dep) 4463 4464# If we are using recovery as boot, output recovery files to BOOT/. 4465ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 4466$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := BOOT 4467else 4468$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY 4469endif 4470 4471ifeq ($(AB_OTA_UPDATER),true) 4472 ifdef OSRELEASED_DIRECTORY 4473 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id 4474 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version 4475 $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version 4476 endif 4477 4478 # Not checking in board_config.mk, since AB_OTA_PARTITIONS may be updated in Android.mk (e.g. to 4479 # additionally include radio or bootloader partitions). 4480 ifeq ($(AB_OTA_PARTITIONS),) 4481 $(error AB_OTA_PARTITIONS must be defined when using AB_OTA_UPDATER) 4482 endif 4483endif 4484 4485ifneq ($(AB_OTA_PARTITIONS),) 4486 ifneq ($(AB_OTA_UPDATER),true) 4487 $(error AB_OTA_UPDATER must be true when defining AB_OTA_PARTITIONS) 4488 endif 4489endif 4490 4491# Run fs_config while creating the target files package 4492# $1: root directory 4493# $2: add prefix 4494define fs_config 4495(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)" 4496endef 4497 4498# Filter out vendor from the list for AOSP targets. 4499# $(1): list 4500define filter-out-missing-vendor 4501$(if $(INSTALLED_VENDORIMAGE_TARGET),$(1),$(filter-out vendor,$(1))) 4502endef 4503 4504# Information related to dynamic partitions and virtual A/B. This information 4505# is needed for building the super image (see dump-super-image-info) and 4506# building OTA packages. 4507# $(1): file 4508define dump-dynamic-partitions-info 4509 $(if $(filter true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)), \ 4510 echo "use_dynamic_partitions=true" >> $(1)) 4511 $(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \ 4512 echo "dynamic_partition_retrofit=true" >> $(1)) 4513 echo "lpmake=$(notdir $(LPMAKE))" >> $(1) 4514 $(if $(filter true,$(PRODUCT_BUILD_SUPER_PARTITION)), $(if $(BOARD_SUPER_PARTITION_SIZE), \ 4515 echo "build_super_partition=true" >> $(1))) 4516 $(if $(filter true,$(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE)), \ 4517 echo "build_retrofit_dynamic_partitions_ota_package=true" >> $(1)) 4518 echo "super_metadata_device=$(BOARD_SUPER_PARTITION_METADATA_DEVICE)" >> $(1) 4519 $(if $(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \ 4520 echo "super_block_devices=$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)" >> $(1)) 4521 $(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \ 4522 echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);) 4523 $(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \ 4524 echo "dynamic_partition_list=$(call filter-out-missing-vendor, $(BOARD_SUPER_PARTITION_PARTITION_LIST))" >> $(1)) 4525 $(if $(BOARD_SUPER_PARTITION_GROUPS), 4526 echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1)) 4527 $(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \ 4528 echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \ 4529 $(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \ 4530 echo "super_$(group)_partition_list=$(call filter-out-missing-vendor, $(BOARD_$(call to-upper,$(group))_PARTITION_LIST))" >> $(1);)) 4531 $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)), \ 4532 echo "build_non_sparse_super_partition=true" >> $(1)) 4533 $(if $(filter true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)), \ 4534 echo "build_non_sparse_super_partition=true" >> $(1)) 4535 $(if $(filter true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE)), \ 4536 echo "super_image_in_update_package=true" >> $(1)) 4537 $(if $(BOARD_SUPER_PARTITION_SIZE), \ 4538 echo "super_partition_size=$(BOARD_SUPER_PARTITION_SIZE)" >> $(1)) 4539 $(if $(BOARD_SUPER_PARTITION_ALIGNMENT), \ 4540 echo "super_partition_alignment=$(BOARD_SUPER_PARTITION_ALIGNMENT)" >> $(1)) 4541 $(if $(BOARD_SUPER_PARTITION_WARN_LIMIT), \ 4542 echo "super_partition_warn_limit=$(BOARD_SUPER_PARTITION_WARN_LIMIT)" >> $(1)) 4543 $(if $(BOARD_SUPER_PARTITION_ERROR_LIMIT), \ 4544 echo "super_partition_error_limit=$(BOARD_SUPER_PARTITION_ERROR_LIMIT)" >> $(1)) 4545 $(if $(filter true,$(PRODUCT_VIRTUAL_AB_OTA)), \ 4546 echo "virtual_ab=true" >> $(1)) 4547 $(if $(filter true,$(PRODUCT_VIRTUAL_AB_OTA_RETROFIT)), \ 4548 echo "virtual_ab_retrofit=true" >> $(1)) 4549endef 4550 4551# By conditionally including the dependency of the target files package on the 4552# full system image deps, we speed up builds that do not build the system 4553# image. 4554ifdef BUILDING_SYSTEM_IMAGE 4555$(BUILT_TARGET_FILES_PACKAGE): $(FULL_SYSTEMIMAGE_DEPS) 4556endif 4557 4558ifeq ($(BUILD_QEMU_IMAGES),true) 4559MK_VBMETA_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_vbmeta_boot_params.sh 4560$(BUILT_TARGET_FILES_PACKAGE): $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) 4561endif 4562 4563# Depending on the various images guarantees that the underlying 4564# directories are up-to-date. 4565$(BUILT_TARGET_FILES_PACKAGE): \ 4566 $(INSTALLED_RAMDISK_TARGET) \ 4567 $(INSTALLED_BOOTIMAGE_TARGET) \ 4568 $(INSTALLED_VENDOR_BOOTIMAGE_TARGET) \ 4569 $(INSTALLED_RADIOIMAGE_TARGET) \ 4570 $(INSTALLED_RECOVERYIMAGE_TARGET) \ 4571 $(INSTALLED_USERDATAIMAGE_TARGET) \ 4572 $(INSTALLED_CACHEIMAGE_TARGET) \ 4573 $(INSTALLED_VENDORIMAGE_TARGET) \ 4574 $(INSTALLED_PRODUCTIMAGE_TARGET) \ 4575 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ 4576 $(INSTALLED_VBMETAIMAGE_TARGET) \ 4577 $(INSTALLED_ODMIMAGE_TARGET) \ 4578 $(INSTALLED_DTBOIMAGE_TARGET) \ 4579 $(INSTALLED_CUSTOMIMAGES_TARGET) \ 4580 $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \ 4581 $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ 4582 $(INSTALLED_KERNEL_TARGET) \ 4583 $(INSTALLED_DTBIMAGE_TARGET) \ 4584 $(INSTALLED_2NDBOOTLOADER_TARGET) \ 4585 $(BOARD_PREBUILT_DTBOIMAGE) \ 4586 $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \ 4587 $(BOARD_RECOVERY_ACPIO) \ 4588 $(PRODUCT_SYSTEM_BASE_FS_PATH) \ 4589 $(PRODUCT_VENDOR_BASE_FS_PATH) \ 4590 $(PRODUCT_PRODUCT_BASE_FS_PATH) \ 4591 $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \ 4592 $(PRODUCT_ODM_BASE_FS_PATH) \ 4593 $(LPMAKE) \ 4594 $(SELINUX_FC) \ 4595 $(INSTALLED_MISC_INFO_TARGET) \ 4596 $(APKCERTS_FILE) \ 4597 $(SOONG_APEX_KEYS_FILE) \ 4598 $(SOONG_ZIP) \ 4599 $(HOST_OUT_EXECUTABLES)/fs_config \ 4600 $(ADD_IMG_TO_TARGET_FILES) \ 4601 $(MAKE_RECOVERY_PATCH) \ 4602 $(BUILT_KERNEL_CONFIGS_FILE) \ 4603 $(BUILT_KERNEL_VERSION_FILE) \ 4604 | $(ACP) 4605 @echo "Package target files: $@" 4606 $(call create-system-vendor-symlink) 4607 $(call create-system-product-symlink) 4608 $(call create-system-system_ext-symlink) 4609 $(call create-vendor-odm-symlink) 4610 $(hide) rm -rf $@ $@.list $(zip_root) 4611 $(hide) mkdir -p $(dir $@) $(zip_root) 4612ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_BOOT))) 4613 @# Components of the recovery image 4614 $(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT) 4615 $(hide) $(call package_files-copy-root, \ 4616 $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK) 4617ifdef INSTALLED_KERNEL_TARGET 4618 cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/ 4619endif 4620ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER))) 4621 echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline 4622else # not (BUILDING_VENDOR_BOOT_IMAGE and AB_OTA_UPDATER) 4623ifdef INSTALLED_2NDBOOTLOADER_TARGET 4624 cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second 4625endif 4626ifdef BOARD_INCLUDE_RECOVERY_DTBO 4627ifdef BOARD_PREBUILT_RECOVERY_DTBOIMAGE 4628 cp $(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo 4629else 4630 cp $(BOARD_PREBUILT_DTBOIMAGE) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_dtbo 4631endif 4632endif # BOARD_INCLUDE_RECOVERY_DTBO 4633ifdef BOARD_INCLUDE_RECOVERY_ACPIO 4634 cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio 4635endif 4636ifdef INSTALLED_DTBIMAGE_TARGET 4637 cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb 4638endif 4639ifdef INTERNAL_KERNEL_CMDLINE 4640 echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline 4641endif 4642ifdef BOARD_KERNEL_BASE 4643 echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/base 4644endif 4645ifdef BOARD_KERNEL_PAGESIZE 4646 echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize 4647endif 4648endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined 4649endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true 4650 @# Components of the boot image 4651 $(hide) mkdir -p $(zip_root)/BOOT 4652 $(hide) mkdir -p $(zip_root)/ROOT 4653 $(hide) $(call package_files-copy-root, \ 4654 $(TARGET_ROOT_OUT),$(zip_root)/ROOT) 4655 @# If we are using recovery as boot, this is already done when processing recovery. 4656ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 4657ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 4658 $(hide) $(call package_files-copy-root, \ 4659 $(TARGET_RAMDISK_OUT),$(zip_root)/BOOT/RAMDISK) 4660endif 4661ifdef INSTALLED_KERNEL_TARGET 4662 $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel 4663endif 4664ifndef INSTALLED_VENDOR_BOOTIMAGE_TARGET 4665ifdef INSTALLED_2NDBOOTLOADER_TARGET 4666 cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second 4667endif 4668ifdef INSTALLED_DTBIMAGE_TARGET 4669 cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/BOOT/dtb 4670endif 4671 echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline 4672ifdef BOARD_KERNEL_BASE 4673 echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/BOOT/base 4674endif 4675ifdef BOARD_KERNEL_PAGESIZE 4676 echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize 4677endif 4678else # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined 4679 echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline 4680endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined 4681endif # BOARD_USES_RECOVERY_AS_BOOT not true 4682 $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\ 4683 mkdir -p $(zip_root)/RADIO; \ 4684 cp $(t) $(zip_root)/RADIO/$(notdir $(t));) 4685ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET 4686 mkdir -p $(zip_root)/VENDOR_BOOT 4687 $(call package_files-copy-root, \ 4688 $(TARGET_VENDOR_RAMDISK_OUT),$(zip_root)/VENDOR_BOOT/RAMDISK) 4689ifdef INSTALLED_DTBIMAGE_TARGET 4690 cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/VENDOR_BOOT/dtb 4691endif 4692ifdef BOARD_KERNEL_BASE 4693 echo "$(BOARD_KERNEL_BASE)" > $(zip_root)/VENDOR_BOOT/base 4694endif 4695ifdef BOARD_KERNEL_PAGESIZE 4696 echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/VENDOR_BOOT/pagesize 4697endif 4698 echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/VENDOR_BOOT/vendor_cmdline 4699endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET 4700ifdef BUILDING_SYSTEM_IMAGE 4701 @# Contents of the system image 4702 $(hide) $(call package_files-copy-root, \ 4703 $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM) 4704endif 4705ifdef BUILDING_USERDATA_IMAGE 4706 @# Contents of the data image 4707 $(hide) $(call package_files-copy-root, \ 4708 $(TARGET_OUT_DATA),$(zip_root)/DATA) 4709endif 4710ifdef BUILDING_VENDOR_IMAGE 4711 @# Contents of the vendor image 4712 $(hide) $(call package_files-copy-root, \ 4713 $(TARGET_OUT_VENDOR),$(zip_root)/VENDOR) 4714endif 4715ifdef BUILDING_PRODUCT_IMAGE 4716 @# Contents of the product image 4717 $(hide) $(call package_files-copy-root, \ 4718 $(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT) 4719endif 4720ifdef BUILDING_SYSTEM_EXT_IMAGE 4721 @# Contents of the system_ext image 4722 $(hide) $(call package_files-copy-root, \ 4723 $(TARGET_OUT_SYSTEM_EXT),$(zip_root)/SYSTEM_EXT) 4724endif 4725ifdef BUILDING_ODM_IMAGE 4726 @# Contents of the odm image 4727 $(hide) $(call package_files-copy-root, \ 4728 $(TARGET_OUT_ODM),$(zip_root)/ODM) 4729endif 4730ifdef BUILDING_SYSTEM_OTHER_IMAGE 4731 @# Contents of the system_other image 4732 $(hide) $(call package_files-copy-root, \ 4733 $(TARGET_OUT_SYSTEM_OTHER),$(zip_root)/SYSTEM_OTHER) 4734endif 4735 @# Extra contents of the OTA package 4736 $(hide) mkdir -p $(zip_root)/OTA 4737 $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/ 4738ifeq ($(TARGET_OTA_ALLOW_NON_AB),true) 4739ifneq ($(built_ota_tools),) 4740 $(hide) mkdir -p $(zip_root)/OTA/bin 4741 $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/ 4742endif 4743endif 4744 @# Files that do not end up in any images, but are necessary to 4745 @# build them. 4746 $(hide) mkdir -p $(zip_root)/META 4747 $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt 4748 $(hide) cp $(SOONG_APEX_KEYS_FILE) $(zip_root)/META/apexkeys.txt 4749ifneq ($(tool_extension),) 4750 $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/ 4751endif 4752 $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt 4753 $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin 4754 $(hide) cp $(INSTALLED_MISC_INFO_TARGET) $(zip_root)/META/misc_info.txt 4755ifneq ($(PRODUCT_SYSTEM_BASE_FS_PATH),) 4756 $(hide) cp $(PRODUCT_SYSTEM_BASE_FS_PATH) \ 4757 $(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_BASE_FS_PATH)) 4758endif 4759ifneq ($(PRODUCT_VENDOR_BASE_FS_PATH),) 4760 $(hide) cp $(PRODUCT_VENDOR_BASE_FS_PATH) \ 4761 $(zip_root)/META/$(notdir $(PRODUCT_VENDOR_BASE_FS_PATH)) 4762endif 4763ifneq ($(PRODUCT_PRODUCT_BASE_FS_PATH),) 4764 $(hide) cp $(PRODUCT_PRODUCT_BASE_FS_PATH) \ 4765 $(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_BASE_FS_PATH)) 4766endif 4767ifneq ($(PRODUCT_SYSTEM_EXT_BASE_FS_PATH),) 4768 $(hide) cp $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \ 4769 $(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH)) 4770endif 4771ifneq ($(PRODUCT_ODM_BASE_FS_PATH),) 4772 $(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \ 4773 $(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH)) 4774endif 4775ifeq ($(TARGET_OTA_ALLOW_NON_AB),true) 4776ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) 4777 $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \ 4778 $(MAKE_RECOVERY_PATCH) $(zip_root) $(zip_root) 4779endif 4780endif 4781ifeq ($(AB_OTA_UPDATER),true) 4782 @# When using the A/B updater, include the updater config files in the zip. 4783 $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt 4784 $(hide) for part in $(AB_OTA_PARTITIONS); do \ 4785 echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \ 4786 done 4787 $(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \ 4788 echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \ 4789 done 4790ifdef OSRELEASED_DIRECTORY 4791 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt 4792 $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt 4793 $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt 4794endif 4795endif 4796ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true) 4797 @# If breakpad symbols have been generated, add them to the zip. 4798 $(hide) cp -R $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD 4799endif 4800ifdef BOARD_PREBUILT_VENDORIMAGE 4801 $(hide) mkdir -p $(zip_root)/IMAGES 4802 $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/ 4803endif 4804ifdef BOARD_PREBUILT_PRODUCTIMAGE 4805 $(hide) mkdir -p $(zip_root)/IMAGES 4806 $(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/ 4807endif 4808ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE 4809 $(hide) mkdir -p $(zip_root)/IMAGES 4810 $(hide) cp $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(zip_root)/IMAGES/ 4811endif 4812ifdef BOARD_PREBUILT_BOOTIMAGE 4813 $(hide) mkdir -p $(zip_root)/IMAGES 4814 $(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/ 4815endif 4816ifdef BOARD_PREBUILT_ODMIMAGE 4817 $(hide) mkdir -p $(zip_root)/IMAGES 4818 $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/ 4819endif 4820ifdef BOARD_PREBUILT_DTBOIMAGE 4821 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES 4822 $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/ 4823endif # BOARD_PREBUILT_DTBOIMAGE 4824ifneq ($(strip $(BOARD_CUSTOMIMAGES_PARTITION_LIST)),) 4825 $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES 4826 $(hide) $(foreach partition,$(BOARD_CUSTOMIMAGES_PARTITION_LIST), \ 4827 $(foreach image,$(BOARD_AVB_$(call to-upper,$(partition))_IMAGE_LIST),cp $(image) $(zip_root)/PREBUILT_IMAGES/;)) 4828endif # BOARD_CUSTOMIMAGES_PARTITION_LIST 4829 @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into 4830 @# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in 4831 @# INSTALLED_RADIOIMAGE_TARGET. 4832 $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \ 4833 echo $(part) >> $(zip_root)/META/pack_radioimages.txt;) 4834 @# Run fs_config on all the system, vendor, boot ramdisk, 4835 @# and recovery ramdisk files in the zip, and save the output 4836ifdef BUILDING_SYSTEM_IMAGE 4837 $(hide) $(call fs_config,$(zip_root)/SYSTEM,system/) > $(zip_root)/META/filesystem_config.txt 4838endif 4839ifdef BUILDING_VENDOR_IMAGE 4840 $(hide) $(call fs_config,$(zip_root)/VENDOR,vendor/) > $(zip_root)/META/vendor_filesystem_config.txt 4841endif 4842ifdef BUILDING_PRODUCT_IMAGE 4843 $(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt 4844endif 4845ifdef BUILDING_SYSTEM_EXT_IMAGE 4846 $(hide) $(call fs_config,$(zip_root)/SYSTEM_EXT,system_ext/) > $(zip_root)/META/system_ext_filesystem_config.txt 4847endif 4848ifdef BUILDING_ODM_IMAGE 4849 $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt 4850endif 4851 @# ROOT always contains the files for the root under normal boot. 4852 $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt 4853ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) 4854 @# BOOT/RAMDISK exists and contains the ramdisk for recovery if using BOARD_USES_RECOVERY_AS_BOOT. 4855 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt 4856endif 4857ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),) 4858 $(call fs_config,$(zip_root)/VENDOR_BOOT/RAMDISK,) > $(zip_root)/META/vendor_boot_filesystem_config.txt 4859endif 4860ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) 4861 @# BOOT/RAMDISK also exists and contains the first stage ramdisk if not using BOARD_BUILD_SYSTEM_ROOT_IMAGE. 4862 $(hide) $(call fs_config,$(zip_root)/BOOT/RAMDISK,) > $(zip_root)/META/boot_filesystem_config.txt 4863endif 4864ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) 4865 $(hide) $(call fs_config,$(zip_root)/RECOVERY/RAMDISK,) > $(zip_root)/META/recovery_filesystem_config.txt 4866endif 4867ifdef BUILDING_SYSTEM_OTHER_IMAGE 4868 $(hide) $(call fs_config,$(zip_root)/SYSTEM_OTHER,system/) > $(zip_root)/META/system_other_filesystem_config.txt 4869endif 4870 @# Metadata for compatibility verification. 4871ifdef BUILT_KERNEL_CONFIGS_FILE 4872 $(hide) cp $(BUILT_KERNEL_CONFIGS_FILE) $(zip_root)/META/kernel_configs.txt 4873endif 4874ifdef BUILT_KERNEL_VERSION_FILE 4875 $(hide) cp $(BUILT_KERNEL_VERSION_FILE) $(zip_root)/META/kernel_version.txt 4876endif 4877 rm -rf $(zip_root)/META/dynamic_partitions_info.txt 4878ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)) 4879 $(call dump-dynamic-partitions-info, $(zip_root)/META/dynamic_partitions_info.txt) 4880endif 4881 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \ 4882 $(ADD_IMG_TO_TARGET_FILES) -a -v -p $(HOST_OUT) $(zip_root) 4883ifeq ($(BUILD_QEMU_IMAGES),true) 4884 $(hide) AVBTOOL=$(AVBTOOL) $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(zip_root)/IMAGES/vbmeta.img \ 4885 $(zip_root)/IMAGES/system.img $(zip_root)/IMAGES/VerifiedBootParams.textproto 4886endif 4887 @# Zip everything up, preserving symlinks and placing META/ files first to 4888 @# help early validation of the .zip file while uploading it. 4889 $(hide) find $(zip_root)/META | sort >$@.list 4890 $(hide) find $(zip_root) -path $(zip_root)/META -prune -o -print | sort >>$@.list 4891 $(hide) $(SOONG_ZIP) -d -o $@ -C $(zip_root) -l $@.list 4892 4893.PHONY: target-files-package 4894target-files-package: $(BUILT_TARGET_FILES_PACKAGE) 4895 4896ifneq ($(filter $(MAKECMDGOALS),target-files-package),) 4897$(call dist-for-goals, target-files-package, $(BUILT_TARGET_FILES_PACKAGE)) 4898endif 4899 4900# ----------------------------------------------------------------- 4901# NDK Sysroot Package 4902NDK_SYSROOT_TARGET := $(PRODUCT_OUT)/ndk_sysroot.tar.bz2 4903$(NDK_SYSROOT_TARGET): $(SOONG_OUT_DIR)/ndk.timestamp 4904 @echo Package NDK sysroot... 4905 $(hide) tar cjf $@ -C $(SOONG_OUT_DIR) ndk 4906 4907$(call dist-for-goals,sdk,$(NDK_SYSROOT_TARGET)) 4908 4909ifeq ($(build_ota_package),true) 4910# ----------------------------------------------------------------- 4911# OTA update package 4912 4913# $(1): output file 4914# $(2): additional args 4915define build-ota-package-target 4916PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ 4917 $(OTA_FROM_TARGET_FILES) \ 4918 --verbose \ 4919 --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \ 4920 --path $(HOST_OUT) \ 4921 $(if $(OEM_OTA_CONFIG), --oem_settings $(OEM_OTA_CONFIG)) \ 4922 $(2) \ 4923 $(BUILT_TARGET_FILES_PACKAGE) $(1) 4924endef 4925 4926name := $(TARGET_PRODUCT) 4927ifeq ($(TARGET_BUILD_TYPE),debug) 4928 name := $(name)_debug 4929endif 4930name := $(name)-ota-$(FILE_NAME_TAG) 4931 4932INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip 4933INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata 4934 4935$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) 4936$(INTERNAL_OTA_PACKAGE_TARGET): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_OTA_METADATA) 4937$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTA_FROM_TARGET_FILES) 4938 @echo "Package OTA: $@" 4939 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --output_metadata_path $(INTERNAL_OTA_METADATA)) 4940 4941.PHONY: otapackage 4942otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) 4943 4944ifeq ($(BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE),true) 4945name := $(TARGET_PRODUCT) 4946ifeq ($(TARGET_BUILD_TYPE),debug) 4947 name := $(name)_debug 4948endif 4949name := $(name)-ota-retrofit-$(FILE_NAME_TAG) 4950 4951INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip 4952$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) 4953$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): \ 4954 $(BUILT_TARGET_FILES_PACKAGE) \ 4955 $(OTA_FROM_TARGET_FILES) 4956 @echo "Package OTA (retrofit dynamic partitions): $@" 4957 $(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions) 4958 4959.PHONY: otardppackage 4960 4961otapackage otardppackage: $(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET) 4962 4963endif # BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE 4964 4965endif # build_ota_package 4966 4967# ----------------------------------------------------------------- 4968# A zip of the appcompat directory containing logs 4969APPCOMPAT_ZIP := $(PRODUCT_OUT)/appcompat.zip 4970# For apps_only build we'll establish the dependency later in build/make/core/main.mk. 4971ifndef TARGET_BUILD_APPS 4972$(APPCOMPAT_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ 4973 $(INSTALLED_RAMDISK_TARGET) \ 4974 $(INSTALLED_BOOTIMAGE_TARGET) \ 4975 $(INSTALLED_USERDATAIMAGE_TARGET) \ 4976 $(INSTALLED_VENDORIMAGE_TARGET) \ 4977 $(INSTALLED_PRODUCTIMAGE_TARGET) \ 4978 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) 4979endif 4980$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist 4981$(APPCOMPAT_ZIP): $(SOONG_ZIP) 4982 @echo "appcompat logs: $@" 4983 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE) 4984 $(hide) mkdir -p $(dir $@) $(PRODUCT_OUT)/appcompat $(dir $(PRIVATE_LIST_FILE)) 4985 $(hide) find $(PRODUCT_OUT)/appcompat | sort >$(PRIVATE_LIST_FILE) 4986 $(hide) $(SOONG_ZIP) -d -o $@ -C $(PRODUCT_OUT)/appcompat -l $(PRIVATE_LIST_FILE) 4987 4988# ----------------------------------------------------------------- 4989# A zip of the symbols directory. Keep the full paths to make it 4990# more obvious where these files came from. 4991# 4992name := $(TARGET_PRODUCT) 4993ifeq ($(TARGET_BUILD_TYPE),debug) 4994 name := $(name)_debug 4995endif 4996name := $(name)-symbols-$(FILE_NAME_TAG) 4997 4998SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip 4999# For apps_only build we'll establish the dependency later in build/make/core/main.mk. 5000ifndef TARGET_BUILD_APPS 5001$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ 5002 $(INSTALLED_RAMDISK_TARGET) \ 5003 $(INSTALLED_BOOTIMAGE_TARGET) \ 5004 $(INSTALLED_USERDATAIMAGE_TARGET) \ 5005 $(INSTALLED_VENDORIMAGE_TARGET) \ 5006 $(INSTALLED_PRODUCTIMAGE_TARGET) \ 5007 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ 5008 $(INSTALLED_ODMIMAGE_TARGET) \ 5009 $(updater_dep) 5010endif 5011$(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist 5012$(SYMBOLS_ZIP): $(SOONG_ZIP) 5013 @echo "Package symbols: $@" 5014 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE) 5015 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_UNSTRIPPED) $(dir $(PRIVATE_LIST_FILE)) 5016 $(hide) find -L $(TARGET_OUT_UNSTRIPPED) -type f | sort >$(PRIVATE_LIST_FILE) 5017 $(hide) $(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE) 5018# ----------------------------------------------------------------- 5019# A zip of the coverage directory. 5020# 5021name := gcov-report-files-all 5022ifeq ($(TARGET_BUILD_TYPE),debug) 5023name := $(name)_debug 5024endif 5025COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip 5026ifndef TARGET_BUILD_APPS 5027$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ 5028 $(INSTALLED_RAMDISK_TARGET) \ 5029 $(INSTALLED_BOOTIMAGE_TARGET) \ 5030 $(INSTALLED_USERDATAIMAGE_TARGET) \ 5031 $(INSTALLED_VENDORIMAGE_TARGET) \ 5032 $(INSTALLED_PRODUCTIMAGE_TARGET) \ 5033 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ 5034 $(INSTALLED_ODMIMAGE_TARGET) 5035endif 5036$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist 5037$(COVERAGE_ZIP): $(SOONG_ZIP) 5038 @echo "Package coverage: $@" 5039 $(hide) rm -rf $@ $(PRIVATE_LIST_FILE) 5040 $(hide) mkdir -p $(dir $@) $(TARGET_OUT_COVERAGE) $(dir $(PRIVATE_LIST_FILE)) 5041 $(hide) find $(TARGET_OUT_COVERAGE) | sort >$(PRIVATE_LIST_FILE) 5042 $(hide) $(SOONG_ZIP) -d -o $@ -C $(TARGET_OUT_COVERAGE) -l $(PRIVATE_LIST_FILE) 5043 5044#------------------------------------------------------------------ 5045# Export the LLVM profile data tool and dependencies for Clang coverage processing 5046# 5047ifeq (true,$(CLANG_COVERAGE)) 5048 LLVM_PROFDATA := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/bin/llvm-profdata 5049 LIBCXX := $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/lib64/libc++.so.1 5050 PROFDATA_ZIP := $(PRODUCT_OUT)/llvm-profdata.zip 5051 $(PROFDATA_ZIP): $(SOONG_ZIP) 5052 $(hide) $(SOONG_ZIP) -d -o $@ -C $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION) -f $(LLVM_PROFDATA) -f $(LIBCXX) 5053 5054 $(call dist-for-goals,droidcore,$(PROFDATA_ZIP)) 5055endif 5056 5057# ----------------------------------------------------------------- 5058# A zip of the Android Apps. Not keeping full path so that we don't 5059# include product names when distributing 5060# 5061name := $(TARGET_PRODUCT) 5062ifeq ($(TARGET_BUILD_TYPE),debug) 5063 name := $(name)_debug 5064endif 5065name := $(name)-apps-$(FILE_NAME_TAG) 5066 5067APPS_ZIP := $(PRODUCT_OUT)/$(name).zip 5068$(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) 5069 @echo "Package apps: $@" 5070 $(hide) rm -rf $@ 5071 $(hide) mkdir -p $(dir $@) 5072 $(hide) apps_to_zip=`find $(TARGET_OUT_APPS) $(TARGET_OUT_APPS_PRIVILEGED) -mindepth 2 -maxdepth 3 -name "*.apk"`; \ 5073 if [ -z "$$apps_to_zip" ]; then \ 5074 echo "No apps to zip up. Generating empty apps archive." ; \ 5075 a=$$(mktemp /tmp/XXXXXXX) && touch $$a && zip $@ $$a && zip -d $@ $$a; \ 5076 else \ 5077 zip -qjX $@ $$apps_to_zip; \ 5078 fi 5079 5080ifeq (true,$(EMMA_INSTRUMENT)) 5081#------------------------------------------------------------------ 5082# An archive of classes for use in generating code-coverage reports 5083# These are the uninstrumented versions of any classes that were 5084# to be instrumented. 5085# Any dependencies are set up later in build/make/core/main.mk. 5086 5087JACOCO_REPORT_CLASSES_ALL := $(PRODUCT_OUT)/jacoco-report-classes-all.jar 5088$(JACOCO_REPORT_CLASSES_ALL) : 5089 @echo "Collecting uninstrumented classes" 5090 find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "jacoco-report-classes.jar" 2>/dev/null | sort > $@.list 5091 $(SOONG_ZIP) -o $@ -L 0 -C $(OUT_DIR) -P out -l $@.list 5092 5093endif # EMMA_INSTRUMENT=true 5094 5095 5096#------------------------------------------------------------------ 5097# A zip of Proguard obfuscation dictionary files. 5098# 5099PROGUARD_DICT_ZIP := $(PRODUCT_OUT)/$(TARGET_PRODUCT)-proguard-dict-$(FILE_NAME_TAG).zip 5100# For apps_only build we'll establish the dependency later in build/make/core/main.mk. 5101ifndef TARGET_BUILD_APPS 5102$(PROGUARD_DICT_ZIP): \ 5103 $(INSTALLED_SYSTEMIMAGE_TARGET) \ 5104 $(INSTALLED_RAMDISK_TARGET) \ 5105 $(INSTALLED_BOOTIMAGE_TARGET) \ 5106 $(INSTALLED_USERDATAIMAGE_TARGET) \ 5107 $(INSTALLED_VENDORIMAGE_TARGET) \ 5108 $(INSTALLED_PRODUCTIMAGE_TARGET) \ 5109 $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ 5110 $(INSTALLED_ODMIMAGE_TARGET) \ 5111 $(updater_dep) 5112endif 5113$(PROGUARD_DICT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard)/filelist 5114$(PROGUARD_DICT_ZIP): $(SOONG_ZIP) 5115 @echo "Packaging Proguard obfuscation dictionary files." 5116 mkdir -p $(dir $@) $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS $(dir $(PRIVATE_LIST_FILE)) 5117 find $(TARGET_OUT_COMMON_INTERMEDIATES)/APPS -name proguard_dictionary | \ 5118 sed -e 's/\(.*\)\/proguard_dictionary/\0\n\1\/classes.jar/' > $(PRIVATE_LIST_FILE) 5119 $(SOONG_ZIP) --ignore_missing_files -d -o $@ -C $(OUT_DIR)/.. -l $(PRIVATE_LIST_FILE) 5120 5121 5122ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)) 5123 5124# Dump variables used by build_super_image.py (for building super.img and super_empty.img). 5125# $(1): output file 5126define dump-super-image-info 5127 $(call dump-dynamic-partitions-info,$(1)) 5128 $(if $(filter true,$(AB_OTA_UPDATER)), \ 5129 echo "ab_update=true" >> $(1)) 5130endef 5131 5132endif # PRODUCT_USE_DYNAMIC_PARTITIONS 5133 5134# ----------------------------------------------------------------- 5135# super partition image (dist) 5136 5137ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION)) 5138 5139# BOARD_SUPER_PARTITION_SIZE must be defined to build super image. 5140ifneq ($(BOARD_SUPER_PARTITION_SIZE),) 5141 5142ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)) 5143 5144# For real devices and for dist builds, build super image from target files to an intermediate directory. 5145INTERNAL_SUPERIMAGE_DIST_TARGET := $(call intermediates-dir-for,PACKAGING,super.img)/super.img 5146$(INTERNAL_SUPERIMAGE_DIST_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) 5147$(INTERNAL_SUPERIMAGE_DIST_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE) 5148 $(call pretty,"Target super fs image from target files: $@") 5149 PATH=$(dir $(LPMAKE)):$$PATH \ 5150 $(BUILD_SUPER_IMAGE) -v $(extracted_input_target_files) $@ 5151 5152# Skip packing it in dist package because it is in update package. 5153ifneq (true,$(BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE)) 5154$(call dist-for-goals,dist_files,$(INTERNAL_SUPERIMAGE_DIST_TARGET)) 5155endif 5156 5157.PHONY: superimage_dist 5158superimage_dist: $(INTERNAL_SUPERIMAGE_DIST_TARGET) 5159 5160endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true" 5161endif # BOARD_SUPER_PARTITION_SIZE != "" 5162endif # PRODUCT_BUILD_SUPER_PARTITION == "true" 5163 5164# ----------------------------------------------------------------- 5165# super partition image for development 5166 5167ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION)) 5168ifneq ($(BOARD_SUPER_PARTITION_SIZE),) 5169ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)) 5170 5171# Build super.img by using $(INSTALLED_*IMAGE_TARGET) to $(1) 5172# $(1): built image path 5173# $(2): misc_info.txt path; its contents should match expectation of build_super_image.py 5174define build-superimage-target 5175 mkdir -p $(dir $(2)) 5176 rm -rf $(2) 5177 $(call dump-super-image-info,$(2)) 5178 $(foreach p,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \ 5179 echo "$(p)_image=$(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)" >> $(2);) 5180 $(if $(BUILDING_SYSTEM_OTHER_IMAGE), $(if $(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)), \ 5181 echo "system_other_image=$(INSTALLED_SYSTEMOTHERIMAGE_TARGET)" >> $(2);)) 5182 mkdir -p $(dir $(1)) 5183 PATH=$(dir $(LPMAKE)):$$PATH \ 5184 $(BUILD_SUPER_IMAGE) -v $(2) $(1) 5185endef 5186 5187INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img 5188INSTALLED_SUPERIMAGE_DEPENDENCIES := $(LPMAKE) $(BUILD_SUPER_IMAGE) \ 5189 $(foreach p, $(BOARD_SUPER_PARTITION_PARTITION_LIST), $(INSTALLED_$(call to-upper,$(p))IMAGE_TARGET)) 5190 5191ifdef BUILDING_SYSTEM_OTHER_IMAGE 5192ifneq ($(filter system,$(BOARD_SUPER_PARTITION_PARTITION_LIST)),) 5193INSTALLED_SUPERIMAGE_DEPENDENCIES += $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) 5194endif 5195endif 5196 5197# If BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT is set, super.img is built from images in the 5198# $(PRODUCT_OUT) directory, and is built to $(PRODUCT_OUT)/super.img. Also, it will 5199# be built for non-dist builds. This is useful for devices that uses super.img directly, e.g. 5200# virtual devices. 5201ifeq (true,$(BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT)) 5202$(INSTALLED_SUPERIMAGE_TARGET): $(INSTALLED_SUPERIMAGE_DEPENDENCIES) 5203 $(call pretty,"Target super fs image for debug: $@") 5204 $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\ 5205 $(call intermediates-dir-for,PACKAGING,superimage_debug)/misc_info.txt) 5206 5207droidcore: $(INSTALLED_SUPERIMAGE_TARGET) 5208 5209# For devices that uses super image directly, the superimage target points to the file in $(PRODUCT_OUT). 5210.PHONY: superimage 5211superimage: $(INSTALLED_SUPERIMAGE_TARGET) 5212 5213$(call dist-for-goals,dist_files,$(INSTALLED_MISC_INFO_TARGET):super_misc_info.txt) 5214endif # BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT 5215 5216# Build $(PRODUCT_OUT)/super.img without dependencies. 5217.PHONY: superimage-nodeps supernod 5218superimage-nodeps supernod: intermediates := 5219superimage-nodeps supernod: | $(INSTALLED_SUPERIMAGE_DEPENDENCIES) 5220 $(call pretty,"make $(INSTALLED_SUPERIMAGE_TARGET): ignoring dependencies") 5221 $(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\ 5222 $(call intermediates-dir-for,PACKAGING,superimage-nodeps)/misc_info.txt) 5223 5224endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS != "true" 5225endif # BOARD_SUPER_PARTITION_SIZE != "" 5226endif # PRODUCT_BUILD_SUPER_PARTITION == "true" 5227 5228# ----------------------------------------------------------------- 5229# super empty image 5230 5231ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS)) 5232ifneq ($(BOARD_SUPER_PARTITION_SIZE),) 5233 5234INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img 5235$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): intermediates := $(call intermediates-dir-for,PACKAGING,super_empty) 5236$(INSTALLED_SUPERIMAGE_EMPTY_TARGET): $(LPMAKE) $(BUILD_SUPER_IMAGE) 5237 $(call pretty,"Target empty super fs image: $@") 5238 mkdir -p $(intermediates) 5239 rm -rf $(intermediates)/misc_info.txt 5240 $(call dump-super-image-info,$(intermediates)/misc_info.txt) 5241 PATH=$(dir $(LPMAKE)):$$PATH \ 5242 $(BUILD_SUPER_IMAGE) -v $(intermediates)/misc_info.txt $@ 5243 5244$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET)) 5245 5246endif # BOARD_SUPER_PARTITION_SIZE != "" 5247endif # PRODUCT_USE_DYNAMIC_PARTITIONS == "true" 5248 5249 5250# ----------------------------------------------------------------- 5251# The update package 5252 5253name := $(TARGET_PRODUCT) 5254ifeq ($(TARGET_BUILD_TYPE),debug) 5255 name := $(name)_debug 5256endif 5257name := $(name)-img-$(FILE_NAME_TAG) 5258 5259INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip 5260 5261$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(IMG_FROM_TARGET_FILES) 5262 $(call pretty,"Package: $@") 5263 PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$(dir $(ZIP2ZIP)):$$PATH \ 5264 $(IMG_FROM_TARGET_FILES) \ 5265 --additional IMAGES/VerifiedBootParams.textproto:VerifiedBootParams.textproto \ 5266 $(BUILT_TARGET_FILES_PACKAGE) $@ 5267 5268.PHONY: updatepackage 5269updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET) 5270$(call dist-for-goals,updatepackage,$(INTERNAL_UPDATE_PACKAGE_TARGET)) 5271 5272 5273# ----------------------------------------------------------------- 5274# dalvik something 5275.PHONY: dalvikfiles 5276dalvikfiles: $(INTERNAL_DALVIK_MODULES) 5277 5278ifeq ($(BUILD_QEMU_IMAGES),true) 5279MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh 5280MK_COMBINE_QEMU_IMAGE := $(HOST_OUT_EXECUTABLES)/mk_combined_img 5281SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk 5282 5283ifdef INSTALLED_SYSTEMIMAGE_TARGET 5284INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img 5285INSTALLED_SYSTEM_QEMU_CONFIG := $(PRODUCT_OUT)/system-qemu-config.txt 5286$(INSTALLED_SYSTEM_QEMU_CONFIG): $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_VBMETAIMAGE_TARGET) 5287 @echo "$(PRODUCT_OUT)/vbmeta.img vbmeta 1" > $@ 5288 @echo "$(INSTALLED_SUPERIMAGE_TARGET) super 2" >> $@ 5289$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_VBMETAIMAGE_TARGET) $(MK_COMBINE_QEMU_IMAGE) $(SGDISK_HOST) $(SIMG2IMG) \ 5290 $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SYSTEM_QEMU_CONFIG) 5291 @echo Create system-qemu.img now 5292 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); \ 5293 $(MK_COMBINE_QEMU_IMAGE) -i $(INSTALLED_SYSTEM_QEMU_CONFIG) -o $@) 5294 5295systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE) 5296droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE) 5297endif 5298ifdef INSTALLED_VENDORIMAGE_TARGET 5299INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img 5300$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) 5301 @echo Create vendor-qemu.img 5302 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDORIMAGE_TARGET)) 5303 5304vendorimage: $(INSTALLED_QEMU_VENDORIMAGE) 5305droidcore: $(INSTALLED_QEMU_VENDORIMAGE) 5306endif 5307 5308ifdef INSTALLED_RAMDISK_TARGET 5309ifdef INSTALLED_VENDOR_BOOTIMAGE_TARGET 5310ifdef INTERNAL_VENDOR_RAMDISK_TARGET 5311INSTALLED_QEMU_RAMDISKIMAGE := $(PRODUCT_OUT)/ramdisk-qemu.img 5312$(INSTALLED_QEMU_RAMDISKIMAGE): $(INTERNAL_VENDOR_RAMDISK_TARGET) $(INSTALLED_RAMDISK_TARGET) 5313 @echo Create ramdisk-qemu.img 5314 (cat $(INSTALLED_RAMDISK_TARGET) $(INTERNAL_VENDOR_RAMDISK_TARGET) > $(INSTALLED_QEMU_RAMDISKIMAGE)) 5315 5316droidcore: $(INSTALLED_QEMU_RAMDISKIMAGE) 5317endif 5318endif 5319endif 5320 5321ifdef INSTALLED_PRODUCTIMAGE_TARGET 5322INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img 5323$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) 5324 @echo Create product-qemu.img 5325 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCTIMAGE_TARGET)) 5326 5327productimage: $(INSTALLED_QEMU_PRODUCTIMAGE) 5328droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE) 5329endif 5330ifdef INSTALLED_SYSTEM_EXTIMAGE_TARGET 5331INSTALLED_QEMU_SYSTEM_EXTIMAGE := $(PRODUCT_OUT)/system_ext-qemu.img 5332$(INSTALLED_QEMU_SYSTEM_EXTIMAGE): $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) 5333 @echo Create system_ext-qemu.img 5334 (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)) 5335 5336systemextimage: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE) 5337droidcore: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE) 5338endif 5339ifdef INSTALLED_ODMIMAGE_TARGET 5340INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img 5341$(INSTALLED_QEMU_ODMIMAGE): $(INSTALLED_ODMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) 5342 @echo Create odm-qemu.img 5343 (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODMIMAGE_TARGET)) 5344 5345odmimage: $(INSTALLED_QEMU_ODMIMAGE) 5346droidcore: $(INSTALLED_QEMU_ODMIMAGE) 5347endif 5348 5349QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto 5350$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \ 5351 $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(AVBTOOL) 5352 @echo Creating $@ 5353 (export AVBTOOL=$(AVBTOOL); $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(INSTALLED_VBMETAIMAGE_TARGET) \ 5354 $(INSTALLED_SYSTEMIMAGE_TARGET) $(QEMU_VERIFIED_BOOT_PARAMS)) 5355 5356systemimage: $(QEMU_VERIFIED_BOOT_PARAMS) 5357droidcore: $(QEMU_VERIFIED_BOOT_PARAMS) 5358 5359endif 5360# ----------------------------------------------------------------- 5361# The emulator package 5362ifeq ($(BUILD_EMULATOR),true) 5363INTERNAL_EMULATOR_PACKAGE_FILES += \ 5364 $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \ 5365 prebuilts/qemu-kernel/$(TARGET_ARCH)/kernel-qemu \ 5366 $(INSTALLED_RAMDISK_TARGET) \ 5367 $(INSTALLED_SYSTEMIMAGE_TARGET) \ 5368 $(INSTALLED_USERDATAIMAGE_TARGET) 5369 5370name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG) 5371 5372INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip 5373 5374$(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES) 5375 @echo "Package: $@" 5376 $(hide) zip -qjX $@ $(INTERNAL_EMULATOR_PACKAGE_FILES) 5377 5378endif 5379# ----------------------------------------------------------------- 5380# Old PDK stuffs, retired 5381# The pdk package (Platform Development Kit) 5382 5383#ifneq (,$(filter pdk,$(MAKECMDGOALS))) 5384# include development/pdk/Pdk.mk 5385#endif 5386 5387 5388# ----------------------------------------------------------------- 5389# The SDK 5390 5391# The SDK includes host-specific components, so it belongs under HOST_OUT. 5392sdk_dir := $(HOST_OUT)/sdk/$(TARGET_PRODUCT) 5393 5394# Build a name that looks like: 5395# 5396# linux-x86 --> android-sdk_12345_linux-x86 5397# darwin-x86 --> android-sdk_12345_mac-x86 5398# windows-x86 --> android-sdk_12345_windows 5399# 5400sdk_name := android-sdk_$(FILE_NAME_TAG) 5401ifeq ($(HOST_OS),darwin) 5402 INTERNAL_SDK_HOST_OS_NAME := mac 5403else 5404 INTERNAL_SDK_HOST_OS_NAME := $(HOST_OS) 5405endif 5406ifneq ($(HOST_OS),windows) 5407 INTERNAL_SDK_HOST_OS_NAME := $(INTERNAL_SDK_HOST_OS_NAME)-$(SDK_HOST_ARCH) 5408endif 5409sdk_name := $(sdk_name)_$(INTERNAL_SDK_HOST_OS_NAME) 5410 5411sdk_dep_file := $(sdk_dir)/sdk_deps.mk 5412 5413ATREE_FILES := 5414-include $(sdk_dep_file) 5415 5416# if we don't have a real list, then use "everything" 5417ifeq ($(strip $(ATREE_FILES)),) 5418ATREE_FILES := \ 5419 $(ALL_DEFAULT_INSTALLED_MODULES) \ 5420 $(INSTALLED_RAMDISK_TARGET) \ 5421 $(ALL_DOCS) \ 5422 $(ALL_SDK_FILES) 5423endif 5424 5425atree_dir := development/build 5426 5427 5428sdk_atree_files := \ 5429 $(atree_dir)/sdk.exclude.atree \ 5430 $(atree_dir)/sdk-$(HOST_OS)-$(SDK_HOST_ARCH).atree 5431 5432# development/build/sdk-android-<abi>.atree is used to differentiate 5433# between architecture models (e.g. ARMv5TE versus ARMv7) when copying 5434# files like the kernel image. We use TARGET_CPU_ABI because we don't 5435# have a better way to distinguish between CPU models. 5436ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree))) 5437 sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree 5438endif 5439 5440ifneq ($(PRODUCT_SDK_ATREE_FILES),) 5441sdk_atree_files += $(PRODUCT_SDK_ATREE_FILES) 5442else 5443sdk_atree_files += $(atree_dir)/sdk.atree 5444endif 5445 5446include $(BUILD_SYSTEM)/sdk_font.mk 5447 5448deps := \ 5449 $(target_notice_file_txt) \ 5450 $(tools_notice_file_txt) \ 5451 $(OUT_DOCS)/offline-sdk-timestamp \ 5452 $(SDK_METADATA_FILES) \ 5453 $(SYMBOLS_ZIP) \ 5454 $(COVERAGE_ZIP) \ 5455 $(APPCOMPAT_ZIP) \ 5456 $(INSTALLED_SYSTEMIMAGE_TARGET) \ 5457 $(INSTALLED_QEMU_SYSTEMIMAGE) \ 5458 $(INSTALLED_QEMU_RAMDISKIMAGE) \ 5459 $(INSTALLED_QEMU_VENDORIMAGE) \ 5460 $(QEMU_VERIFIED_BOOT_PARAMS) \ 5461 $(INSTALLED_USERDATAIMAGE_TARGET) \ 5462 $(INSTALLED_RAMDISK_TARGET) \ 5463 $(INSTALLED_SDK_BUILD_PROP_TARGET) \ 5464 $(INSTALLED_BUILD_PROP_TARGET) \ 5465 $(ATREE_FILES) \ 5466 $(sdk_atree_files) \ 5467 $(HOST_OUT_EXECUTABLES)/atree \ 5468 $(HOST_OUT_EXECUTABLES)/line_endings \ 5469 $(SDK_FONT_DEPS) 5470 5471INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip 5472$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name) 5473$(INTERNAL_SDK_TARGET): PRIVATE_DIR := $(sdk_dir)/$(sdk_name) 5474$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file) 5475$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files) 5476 5477# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built. 5478# 5479#SDK_GNU_ERROR := true 5480 5481$(INTERNAL_SDK_TARGET): $(deps) 5482 @echo "Package SDK: $@" 5483 $(hide) rm -rf $(PRIVATE_DIR) $@ 5484 $(hide) for f in $(target_gnu_MODULES); do \ 5485 if [ -f $$f ]; then \ 5486 echo SDK: $(if $(SDK_GNU_ERROR),ERROR:,warning:) \ 5487 including GNU target $$f >&2; \ 5488 FAIL=$(SDK_GNU_ERROR); \ 5489 fi; \ 5490 done; \ 5491 if [ $$FAIL ]; then exit 1; fi 5492 $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt 5493 $(hide) ( \ 5494 ATREE_STRIP="$(HOST_STRIP) -x" \ 5495 $(HOST_OUT_EXECUTABLES)/atree \ 5496 $(addprefix -f ,$(PRIVATE_INPUT_FILES)) \ 5497 -m $(PRIVATE_DEP_FILE) \ 5498 -I . \ 5499 -I $(PRODUCT_OUT) \ 5500 -I $(HOST_OUT) \ 5501 -I $(TARGET_COMMON_OUT_ROOT) \ 5502 -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \ 5503 -v "OUT_DIR=$(OUT_DIR)" \ 5504 -v "HOST_OUT=$(HOST_OUT)" \ 5505 -v "TARGET_ARCH=$(TARGET_ARCH)" \ 5506 -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \ 5507 -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \ 5508 -v "FONT_OUT=$(SDK_FONT_TEMP)" \ 5509 -o $(PRIVATE_DIR) && \ 5510 cp -f $(target_notice_file_txt) \ 5511 $(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \ 5512 cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \ 5513 HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \ 5514 development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \ 5515 chmod -R ug+rwX $(PRIVATE_DIR) && \ 5516 cd $(dir $@) && zip -rqX $(notdir $@) $(PRIVATE_NAME) \ 5517 ) || ( rm -rf $(PRIVATE_DIR) $@ && exit 44 ) 5518 5519 5520# Is a Windows SDK requested? If so, we need some definitions from here 5521# in order to find the Linux SDK used to create the Windows one. 5522MAIN_SDK_NAME := $(sdk_name) 5523MAIN_SDK_DIR := $(sdk_dir) 5524MAIN_SDK_ZIP := $(INTERNAL_SDK_TARGET) 5525ifneq ($(filter win_sdk winsdk-tools,$(MAKECMDGOALS)),) 5526include $(TOPDIR)development/build/tools/windows_sdk.mk 5527endif 5528 5529# ----------------------------------------------------------------- 5530# Findbugs 5531INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml 5532INTERNAL_FINDBUGS_HTML_TARGET := $(PRODUCT_OUT)/findbugs.html 5533$(INTERNAL_FINDBUGS_XML_TARGET): $(ALL_FINDBUGS_FILES) 5534 @echo UnionBugs: $@ 5535 $(hide) $(FINDBUGS_DIR)/unionBugs $(ALL_FINDBUGS_FILES) \ 5536 > $@ 5537$(INTERNAL_FINDBUGS_HTML_TARGET): $(INTERNAL_FINDBUGS_XML_TARGET) 5538 @echo ConvertXmlToText: $@ 5539 $(hide) $(FINDBUGS_DIR)/convertXmlToText -html:fancy.xsl \ 5540 $(INTERNAL_FINDBUGS_XML_TARGET) > $@ 5541 5542# ----------------------------------------------------------------- 5543# Findbugs 5544 5545# ----------------------------------------------------------------- 5546# These are some additional build tasks that need to be run. 5547ifneq ($(dont_bother),true) 5548include $(sort $(wildcard $(BUILD_SYSTEM)/tasks/*.mk)) 5549-include $(sort $(wildcard vendor/*/build/tasks/*.mk)) 5550-include $(sort $(wildcard device/*/build/tasks/*.mk)) 5551-include $(sort $(wildcard product/*/build/tasks/*.mk)) 5552# Also the project-specific tasks 5553-include $(sort $(wildcard vendor/*/*/build/tasks/*.mk)) 5554-include $(sort $(wildcard device/*/*/build/tasks/*.mk)) 5555-include $(sort $(wildcard product/*/*/build/tasks/*.mk)) 5556# Also add test specifc tasks 5557include $(sort $(wildcard platform_testing/build/tasks/*.mk)) 5558include $(sort $(wildcard test/vts/tools/build/tasks/*.mk)) 5559endif 5560 5561include $(BUILD_SYSTEM)/product-graph.mk 5562 5563# ----------------------------------------------------------------- 5564# Create SDK repository packages. Must be done after tasks/* since 5565# we need the addon rules defined. 5566ifneq ($(sdk_repo_goal),) 5567include $(TOPDIR)development/build/tools/sdk_repo.mk 5568endif 5569 5570# ----------------------------------------------------------------- 5571# Soong generates the list of all shared libraries that are depended on by fuzz 5572# targets. It saves this list as a source:destination pair to 5573# FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS, where the source is the path to the 5574# build of the unstripped shared library, and the destination is the 5575# /data/fuzz/$ARCH/lib (for device) or /fuzz/$ARCH/lib (for host) directory 5576# where fuzz target shared libraries are to be "reinstalled". The 5577# copy-many-files below generates the rules to copy the unstripped shared 5578# libraries to the device or host "reinstallation" directory. These rules are 5579# depended on by each module in soong_cc_prebuilt.mk, where the module will have 5580# a dependency on each shared library that it needs to be "reinstalled". 5581FUZZ_SHARED_DEPS := $(call copy-many-files,$(strip $(FUZZ_TARGET_SHARED_DEPS_INSTALL_PAIRS))) 5582 5583# ----------------------------------------------------------------- 5584# The rule to build all fuzz targets, and package them. 5585# Note: The packages are created in Soong, and in a perfect world, 5586# we'd be able to create the phony rule there. But, if we want to 5587# have dist goals for the fuzz target, we need to have the PHONY 5588# target defined in make. MakeVarsContext.DistForGoal doesn't take 5589# into account that a PHONY rule create by Soong won't be available 5590# during make, and such will fail with `writing to readonly 5591# directory`, because kati will see 'haiku' as being a file, not a 5592# phony target. 5593.PHONY: haiku 5594haiku: $(SOONG_FUZZ_PACKAGING_ARCH_MODULES) $(ALL_FUZZ_TARGETS) 5595$(call dist-for-goals,haiku,$(SOONG_FUZZ_PACKAGING_ARCH_MODULES)) 5596 5597# ----------------------------------------------------------------- 5598# The makefile for haiku line coverage. 5599include $(BUILD_SYSTEM)/line_coverage.mk 5600