Allow installing kernel module from prebuilt deb
- Add a concept of REQUIRED_MODULES to the kernel-modules build. If a
module is in REQUIRED_MODULES, but the source is not available under
$ROOTDIR/modules, try to fetch it from $PREBUILT_MODULES_ROOT.
Change-Id: Ie240402e83b300c0d24412d1281f9a8ffc118919
diff --git a/kernel-modules.mk b/kernel-modules.mk
index 67b09c7..7dffaf1 100644
--- a/kernel-modules.mk
+++ b/kernel-modules.mk
@@ -4,11 +4,21 @@
include $(ROOTDIR)/build/preamble.mk
+REQUIRED_MODULES := apex
+
MODULES_DIRS := $(wildcard $(ROOTDIR)/modules/*)
MODULES := $(foreach module,$(MODULES_DIRS),$(notdir $(module)))
+MODULES := $(sort $(MODULES) $(REQUIRED_MODULES))
+
+PREBUILT_MODULES_ROOT ?= /google/data/ro/teams/spacepark/enterprise/debs
define make-module-target
$1: $(PRODUCT_OUT)/.$1
+ifeq (,$$(wildcard $(ROOTDIR)/modules/$1/*))
+$(PRODUCT_OUT)/.$1: $(PRODUCT_OUT)
+ $$(warning "No source for $1")
+ cp $(PREBUILT_MODULES_ROOT)/$1.deb $(PRODUCT_OUT)
+else
$(PRODUCT_OUT)/.$1: $(shell find $(ROOTDIR)/modules/$1 -type f) $(KERNEL_OUT_DIR)/.config $(KERNEL_OUT_DIR)/arch/arm64/boot/Image
mkdir -p $(PRODUCT_OUT)/obj/MODULE_OBJ/$1/debian
cp -afs $(ROOTDIR)/modules/$1/* $(PRODUCT_OUT)/obj/MODULE_OBJ/$1
@@ -21,6 +31,7 @@
KOUT=$(KERNEL_OUT_DIR) \
debian/rules kdist_image
touch $(PRODUCT_OUT)/.$1
+endif
endef
$(foreach module,$(MODULES),$(eval $(call make-module-target,$(module))))
diff --git a/kokoro/continuous.cfg b/kokoro/continuous.cfg
index 30f9560..03ee270 100644
--- a/kokoro/continuous.cfg
+++ b/kokoro/continuous.cfg
@@ -3,6 +3,7 @@
gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/debootstrap.tgz.sha256sum"
gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img"
gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/rootfs/latest/rootfs.raw.img.sha256sum"
+gfile_resources: "/x20/teams/spacepark/enterprise/kokoro/prod/spacepark/enterprise/debs/apex.deb"
action {
define_artifacts {
regex: "boot.img"
diff --git a/kokoro/continuous.sh b/kokoro/continuous.sh
index 5eaa24d..835ba4e 100644
--- a/kokoro/continuous.sh
+++ b/kokoro/continuous.sh
@@ -13,6 +13,7 @@
popd
export TARBALL_FETCH_ROOT_DIRECTORY=${KOKORO_GFILE_DIR}
+export PREBUILT_MODULES_ROOT=${KOKORO_GFILE_DIR}
export DEBOOTSTRAP_TARBALL_REVISION=.
export ROOTFS_REVISION=.