Linux find kernel config

How do I get the correct .config file for compiling the Linux kernel source specific to my hardware?

I tried using make defconfig to compile the kernel, but as expected, it failed to boot. I was wondering what .config file do kernel vendors like Canonical for Ubuntu use, that the kernel is able to boot right out-of-the-box. Of course, I am still a beginner and configuring the various parameters, is a little out of my league currently. Specifically,I am looking to load a basic «hello, world!» module to my running kernel 2.6.32.41. For that, I would need to compile kernels source against the same .config file that was used for the running kernel.

4 Answers 4

If your running kernel was compiled with the CONFIG_IKCONFIG_PROC option, you can get the config in /proc/config.gz :

$ zcat /proc/config.gz >my_config 

Copy my_config into your kernel build directory as .config and run make config to be prompted for configuration options that are absent from your config file (this will only happen if you are using a kernel source that is newer than your running kernel). You should then be able to compile a new kernel with the same features as your current one.

Distros typically use their own kernel configuration, where most of the drivers are compiled as modules to be dynamically loaded when the corresponding hardware is requested. Also the kernel needs to be booted with relevant boot options (like the one specifying the root filesystem). Your defconfig kernel probably failed to boot because of that.

Does CONFIG_IKCONFIG_PROC increase the size of the too much or why distros do not have this by default?

I don’t know about getting the one that’s «correct for your hardware», but you can use the config that Ubuntu gives you by looking in /boot/ for a file starting with the name config . There may be more than one, in which case use the command uname -r to tell which kernel you’re currently running, and then you can use the appropriate config.

Читайте также:  Linux как работает make

source code of your booted system

cd /usr/src/linux-headers-3.2.0-29; 

this will generate .config

sudo make oldconfig; vi .config 
zcat /proc/config.gz > my_config 
echo /boot/config* > my_config 

«defconfig» is usually pegged at the commonly used hardware — x86, or x86_64, and perhaps not so recent chipset or motherboard. Sometimes, like my Lenovo laptop, only the latest kernel source, and with enabling some config option, after googling through the bugzilla database, will it work.

Like what Jeff Welling said, to get the config in use, u can look under /boot directory. Same for my Fedora Core too. But if u want to compile a basic program as a «kernel module», and by that it simply means «loadable kernel module», u don’t need to compile the kernel source. U just need the kernel headers for that current version. For example, «apt-cache search» in Ubuntu 10.04 returns several possible option:

linux-headers-2.6.38 - Header files related to Linux kernel, specifically, linux-libc-dev - Linux Kernel Headers for development 

Ubuntu normally patched the stock kernel (from kernel.org) to have their own kernel. If u have downloaded the stock kernel, and attempt to use the /boot’s config file (or sometimes u can find the currently loaded config as /proc/config.gz, like the Backtrack’s Ubuntu, which is based on 10.04 LTS), then u may need to do a «make oldconfig» with the current config file named as «.config». «make oldconfig» will then use the .config to generate a new .config that is compatible with the kernel source.

Источник

Where can I get the 11.04 kernel .config file?

I’m using Maverick with the latest available kernels on kernel.org and building them myself. Until now I’ve been basing my configuration off the stock Maverick kernel and accepting the make oldconfig defaults. I’ve been doing this for 3 major releases now so I figure I’m starting to slip behind the current «standard». I would like to re-base my kernels off the new Natty .config file. Is this available somewhere online or do I have to download the whole kernel package and extract it? Edit: I’ve manually pulled in the config from the latest Natty kernel package and I can confirm that I propbably should have done this sooner. A lot of differences between my old «evolved» config and the Natty default. Now if I could just do this without 20 minutes of hunting and downloading the package so I can re-base in the future.

Читайте также:  Typing in terminal linux

4 Answers 4

Each linux-image package contains the exact configuration file that it was built with in /boot/config-* . To see the configuration file for the currently running Linux kernel, do:

I have checked with the Ubuntu kernel people (on Freenode #ubuntu-kernel ) and they have confirmed my belief that there isn’t really «the config», but it is actually constructed at build/compile time by including a number of Kconfig files; these depend on the exact architecture and target (desktop/server/cloud). You should be able to read that (short) conversation at:

A list of that variety can be found using packages.ubuntu.com and the following search:

Hunting, around, it would appear that the .config is also included in the linux-headers-* packages. These are .deb files (which are simple .ar archives that will open with file-roller ) and only about 800 kB each. If you know the particular target, architecture and version you’re after, you can grab these straight from Launchpad or from the archive itself:

If you want to automate the whole process into one command, you could try the following; make sure you keep it all on one line!

Источник

Where can I find linux kernel config options and description?

I am compiling a custom Linux kernel from the source tree, is there any place where all the Linux kernel config options and description is available. It is hard to find a description for each option and its use-case.

2 Answers 2

Options with descriptions are specified in Kconfig in each subdirectoy. To see all of them, you need to concatenate all Kconfig files (e.g. using find ), or you can do something like make menuconfig , where you have a hierarchical menu with descriptions as help texts.

The currently selected options are stored in the .config file in the root directory.

Are you perhaps trying to write a kernel .config file manually from scratch? The kernel source Makefiles have built-in configuration tools: for example, run make menuconfig to get a text-based menu interface for configuring the kernel. See Documentation/admin-guide/README.rst for a complete list of configuration tools available.

The configuration tools include a help function that will be able to describe most options. Those options that don’t have a help description tend to be one of the following:

  • very new, possibly experimental parts of the kernel (so a help description has not been written yet — feel free to submit a patch to add a suitable description in this case).
  • technical settings that are determined automatically based on other settings (for example, when you set the CPU type, a whole lot of settings are automatically set according to the features available in that CPU type)
  • debugging settings that are intended for the developers of a particular driver or other kernel component only — if you need to change these, you should either be one of those developers or at least already contacting them.
Читайте также:  Совместимое оборудование astra linux

The help texts come from the Kconfig files in each sub-directory of the kernel source code.

Источник

How do I find out how my currently Linux kernel was configured [duplicate]

I’m getting no core dumps, and core(5) says the problem might be that my kernel might be configured with CONFIG_COREDUMP , how do I find out if it is true? I’m on Mint 17.3 ( uname -a : Linux laptop 3.19.0-32-generic #37~14.04.1-Ubuntu SMP Thu Oct 22 09:41:40 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux ).

What is your distribution and release version, please? In Debian and its derivatives, you can find the config file in /boot , called something like config-kernel_version .

If you’re using Red Hat family (Red Hat, Fedora, CentOS) or Debian, there’re config files in /boot directory. grep CONFIG_COREDUMP /boot/config-4.3.5-300.fc23.x86_64 —> CONFIG_COREDUMP=y

@LiuYan刘研 Thanks. /boot/config-$(uname -r) does give me the info. If you post it as an answer, I will accept it.

1 Answer 1

On Mint, you’ll find the kernel configuration in /boot/config-$(uname -r) :

grep CONFIG_COREDUMP /boot/config-$(uname -r) 

Most distributions ship the kernel configuration in /boot nowadays.

Linked

Hot Network Questions

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.7.12.43529

Linux is a registered trademark of Linus Torvalds. UNIX is a registered trademark of The Open Group.
This site is not affiliated with Linus Torvalds or The Open Group in any way.

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Оцените статью
Adblock
detector