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