7.12. Linux-2.6.17.4

#### Cross-Compiled Linux From Scratch - Version 1.0.0rc2-MIPS64-Pure64

### Chapter 7. If You Are Going to Boot

- Prev

  Creating the passwd, group, and log Files

- Next

  Colo-1.21

- Up.
- Home

# 7.12. Linux-2.6.17.4

The Linux package contains the Linux kernel.

## 7.12.1. Installation of the kernel

### Warning

Here a temporary cross-compiled kernel will be built. When configuring it, select the minimal amount of options required to boot the target machine and build the final system. I.e., no support for sound, printers, etc. will be needed.

Also, try to avoid the use of modules if possible, and don't use the resulting kernel image for production systems.

The following patch merges changes from Linux-MIPS into the kernel:

    patch -Np1 -i ../linux-2.6.17.4-mips-1.patch

The following patch merges updates for Linux-MIPS kernel:

    patch -Np1 -i ../linux-2.6.17.4-mips_fixes-2.patch

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.

To ensure that your system boots and you can properly run both 32 bit and 64 bit binaries, please make sure that you enable support for ELF and emulations for 32bit ELF into 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.

If your keyboard isn't an US one, you may want to build the proper keymap for your keyboard layout inside the kernel. Do it by running the following command:

    loadkeys -m /usr/share/kbd/keymaps/[path to  keymap] > \
        drivers/char/defkeymap.c

For example, if using a Dutch keyboard, use `/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz`.

Configure the kernel via a menu-driven interface:

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

Compile the kernel image and modules:

    make ARCH=mips CROSS_COMPILE=${CLFS_TARGET}-

If the use of kernel modules can't be avoided, 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. The `modprobe.conf` man page may also be of interest.

Be very careful when reading other documentation relating to kernel modules because it usually applies to 2.4.x kernels only. As far as we know, kernel configuration issues specific to Hotplug and Udev are not documented. The problem is that Udev will create a device node only if Hotplug or a user-written script inserts the corresponding module into the kernel, and not all modules are detectable by Hotplug. Note that statements like the one below in the `/etc/modprobe.conf` file do not work with Udev:

    alias char-major-XXX some-module

Install the modules, if the kernel configuration uses them:

    make ARCH=mips CROSS_COMPILE=${CLFS_TARGET}- \
       INSTALL_MOD_PATH=${CLFS} modules_install

After kernel compilation is complete, additional steps are required to complete the installation. Some files need to be copied to the `${CLFS}/boot` directory.

Issue the following command to install the kernel:

    cp -v vmlinux ${CLFS}/boot/vmlinux-2.6.17.4
    gzip -9 ${CLFS}/boot/vmlinux-2.6.17.4

`System.map` is a symbol file for the kernel. It maps the function entry points of every function in the kernel API, as well as the addresses of the kernel data structures for the running kernel. Issue the following command to install the map file:

    cp -v System.map ${CLFS}/boot/System.map-2.6.17.4

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:

    cp -v .config ${CLFS}/boot/config-2.6.17.4

Details on this package are located in Section 12.3.2, “Contents of Linux.”

- Prev

  Creating the passwd, group, and log Files

- Next

  Colo-1.21

- Up.
- Home.