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