From 5728c951c8c7a2bf1e391234c0dec3c99c4c6e44 Mon Sep 17 00:00:00 2001 From: Robin Peng Date: Fri, 11 Jun 2021 23:15:38 +0800 Subject: [PATCH] Read vendor_boot.modules.load and vendor_dlkm.modules.load Previously, we copied all available kernel modules into the vendor_boot ramdisk except for approx. 14 modules that we explicitly excluded. Going forward, the kernel build will distribute the two additional files vendor_boot.modules.load and vendor_dlkm.modules.load which define, respectively, the lists of modules that should be loaded from vendor_boot and vendor_dlkm. The contents of the two *.modules.load files will be copied almost verbatim into modules.load files in the respective images except for the fact that the directory names of the .ko files are stripped. So, for example, kernel/net/core/pktgen.ko becomes just pktgen.ko. Additionally, we only copy those .ko files into the vendor_boot image that are listed in vendor_boot.modules.load. On the other hand, the vendor_dlkm partition image will contain all .ko files regardless of whether they are listed in vendor_dlkm.modules.load. Bug: 190652328 Change-Id: I6fc41a0143e7253f193cac509ba30506feb4e2d9 --- BoardConfig-common.mk | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index ce9d9f72..f3cb420f 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -373,32 +373,20 @@ BOARD_BUILD_SYSTEM_ROOT_IMAGE := false # Vendor ramdisk image for kernel development BOARD_BUILD_VENDOR_RAMDISK_IMAGE := true -# Kernel modules -BOARD_VENDOR_KERNEL_MODULES += \ - $(wildcard $(TARGET_KERNEL_DIR)/*.ko) +KERNEL_MODULE_DIR := $(TARGET_KERNEL_DIR) +KERNEL_MODULES := $(wildcard $(KERNEL_MODULE_DIR)/*.ko) -BOARD_VENDOR_RAMDISK_KERNEL_MODULES_FILTER += \ - $(TARGET_KERNEL_DIR)/bcmdhd43752.ko \ - $(TARGET_KERNEL_DIR)/bcmdhd4389.ko \ - $(TARGET_KERNEL_DIR)/lwis.ko \ - $(TARGET_KERNEL_DIR)/mali_kbase.ko \ - $(TARGET_KERNEL_DIR)/mali_pixel.ko \ - $(TARGET_KERNEL_DIR)/pinctrl-slg51000.ko \ - $(TARGET_KERNEL_DIR)/pktgen.ko \ - $(TARGET_KERNEL_DIR)/slg51000-core.ko \ - $(TARGET_KERNEL_DIR)/slg51000-regulator.ko \ - $(TARGET_KERNEL_DIR)/stmvl53l1.ko \ - $(TARGET_KERNEL_DIR)/ftm5.ko \ - $(TARGET_KERNEL_DIR)/haptics-cs40l2x.ko \ - $(TARGET_KERNEL_DIR)/snd_soc_cs40l2x.ko \ - $(TARGET_KERNEL_DIR)/sec_touch.ko \ - $(TARGET_KERNEL_DIR)/cl_dsp.ko \ - $(TARGET_KERNEL_DIR)/input-cs40l26-i2c.ko +BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD := $(strip $(shell cat $(KERNEL_MODULE_DIR)/vendor_boot.modules.load)) +ifndef BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD +$(error vendor_boot.modules.load not found or empty) +endif +BOARD_VENDOR_RAMDISK_KERNEL_MODULES := $(addprefix $(KERNEL_MODULE_DIR)/, $(notdir $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD))) -BOARD_VENDOR_RAMDISK_KERNEL_MODULES += \ - $(filter-out $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_FILTER), $(foreach module, $(notdir \ - $(shell cat $(TARGET_KERNEL_DIR)/modules.load)), \ - $(TARGET_KERNEL_DIR)/$(module))) +BOARD_VENDOR_KERNEL_MODULES_LOAD := $(strip $(shell cat $(KERNEL_MODULE_DIR)/vendor_dlkm.modules.load)) +ifndef BOARD_VENDOR_KERNEL_MODULES_LOAD +$(error vendor_dlkm.modules.load not found or empty) +endif +BOARD_VENDOR_KERNEL_MODULES := $(KERNEL_MODULES) # Using BUILD_COPY_HEADERS BUILD_BROKEN_USES_BUILD_COPY_HEADERS := true