Building external modules
Finally, somebody has done it. Sam Ravnborg has posted a patch which improves the external module build process in a number of ways.
The basic form of a makefile for an external module will not change much. It should still look something like:
ifneq ($(KERNELRELEASE),)
obj-m := module.o
else
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
default:
$(MAKE) -C $(KDIR) M=$(PWD)
endif
The change has been underlined above; the parameter that once read SUBDIRS=$(PWD) has changed to M=$(PWD). The older SUBDIRS= format will still work, however. It is also no longer necessary to specify the modules target when invoking the kernel build system.
When the kernel build system is invoked with the M= parameter, it does a number of things differently. It will make no effort to ensure that the built files in the kernel source tree are current; if a developer makes a change to the main tree, it is his or her responsibility to rebuild it before trying to make any external modules. Only a few targets (modules, clean, modules_install) are supported when building external modules. And the modpost program now maintains a file (Module.symvers) containing the symbol version information if modversions is in use; this file is used when postprocessing an external module to note the symbol versions expected by that module.
Among other things, the new scheme will allow distributors to package
sufficient information for the building of external modules without the
user having to actually configure and build the full kernel source tree.
That information can be stored under /lib/modules by replacing the
build symbolic link (which currently points back to the source
tree) with a directory containing just the required information. That
should make life simpler for everybody involved.
| Index entries for this article | |
|---|---|
| Kernel | Build system |
| Kernel | Modules |