Re: modversion.h improvement suggestion

From: Olaf Titz (
Date: Mon May 06 2002 - 16:03:34 EST

> The build instructions for third party modules should say something
> like
> If your kernel was built with CONFIG_MODVERSIONS=y then add these
> flags to the build for this module
> -DMODVERSIONS -include kernel_source_tree/linux/modversions.h

or even better, pick up the _complete_ compilation rule from the
kernel Makefile, since this is (unfortunately) by now the only way to
get all compiler options right.

I do it this way (in a for an external module):
KSRC is the kernel source location.

  cp $KSRC/Makefile conftest.make
  echo -e "conftest.CC:" >>conftest.make
  echo -e "\t@echo \$(CC)" >>conftest.make
  echo -e "conftest.CFLAGS:" >>conftest.make
  echo -e "\t@echo \$(CFLAGS) \$(MODFLAGS)" >>conftest.make
  NKCC=`cd $KSRC; $MAKE -s -f $here/conftest.make conftest.CC`
  NKCFLAGS=`cd $KSRC; $MAKE -s -f $here/conftest.make conftest.CFLAGS`

i.e. copy the main Makefile, add a few rules to just echo the flags,
and then invoke it in the original place (since it depends on that).
We should really have a more elegant way to extract this info from the
main Makefile.

> In any case, modversions.h will disappear in kbuild 2.5.

which leaves hope this issue will be addressed...


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Tue May 07 2002 - 22:00:28 EST