6.3. Linux-4.9.22

The Linux package contains the Linux kernel.

6.3.1. Installation of the kernel

Building the kernel involves a few steps—configuration, compilation, and installation. Read the README file in the kernel source tree for alternative methods to the way this book configures the kernel.

Prepare for compilation by running the following command:

make mrproper

This ensures that the kernel tree is absolutely clean. The kernel team recommends that this command be issued prior to each kernel compilation. Do not rely on the source tree being clean after un-tarring.

Configure the kernel via a menu-driven interface. Be sure to enable DEVTMPFS so that /dev will be populated automatically.

[Note]

Note

Since you are building for an embedded system make sure all key components are built into the kernel and not as modules. The key components are console/video, disk, and network. Without these built in, the system will not function properly. It is recommended to configure the kernel without modules in order to conserve disk space and to reduce the complexity of booting.

make ARCH=${CLFS_ARCH} CROSS_COMPILE=${CLFS_TARGET}- menuconfig

Alternatively, the make oldconfig or make ${CLFS_TARGET}_defconfig may be more appropriate in some situations. See the README file for more information.

If desired, skip kernel configuration by copying the kernel config file, .config, from an example system (assuming it is available) to the root directory of the unpacked kernel sources.

[Note]

Note

If you are using the u-boot bootloader, creating a uImage type kernel is recommended. Install the u-boot tools (not documented here) and append "uImage" when compiling the kernel.

Compile the configured kernel image and modules:

make ARCH=${CLFS_ARCH} CROSS_COMPILE=${CLFS_TARGET}-

If using kernel modules, an /etc/modprobe.conf file may be needed. Information pertaining to modules and kernel configuration is located in the kernel documentation in the Documentation directory of the kernel sources tree. Also, modprobe.conf(5) may be of interest.

If building modules, install the modules:

make ARCH=${CLFS_ARCH} CROSS_COMPILE=${CLFS_TARGET}- \
    INSTALL_MOD_PATH=${CLFS}/targetfs modules_install

The kernel configuration file .config produced by the make menuconfig step above contains all the configuration selections for the kernel that was just compiled. It is a good idea to keep this file for future reference.

The resulting kernel will be located within the arch/${CLFS_ARCH}/boot. There may be more than one version of the same kernel, simply with different compression or bootloader helpers added. Follow your bootloader's instructions on how to copy the kernel to the final system.

6.3.2. Contents of Linux

Installed files: .config, Image files, and System.map

Short Descriptions

.config

Contains all the configuration selections for the kernel

zImage, uImage, bzImage, vmlinux

The compiled Linux kernel.

System.map

A list of addresses and symbols; it maps the entry points and addresses of all the functions and data structures in the kernel. Useful for debugging, sometimes.