Link an out-of-tree module into vmlinux
alexei at alexeicolin.com
Fri Sep 28 12:01:21 EDT 2012
Does the build system support building built-in components of vmlinux
That is, I know that these two are possible:
(1) build out-of-tree code as a loadable kernel module (.ko) (use the
(2) build an in-tree module as a statically built-in component of
vmlinux instead of as a LKM (use the CONFIG_<module>=y, or otherwise add
the object files to obj-y instead of obj-m)
The question is can you build an an _out-of-tree_ module as a statically
built-in component of vmlinux?
It seems you can't do it without modifying the root Makefile. That is,
the reason (2) works is because the directory that will have built-in.o
in it is in-tree and explicitly referenced by the root Makefile. I would
hope that the M=dir parameter would effectively add the dir to the list,
but it seems that it does not, spoiling the whole party: the built-in.o
is correctly created, but it is not picked up by the vmlinux link-line.
The only workaround I have working is to add an ugly out-of-tree path
into the list of directories in the root Makefile.
I could not find this use-case in the neither in the Kbuild
documentation nor online. Thank you in advance.
More information about the Kernelnewbies