Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
The "Oldconfig" Target In The Linux Kernel Makefile
The Linux kernel provides various configuration targets through its Makefile system to help developers and system administrators build customized kernels. The oldconfig target is a crucial configuration option that allows you to update an existing kernel configuration while preserving your previous settings and only prompting for new options introduced in newer kernel versions.
Note Linux commands are case-sensitive.
Understanding the Kernel Build System
The Linux kernel build system uses a sophisticated Makefile structure to manage the compilation process. The configuration system determines which features, drivers, and subsystems get included in the final kernel image. There are five essential components of the kernel Makefile structure
Makefile The main makefile located in the source root directory
arch/$(ARCH)/Makefile Architecture-specific makefile that supplements the main Makefile
.config The kernel configuration file containing all build options
scripts/Makefile.* Common rules and definitions for all kbuild Makefiles
Kbuild Makefiles Approximately 500 individual makefiles distributed throughout the source tree
What is the "oldconfig" Target?
The oldconfig target is a configuration method that reads an existing .config file and prompts the user only for new configuration options that weren't present in the previous kernel version. This approach is particularly valuable when upgrading kernel versions, as it preserves your existing configuration choices while ensuring compatibility with new features and options.
How to Use the "oldconfig" Target
Before using oldconfig, ensure you have an existing configuration file. If starting fresh, create a baseline configuration using
make defconfig
To update an existing configuration with the oldconfig target, navigate to the kernel source directory and execute
make oldconfig
The system will read your current .config file and present interactive prompts only for new configuration options. For each new option, you can
Press Enter Accept the default value (shown in brackets)
Type 'y' Enable the option
Type 'n' Disable the option
Type 'm' Build as a module (if supported)
Enter a number Select from multiple choice options
Comparison with Other Config Targets
| Target | Purpose | User Interaction | Best Use Case |
|---|---|---|---|
| defconfig | Creates default configuration | None | Fresh installations |
| oldconfig | Updates existing configuration | Only for new options | Kernel upgrades |
| menuconfig | Full interactive configuration | Complete menu system | Custom configurations |
| silentoldconfig | Non-interactive oldconfig | None (uses defaults) | Automated builds |
Conclusion
The oldconfig target is an essential tool for maintaining kernel configurations across version upgrades. It preserves your existing settings while ensuring new features are properly configured, making it invaluable for system administrators and developers who need to maintain consistent kernel builds.
