- Exploring the Linux kernel: The secrets of Kconfig/kbuild
- Subscribe to RSS
- Moving Compiler Dependency Checks to Kconfig
- CMakeLists.txt, Kconfig, proj.conf, sample.yaml
Exploring the Linux kernel: The secrets of Kconfig/kbuildIt 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