diff --git a/core/Makefile b/core/Makefile index 190f4a2fcc..a84f7a68a4 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1179,6 +1179,49 @@ INSTALLED_INIT_BOOT_IMAGE_TARGET := endif # BOARD_PREBUILT_INIT_BOOT_IMAGE endif # BUILDING_INIT_BOOT_IMAGE is not true + +# ----------------------------------------------------------------- +# system dlkm image +ifeq ($(BUILDING_SYSTEM_DLKM_IMAGE),true) + +INSTALLED_SYSTEM_DLKM_IMAGE_TARGET := $(PRODUCT_OUT)/system_dlkm.img + +ifeq ($(BOARD_AVB_ENABLE),true) +$(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET): $(TARGET_SYSTEM_DLKM_SRC) $(MKEROFS) $(AVBTOOL) + $(call pretty,"Target system_dlkm image: $@") + rsync -rupE $(TARGET_SYSTEM_DLKM_SRC)/ $(TARGET_SYSTEM_DLKM_OUT) + $(MKEROFS) "-zlz4hc" $@ $(TARGET_SYSTEM_DLKM_OUT) + $(call assert-max-image-size,$@,$(BOARD_SYSTEM_DLKM_PARTITION_SIZE)) + $(AVBTOOL) add_hash_footer \ + --partition_name system_dlkm \ + --partition_size $(BOARD_SYSTEM_DLKM_PARTITION_SIZE) \ + --image $@ +else +$(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET): $(TARGET_SYSTEM_DLKM_SRC) $(MKFSEROFS) + $(call pretty,"Target system_dlkm image: $@") + rsync -rupE $(TARGET_SYSTEM_DLKM_SRC)/ $(TARGET_SYSTEM_DLKM_OUT) + $(MKEROFS) "-zlz4hc" $@ $(TARGET_SYSTEM_DLKM_OUT) + $(call assert-max-image-size,$@,$(BOARD_SYSTEM_DLKM_PARTITION_SIZE)) +endif # BOARD_AVB_ENABLE + +else # BUILDING_SYSTEM_DLKM_IMAGE is not true + +ifdef BOARD_PREBUILT_SYSTEM_DLKM_IMAGE + +INTERNAL_PREBUILT_SYSTEM_DLKM_IMAGE := $(BOARD_PREBUILT_SYSTEM_DLKM_IMAGE) +INSTALLED_SYSTEM_DLKM_IMAGE_TARGET := $(PRODUCT_OUT)/system_dlkm.img +$(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET): $(INTERNAL_PREBUILT_SYSTEM_DLKM_IMAGE) + $(call pretty,"Using prebuilt system_dlkm image: $@") + cp $(INTERNAL_PREBUILT_SYSTEM_DLKM_IMAGE) $@ + +else # BOARD_PREBUILT_SYSTEM_DLKM_IMAGE not defined + +INSTALLED_SYSTEM_DLKM_IMAGE_TARGET := + +endif # BOARD_PREBUILT_SYSTEM_DLKM_IMAGE + +endif # BUILDING_SYSTEM_DLKM_IMAGE is not true + # ----------------------------------------------------------------- # vendor boot image ifeq ($(BUILDING_VENDOR_BOOT_IMAGE),true) diff --git a/core/board_config.mk b/core/board_config.mk index 95cbe3d299..ad7195116d 100644 --- a/core/board_config.mk +++ b/core/board_config.mk @@ -77,6 +77,8 @@ _board_strip_readonly_list += BOARD_VENDORIMAGE_PARTITION_SIZE _board_strip_readonly_list += BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE _board_strip_readonly_list += BOARD_PRODUCTIMAGE_PARTITION_SIZE _board_strip_readonly_list += BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE +_board_strip_readonly_list += BOARD_SYSTEM_DLKM_PARTITION_SIZE +_board_strip_readonly_list += BOARD_SYSTEM_DLKM_FILE_SYSTEM_TYPE _board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE _board_strip_readonly_list += BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE _board_strip_readonly_list += BOARD_ODMIMAGE_PARTITION_SIZE @@ -125,6 +127,7 @@ _board_strip_readonly_list += BOARD_COPY_BOOT_IMAGE_TO_TARGET_FILES # Prebuilt image variables _board_strip_readonly_list += BOARD_PREBUILT_INIT_BOOT_IMAGE +_board_strip_readonly_list += BOARD_PREBUILT_SYSTEM_DLKM_IMAGE # Defines the list of logical vendor ramdisk names to build or include in vendor_boot. _board_strip_readonly_list += BOARD_VENDOR_RAMDISK_FRAGMENTS @@ -502,6 +505,35 @@ else ifeq ($(PRODUCT_BUILD_RECOVERY_IMAGE),true) endif .KATI_READONLY := BUILDING_RECOVERY_IMAGE +# Are we building a system_dlkm image for system_dlkm partition ? +# +# Two choices: +# 1. Use kernel prebuilt system_dlkm.img BOARD_PREBUILT_SYSTEM_DLKM_IMAGE to point image +# 2. Build from kernel prebuilt system_dlkm_staging set PRODUCT_BUILD_SYSTEM_DLKM_IMAGE +# +# Both requires: BOARD_SYSTEM_DLKM_PARTITION_SIZE and must be 64MB or higher (vts). +# +BUILDING_SYSTEM_DLKM_IMAGE := +ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),) + ifdef BOARD_USES_SYSTEM_DLKM_PARTITION + BUILDING_SYSTEM_DLKM_IMAGE := true + endif +endif +ifeq ($(PRODUCT_BUILD_SYSTEM_DLKM_IMAGE),true) + BUILDING_SYSTEM_DLKM_IMAGE := true +endif +.KATI_READONLY := BUILDING_SYSTEM_DLKM_IMAGE +TARGET_SYSTEM_DLKM_SRC := +ifeq ($(BUILDING_SYSTEM_DLKM_IMAGE),true) + # Make sure we know the partition size; or warn for default to 64MB + ifndef BOARD_SYSTEM_DLKM_PARTITION_SIZE + $(error BOARD_SYSTEM_DLKM_PARTITION_SIZE is not defined; must be defined as 64MB or higher.) + endif + # Point to the source for signed module by kernel; if we are building system_dlkm + TARGET_SYSTEM_DLKM_SRC := kernel/prebuilts/$(TARGET_KERNEL_USE)/$(TARGET_ARCH)/system_dlkm_staging +endif +.KATI_READONLY := TARGET_SYSTEM_DLKM_SRC + # Are we building a vendor boot image BUILDING_VENDOR_BOOT_IMAGE := ifdef BOARD_BOOT_HEADER_VERSION diff --git a/core/config.mk b/core/config.mk index 33edd94bfc..69799decef 100644 --- a/core/config.mk +++ b/core/config.mk @@ -597,6 +597,7 @@ APICHECK := $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX) FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX) MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf +MKEROFS := $(HOST_OUT_EXECUTABLES)/mkfs.erofs MKEROFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkerofsimage.sh MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh diff --git a/core/envsetup.mk b/core/envsetup.mk index 823290777d..e730c3a308 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -259,6 +259,7 @@ HOST_PREBUILT_TAG := $(BUILD_OS)-$(HOST_PREBUILT_ARCH) # TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT. # Define them here so they can be used in product config files. TARGET_COPY_OUT_SYSTEM := system +TARGET_COPY_OUT_SYSTEM_DLKM := system_dlkm TARGET_COPY_OUT_SYSTEM_OTHER := system_other TARGET_COPY_OUT_DATA := data TARGET_COPY_OUT_ASAN := $(TARGET_COPY_OUT_DATA)/asan @@ -951,6 +952,9 @@ TARGET_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DEBUG_RAMDISK) TARGET_VENDOR_DEBUG_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_DEBUG_RAMDISK) TARGET_TEST_HARNESS_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_TEST_HARNESS_RAMDISK) +TARGET_SYSTEM_DLKM_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_DLKM) +.KATI_READONLY := TARGET_SYSTEM_DLKM_OUT + TARGET_VENDOR_RAMDISK_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR_RAMDISK) TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT) diff --git a/core/main.mk b/core/main.mk index 56007e2cba..986cbc353b 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1606,6 +1606,9 @@ bootimage: $(INSTALLED_BOOTIMAGE_TARGET) .PHONY: initbootimage bootimage: $(INSTALLED_INIT_BOOT_IMAGE_TARGET) +.PHONY: system_dlkm_image +system_dlkm_image: $(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET) + ifeq (true,$(PRODUCT_EXPORT_BOOT_IMAGE_TO_DIST)) $(call dist-for-goals, bootimage, $(INSTALLED_BOOTIMAGE_TARGET)) endif @@ -1630,6 +1633,7 @@ vbmetavendorimage: $(INSTALLED_VBMETA_VENDORIMAGE_TARGET) .PHONY: droidcore-unbundled droidcore-unbundled: $(filter $(HOST_OUT_ROOT)/%,$(modules_to_install)) \ $(INSTALLED_SYSTEMIMAGE_TARGET) \ + $(INSTALLED_SYSTEM_DLKM_IMAGE_TARGET) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(INSTALLED_INIT_BOOT_IMAGE_TARGET) \ diff --git a/core/product.mk b/core/product.mk index 7192226884..21db81e7ba 100644 --- a/core/product.mk +++ b/core/product.mk @@ -384,6 +384,7 @@ _product_list_vars += PRODUCT_CERTIFICATE_OVERRIDES # Controls for whether different partitions are built for the current product. _product_single_value_vars += PRODUCT_BUILD_SYSTEM_IMAGE +_product_single_value_vars += PRODUCT_BUILD_SYSTEM_DLKM_IMAGE _product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE _product_single_value_vars += PRODUCT_BUILD_VENDOR_IMAGE _product_single_value_vars += PRODUCT_BUILD_PRODUCT_IMAGE