Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make .o files in separate folder in linux kernel compilation

see in linux kernel compilation if just do make

make ARCH=xyz uImage

then it will compile files as per your .conf file and create .o or .ko in same folder where your .c file is there.

So is there any way so i can force to compilation so that all .o and .ko will be any in different folder specified by me

like image 556
Jeegar Patel Avatar asked Apr 12 '13 11:04

Jeegar Patel


1 Answers

try using make O=/path/to/mydir

Here is the documentation from the kernel's 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.
like image 198
ThePosey Avatar answered Oct 19 '22 05:10

ThePosey