compiling external modules
I have been working in a cross-compile environment for a long time and have not cared about native build at all. Since current laptops may require proprietary drivers, I used a default kernel from a distribution as it is. So I have not even built my own kernel for a host machine for a year;). But I want an environment to try simple kernel modules on my laptop and I introdued the following environment. It works well.
doyu@oreo:~/modules$ sudo apt-get install linux-headers-`uname -r` doyu@oreo:~/modules$ cat > Makefile ifneq ($(KERNELRELEASE),) obj-m := module.o else KDIR := /usr/src/linux-headers-$(shell uname -r) PWD := $(shell pwd) default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules endif
This is basically based on http://lwn.net/Articles/21823/ and I just tweaked it for debian/ubuntu.