[PATCH] Makefile: rework kernel version logic

Mikk mikkmar at airmail.cc
Wed Aug 28 15:01:25 CEST 2019


This makes depmod actually work when building/installing the module for a kernel other than the currently running one

Signed-off-by: Mikk <mikkmar at airmail.cc>
---
 src/Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index 24b2ba0..d0d6c4d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2,7 +2,8 @@
 #
 # Copyright (C) 2015-2019 Jason A. Donenfeld <Jason at zx2c4.com>. All Rights Reserved.
 
-KERNELDIR ?= /lib/modules/$(shell uname -r)/build
+KVER ?= $(shell uname -r)
+KERNELDIR ?= /lib/modules/$(KVER)/build
 PREFIX ?= /usr
 DESTDIR ?=
 SRCDIR ?= $(PREFIX)/src
@@ -45,7 +46,7 @@ clean:
 
 module-install:
 	@$(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install
-	$(DEPMOD) -a
+	$(DEPMOD) -a $(KVER)
 
 install: module-install tools-install
 
-- 
2.23.0



More information about the WireGuard mailing list