make .o files in separate folder in linux kernel compilation

喜夏-厌秋 提交于 2020-08-24 07:26:25

问题


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


回答1:


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.


来源:https://stackoverflow.com/questions/15969694/make-o-files-in-separate-folder-in-linux-kernel-compilation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!