Make.o files in a separate folder in the Linux kernel compilation

see in Linux kernel compilation if you just do

make ARCH=xyz uImage

then it will compile the files according to your .conf file and create a .o or .ko in the same folder where your .c file is located.

So, is there a way I can force the compilation so that all .o and .ko are any in another folder that I specified

+5
source share
1 answer

try using make O=/path/to/mydir

Here is the documentation from the kernel 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.
+6
source

All Articles