linux 查看 编译选项,linux系统管理(1)之 内核编译选项查看

三个方法

proc文件系统

ubunut debain

红帽等

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

文件下查看 /usr/src/linux-headers-VERSION-generic/.config

从系统/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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值