Skip to contentSkip to conversation

kbuild: building external module in separate output directory

DISCUSSION Yann Droneaud 1 participant 1 message Feb 13, 2013

lore
Share & tools
lore
#0 lore raw

Hi,

With kbuild, we can build external modules using:

make -C $KERNEL_BUILDDIR M=$PWD

But I'm looking for the proper way to not clobber my module source directory with files from the build, eg. I'd like the build to output the files in another directory.

I'd like to do:

mkdir obj-$ARCH
cd obj-$ARCH
make -C $KERNEL_BUILDDIR M=$PWD/.. O=$PWD

But O= is not supported for external module. It can only be used when building the kernel (and its modules) itself.

I have found people explaining that the currently only way is to copy/link the sources inside the object directory.
But I find this tasteless and error prone.

Do someone know another method or a patch to the kbuild system to improve external module compilation ?

Regards.

Signature · 2 lines
Yann Droneaud
OPTEYA