EN:Kernel Configuration avoid initrd

From FrâG^.WIKI
Jump to: navigation, search

(Deutsche Version)

Server.png
Server.png
This article is related to game servers.


This article is part of the EN:Linux Optimization Guide.

The Linux kernel need to be able to access the root file system to boot properly. For this to work it needs to have the right drivers. Usually, Linux distributions are built to work on any PC, so it would require a very large number of drivers to be present in the kernel. Therefore, drivers are compiled as a module, so the kernel can load them from disk, when necessary. It is self-evident that this cannot work for the disk driver itself. Distributions typically use a trick called initial ram disk to circumvent this problem. All driver modules are loaded by the boot loader together with the kernel into a virtual disk in memory, so the kernel can load the necessary drivers for the boot process. After that is done the initial ram disk is unloaded and the real root file system is mounted instead. Setting up such a initial ram disk is complicated and very depending on the distribution. Therefore here is an alternative way presented to avoid the actual need of an initial ram disk, at the expense of the kernel being only able to boot on one particular system (which is perfectly fine for virtually everyone not building his own Linux distribution).

For the boot process there are typically only three drivers required to be present in the kernel: The driver for accessing the disk controller, the driver for the disk itself and the driver for the file system. The task is now to find those drivers and enable them to be built fixed into the kernel, i.e. they must have a [*], not a [M]. As all drivers, they are found in the Device Drivers section of the kernel configuration menu. This guide will only cover SATA drives, as virtually all users will nowadays such a disk.

Virtually regardless of the type of the disk, the driver for the disk itself is found in the SCSI device support subsection and called SCSI disk support. Mark this driver with a [*].

The driver for the SATA controller is found in the Serial ATA and Parallel ATA drivers subsection. You should enable there the AHCI SATA support. If your controller is set to AHCI mode, this should already suffice. If your controller is set to lecagy mode, or if you do not knwo, you should also enable the ATA SFF support, and then the ATA BMDMA support. Now you have to find the correct driver for your particular chipset. If you are unsure which one is the correct one, run the command lspci at the Linux command line. This will reveal you all installed PCI (and PCI-E) devices, e.g.

00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 10)                                 
00:02.0 VGA compatible controller: Intel Corporation 82G33/G31 Express Integrated Graphics Controller (rev 10)            
00:1c.0 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 1 (rev 01)                                        
00:1c.1 PCI bridge: Intel Corporation N10/ICH 7 Family PCI Express Port 2 (rev 01)                                        
00:1d.0 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #1 (rev 01)
00:1d.1 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #2 (rev 01)
00:1d.2 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #3 (rev 01)
00:1d.3 USB Controller: Intel Corporation N10/ICH 7 Family USB UHCI Controller #4 (rev 01)
00:1d.7 USB Controller: Intel Corporation N10/ICH 7 Family USB2 EHCI Controller (rev 01)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev e1)
00:1f.0 ISA bridge: Intel Corporation 82801GB/GR (ICH7 Family) LPC Interface Bridge (rev 01)
00:1f.1 IDE interface: Intel Corporation 82801G (ICH7 Family) IDE Controller (rev 01)
00:1f.2 IDE interface: Intel Corporation N10/ICH7 Family SATA IDE Controller (rev 01)
00:1f.3 SMBus: Intel Corporation N10/ICH 7 Family SMBus Controller (rev 01)
02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)

Watch out for IDE interface devices, that have SATA IDE Controller in their name (or similar). Look at the manufacturer (Intel in case of this example) and enable the respective driver. Only the drivers in the *** SATA SFF controllers with BMDMA *** section are the correct ones, do not use the drivers further below in the PATA section (which would be correct for the old parallel ATA drives only). If you are absolutely unsure which driver to pick, you can enable all SATA drivers. This will make the kernel a bit larger, but does not hurt otherwise.

Finally you have to select the right file system driver. Those are not found in the Device Drivers, but in the File systems section. In case you do not know which file system your root partition has, run the following command:

mount | grep " on / "

It will output the partition of the root file system and its mount options, e.g.:

/dev/sda2 on / type ext3 (rw,noatime)

Behind the word type the file system is specified, in this example it is ext3. Find the appropriate file system driver and enable it. Usually, extended attributes and other sub-options of the file system driver are not required, so you can disable them.

Double check that all the above mentioned drivers are marked with a star, i.e. [*] or <*>, and not with a M (which would make them a module). Else your kernel will not be able to boot and create a kernel panic.

Click here to get back to the Kernel Compilation guide

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox