kernel: Allow installing modules on system
Change-Id: Id4386cd37645dc9e9253410e0b2093cd2e6b04dc
diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index 4d23c33..8965b1c 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
@@ -66,7 +66,9 @@
# USE_CCACHE = Enable ccache (global Android flag)
#
# NEED_KERNEL_MODULE_ROOT = Optional, if true, install kernel
-# modules in root instead of system
+# modules in root instead of vendor
+# NEED_KERNEL_MODULE_SYSTEM = Optional, if true, install kernel
+# modules in system instead of vendor
ifneq ($(TARGET_NO_KERNEL),true)
@@ -197,6 +199,11 @@
KERNEL_MODULES_OUT := $(TARGET_ROOT_OUT)/lib/modules
KERNEL_DEPMOD_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_recovery)
KERNEL_MODULE_MOUNTPOINT :=
+else ifeq ($(NEED_KERNEL_MODULE_SYSTEM),true)
+KERNEL_MODULES_INSTALL := $(TARGET_COPY_OUT_SYSTEM)
+KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules
+KERNEL_DEPMOD_STAGING_DIR := $(call intermediates-dir-for,PACKAGING,depmod_system)
+KERNEL_MODULE_MOUNTPOINT := system
else
KERNEL_MODULES_INSTALL := $(TARGET_COPY_OUT_VENDOR)
KERNEL_MODULES_OUT := $(TARGET_OUT_VENDOR)/lib/modules