Compiling a kernel module

This post is mainly a note for myself, in case I need this again, but forgot (and I will, both).

To compile a module (e.g. fuse.ko) for a kernel of which you only have the headers (e.g. some linaro build for a Pandaboard), do the following:

make -C /lib/modules/3.1.1-8-linaro-lt-omap/build/ CONFIG_FUSE_FS=m SUBDIRS=$PWD/fs/fuse modules

The argument for -C compiles the module in the proper environment: the target kernel. The "CONFIG_FUSE_FS" enables building fuse as module (linaro default is n). What to build is restricted by SUBDIRS, in which $PWD is the location of the stock 3.1.1 source (similar enough), and the target "modules".

No feedback yet