Skip to contentSkip to conversation

Kernel module compilation

DISCUSSION David Pilger 3 participants 8 messages Mar 29, 2007 – Apr 5, 2007

lore
Share & tools
lore
#0 lore raw

Hello all,
How can I build just a single kernel module from the linux-xen sources. for instance, compile just the xen kernel modules directory...

Thanks,
David.

#1 lore raw

Sorry for the dumb question, but all these compilations are killing me :) I cd into my modue directory inside linux-2.6.18-xen
and executed - "make -C path/to/kernel/src SUBDIRS=$PWD modules"

The error I get is -
----
/work/xen/linux-2.6.18-xen/scripts/Makefile.modpost:38:
include/config/auto.conf: No such file or directory make[1]: *** No rule to make target `include/config/auto.conf'. Stop.
make: *** [modules] Error 2
----

while autoconf.h can be found at the directory -> build-linux-2.6.18-xen_x86... under include/linux/autoconf.h

Do you know how can I recompile just my single driver?

Thanks in advance,
David.

Quoted 7 lines · David Pilger

Hello all,
How can I build just a single kernel module from the linux-xen sources.
for instance, compile just the xen kernel modules directory...

Thanks,
David.

#2 lore raw
Quoted 12 lines · David Pilger

Sorry for the dumb question, but all these compilations are killing me :) I cd into my modue directory inside linux-2.6.18-xen
and executed - "make -C path/to/kernel/src SUBDIRS=$PWD modules"

The error I get is -
----
/work/xen/linux-2.6.18-xen/scripts/Makefile.modpost:38:
include/config/auto.conf: No such file or directory make[1]: *** No rule to make target `include/config/auto.conf'. Stop.
make: *** [modules] Error 2
----

Quoted 4 lines

while autoconf.h can be found at the directory -> build-linux-2.6.18-xen_x86... under include/linux/autoconf.h

Do you know how can I recompile just my single driver?

Not sure but try adding O=/path/to/build-linux-2.6.18-xen_x86 to your existing command line.

It's more normal to use M=$PWD rather than SUBDIRS=$PWD but I don't know if that is related and I think both work ok.

Ian.

Quoted 17 lines

Thanks in advance,
David.

Quoted 7 lines · David Pilger

Hello all,
How can I build just a single kernel module from the linux-xen sources.
for instance, compile just the xen kernel modules directory...

Thanks,
David.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw

Thanks for your help,
It didn't work...

This is the error I got ->
----
Makefile:107: *** output directory "../../../build-linux-2.6.18-xen_x86_32/" does not exist. Stop.
----

And without the "O=...", using "M=..." instead of "SUBDIRS=..." gives the same error as before.

Any ideas?
Thanks!

Quoted 45 lines · Ian Campbell
Quoted 12 lines · David Pilger

Sorry for the dumb question, but all these compilations are killing me :) I cd into my modue directory inside linux-2.6.18-xen
and executed - "make -C path/to/kernel/src SUBDIRS=$PWD modules"

The error I get is -
----
/work/xen/linux-2.6.18-xen/scripts/Makefile.modpost:38:
include/config/auto.conf: No such file or directory make[1]: *** No rule to make target `include/config/auto.conf'. Stop.
make: *** [modules] Error 2
----

Quoted 4 lines

while autoconf.h can be found at the directory -> build-linux-2.6.18-xen_x86... under include/linux/autoconf.h

Do you know how can I recompile just my single driver?

Not sure but try adding O=/path/to/build-linux-2.6.18-xen_x86 to your existing command line.

It's more normal to use M=$PWD rather than SUBDIRS=$PWD but I don't know if that is related and I think both work ok.

Ian.

Quoted 17 lines

Thanks in advance,
David.

Quoted 7 lines · David Pilger

Hello all,
How can I build just a single kernel module from the linux-xen sources.
for instance, compile just the xen kernel modules directory...

Thanks,
David.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw
Quoted 7 lines · David Pilger

Thanks for your help,
It didn't work...

This is the error I got ->
----
Makefile:107: *** output directory "../../../build-linux-2.6.18-xen_x86_32/" does not exist. Stop.

I presume that path does exist. It's possible that it needs to be relative to the kernel source directory rather than the module source directory. It would be worth trying an absolute path rather than a relative one.

The only other thing I can suggest is to have a read through Documentation/kbuild/* (esp. modules.txt) in the kernel source and see if it has any hints.

Ian.

#5 lore raw
Quoted 10 lines · Ian Campbell

I presume that path does exist. It's possible that it needs to be relative to the kernel source directory rather than the module source directory. It would be worth trying an absolute path rather than a relative one.

The only other thing I can suggest is to have a read through Documentation/kbuild/* (esp. modules.txt) in the kernel source and see if it has any hints.

Thanks again,
I guess it's something with the Xen Makefile, in the way that Xen builds the kernels. autoconf.h is present but in the build-...x86 directory.

Quoted 3 lines

Ian.

#6 lore raw
In reply to Ian Campbell
Quoted 10 lines · Ian Campbell
Quoted 7 lines · David Pilger

Thanks for your help,
It didn't work...

This is the error I got ->
----
Makefile:107: *** output directory "../../../build-linux-2.6.18-xen_x86_32/" does not exist. Stop.

I presume that path does exist.

It would only exist if you're building the unified kernel. If you're building separate domU and dom0 kernels you'll have slightly differently named build directories.

To just rebuild a couple of modules that I've changed I do:

cd /path/to/your/xen-unstable.hg
make -C build-linux-<whatever>_x86_32 modules

where <whatever> should match the kernel you want to build for.

This doesn't result in the compiled modules being copied to dist/install/lib/modules/ in the xen-unstable.hg as it would if I'd done a normal "make dist", but copying them over is easy enough with a script.

Kieran

#7 lore raw
Quoted 21 lines · Kieran Mansley
Quoted 10 lines · Ian Campbell
Quoted 7 lines · David Pilger

Thanks for your help,
It didn't work...

This is the error I got ->
----
Makefile:107: *** output directory "../../../build-linux-2.6.18-xen_x86_32/" does not exist. Stop.

I presume that path does exist.

It would only exist if you're building the unified kernel. If you're building separate domU and dom0 kernels you'll have slightly differently named build directories.

To just rebuild a couple of modules that I've changed I do:

cd /path/to/your/xen-unstable.hg
make -C build-linux-<whatever>_x86_32 modules

Quoted 9 lines

where <whatever> should match the kernel you want to build for.

This doesn't result in the compiled modules being copied to dist/install/lib/modules/ in the xen-unstable.hg as it would if I'd done a normal "make dist", but copying them over is easy enough with a script.

Kieran

Thanks everyone!
Kieran, I just added "M=driver/path/to/driver" and it worked! The final line looks like this ->

make -C build-linux-2.6.18-xen_x86_32 modules M=drivers/char/mydriver CONFIG_MYDRIVER=m

Quoted 6 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel