Exploring the Linux kernel: The secrets of Kconfig/kbuild

It is normally invoked using the command make menuconfigmenuconfig is a target in Linux Makefile. The predecessor tool is a question-and-answer-based utility make configmake oldconfig. A third tool for Linux configuration is make xconfigwhich requires Qt. All these tools use the Kconfig language internally. Kconfig is also used in other projects, such as Das U-Boota bootloader for embedded devices, Buildroota tool for generating embedded Linux systems, and BusyBoxa single-executable shell utility toolbox for embedded systems. If the user is satisfied with a previous. This is intended for a version upgrade, but may be appropriate at other times. It's possible to ignore most of the features with make configand doing so makes it more likely that one will configure an incomplete or oversized kernel. It's recommended to start with the. Better than editing the. With make oldconfig, dependency checking can be done in one step, but requires the user to locate the features that were changed, by hand, to be sure that the needed ones are still enabled. Practically, using both make menuconfig and make oldconfigdiffalso cvs and a decent text editor provides the most flexibility and most dependability. Configuring Linux is a significant labor, so users are strongly advised to make backups of it i. The help information is distributed throughout the kernel source tree in the various files called Kconfig. To use make menuconfigLinux source is a requirement, a make tool, a C compiler, and the ncurses library. Note that the supplied dependency information is primitive, it does not tell you the names of the depentant features. Each will configure the kernel, but with different features activated, or using a different interactive interface; such as tinyconfig or allyesconfig. From Wikipedia, the free encyclopedia. This article has multiple issues. Please help improve it or discuss these issues on the talk page.

Subscribe to RSS

The Linux kernel config system, Kconfiguses a macro language very similar to the make build tool's macro language. There are a few differences, however. And of course, make is designed as a general-purpose build tool while Kconfig is Linux-kernel-specific. But, why would the kernel developers create a whole new macro language so closely resembling that of an existing general-purpose tool? One reason became clear recently when Linus Torvalds asked developers to add an entirely new system of dependency checks to the Kconfig language, specifically testing the capabilities of the GCC compiler. It's actually an important issue. The Linux kernel wants to support as many versions of GCC as possible—so long as doing so would not require too much insanity in the kernel code itself—but different versions of GCC support different features. The GCC developers always are tweaking and adjusting, and GCC releases also sometimes have bugs that need to be worked around. Some Linux kernel features can only be built using one version of the compiler or another. And, some features build better or faster if they can take advantage of various GCC features that exist only in certain versions. Up until this year, the kernel build system has had to check all those compiler features by hand, using many hacky methods. The art of probing a tool to find out if it supports a given feature dates back decades and is filled with insanity. Imagine giving a command that you know will fail, but giving it anyway because the specific manner of failure will tell you what you need to know for a future command to work. Now imagine hundreds of hacks like that in the Linux kernel build system. Part of the problem with having those hacky checks in the build system is that you find out about them only during the build—not during configuration. But since some kernel features require certain GCC versions, the proper place to learn about the GCC version is at config time. If the user's compiler doesn't support a given feature, there's no reason to show that feature in the config system. It should just silently not exist. Linus requested that developers migrate those checks into the Kconfig system and regularize them into the macro language itself. This way, kernel features with particular GCC dependencies could identify those dependencies and then show up or not show up at config time, according to whether those dependencies had been met. That's the reason simply using make wouldn't work. The config language had to represent the results of all those ugly hacks in a friendly way that developers could make use of. The code to do this has been added to the kernel tree, and Masahiro Yamada recently posted some documentation to explain how to use it. The docs are essentially fine, although the code will gradually grow and grow as new versions of GCC require new hacky probes. It's actually not so easy to know what should and should not go into the config system. If we're probing for GCC versions, why not probe for hardware peripherals as well?

Moving Compiler Dependency Checks to Kconfig

Jump to navigation. As supporting infrastructure, however, it is seldom in the spotlight; even kernel developers who use it in their daily work never really think about it. The first step in building a kernel is always configuration. Kconfig helps make the Linux kernel highly modular and customizable. Kconfig offers the user many config targets:. I think menuconfig is the most popular of these targets. The targets are processed by different host programs, which are provided by the kernel and built during kernel building. Some targets have a GUI for the user's convenience while most don't. Except for confeach of them is responsible for one of the GUI-based config targets, so, conf deals with most of them. Logically, Kconfig's infrastructure has two parts: one implements a new language to define the configuration items see the Kconfig files under the kernel sourceand the other parses the Kconfig language and deals with configuration actions. The Linux Terminal Top 7 terminal emulators for Linux 10 command-line tools for data analysis in Linux Download Now: SSH cheat sheet Advanced Linux commands cheat sheet Linux command line tutorials Note that all configuration items have a default value. The first step reads the Kconfig file under source root to construct an initial configuration database; then it updates the initial database by reading an existing configuration file according to this priority:. If you are doing GUI-based configuration via menuconfig or command-line-based configuration via oldconfigthe database is updated according to your customization. Finally, the configuration database is dumped into the. But the. Also, because it is for internal use not for usersit was dropped from the list. Component-wise building, called recursive makeis a common way for GNU make to manage a large project. Kbuild is a good example of recursive make. When you start building, a top makefile invokes each component's makefile in the proper order, builds the components, and collects them into the final executive. The top makefile includes the arch makefile, reads the. Steven's blog. It was updated and is used with the author's permission. All the. Take a look at how recursive make is implemented in the Linux kernel, with the help of simplified makefile code:. Many Linux kernel developers may not be clear about the relationship between vmlinux and bzImage. For example, here is their relationship in x

CMakeLists.txt, Kconfig, proj.conf, sample.yaml

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I use Debian 7. I trying to upgrade my kernel, but when I type "make menuconfig" it says:. At last, use make-kpkg --initrd binary to compile your kernel. I had the same problem. In my case installation of package libncursesw5-dev solved the issue. How are we doing? Please help us improve Stack Overflow. Take our short survey. Learn more. Can't make menuconfig Ask Question. Asked 5 years, 11 months ago. Active 1 year, 6 months ago. Viewed 32k times. I downloaded and installed the packages manually and now everything is okay! Thanks a lot!! Veerendra Kakumanu 1, 2 2 gold badges 19 19 silver badges 44 44 bronze badges. ValeriRangelov ValeriRangelov 2 2 gold badges 6 6 silver badges 18 18 bronze badges. Active Oldest Votes. You should have run as root aptitude update aptitude search libncurses that would suggest you the right package name. Then try aptitude install libncurses-dev and aptitude install kernel-package aptitude build-dep linux-image linux-image-amd64 At last, use make-kpkg --initrd binary to compile your kernel. Basile Starynkevitch Basile Starynkevitch k 16 16 gold badges silver badges bronze badges. When I type apt-get update libncurses5 libncursesw5 I get this massege Reading package lists Done Building dependency tree Reading state information Done libncursesw5 is already the newest version. Need to get 0 B of archives. After unpacking 0 B will be used. The thing that surprised me is that it needed the -dev package. I had libncurses5 installed, and thought that would be enough. But it turned out that libncurses5-dev was needed. Patrizio Bertoni 1, 21 21 silver badges 33 33 bronze badges.


The central class of the KDE configuration data system. Get the default application config object via KSharedConfig::openConfig. In general it is recommended to use KSharedConfig instead of creating multiple instances of KConfig to avoid the overhead of separate objects or concerns about synchronizing writes to disk even if the configuration object is updated from multiple code paths. KSharedConfig provides a set of open methods as counterparts for the KConfig constructors. Definition at line 56 of file kconfig. Determines how the system-wide and user's global settings will affect the reading of the configuration. If CascadeConfig is selected, system-wide configuration sources are used to provide defaults for the settings accessed through this object, or possibly to override those settings in certain cases. If IncludeGlobals is selected, the kdeglobals configuration is used as additional configuration sources to provide defaults. Additionally selecting CascadeConfig will result in the system-wide kdeglobals sources also getting included. Note that the main configuration source overrides the cascaded sources, which override those provided to addConfigSourceswhich override the global sources. The exception is that if a key or group is marked as being immutable, it will not be overridden. Note that all values other than IncludeGlobals and CascadeConfig are convenience definitions for the basic mode. Do not combine them with anything. Definition at line 81 of file kconfig. Creates a KConfig object to manipulate a configuration file for the current application. If an absolute path is specified for filethat file will be used as the store for the configuration settings. If a non-absolute path is provided, the file will be looked for in the standard directory specified by type. If no path is provided, a default configuration file will be used based on the name of the main application component. See OpenFlags for more details. Definition at line of file kconfig. Creates a KConfig object using the specified backend. If the backend can not be found or loaded, then the standard configuration parser is used as a fallback. Implements KConfigBase. The first entry in sources is treated as the most general and will be overridden by the second entry. The settings in the final entry in sources will override all the other sources provided in the list. The settings in sources will also be overridden by the sources provided by any previous calls to addConfigSources. The settings in the global configuration sources will be overridden by the sources provided to this method. Note that only the most specific file, ie: the file provided to the constructor, will be written to by this object. The state is automatically updated by this method, so there is no need to call reparseConfiguration. If you install config update files with critical fixes you may wish to use this method to verify that a critical update has indeed been performed to catch the case where a user restores an old config file from backup that has not been updated yet. Copies all entries from this config object to a new config object that will save itself to file. The configuration will not actually be saved to file until the returned object is destroyed, or sync is called on it. Do not forget to delete the returned KConfig object if config was 0. If warnUser is true and the configuration cannot be written to ie: this method returns falsea warning message box will be shown to the user telling them to contact their system administrator to get the problem fixed. The most likely cause for this method returning false is that the user does not have write permission for the configuration file. Used by KSharedConfig. Forces all following write-operations to be performed on kdeglobalsindependent of the Global flag in writeEntry. When set, all readEntry calls return the system-wide default values instead of the user's settings. Reimplemented from KConfigBase.

How to create a Kconfig file?

Comments on “Kconfig

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>