Building external modules against objdirs

From: Andi Kleen
Date: Sun Jul 30 2006 - 12:58:31 EST


It looks like building external modules against separate objdirs doesn't work
anymore in 2.6.18.

tmod is a simple module I use for some testing.

obj-* are objdirs tree built against separate source with make O=$(pwd) -C ../linux-...

> cat Makefile
obj-m := tmod.o

KERNELDIR := /lib/modules/`uname -r`/build

$(MAKE) -C ${KERNELDIR} M=`pwd`

With 2.6.17 it works great:

> make KERNELDIR=/home/lsrc/obj-2.6.17
make -C /home/lsrc/obj-2.6.17 M=`pwd`
make[1]: Entering directory `/home/lsrc/obj-2.6.17'
make -C /home/lsrc/linux-2.6.17 O=/home/lsrc/obj-2.6.17
Building modules, stage 2.
CC /home/andi/tsrc/tmod/tmod.mod.o
LD [M] /home/andi/tsrc/tmod/tmod.ko
make[1]: Leaving directory `/home/lsrc/obj-2.6.17'

But with 2.6.18-rc3 it doesn't work anymore. I saw this for at least a few weeks already
with 2.6.17-git*, but only realized now it wasn't some stupid mistake on my side.

> make -C /home/lsrc/quilt/obj M=`pwd`
make[1]: Entering directory `/home/lsrc/quilt/obj'
make -C /basil/home/lsrc/quilt/linux O=/basil/home/lsrc/quilt/obj
/home/lsrc/quilt/linux/Makefile:456: *** kernel configuration not valid - run 'make prepare' in /home/lsrc/quilt/linux to update it. Stop.
make[2]: *** [_all] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/lsrc/quilt/obj'
make: *** [all] Error 2

Is there a workaround? It would be good to fix it for 2.6.18 because it will
likely cause trouble for a lot of external projects.

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