diff --git a/core/Makefile b/core/Makefile index 2550c0e5e..1e273865c 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1205,6 +1205,7 @@ ifneq ($(filter \ $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) \ $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE) \ $(BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE) \ + $(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE) \ ,squashfs),) INTERNAL_USERIMAGES_DEPS += $(MKSQUASHFSUSERIMG) endif @@ -1235,7 +1236,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 vendor_dlkm" +# $(2): a subset of "system vendor cache userdata product system_ext oem odm vendor_dlkm odm_dlkm" # $(3): additional "key=value" pairs to append to the dictionary file. define generate-image-prop-dictionary $(if $(filter $(2),system),\ @@ -1345,6 +1346,20 @@ $(if $(filter $(2),vendor_dlkm),\ $(hide) echo "vendor_dlkm_selinux_fc=$(SELINUX_FC)" >> $(1) $(hide) echo "building_vendor_dlkm_image=$(BUILDING_VENDOR_DLKM_IMAGE)" >> $(1) ) +$(if $(filter $(2),odm_dlkm),\ + $(if $(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_dlkm_fs_type=$(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "odm_dlkm_extfs_inode_count=$(BOARD_ODM_DLKMIMAGE_EXTFS_INODE_COUNT)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_EXTFS_RSV_PCT),$(hide) echo "odm_dlkm_extfs_rsv_pct=$(BOARD_ODM_DLKMIMAGE_EXTFS_RSV_PCT)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE),$(hide) echo "odm_dlkm_size=$(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_JOURNAL_SIZE),$(hide) echo "odm_dlkm_journal_size=$(BOARD_ODM_DLKMIMAGE_JOURNAL_SIZE)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "odm_dlkm_squashfs_compressor=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "odm_dlkm_squashfs_compressor_opt=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "odm_dlkm_squashfs_block_size=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_dlkm_squashfs_disable_4k_align=$(BOARD_ODM_DLKMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1)) + $(if $(BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_dlkm_reserved_size=$(BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1)) + $(hide) echo "odm_dlkm_selinux_fc=$(SELINUX_FC)" >> $(1) + $(hide) echo "building_odm_dlkm_image=$(BUILDING_ODM_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)) @@ -1372,6 +1387,7 @@ $(if $(PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device $(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_ODM_DLKM_VERITY_PARTITION),$(hide) echo "odm_dlkm_verity_block_device=$(PRODUCT_ODM_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)) @@ -1428,6 +1444,14 @@ $(if $(BOARD_AVB_ENABLE),\ $(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 $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_dlkm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1)) +$(if $(BOARD_AVB_ENABLE),\ + $(hide) echo "avb_odm_dlkm_add_hashtree_footer_args=$(BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1)) +$(if $(BOARD_AVB_ENABLE),\ + $(if $(BOARD_AVB_ODM_DLKM_KEY_PATH),\ + $(hide) echo "avb_odm_dlkm_key_path=$(BOARD_AVB_ODM_DLKM_KEY_PATH)" >> $(1) + $(hide) echo "avb_odm_dlkm_algorithm=$(BOARD_AVB_ODM_DLKM_ALGORITHM)" >> $(1) + $(hide) echo "avb_odm_dlkm_rollback_index_location=$(BOARD_AVB_ODM_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)),\ @@ -1468,6 +1492,9 @@ endif ifdef BUILDING_VENDOR_DLKM_IMAGE PROP_DICTIONARY_IMAGES += vendor_dlkm endif +ifdef BUILDING_ODM_DLKM_IMAGE + PROP_DICTIONARY_IMAGES += odm_dlkm +endif define generate-userimage-prop-dictionary $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2)) endef @@ -2463,6 +2490,9 @@ endif ifdef BUILDING_VENDOR_DLKM_IMAGE echo "-D $(TARGET_OUT_VENDOR_DLKM)" >> $@.lst endif +ifdef BUILDING_ODM_DLKM_IMAGE + echo "-D $(TARGET_OUT_ODM_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 \ @@ -3013,6 +3043,62 @@ INSTALLED_VENDOR_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/vendor_dlkm.img $(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDOR_DLKMIMAGE),$(INSTALLED_VENDOR_DLKMIMAGE_TARGET))) endif +# ----------------------------------------------------------------- +# odm_dlkm partition image +ifdef BUILDING_ODM_DLKM_IMAGE +INTERNAL_ODM_DLKMIMAGE_FILES := \ + $(filter $(TARGET_OUT_ODM_DLKM)/%,\ + $(ALL_DEFAULT_INSTALLED_MODULES)\ + $(ALL_PDK_FUSION_FILES)) \ + $(PDK_FUSION_SYMLINK_STAMP) +# platform.zip depends on $(INTERNAL_ODM_DLKMIMAGE_FILES). +$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_ODM_DLKMIMAGE_FILES) + +INSTALLED_FILES_FILE_ODM_DLKM := $(PRODUCT_OUT)/installed-files-odm_dlkm.txt +INSTALLED_FILES_JSON_ODM_DLKM := $(INSTALLED_FILES_FILE_ODM_DLKM:.txt=.json) +$(INSTALLED_FILES_FILE_ODM_DLKM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM_DLKM) +$(INSTALLED_FILES_FILE_ODM_DLKM) : $(INTERNAL_ODM_DLKMIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL) + @echo Installed file list: $@ + @mkdir -p $(dir $@) + @rm -f $@ + $(hide) $(FILESLIST) $(TARGET_OUT_ODM_DLKM) > $(@:.txt=.json) + $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@ + +odm_dlkmimage_intermediates := \ + $(call intermediates-dir-for,PACKAGING,odm_dlkm) +BUILT_ODM_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/odm_dlkm.img +define build-odm_dlkmimage-target + $(call pretty,"Target odm_dlkm fs image: $(INSTALLED_ODM_DLKMIMAGE_TARGET)") + @mkdir -p $(TARGET_OUT_ODM_DLKM) + @mkdir -p $(odm_dlkmimage_intermediates) && rm -rf $(odm_dlkmimage_intermediates)/odm_dlkm_image_info.txt + $(call generate-userimage-prop-dictionary, $(odm_dlkmimage_intermediates)/odm_dlkm_image_info.txt, skip_fsck=true) + PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \ + $(BUILD_IMAGE) \ + $(TARGET_OUT_ODM_DLKM) $(odm_dlkmimage_intermediates)/odm_dlkm_image_info.txt \ + $(INSTALLED_ODM_DLKMIMAGE_TARGET) $(TARGET_OUT) + $(call assert-max-image-size,$(INSTALLED_ODM_DLKMIMAGE_TARGET),$(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE)) +endef + +# We just build this directly to the install location. +INSTALLED_ODM_DLKMIMAGE_TARGET := $(BUILT_ODM_DLKMIMAGE_TARGET) +$(INSTALLED_ODM_DLKMIMAGE_TARGET): \ + $(INTERNAL_USERIMAGES_DEPS) \ + $(INTERNAL_ODM_DLKMIMAGE_FILES) \ + $(INSTALLED_FILES_FILE_ODM_DLKM) + $(build-odm_dlkmimage-target) + +.PHONY: odm_dlkmimage-nodeps odnod +odm_dlkmimage-nodeps odnod: | $(INTERNAL_USERIMAGES_DEPS) + $(build-odm_dlkmimage-target) + +sync: $(INTERNAL_ODM_DLKMIMAGE_FILES) + +else ifdef BOARD_PREBUILT_ODM_DLKMIMAGE +INSTALLED_ODM_DLKMIMAGE_TARGET := $(PRODUCT_OUT)/odm_dlkm.img +$(eval $(call copy-one-file,$(BOARD_PREBUILT_ODM_DLKMIMAGE),$(INSTALLED_ODM_DLKMIMAGE_TARGET))) +endif + + # ----------------------------------------------------------------- # dtbo image ifdef BOARD_PREBUILT_DTBOIMAGE @@ -3173,6 +3259,10 @@ 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_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \ + --prop com.android.build.odm_dlkm.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) \ + --prop com.android.build.odm_dlkm.os_version:$(PLATFORM_VERSION_LAST_STABLE) + BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS += \ --prop com.android.build.dtbo.fingerprint:$(BUILD_FINGERPRINT_FROM_FILE) @@ -3197,6 +3287,11 @@ BOARD_AVB_VENDOR_DLKM_ADD_HASHTREE_FOOTER_ARGS += \ --prop com.android.build.vendor_dlkm.security_patch:$(VENDOR_DLKM_SECURITY_PATCH) endif +ifdef ODM_DLKM_SECURITY_PATCH +BOARD_AVB_ODM_DLKM_ADD_HASHTREE_FOOTER_ARGS += \ + --prop com.android.build.odm_dlkm.security_patch:$(ODM_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 @@ -3207,6 +3302,7 @@ 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 +ODM_DLKM_FOOTER_ARGS := BOARD_AVB_ODM_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. @@ -3305,6 +3401,10 @@ ifdef INSTALLED_VENDOR_DLKMIMAGE_TARGET $(eval $(call check-and-set-avb-args,vendor_dlkm)) endif +ifdef INSTALLED_ODM_DLKMIMAGE_TARGET +$(eval $(call check-and-set-avb-args,odm_dlkm)) +endif + ifdef INSTALLED_DTBOIMAGE_TARGET $(eval $(call check-and-set-avb-args,dtbo)) endif @@ -3388,6 +3488,9 @@ define extract-avb-chain-public-keys $(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_ODM_DLKM_KEY_PATH),\ + $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_DLKM_KEY_PATH) \ + --output $(1)/odm_dlkm.avbpubkey) $(if $(BOARD_AVB_DTBO_KEY_PATH),\ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_DTBO_KEY_PATH) \ --output $(1)/dtbo.avbpubkey) @@ -3471,6 +3574,7 @@ $(INSTALLED_VBMETAIMAGE_TARGET): \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ + $(INSTALLED_ODM_DLKMIMAGE_TARGET) \ $(INSTALLED_DTBOIMAGE_TARGET) \ $(INSTALLED_CUSTOMIMAGES_TARGET) \ $(INSTALLED_RECOVERYIMAGE_TARGET) \ @@ -3493,7 +3597,7 @@ endif # BOARD_AVB_ENABLE # ----------------------------------------------------------------- # Check VINTF of build -# Note: vendor_dlkm does not have VINTF files. +# Note: vendor_dlkm and odm_dlkm does not have VINTF files. ifeq (,$(TARGET_BUILD_UNBUNDLED)) intermediates := $(call intermediates-dir-for,PACKAGING,check_vintf_all) @@ -4281,6 +4385,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_VBMETAIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ + $(INSTALLED_ODM_DLKMIMAGE_TARGET) \ $(INSTALLED_DTBOIMAGE_TARGET) \ $(INSTALLED_CUSTOMIMAGES_TARGET) \ $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \ @@ -4297,6 +4402,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \ $(PRODUCT_ODM_BASE_FS_PATH) \ $(PRODUCT_VENDOR_DLKM_BASE_FS_PATH) \ + $(PRODUCT_ODM_DLKM_BASE_FS_PATH) \ $(LPMAKE) \ $(SELINUX_FC) \ $(INSTALLED_MISC_INFO_TARGET) \ @@ -4440,6 +4546,11 @@ ifdef BUILDING_VENDOR_DLKM_IMAGE $(hide) $(call package_files-copy-root, \ $(TARGET_OUT_VENDOR_DLKM),$(zip_root)/VENDOR_DLKM) endif +ifdef BUILDING_ODM_DLKM_IMAGE + @# Contents of the odm_dlkm image + $(hide) $(call package_files-copy-root, \ + $(TARGET_OUT_ODM_DLKM),$(zip_root)/ODM_DLKM) +endif ifdef BUILDING_SYSTEM_OTHER_IMAGE @# Contents of the system_other image $(hide) $(call package_files-copy-root, \ @@ -4489,6 +4600,10 @@ 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 +ifneq ($(PRODUCT_ODM_DLKM_BASE_FS_PATH),) + $(hide) cp $(PRODUCT_ODM_DLKM_BASE_FS_PATH) \ + $(zip_root)/META/$(notdir $(PRODUCT_ODM_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) \ @@ -4571,6 +4686,9 @@ ifdef BUILDING_ODM_IMAGE 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 +ifdef BUILDING_ODM_DLKM_IMAGE + $(hide) $(call fs_config,$(zip_root)/ODM_DLKM,odm_dlkm/) > $(zip_root)/META/odm_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 @@ -4731,6 +4849,7 @@ $(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ + $(INSTALLED_ODM_DLKMIMAGE_TARGET) \ $(updater_dep) endif $(SYMBOLS_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,symbols)/filelist @@ -4757,7 +4876,8 @@ $(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ - $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) + $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ + $(INSTALLED_ODM_DLKMIMAGE_TARGET) endif $(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist $(COVERAGE_ZIP): $(SOONG_ZIP) @@ -4835,6 +4955,7 @@ $(PROGUARD_DICT_ZIP): \ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ + $(INSTALLED_ODM_DLKMIMAGE_TARGET) \ $(updater_dep) endif $(PROGUARD_DICT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,proguard)/filelist @@ -5083,6 +5204,15 @@ vendor_dlkmimage: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE) droidcore: $(INSTALLED_QEMU_VENDOR_DLKMIMAGE) endif +ifdef INSTALLED_ODM_DLKMIMAGE_TARGET +INSTALLED_QEMU_ODM_DLKMIMAGE := $(PRODUCT_OUT)/odm_dlkm-qemu.img +$(INSTALLED_QEMU_ODM_DLKMIMAGE): $(INSTALLED_ODM_DLKMIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) + @echo Create odm_dlkm-qemu.img + (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) $(INSTALLED_ODM_DLKMIMAGE_TARGET)) + +odm_dlkmimage: $(INSTALLED_QEMU_ODM_DLKMIMAGE) +droidcore: $(INSTALLED_QEMU_ODM_DLKMIMAGE) +endif QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto $(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \ diff --git a/core/board_config.mk b/core/board_config.mk index 70c15895e..4141cee45 100644 --- a/core/board_config.mk +++ b/core/board_config.mk @@ -74,6 +74,8 @@ _board_strip_readonly_list += \ BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \ BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE \ BOARD_VENDOR_DLKMIMAGE_FILE_SYSTEM_TYPE \ + BOARD_ODM_DLKMIMAGE_PARTITION_SIZE \ + BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE \ # Logical partitions related variables. _dynamic_partitions_var_list += \ @@ -81,6 +83,7 @@ _dynamic_partitions_var_list += \ BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \ BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \ BOARD_VENDOR_DLKMIMAGE_PARTITION_RESERVED_SIZE \ + BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE \ BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \ BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE \ BOARD_SUPER_PARTITION_SIZE \ @@ -582,6 +585,41 @@ ifdef BOARD_PREBUILT_ODMIMAGE endif .KATI_READONLY := BUILDING_ODM_IMAGE + +########################################### +# Now we can substitute with the real value of TARGET_COPY_OUT_ODM_DLKM +ifeq ($(TARGET_COPY_OUT_ODM_DLKM),$(_odm_dlkm_path_placeholder)) + TARGET_COPY_OUT_ODM_DLKM := $(TARGET_COPY_OUT_VENDOR)/odm_dlkm +else ifeq ($(filter odm_dlkm system/vendor/odm_dlkm vendor/odm_dlkm,$(TARGET_COPY_OUT_ODM_DLKM)),) + $(error TARGET_COPY_OUT_ODM_DLKM must be either 'odm_dlkm', 'system/vendor/odm_dlkm' or 'vendor/odm_dlkm', seeing '$(TARGET_COPY_OUT_ODM_DLKM)'.) +endif +PRODUCT_COPY_FILES := $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),$(PRODUCT_COPY_FILES)) + +BOARD_USES_ODM_DLKMIMAGE := +ifdef BOARD_PREBUILT_ODM_DLKMIMAGE + BOARD_USES_ODM_DLKMIMAGE := true +endif +ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE + BOARD_USES_ODM_DLKMIMAGE := true +endif +$(call check_image_config,odm_dlkm) + +BUILDING_ODM_DLKM_IMAGE := +ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),) + ifdef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE + BUILDING_ODM_DLKM_IMAGE := true + endif +else ifeq ($(PRODUCT_BUILD_ODM_DLKM_IMAGE),true) + BUILDING_ODM_DLKM_IMAGE := true + ifndef BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE + $(error PRODUCT_BUILD_ODM_DLKM_IMAGE set to true, but BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE not defined) + endif +endif +ifdef BOARD_PREBUILT_ODM_DLKMIMAGE + BUILDING_ODM_DLKM_IMAGE := +endif +.KATI_READONLY := BUILDING_ODM_DLKM_IMAGE + ########################################### # Ensure consistency among TARGET_RECOVERY_UPDATER_LIBS, AB_OTA_UPDATER, and PRODUCT_OTA_FORCE_NON_AB_PACKAGE. TARGET_RECOVERY_UPDATER_LIBS ?= diff --git a/core/config.mk b/core/config.mk index 2689d8032..b928af088 100644 --- a/core/config.mk +++ b/core/config.mk @@ -937,6 +937,13 @@ $(error Should not define BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE and \ endif endif +ifneq ($(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE),) +ifneq ($(BOARD_ODM_DLKMIMAGE_PARTITION_RESERVED_SIZE),) +$(error Should not define BOARD_ODM_DLKMIMAGE_PARTITION_SIZE and \ + BOARD_ODM_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 \ @@ -972,7 +979,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 vendor_dlkm +valid_super_partition_list := system vendor product system_ext odm vendor_dlkm odm_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 1fb460588..f78ecb4f5 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -254,6 +254,7 @@ _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|| +_odm_dlkm_path_placeholder := ||ODM_DLKM-PATH-PH|| TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder) TARGET_COPY_OUT_VENDOR_RAMDISK := vendor-ramdisk TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder) @@ -263,6 +264,7 @@ 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) +TARGET_COPY_OUT_ODM_DLKM := $(_odm_dlkm_path_placeholder) # Returns the non-sanitized version of the path provided in $1. define get_non_asan_path @@ -755,6 +757,40 @@ $(KATI_obsolete_var \ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_VENDOR_DLKM_APPS_PRIVILEGED \ , vendor_dlkm should not contain any executables, libraries, or apps) +TARGET_OUT_ODM_DLKM := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ODM_DLKM) + +TARGET_OUT_ODM_DLKM_ETC := $(TARGET_OUT_ODM_DLKM)/etc +.KATI_READONLY := \ + TARGET_OUT_ODM_DLKM_ETC + +# Unlike other partitions, odm_dlkm should only contain kernel modules. +TARGET_OUT_ODM_DLKM_EXECUTABLES := +TARGET_OUT_ODM_DLKM_OPTIONAL_EXECUTABLES := +TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES := +TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE := +TARGET_OUT_ODM_DLKM_JAVA_LIBRARIES := +TARGET_OUT_ODM_DLKM_APPS := +TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_EXECUTABLES := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS := +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED := +$(KATI_obsolete_var \ + TARGET_OUT_ODM_DLKM_EXECUTABLES \ + TARGET_OUT_ODM_DLKM_OPTIONAL_EXECUTABLES \ + TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES \ + TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE \ + TARGET_OUT_ODM_DLKM_JAVA_LIBRARIES \ + TARGET_OUT_ODM_DLKM_APPS \ + TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_EXECUTABLES \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_SHARED_LIBRARIES \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_RENDERSCRIPT_BITCODE \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS \ + $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_ODM_DLKM_APPS_PRIVILEGED \ + , odm_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 8ac07173a..0c47f0987 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1142,7 +1142,8 @@ define resolve-product-relative-paths $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),\ $(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),\ $(subst $(_vendor_dlkm_path_placeholder),$(TARGET_COPY_OUT_VENDOR_DLKM),\ - $(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2)))))))) + $(subst $(_odm_dlkm_path_placeholder),$(TARGET_COPY_OUT_ODM_DLKM),\ + $(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2))))))))) endef # Returns modules included automatically as a result of certain BoardConfig @@ -1523,6 +1524,9 @@ odmimage: $(INSTALLED_ODMIMAGE_TARGET) .PHONY: vendor_dlkmimage vendor_dlkmimage: $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) +.PHONY: odm_dlkmimage +odm_dlkmimage: $(INSTALLED_ODM_DLKMIMAGE_TARGET) + .PHONY: systemotherimage systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) @@ -1561,6 +1565,7 @@ droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ $(INSTALLED_VENDOR_DEBUG_BOOTIMAGE_TARGET) \ $(INSTALLED_ODMIMAGE_TARGET) \ $(INSTALLED_VENDOR_DLKMIMAGE_TARGET) \ + $(INSTALLED_ODM_DLKMIMAGE_TARGET) \ $(INSTALLED_SUPERIMAGE_EMPTY_TARGET) \ $(INSTALLED_PRODUCTIMAGE_TARGET) \ $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ @@ -1572,6 +1577,8 @@ droidcore: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ $(INSTALLED_FILES_JSON_ODM) \ $(INSTALLED_FILES_FILE_VENDOR_DLKM) \ $(INSTALLED_FILES_JSON_VENDOR_DLKM) \ + $(INSTALLED_FILES_FILE_ODM_DLKM) \ + $(INSTALLED_FILES_JSON_ODM_DLKM) \ $(INSTALLED_FILES_FILE_PRODUCT) \ $(INSTALLED_FILES_JSON_PRODUCT) \ $(INSTALLED_FILES_FILE_SYSTEM_EXT) \ @@ -1669,6 +1676,8 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(INSTALLED_FILES_JSON_ODM) \ $(INSTALLED_FILES_FILE_VENDOR_DLKM) \ $(INSTALLED_FILES_JSON_VENDOR_DLKM) \ + $(INSTALLED_FILES_FILE_ODM_DLKM) \ + $(INSTALLED_FILES_JSON_ODM_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 740563f3f..324010c70 100644 --- a/core/product.mk +++ b/core/product.mk @@ -252,6 +252,7 @@ _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_ODM_DLKM_VERITY_PARTITION _product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO _product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO @@ -280,6 +281,7 @@ _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 +_product_single_value_vars += PRODUCT_ODM_DLKM_BASE_FS_PATH # The first API level this product shipped with _product_single_value_vars += PRODUCT_SHIPPING_API_LEVEL @@ -372,6 +374,7 @@ _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_ODM_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 d614e107c..bb806bb2a 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -400,6 +400,7 @@ $(foreach image, \ SYSTEM_EXT \ ODM \ VENDOR_DLKM \ + ODM_DLKM \ CACHE \ RAMDISK \ USERDATA \ diff --git a/core/soong_config.mk b/core/soong_config.mk index c7bf61e3f..b826024e3 100644 --- a/core/soong_config.mk +++ b/core/soong_config.mk @@ -156,6 +156,7 @@ $(call add_json_bool, Use_lmkd_stats_log, $(filter true,$(TARGET_ $(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, OdmDlkmPath, $(TARGET_COPY_OUT_ODM_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))) @@ -174,6 +175,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, BoardOdmDlkmSepolicyDirs, $(BOARD_ODM_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 89a34d6f6..4d7d67eb4 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)/% $(TARGET_OUT_VENDOR_DLKM)/% $(HOST_OUT)/%, $(ALL_MODULES.$(m).INSTALLED)),,\ + $(if $(filter $(TARGET_OUT_VENDOR)/% $(TARGET_OUT_ODM)/% $(TARGET_OUT_VENDOR_DLKM)/% $(TARGET_OUT_ODM_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, odm or vendor_dlkm tree)))) + $(ALL_MODULES.$(m).INSTALLED) which is not in the vendor, odm, vendor_dlkm or odm_dlkm tree)))) endif diff --git a/help.sh b/help.sh index 37018f78c..4af51548c 100755 --- a/help.sh +++ b/help.sh @@ -46,6 +46,8 @@ Common goals are: Stands for "Odm, NO Dependencies" vdnod Quickly rebuild the vendor_dlkm image from built packages Stands for "VendorDlkm, NO Dependencies" + odnod Quickly rebuild the odm_dlkm image from built packages + Stands for "OdmDlkm, 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 e536e5550..a0c3e6ddd 100644 --- a/target/product/mainline_system_arm64.mk +++ b/target/product/mainline_system_arm64.mk @@ -27,6 +27,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_ODM_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 484ae3076..3c4a867f4 100644 --- a/target/product/mainline_system_x86.mk +++ b/target/product/mainline_system_x86.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_ODM_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 ad31f81c0..410c99830 100644 --- a/target/product/mainline_system_x86_64.mk +++ b/target/product/mainline_system_x86_64.mk @@ -27,6 +27,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_ODM_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 24f1ad70e..8c6611e8e 100644 --- a/target/product/mainline_system_x86_arm.mk +++ b/target/product/mainline_system_x86_arm.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_ODM_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 60b51b613..41e8ca566 100644 --- a/tools/fs_config/Android.mk +++ b/tools/fs_config/Android.mk @@ -27,12 +27,13 @@ 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, vendor_dlkm, product and system_ext Partitions +# List of supported vendor, oem, odm, vendor_dlkm, odm_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_USES_ODM_DLKMIMAGE)$(BOARD_ODM_DLKMIMAGE_FILE_SYSTEM_TYPE),odm_dlkm) \ $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),product) \ $(if $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE),system_ext) \ ) @@ -334,6 +335,57 @@ $(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_G endif +ifneq ($(filter odm_dlkm,$(fs_config_generate_extra_partition_list)),) +################################## +# Generate the odm_dlkm/etc/fs_config_dirs binary file for the target +# Add fs_config_dirs or fs_config_dirs_odm_dlkm to PRODUCT_PACKAGES in +# the device make file to enable +include $(CLEAR_VARS) + +LOCAL_MODULE := fs_config_dirs_odm_dlkm +LOCAL_MODULE_CLASS := ETC +LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs +LOCAL_MODULE_PATH := $(TARGET_OUT_ODM_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 odm_dlkm \ + --dirs \ + --out_file $@ \ + $(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null) + +################################## +# Generate the odm_dlkm/etc/fs_config_files binary file for the target +# Add fs_config_files of fs_config_files_odm_dlkm to PRODUCT_PACKAGES in +# the device make file to enable +include $(CLEAR_VARS) + +LOCAL_MODULE := fs_config_files_odm_dlkm +LOCAL_MODULE_CLASS := ETC +LOCAL_INSTALLED_MODULE_STEM := fs_config_files +LOCAL_MODULE_PATH := $(TARGET_OUT_ODM_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 odm_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 284c89adb..a1f8e31b8 100644 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -296,6 +296,21 @@ def AddVendorDlkm(output_zip): block_list=block_list) return img.name +def AddOdmDlkm(output_zip): + """Turn the contents of OdmDlkm into an odm_dlkm image and store it in output_zip.""" + + img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES", "odm_dlkm.img") + if os.path.exists(img.name): + logger.info("odm_dlkm.img already exists; no need to rebuild...") + return img.name + + block_list = OutputFile( + output_zip, OPTIONS.input_tmp, "IMAGES", "odm_dlkm.map") + CreateImage( + OPTIONS.input_tmp, OPTIONS.info_dict, "odm_dlkm", img, + block_list=block_list) + return img.name + def AddDtbo(output_zip): """Adds the DTBO image. @@ -752,8 +767,9 @@ 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,vendor_dlkm}.img are unlike system.img or - # system_other.img. Because it could be built from source, or dropped into + # {vendor,odm,product,system_ext,vendor_dlkm,odm_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 # used when generating vbmeta.img for AVB. @@ -772,6 +788,12 @@ def AddImagesToTargetFiles(filename): os.path.exists( os.path.join(OPTIONS.input_tmp, "IMAGES", "vendor_dlkm.img"))) + has_odm_dlkm = ((os.path.isdir(os.path.join(OPTIONS.input_tmp, + "ODM_DLKM")) and + OPTIONS.info_dict.get("building_odm_dlkm_image") + == "true") or + os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES", + "odm_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( @@ -901,6 +923,10 @@ def AddImagesToTargetFiles(filename): banner("vendor_dlkm") partitions['vendor_dlkm'] = AddVendorDlkm(output_zip) + if has_odm_dlkm: + banner("odm_dlkm") + partitions['odm_dlkm'] = AddOdmDlkm(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 dbfb4851c..9cc072fe0 100755 --- a/tools/releasetools/build_image.py +++ b/tools/releasetools/build_image.py @@ -731,6 +731,29 @@ def ImagePropFromGlobalDict(glob_dict, mount_point): 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 == "odm_dlkm": + copy_prop("avb_odm_dlkm_hashtree_enable", "avb_hashtree_enable") + copy_prop("avb_odm_dlkm_add_hashtree_footer_args", + "avb_add_hashtree_footer_args") + copy_prop("avb_odm_dlkm_key_path", "avb_key_path") + copy_prop("avb_odm_dlkm_algorithm", "avb_algorithm") + copy_prop("avb_odm_dlkm_salt", "avb_salt") + copy_prop("odm_dlkm_fs_type", "fs_type") + copy_prop("odm_dlkm_size", "partition_size") + if not copy_prop("odm_dlkm_journal_size", "journal_size"): + d["journal_size"] = "0" + copy_prop("odm_dlkm_verity_block_device", "verity_block_device") + copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks") + copy_prop("odm_dlkm_squashfs_compressor", "squashfs_compressor") + copy_prop("odm_dlkm_squashfs_compressor_opt", "squashfs_compressor_opt") + copy_prop("odm_dlkm_squashfs_block_size", "squashfs_block_size") + copy_prop("odm_dlkm_squashfs_disable_4k_align", "squashfs_disable_4k_align") + copy_prop("odm_dlkm_base_fs_file", "base_fs_file") + copy_prop("odm_dlkm_extfs_inode_count", "extfs_inode_count") + if not copy_prop("odm_dlkm_extfs_rsv_pct", "extfs_rsv_pct"): + d["extfs_rsv_pct"] = "0" + copy_prop("odm_dlkm_reserved_size", "partition_reserved_size") + copy_prop("odm_dlkm_selinux_fc", "selinux_fc") elif mount_point == "oem": copy_prop("fs_type", "fs_type") copy_prop("oem_size", "partition_size") @@ -777,6 +800,8 @@ def GlobalDictFromImageProp(image_prop, mount_point): copy_prop("partition_size", "odm_size") elif mount_point == "vendor_dlkm": copy_prop("partition_size", "vendor_dlkm_size") + elif mount_point == "odm_dlkm": + copy_prop("partition_size", "odm_dlkm_size") elif mount_point == "product": copy_prop("partition_size", "product_size") elif mount_point == "system_ext": @@ -818,6 +843,8 @@ def main(argv): mount_point = "odm" elif image_filename == "vendor_dlkm.img": mount_point = "vendor_dlkm" + elif image_filename == "odm_dlkm.img": + mount_point = "odm_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 79005df4d..ef6611235 100755 --- a/tools/releasetools/check_target_files_vintf.py +++ b/tools/releasetools/check_target_files_vintf.py @@ -46,7 +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. + # vendor_dlkm and odm_dlkm does not have VINTF files. } UNZIP_PATTERN = ['META/*', '*/build.prop'] diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index a26f9e409..25ccea0a8 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -110,7 +110,8 @@ 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', 'vendor_dlkm') + 'system_ext', 'vendor', 'vendor_boot', 'vendor_dlkm', + 'odm_dlkm') # Chained VBMeta partitions. AVB_VBMETA_PARTITIONS = ('vbmeta_system', 'vbmeta_vendor') @@ -123,6 +124,7 @@ PARTITIONS_WITH_CARE_MAP = ( 'system_ext', 'odm', 'vendor_dlkm', + 'odm_dlkm', ) @@ -663,7 +665,7 @@ def LoadInfoDict(input_file, repacking=False): # Redirect {partition}_base_fs_file for each of the named partitions. for part_name in ["system", "vendor", "system_ext", "product", "odm", - "vendor_dlkm"]: + "vendor_dlkm", "odm_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 ad991caab..45532f50d 100755 --- a/tools/releasetools/merge_target_files.py +++ b/tools/releasetools/merge_target_files.py @@ -198,6 +198,7 @@ DEFAULT_VENDOR_ITEM_LIST = ( 'RADIO/*', 'VENDOR/*', 'VENDOR_DLKM/*', + 'ODM_DLKM/*', ) # VENDOR_EXTRACT_SPECIAL_ITEM_LIST is a list of items to extract from the @@ -225,6 +226,7 @@ SINGLE_BUILD_PARTITIONS = ( 'SYSTEM_OTHER/', 'VENDOR/', 'VENDOR_DLKM/', + 'ODM_DLKM/', ) diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index f114f6383..c3dcf0d6c 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -278,15 +278,15 @@ 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/*', - 'VENDOR_DLKM/*'] + 'VENDOR_DLKM/*', 'ODM_DLKM/*'] RETROFIT_DAP_UNZIP_PATTERN = ['OTA/super_*.img', AB_PARTITIONS] # Images to be excluded from secondary payload. We essentially only keep # 'system_other' and bootloader partitions. SECONDARY_PAYLOAD_SKIPPED_IMAGES = [ - 'boot', 'dtbo', 'modem', 'odm', 'product', 'radio', 'recovery', + 'boot', 'dtbo', 'modem', 'odm', 'odm_dlkm', 'product', 'radio', 'recovery', 'system_ext', 'vbmeta', 'vbmeta_system', 'vbmeta_vendor', 'vendor', - 'vendor_boot', 'vendor_dlkm'] + 'vendor_boot'] class PayloadSigner(object): @@ -670,7 +670,7 @@ def GetBlockDifferences(target_zip, source_zip, target_info, source_info, block_diff_dict = collections.OrderedDict() partition_names = ["system", "vendor", "product", "odm", "system_ext", - "vendor_dlkm"] + "vendor_dlkm", "odm_dlkm"] for partition in partition_names: if not HasPartition(target_zip, partition): continue