I am writing a simple Makefile for an external kernel module.
Building it with:
obj-m += usbtherm.o
all:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
compiles only the external module, which is nice.
But installing it with:
install:
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules_install
installs all modules in the kernel source tree, and I don't know how I can have the module installed to drivers/usb/misc
.
So I am installing the module like this:
install:
cp $(shell pwd)/usbtherm.ko /lib/modules/$(shell uname -r)/kernel/drivers/usb/misc
depmod -a
which will install only the external module.
But it doesn't look too elegant to me - what am I missing?
make
as user butmake install
as root with sudo. That worked fine so far since every time I get a kernel update I need to reinstall the module.