在Linux内核里,编译内核文件时,先要配置.config文件,然后Makefile在编译时通过读取.config文件的配置来选择要编译的文件,选择驱动的加载方式。
  • defconfig 一般在arch/arm64/configs/目录下,是一个没有展开的内核配置,需要配合Kconfig展开成.config
  • 从defconfig到.config不是简单的复制操作,而是make ARCH=arm64 defconfig
  • .confg也不是直接拷贝成defconfig,而是使用make ARCH=arm64 savedefconfig
正确使用和保存deconfig的流程:
1. 要修改在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中,没必要重复保存。

linux kernel: defconfig和.config相关推荐

  1. linux kernel defconfig和.config

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

  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. IDEA自动生成类注解,IDEA作者信息自动生成,IDEA类信息自动生成
  2. 模仿Hibernate的逆向工程_java版_源码下载
  3. NLP(2) | 中文分词分词的概念分词方法分类CRFHMM分词
  4. Fedora 31 将被“砍掉”或推迟更久发布,但和 IBM 无关
  5. 李开复:走向全球的两大路径,中美何以各占其一
  6. 测试如何学python_如何从0开始学Python自动化测试
  7. keepalived 报错 Popt libraries is required
  8. 9. 求数组任意次最值
  9. springboot 多数据源_SpringBoot整合多数据源的巨坑一
  10. java 时间格式化 星期_Java SimpleDateFormate时间格式化
  11. 那些唱衰智能电视的砖家们可以闭嘴了
  12. java 数组溢出异常,Java数组超出范围时如何处理多个异常?
  13. 多个微服务的接口依赖如何测试_一文看懂微服务
  14. xmapp 终端数据库问题记录 已解决
  15. 数字人民币隐私与个人信息保护
  16. 关于mysql union 之后 排序乱掉
  17. Android -- 创建数据库到SD卡
  18. 查询mysql版本信息
  19. 使用XUnit的测试驱动开发过程
  20. 【pandas drop()和dropna()函数使用详解】

热门文章

  1. html area图片热点
  2. linux 手动安装 oracle(转)
  3. 给力登场:15款免费的Windows系统工具
  4. Adobe (Acrobat)Reader 6.0以上版本支持对有特殊权限的PDF进行添加注释,填写标单以及保存的功能。...
  5. linux 多域名绑定
  6. Mybatis源码:MapperProxy 代理模式
  7. Write operations are not allowed in read-only mode 只读模式下(FlushMode.NEVER/MANUAL)写操作不允
  8. 面向服务的分析与设计原理
  9. oracle 共享硬盘主从,oracle dataguard主从切换
  10. python将非0数视为false_python 面试题