Book: LPI Linux Certification in a Nutshell
Section: Chapter 24.  Exam 102 Highlighter's Index



24.3 Kernel

24.3.1 Objective 1: Manage Kernel Modules at Runtime

  • The Linux kernel is modular, and device driver software is inserted into the running kernel as needed.

  • Module files are objects, stored under /lib/modules.

  • Kernel modules can be managed using:

    lsmod

    List modules.

    insmod

    Insert a module into the kernel.

    rmmod

    Remove a module from the kernel.

    modinfo

    Get information about a module.

    modprobe

    Insert modules along with their prerequisites.

  • Modules are configured in /etc/conf.modules or /etc/modules.conf.

  • modprobe determines module dependencies using a file called modules.dep. This file is usually created at boot time using depmod.

24.3.2 Objective 2: Reconfigure, Build, and Install a Custom Kernel and Modules

  • To build a kernel, you need the compiler, assembler, linker, make, kernel source, and kernel headers.

  • These are typical kernel compilation steps, done in /usr/src/linux:

    1. Make a configuration using make oldconfig (existing setup), make config (basic interactive text program), make menuconfig (interactive text menu program), or make xconfig (graphical program). Each method creates the .config file containing kernel options.

    2. Modify EXTRAVERSION in Makefile, if desired.

    3. Build dependencies using make dep.

    4. Clean old results with make clean.

    5. Create the kernel with make bzImage.

    6. Create modules with make modules.

    7. Install the modules with make modules_install.

    8. Copy the new image to /boot.

    9. Update /etc/lilo.conf for the new image.

    10. Update the boot loader by running the lilo command.