Linux Kernel compilation, local driver configuration, Linux Kernel
1. Preface
The cause of Linux kernel compilation failure is that the driver is selected incorrectly. It is suitable for the driver of your local machine not to be compiled. In the face of special platforms (or some scammers, I am mongo_^), to compile and streamline the kernel, as long as the local driver is not required. In the face of so many drivers in the kernel that do not know the hardware, we can see that all of them are big. When I first installed gentoo, the kernel was compiled five times. The main cause of the first four failures was that the ethernet card driver, wireless NIC Driver, graphics card driver, and audio card driver were not correctly configured at one time. Although gentoo provides the genkernel command to automatically compile the kernel for you, you still want to try it manually.
2. Get local driver information
Since it is linked to the kernel, the most direct way to obtain the local kernel driver information is to use the lspci command, which can output the local driver information, with the-k option, you can see the position of the driver in the kernel.
General kernel compilation scenarios: Update Old kernel, install customized linux distributions (gentoo, arch, etc.), embedded platforms, and other special platforms...
Lspci commands can be used in most scenarios. livecd for gentoo installation provides this tool. If other systems do not, install this tool.
Debian series Installation
1 $:sudo apt-get install pciutils
Or source code compilation installation, https://www.kernel.org/pub/software/utils/pciutils/
Then we get the existing driver information in the local environment. The following is the information on my machine:
1 $:lspci -k 2 00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09) 3 Subsystem: Lenovo Device 21e2 4 00:01.0 PCI bridge: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port (rev 09) 5 Kernel driver in use: pcieport 6 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 7 Subsystem: Lenovo Device 21e3 8 Kernel driver in use: i915 9 00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)10 Subsystem: Lenovo Device 21e211 Kernel driver in use: mei_me12 00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)13 Subsystem: Lenovo Device 21e214 Kernel driver in use: ehci-pci15 00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)16 Subsystem: Lenovo Device 21e217 Kernel driver in use: snd_hda_intel18 00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)19 Kernel driver in use: pcieport20 00:1c.1 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2 (rev b4)21 Kernel driver in use: pcieport22 00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 3 (rev b4)23 Kernel driver in use: pcieport24 00:1c.3 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 4 (rev b4)25 Kernel driver in use: pcieport26 00:1c.7 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 8 (rev b4)27 Kernel driver in use: pcieport28 00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)29 Subsystem: Lenovo Device 21e230 Kernel driver in use: ehci-pci31 00:1f.0 ISA bridge: Intel Corporation HM65 Express Chipset Family LPC Controller (rev 04)32 Subsystem: Lenovo Device 21e233 Kernel driver in use: lpc_ich34 00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller (rev 04)35 Subsystem: Lenovo Device 21e236 Kernel driver in use: ahci37 00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)38 Subsystem: Lenovo Device 21e239 01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Seymour [Radeon HD 6400M/7400M Series] (rev ff)40 Kernel driver in use: radeon41 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)42 Subsystem: Lenovo Device 21e243 Kernel driver in use: r816944 04:00.0 System peripheral: Ricoh Co Ltd PCIe SDXC/MMC Host Controller (rev 07)45 Subsystem: Lenovo Device 21e246 Kernel driver in use: sdhci-pci47 09:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8188CE 802.11b/g/n WiFi Adapter (rev 01)48 Subsystem: Realtek Semiconductor Co., Ltd. Device 819549 Kernel driver in use: rtl8192ce
We can see that each driver is followed by a Kernel driver in use:, representing the link position of the driver in the Kernel.
3. Configure the kernel driver
Download the kernel source code https://www.kernel.org/. here I download stable 4.3.3. decompress the package and go to the source code directory for execution:
1 $:make menuconfig
Next, the compilation option interface will pop up,
We can see that there is a shortcut key operation instructions, I focus on </> for Search, in the interface directly press the backslash to enter the Search interface. Next, let's take a look at the key driver.
Network controller, you can see that the model is Realtek RTL8188CE, then the Kernel driver in use: rtl8192ce, the seat link in the Kernel is rtl8192ce
Press </>, enter rtl8192ce, and press enter to display the detailed seat,
We can see that the Pormt prompts that the model above is the same as the model I want. There is a (1) in front of the specific option. Note that there are many options corresponding to the same Symbol (that is, the rtl8192ce just entered, based on the preceding serial number, you can directly enter the option by pressing the corresponding number. Press <esc> to return to this interface. Here, I press 1 directly. After pressing 1, the specific options are displayed,
We can see that the release version has compiled all Realtek drivers into modules to be compatible with various machines. Next, keep your own driver model and remove other models.
The remaining drivers are the same as those above. Other unnecessary drivers are directly compiled into the kernel, not a module. You can compare your own driver with others. Kernel after Configuration
It is best to save the configuration file. If the driver is not configured successfully, copy the saved configuration file to the source code directory and name it. config. Continue to make menuconfig configuration.