kbuild: building external module in separate output directory

Yann Droneaud ydroneaud at opteya.com
Wed Feb 13 10:28:46 EST 2013


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.

-- 
Yann Droneaud
OPTEYA





More information about the Kernelnewbies mailing list