在Linux内核编译中将.o文件放在单独的文件夹中

在linux内核编译中看看,如果只是做

make ARCH=xyz uImage 

那么它将按照.conf文件编译文件,并在.c文件所在的同一文件夹中创build.o或.ko文件。

所以有什么办法,所以我可以强制编译,以便所有.o和.ko将在我指定的不同文件夹中的任何

尝试使用make O=/path/to/mydir

这里是内核的Makefile的文档:

 # kbuild supports saving output files in a separate directory. # To locate output files in a separate directory two syntaxes are supported. # In both cases the working directory must be the root of the kernel src. # 1) O= # Use "make O=dir/to/store/output/files/" # # 2) Set KBUILD_OUTPUT # Set the environment variable KBUILD_OUTPUT to point to the directory # where the output files shall be placed. # export KBUILD_OUTPUT=dir/to/store/output/files/ # make # # The O= assignment takes precedence over the KBUILD_OUTPUT environment # variable.