Skip to contentSkip to conversation

export KLIB_VERSION during make install

PATCH New Thomas Pedersen 1 participant 2 messages Nov 22, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 export KLIB_VERSION during make install

This should fix make install against non-running kernel versions.

---
 backport/Makefile               | 6 ++++--
 backport/Makefile.real          | 4 ++--
 backport/scripts/mod_helpers.sh | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)
backport/Makefile +4 -2
index 11678f6..edd36b7 100644
@@ -11,16 +11,18 @@ BACKPORT_DIR := $(shell pwd)
 KMODDIR ?= updates
 ifneq ($(origin KLIB), undefined)
 KMODPATH_ARG := "INSTALL_MOD_PATH=$(KLIB)"
+KLIB_VERSION := $(shell basename $(KLIB))
 else
-KLIB := /lib/modules/$(shell uname -r)/
+KLIB_VERSION := $(shell uname -r)
 KMODPATH_ARG :=
+KLIB := /lib/modules/$(KLIB_VERSION)/
 endif
 KLIB_BUILD ?= $(KLIB)/build/
 KERNEL_CONFIG := $(KLIB_BUILD)/.config
 KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
 CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//')
 
-export KLIB KLIB_BUILD BACKPORT_DIR KMODDIR KMODPATH_ARG
+export KLIB KLIB_VERSION KLIB_BUILD BACKPORT_DIR KMODDIR KMODPATH_ARG
 
 # disable built-in rules for this file
 .SUFFIXES:
backport/Makefile.real +2 -2
index a0f4916..5ec133e 100644
@@ -95,7 +95,7 @@ install: modules
 	@./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR)
 	@./scripts/compress_modules.sh $(KLIB)/$(KMODDIR)
 	@./scripts/check_depmod.sh
-	@/sbin/depmod -a
+	@/sbin/depmod -a $(KLIB_VERSION)
 	@./scripts/update-initramfs.sh $(KLIB)
 	@echo
 	@echo Your backported driver modules should be installed now.
@@ -108,7 +108,7 @@ modules_install: install
 .PHONY: uninstall
 uninstall:
 	@./scripts/uninstall.sh
-	@/sbin/depmod -a
+	@/sbin/depmod -a $(KLIB_VERSION)
 	@./scripts/update-initramfs.sh $(KLIB)
 	@echo
 	@echo Your backported driver modules should be uninstalled now.
backport/scripts/mod_helpers.sh +1 -1
index 0845b3e..4056a0f 100644
@@ -2,7 +2,7 @@ function mod_filename()
 {
 	which modinfo > /dev/null 2>&1
 	if [[ $? -eq 0 ]]; then
-		MOD_QUERY="modinfo -F filename"
+		MOD_QUERY="modinfo -k ${KLIB_VERSION} -F filename"
 	else
 		MOD_QUERY="modprobe -l"
 	fi
Signature · 5 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#1 lore raw

PATCH 2/2 remove KMODPATH_ARG

This interferes with module install when specifying KLIB.

According to kernel docs, INSTALL_MOD_PATH is the module install path prefix:

INSTALL_MOD_PATH
--------------------------------------------------
INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory relocations required by build roots. This is not defined in the makefile but the argument can be passed to make if needed.

Which causes modules to be installed in /lib/modules/$KLIB_VERSION/lib/modules/$KLIB_VERSION.

---
 backport/Makefile      | 4 +---
 backport/Makefile.real | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)
backport/Makefile +1 -3
index edd36b7..8cf1096 100644
@@ -10,11 +10,9 @@ BACKPORT_DIR := $(shell pwd)
 
 KMODDIR ?= updates
 ifneq ($(origin KLIB), undefined)
-KMODPATH_ARG := "INSTALL_MOD_PATH=$(KLIB)"
 KLIB_VERSION := $(shell basename $(KLIB))
 else
 KLIB_VERSION := $(shell uname -r)
-KMODPATH_ARG :=
 KLIB := /lib/modules/$(KLIB_VERSION)/
 endif
 KLIB_BUILD ?= $(KLIB)/build/
@@ -22,7 +20,7 @@ KERNEL_CONFIG := $(KLIB_BUILD)/.config
 KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
 CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//')
 
-export KLIB KLIB_VERSION KLIB_BUILD BACKPORT_DIR KMODDIR KMODPATH_ARG
+export KLIB KLIB_VERSION KLIB_BUILD BACKPORT_DIR KMODDIR
 
 # disable built-in rules for this file
 .SUFFIXES:
backport/Makefile.real +1 -1
index 5ec133e..b65474b 100644
@@ -90,7 +90,7 @@ modules: backport-include/backport/autoconf.h
 .PHONY: install
 install: modules
 	@$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_DIR)			\
-		INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG)		\
+		INSTALL_MOD_DIR=$(KMODDIR)				\
 		modules_install
 	@./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR)
 	@./scripts/compress_modules.sh $(KLIB)/$(KMODDIR)
Signature · 5 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe backports" in