[ltp] [PATCH: Build improvements 2/3] Allow build of modules for not-running kernel versions

linux-thinkpad@linux-thinkpad.org linux-thinkpad@linux-thinkpad.org
Sat, 6 Apr 2013 15:35:00 +0200

The current Makefile always sets KVER and some other variables to the
version of the currently running kernel and does not allow overriding
this value. So installing a newer kernel and building and installing
the modules for the new version will not work before activation of the
new kernel. With this patch, the following can be done:

export KVER=<newly-installed-kernel-version>
echo "Kernel version to build for: $KVER"
export MOD_DIR=/lib/modules/${KVER}/extra/

Signed-off-by: Joerg Mayer <jmayer@loplof.de>
:100644 100644 ccdde19... 97e2172... M	Makefile
 Makefile |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index ccdde19..97e2172 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
 ifndef TP_MODULES
 # This part runs as a normal, top-level Makefile:
 X:=$(shell false)
-KVER        := $(shell uname -r)
-KBASE       := /lib/modules/$(KVER)
-KSRC        := $(KBASE)/source
-KBUILD      := $(KBASE)/build
-MOD_DIR     := $(KBASE)/kernel
+KVER        ?= $(shell uname -r)
+KBASE       ?= /lib/modules/$(KVER)
+KSRC        ?= $(KBASE)/source
+KBUILD      ?= $(KBASE)/build
+MOD_DIR     ?= $(KBASE)/kernel
 PWD         := $(shell pwd)
 IDIR        := include/linux
 TP_DIR      := drivers/platform/x86