Thread (3 messages) 3 messages, 2 authors, 2012-09-28

Link an out-of-tree module into vmlinux

From: Dave Hylands <hidden>
Date: 2012-09-28 18:01:51

Hi Alexei,

On Fri, Sep 28, 2012 at 9:01 AM, Alexei Colin [off-list ref] wrote:
Hello,

Does the build system support building built-in components of vmlinux
out-of-tree?

That is, I know that these two are possible:
(1) build out-of-tree code as a loadable kernel module (.ko) (use the
M=/path/to/out-of-tree/dir)
(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.
It depends on what you mean by "out-of-tree"

You can build the entire kernel out-of-tree, and by that I mean have
the object files go into a different tree than the source files.

You can't build the static portions separate from the rest of the
kernel, i.e. all of the objects are in the same tree, either the
source tree, or some other tree.

You use O= to specify the tree that the object files will go in.

-- 
Dave Hylands
Shuswap, BC, Canada
http://www.davehylands.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help