From cfb917a1c79e53c4c2b3f3c19f7f760f14233bf0 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 7 May 2020 14:58:20 -0700 Subject: [PATCH] Add vendor_dlkm partition. Test: define vendor_dlkm for CF. Bug: 156020364 Change-Id: I459059e1c20df7a285a377b8b3bbc8decc60b124 --- core/Makefile | 149 +++++++++++++++++- core/board_config.mk | 37 +++++ core/config.mk | 9 +- core/envsetup.mk | 36 +++++ core/main.mk | 11 +- core/product.mk | 3 + core/product_config.mk | 1 + core/soong_config.mk | 2 + core/tasks/vendor_module_check.mk | 4 +- help.sh | 4 +- target/product/mainline_system_arm64.mk | 1 + target/product/mainline_system_x86.mk | 1 + target/product/mainline_system_x86_64.mk | 1 + target/product/mainline_system_x86_arm.mk | 1 + tools/fs_config/Android.mk | 54 ++++++- tools/releasetools/add_img_to_target_files.py | 29 +++- tools/releasetools/build_image.py | 27 ++++ .../releasetools/check_target_files_vintf.py | 1 + tools/releasetools/common.py | 14 +- tools/releasetools/merge_target_files.py | 2 + tools/releasetools/ota_from_target_files.py | 8 +- 21 files changed, 379 insertions(+), 16 deletions(-) diff --git a/core/Makefile b/core/Makefile index 5aad7991d..15e073ceb 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1177,7 +1177,14 @@ ifeq ($(TARGET_USERIMAGES_USE_F2FS),true) INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) endif -ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),) +ifneq ($(filter \ + $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) \ + $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE) \ + $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) \ + $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) \ + $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE) \ + $(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE) \ + ,squashfs),) INTERNAL_USERIMAGES_DEPS += $(MKSQUASHFSUSERIMG) endif @@ -1207,7 +1214,7 @@ endif endif # PRODUCT_USE_DYNAMIC_PARTITIONS # $(1): the path of the output dictionary file -# $(2): a subset of "system vendor cache userdata product system_ext oem odm" +# $(2): a subset of "system vendor cache userdata product system_ext oem odm vendor_dlkm" # $(3): additional "key=value" pairs to append to the dictionary file. define generate-image-prop-dictionary $(if $(filter $(2),system),\ @@ -1303,6 +1310,20 @@ $(if $(filter $(2),odm),\ $(hide) echo "odm_selinux_fc=$(SELINUX_FC)" >> $(1) $(hide) echo "building_odm_image=$(BUILDING_ODM_IMAGE)" >> $(1) ) +$(if $(filter $(2),vendor_dlkm),\ + $(if $(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_dlkm_fs_type=$(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_dlkm_extfs_inode_count=$(BOARD_VENDOR_DLKMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_dlkm_extfs_rsv_pct=$(BOARD_VENDOR_DLKMIMAGE_EXTFS_RSV_PCT)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE),$(hide) echo "vendor_dlkm_size=$(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_dlkm_journal_size=$(BOARD_VENDOR_DLKMIMAGE_JOURNAL_SIZE)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_dlkm_squashfs_compressor=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_dlkm_squashfs_compressor_opt=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_dlkm_squashfs_block_size=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_dlkm_squashfs_disable_4k_align=$(BOARD_VENDOR_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) + $(if $(BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_dlkm_reserved_size=$(BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) + $(hide) echo "vendor_dlkm_selinux_fc=$(SELINUX_FC)" >> $(1) + $(hide) echo "building_vendor_dlkm_image=$(BUILDING_VENDOR_DLKM_IMAGE)" >> $(1) +) $(if $(filter $(2),oem),\ $(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1)) $(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1)) @@ -1329,6 +1350,7 @@ $(if $(PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device $(if $(PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1)) $(if $(PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1)) $(if $(PRODUCT_SYSTEM_EXT_VERITY_PARTITION),$(hide) echo "system_ext_verity_block_device=$(PRODUCT_SYSTEM_EXT_VERITY_PARTITION)" >> $(1)) +$(if $(PRODUCT_VENDOR_DLKM_VERITY_PARTITION),$(hide) echo "vendor_dlkm_verity_block_device=$(PRODUCT_VENDOR_DLKM_VERITY_PARTITION)" >> $(1)) $(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCT_SUPPORTS_VBOOT)" >> $(1)) $(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCT_VBOOT_SIGNING_KEY)" >> $(1)) $(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1)) @@ -1377,6 +1399,14 @@ $(if $(BOARD_AVB_ENABLE),\ $(hide) echo "avb_odm_key_path=$(BOARD_AVB_ODM_KEY_PATH)" >> $(1) $(hide) echo "avb_odm_algorithm=$(BOARD_AVB_ODM_ALGORITHM)" >> $(1) $(hide) echo "avb_odm_rollback_index_location=$(BOARD_AVB_ODM_ROLLBACK_INDEX_LOCATION)" >> $(1))) +$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_vendor_dlkm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) +$(if $(BOARD_AVB_ENABLE),\ + $(hide) echo "avb_vendor_dlkm_add_hashtree_footer_args=$(BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) +$(if $(BOARD_AVB_ENABLE),\ + $(if $(BOARD_AVB_VENDOR_DLKM_KEY_PATH),\ + $(hide) echo "avb_vendor_dlkm_key_path=$(BOARD_AVB_VENDOR_DLKM_KEY_PATH)" >> $(1) + $(hide) echo "avb_vendor_dlkm_algorithm=$(BOARD_AVB_VENDOR_DLKM_ALGORITHM)" >> $(1) + $(hide) echo "avb_vendor_dlkm_rollback_index_location=$(BOARD_AVB_VENDOR_DLKM_ROLLBACK_INDEX_LOCATION)" >> $(1))) $(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\ $(hide) echo "recovery_as_boot=true" >> $(1)) $(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\ @@ -1414,6 +1444,9 @@ endif ifdef BUILDING_ODM_IMAGE PROP_DICTIONARY_IMAGES += odm endif +ifdef BUILDING_VENDOR_DLKM_IMAGE + PROP_DICTIONARY_IMAGES += vendor_dlkm +endif define generate-userimage-prop-dictionary $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2)) endef @@ -2406,6 +2439,9 @@ endif ifdef BUILDING_ODM_IMAGE echo "-D $(TARGET_OUT_ODM)" >> $@.lst endif +ifdef BUILDING_VENDOR_DLKM_IMAGE + echo "-D $(TARGET_OUT_VENDOR_DLKM)" >> $@.lst +endif ifneq ($(PDK_PLATFORM_JAVA_ZIP_CONTENTS),) echo "-C $(OUT_DIR)" >> $@.lst for f in $(filter-out $(PRIVATE_DEX_FILES),$(addprefix -f $(OUT_DIR)/,$(PDK_PLATFORM_JAVA_ZIP_CONTENTS))); do \ @@ -2872,6 +2908,61 @@ INSTALLED_ODMIMAGE_TARGET := $(PRODUCT_OUT)/odm.img $(eval $(call copy-one-file,$(BOARD_PREBUILT_ODMIMAGE),$(INSTALLED_ODMIMAGE_TARGET))) endif +# ----------------------------------------------------------------- +# vendor_dlkm partition image +ifdef BUILDING_VENDOR_DLKM_IMAGE +INTERNAL_VENDOR_DLKMIMAGE_FILES := \ + $(filter $(TARGET_OUT_VENDOR_DLKM)/%,\ + $(ALL_DEFAULT_INSTALLED_MODULES)\ + $(ALL_PDK_FUSION_FILES)) \ + $(PDK_FUSION_SYMLINK_STAMP) +# platform.zip depends on $(INTERNAL_VENDOR_DLKMIMAGE_FILES). +$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_VENDOR_DLKMIMAGE_FILES) + +INSTALLED_FILES_FILE_VENDOR_DLKM := $(PRODUCT_OUT)/installed-files-vendor_dlkm.txt +INSTALLED_FILES_JSON_VENDOR_DLKM := $(INSTALLED_FILES_FILE_VENDOR_DLKM:.txt=.json) +$(INSTALLED_FILES_FILE_VENDOR_DLKM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR_DLKM) +$(INSTALLED_FILES_FILE_VENDOR_DLKM) : $(INTERNAL_VENDOR_DLKMIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) + @echo Installed file list: $@ + @mkdir -p $(dir $@) + @rm -f $@ + $(hide) $(FILESLIST) $(TARGET_OUT_VENDOR_DLKM) > $(@:.txt=.json) + $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ + +vendor_dlkmimage_intermediates := \ + $(call intermediates-dir-for,PACKAGING,vendor_dlkm) +BUILT_VENDOR_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/vendor_dlkm.img +define build-vendor_dlkmimage-target + $(call pretty,"Target vendor_dlkm fs image: $(INSTALLED_VENDOR_DLKMIMAGE_TARGET)") + @mkdir -p $(TARGET_OUT_VENDOR_DLKM) + @mkdir -p $(vendor_dlkmimage_intermediates) && rm -rf $(vendor_dlkmimage_intermediates)/vendor_dlkm_image_info.txt + $(call generate-userimage-prop-dictionary, $(vendor_dlkmimage_intermediates)/vendor_dlkm_image_info.txt, skip_fsck=true) + PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ + $(BUILD_IMAGE) \ + $(TARGET_OUT_VENDOR_DLKM) $(vendor_dlkmimage_intermediates)/vendor_dlkm_image_info.txt \ + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) $(TARGET_OUT) + $(call assert-max-image-size,$(INSTALLED_VENDOR_DLKMIMAGE_TARGET),$(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE)) +endef + +# We just build this directly to the install location. +INSTALLED_VENDOR_DLKMIMAGE_TARGET := $(BUILT_VENDOR_DLKMIMAGE_TARGET) +$(INSTALLED_VENDOR_DLKMIMAGE_TARGET): \ + $(INTERNAL_USERIMAGES_DEPS) \ + $(INTERNAL_VENDOR_DLKMIMAGE_FILES) \ + $(INSTALLED_FILES_FILE_VENDOR_DLKM) + $(build-vendor_dlkmimage-target) + +.PHONY: vendor_dlkmimage-nodeps vdnod +vendor_dlkmimage-nodeps vdnod: | $(INTERNAL_USERIMAGES_DEPS) + $(build-vendor_dlkmimage-target) + +sync: $(INTERNAL_VENDOR_DLKMIMAGE_FILES) + +else ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE +INSTALLED_VENDOR_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/vendor_dlkm.img +$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDOR_DLKMIMAGE),$(INSTALLED_VENDOR_DLKMIMAGE_TARGET))) +endif + # ----------------------------------------------------------------- # dtbo image ifdef BOARD_PREBUILT_DTBOIMAGE @@ -3028,6 +3119,10 @@ BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \ --prop com.android.build.odm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ --prop com.android.build.odm.os_version:$(PLATFORM_VERSION) +BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += \ + --prop com.android.build.vendor_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ + --prop com.android.build.vendor_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE) + BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \ --prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) @@ -3047,6 +3142,11 @@ BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS += \ --prop com.android.build.odm.security_patch:$(ODM_SECURITY_PATCH) endif +ifdef VENDOR_DLKM_SECURITY_PATCH +BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += \ + --prop com.android.build.vendor_dlkm.security_patch:$(VENDOR_DLKM_SECURITY_PATCH) +endif + BOOT_FOOTER_ARGS := BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS VENDOR_BOOT_FOOTER_ARGS := BOARD_AVB_VENDOR_BOOT_ADD_HASH_FOOTER_ARGS DTBO_FOOTER_ARGS := BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS @@ -3056,6 +3156,7 @@ RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS SYSTEM_EXT_FOOTER_ARGS := BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS +VENDOR_DLKM_FOOTER_ARGS := BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS # Helper function that checks and sets required build variables for an AVB chained partition. # $(1): the partition to enable AVB chain, e.g., boot or system or vbmeta_system. @@ -3150,6 +3251,10 @@ ifdef INSTALLED_ODMIMAGE_TARGET $(eval $(call check-and-set-avb-args,odm)) endif +ifdef INSTALLED_VENDOR_DLKMIMAGE_TARGET +$(eval $(call check-and-set-avb-args,vendor_dlkm)) +endif + ifdef INSTALLED_DTBOIMAGE_TARGET $(eval $(call check-and-set-avb-args,dtbo)) endif @@ -3230,6 +3335,9 @@ define extract-avb-chain-public-keys $(if $(BOARD_AVB_ODM_KEY_PATH),\ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \ --output $(1)/odm.avbpubkey) + $(if $(BOARD_AVB_VENDOR_DLKM_KEY_PATH),\ + $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_VENDOR_DLKM_KEY_PATH) \ + --output $(1)/vendor_dlkm.avbpubkey) $(if $(BOARD_AVB_DTBO_KEY_PATH),\ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \ --output $(1)/dtbo.avbpubkey) @@ -3312,6 +3420,7 @@ $(INSTALLED_VBMETAIMAGE_TARGET): \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ $(INSTALLED_DTBOIMAGE_TARGET) \ $(INSTALLED_CUSTOMIMAGES_TARGET) \ $(INSTALLED_RECOVERYIMAGE_TARGET) \ @@ -3334,7 +3443,9 @@ endif # BOARD_AVB_ENABLE # ----------------------------------------------------------------- # Check VINTF of build +# Note: vendor_dlkm does not have VINTF files. ifeq (,$(TARGET_BUILD_UNBUNDLED)) + intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all) check_vintf_all_deps := @@ -4119,6 +4230,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_VBMETAIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ $(INSTALLED_DTBOIMAGE_TARGET) \ $(INSTALLED_CUSTOMIMAGES_TARGET) \ $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \ @@ -4134,6 +4246,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(PRODUCT_PRODUCT_BASE_FS_PATH) \ $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \ $(PRODUCT_ODM_BASE_FS_PATH) \ + $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH) \ $(LPMAKE) \ $(SELINUX_FC) \ $(INSTALLED_MISC_INFO_TARGET) \ @@ -4271,6 +4384,11 @@ ifdef BUILDING_ODM_IMAGE $(hide) $(call package_files-copy-root, \ $(TARGET_OUT_ODM),$(zip_root)/ODM) endif +ifdef BUILDING_VENDOR_DLKM_IMAGE + @# Contents of the vendor_dlkm image + $(hide) $(call package_files-copy-root, \ + $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM) +endif ifdef BUILDING_SYSTEM_OTHER_IMAGE @# Contents of the system_other image $(hide) $(call package_files-copy-root, \ @@ -4316,6 +4434,10 @@ ifneq ($(PRODUCT_ODM_BASE_FS_PATH),) $(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \ $(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH)) endif +ifneq ($(PRODUCT_VENDOR_DLKM_BASE_FS_PATH),) + $(hide) cp $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH) \ + $(zip_root)/META/$(notdir $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH)) +endif ifeq ($(TARGET_OTA_ALLOW_NON_AB),true) ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \ @@ -4361,6 +4483,10 @@ ifdef BOARD_PREBUILT_ODMIMAGE $(hide) mkdir -p $(zip_root)/IMAGES $(hide) cp $(INSTALLED_ODMIMAGE_TARGET) $(zip_root)/IMAGES/ endif +ifdef BOARD_PREBUILT_VENDOR_DLKIMMAGE + $(hide) mkdir -p $(zip_root)/IMAGES + $(hide) cp $(INSTALLED_VENDOR_DLKIMMAGE_TARGET) $(zip_root)/IMAGES/ +endif ifdef BOARD_PREBUILT_DTBOIMAGE $(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES $(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/ @@ -4391,6 +4517,9 @@ ifdef BUILDING_SYSTEM_EXT_IMAGE endif ifdef BUILDING_ODM_IMAGE $(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt +endif +ifdef BUILDING_VENDOR_DLKM_IMAGE + $(hide) $(call fs_config,$(zip_root)/VENDOR_DLKM,vendor_dlkm/) > $(zip_root)/META/vendor_dlkm_filesystem_config.txt endif @# ROOT always contains the files for the root under normal boot. $(hide) $(call fs_config,$(zip_root)/ROOT,) > $(zip_root)/META/root_filesystem_config.txt @@ -4550,6 +4679,7 @@ $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ $(updater_dep) endif $(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist @@ -4575,7 +4705,8 @@ $(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_VENDORIMAGE_TARGET) \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ - $(INSTALLED_ODMIMAGE_TARGET) + $(INSTALLED_ODMIMAGE_TARGET) \ + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) endif $(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist $(COVERAGE_ZIP): $(SOONG_ZIP) @@ -4652,6 +4783,7 @@ $(PROGUARD_DICT_ZIP): \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ $(updater_dep) endif $(PROGUARD_DICT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard)/filelist @@ -4890,6 +5022,17 @@ odmimage: $(INSTALLED_QEMU_ODMIMAGE) droidcore: $(INSTALLED_QEMU_ODMIMAGE) endif +ifdef INSTALLED_VENDOR_DLKMIMAGE_TARGET +INSTALLED_QEMU_VENDOR_DLKMIMAGE := $(PRODUCT_OUT)/vendor_dlkm-qemu.img +$(INSTALLED_QEMU_VENDOR_DLKMIMAGE): $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) + @echo Create vendor_dlkm-qemu.img + (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_VENDOR_DLKMIMAGE_TARGET)) + +vendor_dlkmimage: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE) +droidcore: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE) +endif + + QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto $(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(AVBTOOL) diff --git a/core/board_config.mk b/core/board_config.mk index a6e586d2e..70c15895e 100644 --- a/core/board_config.mk +++ b/core/board_config.mk @@ -72,12 +72,15 @@ _board_strip_readonly_list += \ BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE \ BOARD_ODMIMAGE_PARTITION_SIZE \ BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \ + BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE \ + BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE \ # Logical partitions related variables. _dynamic_partitions_var_list += \ BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \ BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \ BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \ + BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE \ BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \ BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE \ BOARD_SUPER_PARTITION_SIZE \ @@ -511,6 +514,40 @@ ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE endif .KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE +########################################### +# Now we can substitute with the real value of TARGET_COPY_OUT_VENDOR_DLKM +ifeq ($(TARGET_COPY_OUT_VENDOR_DLKM),$(_vendor_dlkm_path_placeholder)) + TARGET_COPY_OUT_VENDOR_DLKM := $(TARGET_COPY_OUT_VENDOR)/vendor_dlkm +else ifeq ($(filter vendor_dlkm system/vendor/vendor_dlkm vendor/vendor_dlkm,$(TARGET_COPY_OUT_VENDOR_DLKM)),) + $(error TARGET_COPY_OUT_VENDOR_DLKM must be either 'vendor_dlkm', 'system/vendor/vendor_dlkm' or 'vendor/vendor_dlkm', seeing '$(TARGET_COPY_OUT_VENDOR_DLKM)'.) +endif +PRODUCT_COPY_FILES := $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),$(PRODUCT_COPY_FILES)) + +BOARD_USES_VENDOR_DLKMIMAGE := +ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE + BOARD_USES_VENDOR_DLKMIMAGE := true +endif +ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE + BOARD_USES_VENDOR_DLKMIMAGE := true +endif +$(call check_image_config,vendor_dlkm) + +BUILDING_VENDOR_DLKM_IMAGE := +ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),) + ifdef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE + BUILDING_VENDOR_DLKM_IMAGE := true + endif +else ifeq ($(PRODUCT_BUILD_VENDOR_DLKM_IMAGE),true) + BUILDING_VENDOR_DLKM_IMAGE := true + ifndef BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE + $(error PRODUCT_BUILD_VENDOR_DLKM_IMAGE set to true, but BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE not defined) + endif +endif +ifdef BOARD_PREBUILT_VENDOR_DLKMIMAGE + BUILDING_VENDOR_DLKM_IMAGE := +endif +.KATI_READONLY := BUILDING_VENDOR_DLKM_IMAGE + ########################################### # Now we can substitute with the real value of TARGET_COPY_OUT_ODM ifeq ($(TARGET_COPY_OUT_ODM),$(_odm_path_placeholder)) diff --git a/core/config.mk b/core/config.mk index 5092e9023..2689d8032 100644 --- a/core/config.mk +++ b/core/config.mk @@ -930,6 +930,13 @@ $(error Should not define BOARD_ODMIMAGE_PARTITION_SIZE and \ endif endif +ifneq ($(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE),) +ifneq ($(BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE),) +$(error Should not define BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE and \ + BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE together) +endif +endif + ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_SIZE),) ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),) $(error Should not define BOARD_PRODUCTIMAGE_PARTITION_SIZE and \ @@ -965,7 +972,7 @@ $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \ ) # BOARD_*_PARTITION_LIST: a list of the following tokens -valid_super_partition_list := system vendor product system_ext odm +valid_super_partition_list := system vendor product system_ext odm vendor_dlkm $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \ $(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \ $(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \ diff --git a/core/envsetup.mk b/core/envsetup.mk index 3aff0079c..1fb460588 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -253,6 +253,7 @@ _vendor_path_placeholder := ||VENDOR-PATH-PH|| _product_path_placeholder := ||PRODUCT-PATH-PH|| _system_ext_path_placeholder := ||SYSTEM_EXT-PATH-PH|| _odm_path_placeholder := ||ODM-PATH-PH|| +_vendor_dlkm_path_placeholder := ||VENDOR_DLKM-PATH-PH|| TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder) TARGET_COPY_OUT_VENDOR_RAMDISK := vendor-ramdisk TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder) @@ -261,6 +262,7 @@ TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder) TARGET_COPY_OUT_PRODUCT_SERVICES := $(_product_path_placeholder) TARGET_COPY_OUT_SYSTEM_EXT := $(_system_ext_path_placeholder) TARGET_COPY_OUT_ODM := $(_odm_path_placeholder) +TARGET_COPY_OUT_VENDOR_DLKM := $(_vendor_dlkm_path_placeholder) # Returns the non-sanitized version of the path provided in $1. define get_non_asan_path @@ -719,6 +721,40 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS_PRIVILEGED := $(TARGET_OUT_ODM_ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS \ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_APPS_PRIVILEGED +TARGET_OUT_VENDOR_DLKM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_DLKM) + +TARGET_OUT_VENDOR_DLKM_ETC := $(TARGET_OUT_VENDOR_DLKM)/etc +.KATI_READONLY := \ + TARGET_OUT_VENDOR_DLKM_ETC + +# Unlike other partitions, vendor_dlkm should only contain kernel modules. +TARGET_OUT_VENDOR_DLKM_EXECUTABLES := +TARGET_OUT_VENDOR_DLKM_OPTIONAL_EXECUTABLES := +TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES := +TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE := +TARGET_OUT_VENDOR_DLKM_JAVA_LIBRARIES := +TARGET_OUT_VENDOR_DLKM_APPS := +TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_EXECUTABLES := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED := +$(KATI_obsolete_var \ + TARGET_OUT_VENDOR_DLKM_EXECUTABLES \ + TARGET_OUT_VENDOR_DLKM_OPTIONAL_EXECUTABLES \ + TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES \ + TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE \ + TARGET_OUT_VENDOR_DLKM_JAVA_LIBRARIES \ + TARGET_OUT_VENDOR_DLKM_APPS \ + TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_EXECUTABLES \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_SHARED_LIBRARIES \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_RENDERSCRIPT_BITCODE \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED \ + , vendor_dlkm should not contain any executables, libraries, or apps) + TARGET_OUT_PRODUCT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT) TARGET_OUT_PRODUCT_EXECUTABLES := $(TARGET_OUT_PRODUCT)/bin .KATI_READONLY := TARGET_OUT_PRODUCT diff --git a/core/main.mk b/core/main.mk index c2287bbcc..835c7ab1c 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1141,7 +1141,8 @@ define resolve-product-relative-paths $(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),\ $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),\ $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),\ - $(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2))))))) + $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),\ + $(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2)))))))) endef # Returns modules included automatically as a result of certain BoardConfig @@ -1519,6 +1520,9 @@ systemextimage: $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) .PHONY: odmimage odmimage: $(INSTALLED_ODMIMAGE_TARGET) +.PHONY: vendor_dlkmimage +vendor_dlkmimage: $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) + .PHONY: systemotherimage systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) @@ -1556,6 +1560,7 @@ droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ $(INSTALLED_VENDOR_DEBUG_RAMDISK_TARGET) \ $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ @@ -1565,6 +1570,8 @@ droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ $(INSTALLED_FILES_JSON_VENDOR) \ $(INSTALLED_FILES_FILE_ODM) \ $(INSTALLED_FILES_JSON_ODM) \ + $(INSTALLED_FILES_FILE_VENDOR_DLKM) \ + $(INSTALLED_FILES_JSON_VENDOR_DLKM) \ $(INSTALLED_FILES_FILE_PRODUCT) \ $(INSTALLED_FILES_JSON_PRODUCT) \ $(INSTALLED_FILES_FILE_SYSTEM_EXT) \ @@ -1660,6 +1667,8 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(INSTALLED_FILES_JSON_VENDOR) \ $(INSTALLED_FILES_FILE_ODM) \ $(INSTALLED_FILES_JSON_ODM) \ + $(INSTALLED_FILES_FILE_VENDOR_DLKM) \ + $(INSTALLED_FILES_JSON_VENDOR_DLKM) \ $(INSTALLED_FILES_FILE_PRODUCT) \ $(INSTALLED_FILES_JSON_PRODUCT) \ $(INSTALLED_FILES_FILE_SYSTEM_EXT) \ diff --git a/core/product.mk b/core/product.mk index f531319ce..740563f3f 100644 --- a/core/product.mk +++ b/core/product.mk @@ -251,6 +251,7 @@ _product_single_value_vars += PRODUCT_VENDOR_VERITY_PARTITION _product_single_value_vars += PRODUCT_PRODUCT_VERITY_PARTITION _product_single_value_vars += PRODUCT_SYSTEM_EXT_VERITY_PARTITION _product_single_value_vars += PRODUCT_ODM_VERITY_PARTITION +_product_single_value_vars += PRODUCT_VENDOR_DLKM_VERITY_PARTITION _product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO _product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO @@ -278,6 +279,7 @@ _product_single_value_vars += PRODUCT_VENDOR_BASE_FS_PATH _product_single_value_vars += PRODUCT_PRODUCT_BASE_FS_PATH _product_single_value_vars += PRODUCT_SYSTEM_EXT_BASE_FS_PATH _product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH +_product_single_value_vars += PRODUCT_VENDOR_DLKM_BASE_FS_PATH # The first API level this product shipped with _product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL @@ -369,6 +371,7 @@ _product_single_value_vars += PRODUCT_BUILD_VENDOR_IMAGE _product_single_value_vars += PRODUCT_BUILD_PRODUCT_IMAGE _product_single_value_vars += PRODUCT_BUILD_SYSTEM_EXT_IMAGE _product_single_value_vars += PRODUCT_BUILD_ODM_IMAGE +_product_single_value_vars += PRODUCT_BUILD_VENDOR_DLKM_IMAGE _product_single_value_vars += PRODUCT_BUILD_CACHE_IMAGE _product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE _product_single_value_vars += PRODUCT_BUILD_USERDATA_IMAGE diff --git a/core/product_config.mk b/core/product_config.mk index 7a7c4b7e2..d614e107c 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -399,6 +399,7 @@ $(foreach image, \ PRODUCT \ SYSTEM_EXT \ ODM \ + VENDOR_DLKM \ CACHE \ RAMDISK \ USERDATA \ diff --git a/core/soong_config.mk b/core/soong_config.mk index bc0dc6e07..c7bf61e3f 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -155,6 +155,7 @@ $(call add_json_bool, Uml, $(filter true,$(TARGET_ $(call add_json_bool, Use_lmkd_stats_log, $(filter true,$(TARGET_LMKD_STATS_LOG))) $(call add_json_str, VendorPath, $(TARGET_COPY_OUT_VENDOR)) $(call add_json_str, OdmPath, $(TARGET_COPY_OUT_ODM)) +$(call add_json_str, VendorDlkmPath, $(TARGET_COPY_OUT_VENDOR_DLKM)) $(call add_json_str, ProductPath, $(TARGET_COPY_OUT_PRODUCT)) $(call add_json_str, SystemExtPath, $(TARGET_COPY_OUT_SYSTEM_EXT)) $(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))) @@ -172,6 +173,7 @@ $(call add_json_list, PgoAdditionalProfileDirs, $(PGO_ADDITIONAL_PROFIL $(call add_json_list, BoardVendorSepolicyDirs, $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_SEPOLICY_DIRS)) $(call add_json_list, BoardOdmSepolicyDirs, $(BOARD_ODM_SEPOLICY_DIRS)) +$(call add_json_list, BoardVendorDlkmSepolicyDirs, $(BOARD_VENDOR_DLKM_SEPOLICY_DIRS)) $(call add_json_list, BoardPlatPublicSepolicyDirs, $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR)) $(call add_json_list, BoardPlatPrivateSepolicyDirs, $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR)) $(call add_json_list, BoardSepolicyM4Defs, $(BOARD_SEPOLICY_M4DEFS)) diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk index b4c5a3bc6..89a34d6f6 100644 --- a/core/tasks/vendor_module_check.mk +++ b/core/tasks/vendor_module_check.mk @@ -108,10 +108,10 @@ ifneq (,$(filter path all, $(_restrictions))) $(foreach m, $(_vendor_check_modules), \ $(if $(filter-out ,$(ALL_MODULES.$(m).INSTALLED)),\ - $(if $(filter $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_ODM)/% $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED)),,\ + $(if $(filter $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_ODM)/% $(TARGET_OUT_VENDOR_DLKM)/% $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED)),,\ $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) \ in product "$(TARGET_PRODUCT)" being installed to \ - $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor tree or odm tree)))) + $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor, odm or vendor_dlkm tree)))) endif diff --git a/help.sh b/help.sh index b02b14cfd..37018f78c 100755 --- a/help.sh +++ b/help.sh @@ -43,7 +43,9 @@ Common goals are: senod Quickly rebuild the system_ext image from built packages Stands for "SystemExt, NO Dependencies" onod Quickly rebuild the odm image from built packages - Stands for "ODM, NO Dependencies" + Stands for "Odm, NO Dependencies" + vdnod Quickly rebuild the vendor_dlkm image from built packages + Stands for "VendorDlkm, NO Dependencies" So, for example, you could run: diff --git a/target/product/mainline_system_arm64.mk b/target/product/mainline_system_arm64.mk index 60035c13e..e536e5550 100644 --- a/target/product/mainline_system_arm64.mk +++ b/target/product/mainline_system_arm64.mk @@ -26,6 +26,7 @@ PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true PRODUCT_BUILD_CACHE_IMAGE := false PRODUCT_BUILD_ODM_IMAGE := false +PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false PRODUCT_BUILD_PRODUCT_IMAGE := false PRODUCT_BUILD_RAMDISK_IMAGE := false PRODUCT_BUILD_SYSTEM_IMAGE := true diff --git a/target/product/mainline_system_x86.mk b/target/product/mainline_system_x86.mk index a30a1fcb4..484ae3076 100644 --- a/target/product/mainline_system_x86.mk +++ b/target/product/mainline_system_x86.mk @@ -25,6 +25,7 @@ PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true PRODUCT_BUILD_CACHE_IMAGE := false PRODUCT_BUILD_ODM_IMAGE := false +PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false PRODUCT_BUILD_PRODUCT_IMAGE := false PRODUCT_BUILD_RAMDISK_IMAGE := false PRODUCT_BUILD_SYSTEM_IMAGE := true diff --git a/target/product/mainline_system_x86_64.mk b/target/product/mainline_system_x86_64.mk index 473ff7236..ad31f81c0 100644 --- a/target/product/mainline_system_x86_64.mk +++ b/target/product/mainline_system_x86_64.mk @@ -26,6 +26,7 @@ PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true PRODUCT_BUILD_CACHE_IMAGE := false PRODUCT_BUILD_ODM_IMAGE := false +PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false PRODUCT_BUILD_PRODUCT_IMAGE := false PRODUCT_BUILD_RAMDISK_IMAGE := false PRODUCT_BUILD_SYSTEM_IMAGE := true diff --git a/target/product/mainline_system_x86_arm.mk b/target/product/mainline_system_x86_arm.mk index 2e01cde76..24f1ad70e 100644 --- a/target/product/mainline_system_x86_arm.mk +++ b/target/product/mainline_system_x86_arm.mk @@ -25,6 +25,7 @@ PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := true PRODUCT_BUILD_CACHE_IMAGE := false PRODUCT_BUILD_ODM_IMAGE := false +PRODUCT_BUILD_VENDOR_DLKM_IMAGE := false PRODUCT_BUILD_PRODUCT_IMAGE := false PRODUCT_BUILD_RAMDISK_IMAGE := false PRODUCT_BUILD_SYSTEM_IMAGE := true diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk index 64fabe62f..60b51b613 100644 --- a/tools/fs_config/Android.mk +++ b/tools/fs_config/Android.mk @@ -27,11 +27,12 @@ endif system_android_filesystem_config := system/core/include/private/android_filesystem_config.h system_capability_header := bionic/libc/kernel/uapi/linux/capability.h -# List of supported vendor, oem, odm, product and system_ext Partitions +# List of supported vendor, oem, odm, vendor_dlkm, product and system_ext Partitions fs_config_generate_extra_partition_list := $(strip \ $(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),vendor) \ $(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),oem) \ $(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),odm) \ + $(if $(BOARD_USES_VENDOR_DLKMIMAGE)$(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE),vendor_dlkm) \ $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),product) \ $(if $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE),system_ext) \ ) @@ -282,6 +283,57 @@ $(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_G endif +ifneq ($(filter vendor_dlkm,$(fs_config_generate_extra_partition_list)),) +################################## +# Generate the vendor_dlkm/etc/fs_config_dirs binary file for the target +# Add fs_config_dirs or fs_config_dirs_vendor_dlkm to PRODUCT_PACKAGES in +# the device make file to enable +include $(CLEAR_VARS) + +LOCAL_MODULE := fs_config_dirs_vendor_dlkm +LOCAL_MODULE_CLASS := ETC +LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_DLKM)/etc +include $(BUILD_SYSTEM)/base_rules.mk +$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config) +$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(system_capability_header) +$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN) +$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) $(system_capability_header) + @mkdir -p $(dir $@) + $< fsconfig \ + --aid-header $(PRIVATE_ANDROID_FS_HDR) \ + --capability-header $(PRIVATE_ANDROID_CAP_HDR) \ + --partition vendor_dlkm \ + --dirs \ + --out_file $@ \ + $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null) + +################################## +# Generate the vendor_dlkm/etc/fs_config_files binary file for the target +# Add fs_config_files of fs_config_files_vendor_dlkm to PRODUCT_PACKAGES in +# the device make file to enable +include $(CLEAR_VARS) + +LOCAL_MODULE := fs_config_files_vendor_dlkm +LOCAL_MODULE_CLASS := ETC +LOCAL_INSTALLED_MODULE_STEM := fs_config_files +LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_DLKM)/etc +include $(BUILD_SYSTEM)/base_rules.mk +$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config) +$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(system_capability_header) +$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN) +$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) $(system_capability_header) + @mkdir -p $(dir $@) + $< fsconfig \ + --aid-header $(PRIVATE_ANDROID_FS_HDR) \ + --capability-header $(PRIVATE_ANDROID_CAP_HDR) \ + --partition vendor_dlkm \ + --files \ + --out_file $@ \ + $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null) + +endif + ifneq ($(filter product,$(fs_config_generate_extra_partition_list)),) ################################## # Generate the product/etc/fs_config_dirs binary file for the target diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index 723fe94b3..284c89adb 100644 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -281,6 +281,22 @@ def AddOdm(output_zip): return img.name +def AddVendorDlkm(output_zip): + """Turn the contents of VENDOR_DLKM into an vendor_dlkm image and store it in output_zip.""" + + img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "vendor_dlkm.img") + if os.path.exists(img.name): + logger.info("vendor_dlkm.img already exists; no need to rebuild...") + return img.name + + block_list = OutputFile( + output_zip, OPTIONS.input_tmp, "IMAGES", "vendor_dlkm.map") + CreateImage( + OPTIONS.input_tmp, OPTIONS.info_dict, "vendor_dlkm", img, + block_list=block_list) + return img.name + + def AddDtbo(output_zip): """Adds the DTBO image. @@ -736,7 +752,7 @@ def AddImagesToTargetFiles(filename): has_boot = OPTIONS.info_dict.get("no_boot") != "true" has_vendor_boot = OPTIONS.info_dict.get("vendor_boot") == "true" - # {vendor,odm,product,system_ext}.img are unlike system.img or + # {vendor,odm,product,system_ext,vendor_dlkm}.img are unlike system.img or # system_other.img. Because it could be built from source, or dropped into # target_files.zip as a prebuilt blob. We consider either of them as # {vendor,product,system_ext}.img being available, which could be @@ -749,6 +765,13 @@ def AddImagesToTargetFiles(filename): OPTIONS.info_dict.get("building_odm_image") == "true") or os.path.exists( os.path.join(OPTIONS.input_tmp, "IMAGES", "odm.img"))) + has_vendor_dlkm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, + "VENDOR_DLKM")) and + OPTIONS.info_dict.get("building_vendor_dlkm_image") + == "true") or + os.path.exists( + os.path.join(OPTIONS.input_tmp, "IMAGES", + "vendor_dlkm.img"))) has_product = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, "PRODUCT")) and OPTIONS.info_dict.get("building_product_image") == "true") or os.path.exists( @@ -874,6 +897,10 @@ def AddImagesToTargetFiles(filename): banner("odm") partitions['odm'] = AddOdm(output_zip) + if has_vendor_dlkm: + banner("vendor_dlkm") + partitions['vendor_dlkm'] = AddVendorDlkm(output_zip) + if has_system_other: banner("system_other") AddSystemOther(output_zip) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py index 756734649..dbfb4851c 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -708,6 +708,29 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): d["extfs_rsv_pct"] = "0" copy_prop("odm_reserved_size", "partition_reserved_size") copy_prop("odm_selinux_fc", "selinux_fc") + elif mount_point == "vendor_dlkm": + copy_prop("avb_vendor_dlkm_hashtree_enable", "avb_hashtree_enable") + copy_prop("avb_vendor_dlkm_add_hashtree_footer_args", + "avb_add_hashtree_footer_args") + copy_prop("avb_vendor_dlkm_key_path", "avb_key_path") + copy_prop("avb_vendor_dlkm_algorithm", "avb_algorithm") + copy_prop("avb_vendor_dlkm_salt", "avb_salt") + copy_prop("vendor_dlkm_fs_type", "fs_type") + copy_prop("vendor_dlkm_size", "partition_size") + if not copy_prop("vendor_dlkm_journal_size", "journal_size"): + d["journal_size"] = "0" + copy_prop("vendor_dlkm_verity_block_device", "verity_block_device") + copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks") + copy_prop("vendor_dlkm_squashfs_compressor", "squashfs_compressor") + copy_prop("vendor_dlkm_squashfs_compressor_opt", "squashfs_compressor_opt") + copy_prop("vendor_dlkm_squashfs_block_size", "squashfs_block_size") + copy_prop("vendor_dlkm_squashfs_disable_4k_align", "squashfs_disable_4k_align") + copy_prop("vendor_dlkm_base_fs_file", "base_fs_file") + copy_prop("vendor_dlkm_extfs_inode_count", "extfs_inode_count") + if not copy_prop("vendor_dlkm_extfs_rsv_pct", "extfs_rsv_pct"): + d["extfs_rsv_pct"] = "0" + copy_prop("vendor_dlkm_reserved_size", "partition_reserved_size") + copy_prop("vendor_dlkm_selinux_fc", "selinux_fc") elif mount_point == "oem": copy_prop("fs_type", "fs_type") copy_prop("oem_size", "partition_size") @@ -752,6 +775,8 @@ def GlobalDictFromImageProp(image_prop, mount_point): copy_prop("partition_size", "vendor_size") elif mount_point == "odm": copy_prop("partition_size", "odm_size") + elif mount_point == "vendor_dlkm": + copy_prop("partition_size", "vendor_dlkm_size") elif mount_point == "product": copy_prop("partition_size", "product_size") elif mount_point == "system_ext": @@ -791,6 +816,8 @@ def main(argv): mount_point = "vendor" elif image_filename == "odm.img": mount_point = "odm" + elif image_filename == "vendor_dlkm.img": + mount_point = "vendor_dlkm" elif image_filename == "oem.img": mount_point = "oem" elif image_filename == "product.img": diff --git a/tools/releasetools/check_target_files_vintf.py b/tools/releasetools/check_target_files_vintf.py index 95d09cc17..79005df4d 100755 --- a/tools/releasetools/check_target_files_vintf.py +++ b/tools/releasetools/check_target_files_vintf.py @@ -46,6 +46,7 @@ DIR_SEARCH_PATHS = { '/product': ('PRODUCT', 'SYSTEM/product'), '/odm': ('ODM', 'VENDOR/odm', 'SYSTEM/vendor/odm'), '/system_ext': ('SYSTEM_EXT', 'SYSTEM/system_ext'), + # vendor_dlkm does not have VINTF files. } UNZIP_PATTERN = ['META/*', '*/build.prop'] diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 8bbc35e53..a26f9e409 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -110,13 +110,20 @@ SPECIAL_CERT_STRINGS = ("PRESIGNED", "EXTERNAL") # that system_other is not in the list because we don't want to include its # descriptor into vbmeta.img. AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'recovery', 'system', - 'system_ext', 'vendor', 'vendor_boot') + 'system_ext', 'vendor', 'vendor_boot', 'vendor_dlkm') # Chained VBMeta partitions. AVB_VBMETA_PARTITIONS = ('vbmeta_system', 'vbmeta_vendor') # Partitions that should have their care_map added to META/care_map.pb -PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product', 'system_ext', 'odm') +PARTITIONS_WITH_CARE_MAP = ( + 'system', + 'vendor', + 'product', + 'system_ext', + 'odm', + 'vendor_dlkm', +) class ErrorCode(object): @@ -655,7 +662,8 @@ def LoadInfoDict(input_file, repacking=False): input_file, "META", "root_filesystem_config.txt") # Redirect {partition}_base_fs_file for each of the named partitions. - for part_name in ["system", "vendor", "system_ext", "product", "odm"]: + for part_name in ["system", "vendor", "system_ext", "product", "odm", + "vendor_dlkm"]: key_name = part_name + "_base_fs_file" if key_name not in d: continue diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py index ed42b20d2..ad991caab 100755 --- a/tools/releasetools/merge_target_files.py +++ b/tools/releasetools/merge_target_files.py @@ -197,6 +197,7 @@ DEFAULT_VENDOR_ITEM_LIST = ( 'PREBUILT_IMAGES/*', 'RADIO/*', 'VENDOR/*', + 'VENDOR_DLKM/*', ) # VENDOR_EXTRACT_SPECIAL_ITEM_LIST is a list of items to extract from the @@ -223,6 +224,7 @@ SINGLE_BUILD_PARTITIONS = ( 'SYSTEM/', 'SYSTEM_OTHER/', 'VENDOR/', + 'VENDOR_DLKM/', ) diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 7fb0a7717..f114f6383 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -277,7 +277,8 @@ AB_PARTITIONS = 'META/ab_partitions.txt' UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'OTA/*', 'RADIO/*'] # Files to be unzipped for target diffing purpose. TARGET_DIFFING_UNZIP_PATTERN = ['BOOT', 'RECOVERY', 'SYSTEM/*', 'VENDOR/*', - 'PRODUCT/*', 'SYSTEM_EXT/*', 'ODM/*'] + 'PRODUCT/*', 'SYSTEM_EXT/*', 'ODM/*', + 'VENDOR_DLKM/*'] RETROFIT_DAP_UNZIP_PATTERN = ['OTA/super_*.img', AB_PARTITIONS] # Images to be excluded from secondary payload. We essentially only keep @@ -285,7 +286,7 @@ RETROFIT_DAP_UNZIP_PATTERN = ['OTA/super_*.img', AB_PARTITIONS] SECONDARY_PAYLOAD_SKIPPED_IMAGES = [ 'boot', 'dtbo', 'modem', 'odm', 'product', 'radio', 'recovery', 'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor', - 'vendor_boot'] + 'vendor_boot', 'vendor_dlkm'] class PayloadSigner(object): @@ -668,7 +669,8 @@ def GetBlockDifferences(target_zip, source_zip, target_info, source_info, assert blockimgdiff_version >= 3 block_diff_dict = collections.OrderedDict() - partition_names = ["system", "vendor", "product", "odm", "system_ext"] + partition_names = ["system", "vendor", "product", "odm", "system_ext", + "vendor_dlkm"] for partition in partition_names: if not HasPartition(target_zip, partition): continue