On 09/08/17 00:30, Jason A. Donenfeld wrote: > For (1) and (2), though, what do you think of the warning I've added > to Gentoo? That's what I meant by asking for thoughts on "this > pattern" -- the whole thing with comparing running kernel and > compiled-for-kernel and comparing loaded-module-version and > compiled-module-version. > Ah, righty. From my admittedly limited experience that seems fine - for example, from the Debian/Ubuntu virtualbox-dkms package (vboxdrv/Makefile, #192): > # kernel base directory > ifndef KERN_DIR > # build for the current kernel, version check > KERN_DIR := /lib/modules/$(shell uname -r)/build > ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) > KERN_DIR := /usr/src/linux > ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) > $(error Error: unable to find the sources of your current Linux kernel. \ > Specify KERN_DIR= and run Make again) > endif > $(warning Warning: using /usr/src/linux as the source directory of your \ > Linux kernel. If this is not correct, specify \ > KERN_DIR= and run Make again.) > endif > else > ifneq ($(shell if test -d $(KERN_DIR); then echo yes; fi),yes) > $(error Error: KERN_DIR does not point to a directory) > endif > endif