Demystifying Kconfig: Understanding Network Device Support Configuration
Pragati Ghatte
Crafting High-Performance Embedded Linux Solutions | Yocto project & Kernel Development
Navigating the Linux kernel configuration can be daunting, especially with the myriad options available. Network device support is a crucial component for any system that relies on network connectivity. Today, we'll break down a segment of the Kconfig file that handles this, helping you understand how to configure network devices in the Linux kernel.
Network Device Support in Kconfig
In the Linux kernel, network device support is defined using the NETDEVICES configuration option. This option and its dependencies ensure that your system can support various network interfaces and protocols. Let’s take a closer look at how this is structured in a Kconfig file.
Basic Structure
Here’s the Kconfig entry for NETDEVICES, which is the primary switch for network device support
config NETDEVICES default y if UML depends on NET bool "Network device support" help You can say N here if you don't intend to connect your Linux box to any other computer at all. You'll have to say Y if your computer contains a network card that you want to use under Linux. If you are going to run SLIP or PPP over telephone line or null modem cable you need say Y here. Connecting two machines with parallel ports using PLIP needs this, as well as AX.25/KISS for sending Internet traffic over amateur radio links. If unsure, say Y.
Conditional Configuration: The if Block
In Kconfig, you can group related options under a condition. For NETDEVICES, we use an if block to indicate that the following options are only relevant if NETDEVICES is enabled.
#All the following symbols are dependent on NETDEVICES - do not repeat # that for each of the symbols. if NETDEVICES config MII tristate config NET_CORE default y bool "Network core driver support" help You can say N here if you do not intend to use any of the networking core drivers (i.e. VLAN, bridging, bonding, etc.)
Detailed Configurations
Within the if NETDEVICES block, we define additional options like MII and NET_CORE.
MII Configuration
config MII tristate
Network Core Driver Support
config NET_CORE default y bool "Network core driver support" help You can say N here if you do not intend to use any of the networking core drivers (i.e. VLAN, bridging, bonding, etc.)
Advanced Options: Bonding Driver Support
Nested within NET_CORE is another configuration option for the bonding driver:
if NET_CORE config BONDING tristate "Bonding driver support" depends on INET depends on IPV6 || IPV6=n depends on TLS || TLS_DEVICE=n help Say 'Y' or 'M' if you wish to be able to 'bond' multiple Ethernet Channels together. This is called 'Etherchannel' by Cisco, 'Trunking' by Sun, 802.3ad by the IEEE, and 'Bonding' in Linux. The driver supports multiple bonding modes to allow for both high performance and high availability operation.
By demystifying Kconfig files, you gain the power to customize your Linux kernel precisely to your needs, ensuring it is lean, efficient, and capable of supporting the desired features.
Great topic! Kconfig is a fascinating aspect of the kernel. Unveiling the secrets behind network device support sounds particularly interesting. Will the post delve into how modules are loaded dynamically based on Kconfig options?