栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

1.2 Linux内核编译目标生成路径配置

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

1.2 Linux内核编译目标生成路径配置

写在前面

本来这部分是不能单独成篇的,但是想到后面还要很多内核编译相关的内容,就单独拉出来分享了。

首先写博客是一种记录,而这种记录都是问题驱动的。遇到问题,解决问题,记录问题,分享问题。在编译内核的时候,我发现编译生成的文件都适合源码混在一起的,如果改动比较小,自己记得住是没问题的,但是随着改动越来越多,尤其是在本地创建了git库来管理以后,看起来非常混乱,如下图:

配置编译目标生成路径有两种方法,如下:

一、指定编译命令参数
make O=dir/to/store/output/files/
二、配置环境变量方式
export KBUILD_OUTPUT=dir/to/store/output/files/

三、使用案例

 四、Kbuild源码中相关说明

/linux-4.19.236/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.

# KBUILD_SRC is not intended to be used by the regular user (for now),
# it is set on invocation of make with KBUILD_OUTPUT or O= specified.
ifeq ($(KBUILD_SRC),)

# OK, Make called in directory where kernel src resides
# Do we want to locate output files in a separate directory?
ifeq ("$(origin O)", "command line")
  KBUILD_OUTPUT := $(O)
endif

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/851819.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号