在Linux内核里,编译内核文件时,先要配置.config文件,然后Makefile在编译时通过读取.config文件的配置来选择要编译的文件,选择驱动的加载方式。
  • xxx_defconfig 一般在arch/arm64/configs/目录下,是一个没有展开的内核配置,需要配合Kconfig展开成.config
  • 从defconfig到.config不是简单的复制操作,而是make ARCH=arm64 defconfig
  • .confg也不是直接拷贝成defconfig,而是使用make ARCH=arm64 savedefconfig
正确使用和保存deconfig的流程:
要修改在arch/arm/configs下的文件xxx_defconfig
2. make ARCH=arm64 xxx_defconfig 会生成.config文件
3. make ARCH=arm64 menuconfig 修改配置后保存
4. make ARCH=arm64 savedefconfig 生成defconfg文件
5. cp defconfig arch/arm/configs/xxx_defconfig 保存
这样保存的defconfig文件,配置最小化,且日后能恢复成.config。
.config
All config symbol values are saved in a special file called .config. Every time you want to change a kernel compile configuration, you execute a make target, such as menuconfig or xconfig. These read the Kconfig files to create the menus and update the config symbols' values using the values defined in the .config file. Additionally, these tools update the .config file with the new options you chose and also can generate one if it didn't exist before.
Because the .config file is plain text, you also can change it without needing any specialized tool. It is very convenient for saving and restoring previous kernel compilation configurations as well.
deconfig
The .config file is not simply copied from your defconfig file. The motivation for storing defconfig in such a format is next: in defconfig we can only specify options with non-default values (i.e. options we changed for our board). This way we can keep it small and clear. Every new kernel version brings a bunch of new options, and this way we don't need to update our defconfig file each time the kernel releases. Also, it should be mentioned that kernel build system keeps very specific order of options in defconfig file, so it's better to avoid modifying it by hand. Instead you should use make savedefconfig rule.
When .config file is being generated, kernel build system goes through all Kconfig files (from all subdirs), checking all options in those Kconfig files:
  • if option is mentioned in defconfig, build system puts that option into .config with value chosen in defconfig
  • if option isn't mentioned in defconfig, build system puts that option into .config using its default value, specified in corresponding Kconfig
根据上述描述,xxx_deconfig中只保存那些没有默认值的option(但被用户修改过的option除外,如config_xxx默认值为y,但是被用户修改为n,那么config_xxx将被保存进deconfig),因为有默认值的option保存在Kconfig中,没必要重复保存。
配置menuconfig后查看config变化
diff .config .config.old

linux kernel defconfig和.config相关推荐

  1. linux kernel: defconfig和.config

    在Linux内核里,编译内核文件时,先要配置.config文件,然后Makefile在编译时通过读取.config文件的配置来选择要编译的文件,选择驱动的加载方式. defconfig 一般在arch ...

  2. Linux kernel编译时编译选项多选一如何固化在config文件

    每次在进行裁剪的Linux kernel编译时,都会碰到有提示,让你在某些编译选项多选一,如: Initialize kernel stack variables at function entry ...

  3. Linux内核defconfig在哪,Linux内核根目录中的配置文件.config中包含了许多宏定义,...

    满意答案 大大bigone 推荐于 2017.11.22 采纳率:52%    等级:9 已帮助:813人 一.Linux内核的配置系统由三个部分组成,分别是: 1.Makefile:分布在 Linu ...

  4. linux kernel makefile analysis

    编译自:https://github.com/0xAX/linux-insides/blob/master/Misc/how_kernel_compiled.md 作者: 0xAX 原创:LCTT h ...

  5. build linux kernel

    一.首先安装toolchains 1. download Linaro toolchains Linaro toolchains是由 Linaro 公司基于GCC推出的的ARM交叉编译工具.可用于交叉 ...

  6. LinuX编译显示内核配置无效,配置编译内核(Linux kernel)

    虽然以前也编译过内核,但是关于内核配置选项特别是有关本机驱动这块还是不熟悉,因为没有通过确定有效的途径知道当前工作正常的内核中到底使用了什么驱动模块来控制硬件,最近看到一本书<Linux ker ...

  7. risc-v 编译 linux,linux - 如何为RISC-V编译Linux Kernel 4.20 - 堆栈内存溢出

    这可能没有用,因为您使用了目标riscv-defconfig而不是defconfig - 请参阅Chris Stratton在评论中的暗示. ls -l arch/riscv/configs/ tot ...

  8. 1. Linux kernel release 3.x

    Linux kernel release 3.x <http://kernel.org/> 它的内容包括以下几部分:什么是Linux.运行的硬件环境.怎样安装和升级Linux内核源码.编译 ...

  9. 编译Linux Kernel(linux-4.19.178)并制作成rpm文件

    目录 一.安装依赖项 二.下载.解压缩.制作.config文件 三.编译内核及打包 四.升级内核 首次尝试编译Linux内核,记录过程,提供Linux Kernel(linux-4.19.178)下载 ...

最新文章

  1. 2022年的东南亚跨境市场风口,越南电商市场一定不要错过
  2. 搭建Apache Mina框架并实现Server与Client端的简单消息传递
  3. 创建一个带副本机制的topic
  4. H - Hello Ms. Ze(树状数组套主席树,线段树上二分)
  5. 软件开发中 前台、中台、后台英文_最近处处惹人爱的中台到底是什么
  6. Jquery ajax ajaxStart()和ajaxStop()加载前的优雅表现
  7. java 反射调用set方法_java反射调用set方法时如果让参数做自动类型转换
  8. 解决“chrome正受到自动测试软件的控制”信息栏显示问题(转)
  9. 安卓学习笔记35:广播接收者
  10. UINavigationController_学习笔记
  11. BZOJ4303 : 数列
  12. 力的吸引,是否因为负动量
  13. 《数字货币与人民币国际化》读书笔记2
  14. 柳州楼顶种植水稻 国稻种芯·中国水稻节:广西12万亩米飘香
  15. 虎牙不想做一家游戏直播公司
  16. Mqtt Retained Message(保留消息)
  17. python提取人物特征_基于图像人物面部表情识别的特征提取优化方法与流程
  18. 输入法中表情和小图标的应用
  19. 快速编写HTML代码常用的方法
  20. 游戏陪玩小程序怎么开发-游戏陪玩小程序功能

热门文章

  1. TODO:Laravel增加验证码
  2. 2.4、Android Studio使用主题编辑器设计主题
  3. Oracle 11g 内存结构
  4. 成立仅8个月的个人网站,月收入几十万美金
  5. ICE专题:实现简单的聊天室(一)
  6. JavaScript from C#(入门篇)
  7. Shell 命令大全Xhell入门
  8. 怎么把外部参照合并到图纸_做电气设计的,拿到建筑图,怎么下手呢?
  9. java 8代码 改 java7_Java 8 到 Java 14,改变了哪些你写代码的方式?
  10. linux hadoop 运行jar,Linux下执行Hadoop WordCount.jar