I'd like to redirect the output of my module build to segregate the artifacts from the source.
My makefile looks like:
obj-m += hello-1.o
all:
make ARCH=arm CROSS_COMPILE=arm-eabi- -C /work/TI-Android-ICS-4.0.3_AM37x_3.0.0/kernel M=$(PWD) modules
clean:
make ARCH=arm CROSS_COMPILE=arm-eabi- -C /work/TI-Android-ICS-4.0.3_AM37x_3.0.0/kernel M=$(PWD) clean
This works correctly, except that the module output happens to be in my source directory. I tried adding O={path to my output dirctory} in each line, but then it failed to build with something like...
ERROR: Kernel configuration is invalid. include/generated/autoconf.h or include/config/auto.conf are missing. Run 'make oldconfig && make prepare' on kernel src to fix it.
WARNING: Symbol version dump /work/development/linux/driver/blah/Module.symvers is missing; modules will have no dependencies and modversions.
I assume this stems from the fact that there is some output file from the kernel build that's used in the module build, and changing the output directory with "O=" collides with that.
Is there a method for accomplishing this using the existing build infrastructure?
Looking at the documentation for the module system, it doesn't look good. Perhaps you can copy
.config
into your build directory and do amake oldconfig && make modules-prepare
withO=
set.Alternatively, what happens if you run
make
from another directory?This Makefile will solve your query