summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <keescook@google.com>2016-05-20 14:16:37 -0700
committerKees Cook <keescook@google.com>2016-05-20 14:31:00 -0700
commitec025b3af5d3bfc148adb9f7b6ef97dcc0eb31a8 (patch)
tree590825475b2618f9723dd7367a9a42281bc7853d
parentdb4c48bcee10d4b707ccb966a14f2ebb0ca5245d (diff)
downloadbrillo-ec025b3af5d3bfc148adb9f7b6ef97dcc0eb31a8.tar.gz
kernel: split modules install target
In order to give the system image target something to use as a dependency, this splits the kernel modules target into a separate target. Bug: 27774946 Change-Id: Iec5b578e65513f97584c0164fc78c7784bf6a497
-rw-r--r--kernel.mk13
1 files changed, 11 insertions, 2 deletions
diff --git a/kernel.mk b/kernel.mk
index e5511d9..4c63e02 100644
--- a/kernel.mk
+++ b/kernel.mk
@@ -129,9 +129,10 @@ KERNEL_CONFIG := $(KERNEL_OUT)/.config
KERNEL_MERGE_CONFIG := device/generic/brillo/mergeconfig.sh
KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr
+KERNEL_MODULES_INSTALL := $(TARGET_OUT)/lib/modules
$(KERNEL_OUT):
- mkdir -p $(KERNEL_OUT)
+ mkdir -p $@
# Merge the required kernel config elements into a single file.
$(KERNEL_CONFIG_REQUIRED): $(KERNEL_CONFIG_REQUIRED_SRC) | $(KERNEL_OUT)
@@ -161,6 +162,11 @@ $(KERNEL_BIN): $(KERNEL_CONFIG) | $(KERNEL_OUT)
$(hide) rm -rf $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts
$(hide) rm -rf $(PRODUCT_OUT)/kernel.dtb $(PRODUCT_OUT)/kernel-and-dtb
$(call build_kernel,all)
+
+$(KERNEL_MODULES_INSTALL): $(KERNEL_BIN)
+ $(hide) echo "Installing kernel modules ..."
+ # Since there may be no modules built, at least create the empty dir.
+ mkdir -p $@
if grep -q ^CONFIG_MODULES=y $(KERNEL_CONFIG) ; then \
$(call build_kernel,modules_install) ; \
fi
@@ -195,7 +201,7 @@ $(PRODUCT_OUT)/kernel-and-dtb: $(KERNEL_BIN) $(PRODUCT_OUT)/kernel.dtb
$(hide) cat $^ > $@
# The list of dependencies for the final kernel.
-KERNEL_DEPS := $(KERNEL_BIN).vdso $(KERNEL_HEADERS_INSTALL)
+KERNEL_DEPS := $(KERNEL_BIN).vdso $(KERNEL_HEADERS_INSTALL) $(KERNEL_MODULES_INSTALL)
ifdef TARGET_KERNEL_DTB
# If we need the DTB, include it in the build list.
KERNEL_DEPS += $(PRODUCT_OUT)/kernel.dtb
@@ -208,6 +214,9 @@ else
KERNEL_IMAGE := $(KERNEL_BIN)
endif
+# Makes sure any built modules will be included in the system image build.
+ALL_DEFAULT_INSTALLED_MODULES += $(KERNEL_MODULES_INSTALL)
+
# Produces the actual kernel image!
$(PRODUCT_OUT)/kernel: $(KERNEL_IMAGE) $(KERNEL_DEPS) | $(ACP)
$(ACP) -fp $< $@