三个方法

  1. proc文件系统
  2. ubunut debain
  3. 红帽等

proc文件系统

/proc/config.gz

This file shows you the compile-time configuration settings for the kernel (gzip compressed, use zcat or zless to see its contents). It is available only if you enable it using CONFIG_IKCONFIG_PROC when you compile.

Say you want to upgrade to the next available kernel. Your current kernel works fine, so you'd like to use the same parameters, but you accidentally lost your original .config configuration file. Simplyzcat /proc/config.gz > /usr/src/linux/.config and you're ready to go.

Example output:

Automatically generated make config: don't edit

Linux kernel version: 2.6.17

Sat Jul 15 17:01:24 2006

CONFIG_X86_32=y

CONFIG_SEMAPHORE_SLEEPERS=y

CONFIG_X86=y

CONFIG_MMU=y

CONFIG_GENERIC_ISA_DMA=y

CONFIG_GENERIC_IOMAP=y

CONFIG_GENERIC_HWEIGHT=y

CONFIG_ARCH_MAY_HAVE_PC_FDC=y

CONFIG_DMI=y

#zcat /proc/config.gz

需要开启内核配置项CONFIG_IKCONFIG才会生成这个文件

ubuntu

  1. 文件下查看

    /usr/src/linux-headers-VERSION-generic/.config

  2. 从系统/boot目录下获取

[root@localhost ~]# uname -r
4.9.77
[root@localhost ~]# ls /boot/
config-4.9.77-30.el7.x86_64 System.map
grub System.map-4.9.77
grub2 System.map-4.9.77-30.el7.x86_64
initramfs-0-rescue-d5e5083a18b24f4db74d0c0f71770f64.img System.map-4.9.77.old
initramfs-4.9.77.img vmlinuz
initramfs-4.9.77kdump.img vmlinuz-0-rescue-d5e5083a18b24f4db74d0c0f71770f64
initrd-plymouth.img vmlinuz-4.9.77
symvers-4.9.77-30.el7.x86_64.gz

3.从系统/usr/src/kernel目录下获取

[root@localhost ~]# uname -r
4.9.77
[root@localhost ~]# cd /usr/src/kernels
[root@localhost kernels]# ls
4.9.77-30.el7.x86_64
[root@localhost kernels]# cd 4.9.77-30.el7.x86_64/
[root@localhost 4.9.77-30.el7.x86_64]# ls -a
. block .config drivers include Kconfig Makefile net security tools
.. certs .config.old firmware init kernel mm samples sound usr
arch config crypto fs ipc lib Module.symvers scripts System.map virt

如上所示,当前内核的编译配置文件为:.config

最新文章

  1. gdb调试基本命令(常用)
  2. 基于@AspectJ配置Spring AOP之一--转
  3. UIScrollView常见属性
  4. 怎样写 OpenStack Neutron 的 Extension (二)
  5. ngnix 下配置多域名跳转 配置方法
  6. hdu 4901
  7. Source kit service terminated Editor functionality temporarily limited
  8. jQuery基本知识
  9. 10-TypeScript中的接口
  10. [NOI 2010]能量采集
  11. 微信小程序登录(包括获取不到unionid的情况)
  12. 关于数据分析的4点心得:维度、指标、KPI
  13. python文件的md5加密方法
  14. Kali安装nessus
  15. Android标题头滑动渐变,Titlebar滑动渐变,仿美团饿了么标题头渐变;
  16. day 92 跨域和CORS
  17. FDStoredProc 存储过程控件 强
  18. node的简单爬虫
  19. springboot(六)-使用shiro
  20. rf常用关键字

热门文章

  1. 设计模式(java)--模版方法模式之任务分配
  2. schedule-pool模拟并行任务分片
  3. Opengl中的GLUT下的回调函数
  4. SpringCloud教程 | 第二篇: 服务消费者(rest+ribbon)(Finchley版本)
  5. elasticsearch CriteriaQuery查询例子
  6. redis整理の配置
  7. 数独高阶技巧入门之六——ALS
  8. django drf GenericAPIView和ListAPIView
  9. C#面向对象二
  10. 二. linux基础命令