kernel: Support pixel style vendor_boot modules
Mini documentation: List the names of boot modules in BOOT_KERNEL_MODULES to add them to vendor_boot. All modules still end up in their primary location (normally vendor/lib/modules). Boot modules will be kept here as duplicates. The list of boot modules is then depmod'ed and copied to the vendor ramdisk. The file modules.load is created from BOARD_$(IMAGE)_KERNEL_MODULES_LOAD as the ordered list of modules to be loaded form that location, either parsed by a modprobe script or by init itself (only boot modules) When using vendor_boot modules, vendor/lib/modules/modules.load should list all modules but boot modules. Also don't clear the output directory, because one might want to push a modules.blocklist there. Change-Id: I89a4aad42a6585a572812f1d7e89f5d78931e1e6
This commit is contained in:
parent
c63fa8441b
commit
b9aa311d5a
1 changed files with 18 additions and 2 deletions
|
@ -182,6 +182,9 @@ $(INSTALLED_VENDORIMAGE_TARGET): $(TARGET_PREBUILT_INT_KERNEL)
|
|||
endif
|
||||
MODULES_INTERMEDIATES := $(KERNEL_BUILD_OUT_PREFIX)$(call intermediates-dir-for,PACKAGING,kernel_modules)
|
||||
|
||||
KERNEL_VENDOR_RAMDISK_DEPMOD_STAGING_DIR := $(KERNEL_BUILD_OUT_PREFIX)$(call intermediates-dir-for,PACKAGING,depmod_vendor_ramdisk)
|
||||
$(INTERNAL_VENDOR_RAMDISK_TARGET): $(TARGET_PREBUILT_INT_KERNEL)
|
||||
|
||||
# Add host bin out dir to path
|
||||
PATH_OVERRIDE := PATH=$(KERNEL_BUILD_OUT_PREFIX)$(HOST_OUT_EXECUTABLES):$$PATH
|
||||
ifeq ($(TARGET_KERNEL_CLANG_COMPILE),true)
|
||||
|
@ -248,9 +251,9 @@ endef
|
|||
# $(2): output dir
|
||||
# $(3): mount point
|
||||
# $(4): staging dir
|
||||
# $(5): module load list
|
||||
# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
|
||||
define build-image-kernel-modules-lineage
|
||||
rm -rf $(2)/lib/modules
|
||||
mkdir -p $(2)/lib/modules
|
||||
cp $(1) $(2)/lib/modules/
|
||||
rm -rf $(4)
|
||||
|
@ -258,7 +261,12 @@ define build-image-kernel-modules-lineage
|
|||
cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
|
||||
$(DEPMOD) -b $(4) 0.0
|
||||
sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
|
||||
cp $(4)/lib/modules/0.0/modules.softdep $(2)/lib/modules
|
||||
cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
|
||||
rm -f $(2)/lib/modules/modules.load
|
||||
for MODULE in $(5); do \
|
||||
basename $$MODULE >> $(2)/lib/modules/modules.load; \
|
||||
done
|
||||
endef
|
||||
|
||||
$(KERNEL_OUT):
|
||||
|
@ -301,7 +309,15 @@ $(TARGET_PREBUILT_INT_KERNEL): $(KERNEL_CONFIG) $(DEPMOD) $(DTC)
|
|||
$(eval p := $(subst :,$(space),$(s))) \
|
||||
; mv $$(find $$kernel_modules_dir -name $(word 1,$(p))) $$kernel_modules_dir/$(word 2,$(p))); \
|
||||
modules=$$(find $$kernel_modules_dir -type f -name '*.ko'); \
|
||||
($(call build-image-kernel-modules-lineage,$$modules,$(KERNEL_MODULES_OUT),$(KERNEL_MODULE_MOUNTPOINT)/,$(KERNEL_DEPMOD_STAGING_DIR))); \
|
||||
($(call build-image-kernel-modules-lineage,$$modules,$(KERNEL_MODULES_OUT),$(KERNEL_MODULE_MOUNTPOINT)/,$(KERNEL_DEPMOD_STAGING_DIR),$(BOARD_VENDOR_KERNEL_MODULES_LOAD))); \
|
||||
$(if $(BOOT_KERNEL_MODULES),\
|
||||
vendor_boot_modules=$$(for m in $(BOOT_KERNEL_MODULES); do \
|
||||
p=$$(find $$kernel_modules_dir -type f -name $$m); \
|
||||
if [ -n "$$p" ]; then echo $$p; else echo "ERROR: $$m from BOOT_KERNEL_MODULES was not found" 1>&2 && exit 1; fi; \
|
||||
done); \
|
||||
[ $$? -ne 0 ] && exit 1; \
|
||||
($(call build-image-kernel-modules-lineage,$$vendor_boot_modules,$(TARGET_VENDOR_RAMDISK_OUT),/,$(KERNEL_VENDOR_RAMDISK_DEPMOD_STAGING_DIR),$(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD))); \
|
||||
) \
|
||||
fi
|
||||
|
||||
.PHONY: kerneltags
|
||||
|
|
Loading…
Reference in a new issue