SHELL := /bin/bash
BACKPORT_PWD := $(shell pwd)
-KLIB ?= /lib/modules/$(shell uname -r)/
+KMODDIR ?= updates
+ifneq ($(origin KLIB), undefined)
+KMODPATH_ARG := "INSTALL_MOD_PATH=$(KLIB)"
+else
+KLIB := /lib/modules/$(shell uname -r)/
+KMODPATH_ARG :=
+endif
KLIB_BUILD ?= $(KLIB)/build/
KERNEL_CONFIG := $(KLIB_BUILD)/.config
KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile
CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) | sed 's/\s.*//')
-export KLIB_BUILD BACKPORT_PWD
+export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG
# disable built-in rules for this file
.SUFFIXES:
.PHONY: modules
modules: include/linux/compat_autoconf.h
@$(MAKE) -f Makefile.build modules
+
+.PHONY: install
+install: modules
+ @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) \
+ INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG) \
+ modules_install
+ @/sbin/depmod -ae
+ @echo
+ @echo Your backported driver modules should be installed now.
+ @echo Try loading them with modprobe.
+ @echo
+# FIXME:
+# compress modules
+# check depmod
+# iwlwifi vs. iwlagn
+# iwl4965 vs. iwlagn
+# install/load/unload/... scripts?
+# compat firmware class udev stuff