[ << ]
[ < ]
[ Home ]
[ > ]
[ >> ]
7. Configuring the Kernel
7.a. Installing the Sources
Choosing a Kernel
The core around which all distributions are built is the Linux kernel. It is
the layer between the user programs and your system hardware. Gentoo provides
its users several possible kernel sources. A full listing with description is
available at the Gentoo Kernel
MIPS-based systems have just the one kernel tree to choose from,
mips-sources. This patchset differs from the ones available for other
architectures, in that it has lots of patches specific to the MIPS
Code Listing 1.1: Merging kernel sources...
# emerge mips-sources
On the Origin 200/2000, Indigo2 Impact (R10000), Octane/Octane2 and O2, a 64-bit
kernel is required to boot these systems. For these machines, you should
emerge kgcc64 to create a cross-compiler for building 64-bit kernels.
Code Listing 1.2: Installing kgcc64
# emerge kgcc64
When you take a look in /usr/src you should see a symlink called
linux pointing to your kernel source. In this case, the installed
kernel source points to mips-sources-2.6.34-mips. Your
version may be different, so keep this in mind.
Code Listing 1.3: Viewing the kernel source symlink
# ls -l /usr/src/linux
lrwxrwxrwx 1 root root 12 Oct 13 11:04 /usr/src/linux -> linux-2.6.34-mips
Now it is time to configure and compile your kernel source.
7.b. Kernel Compilation & Installation
Previously, we went through the manual configuration of how to set up the
kernel sources. This has become impractical with the number of systems we now
support. This section details various sources for sample kernel configurations.
Using sample configurations in the kernel source
Many of the systems supported have sample .configs hiding in amongst the kernel
source. Not all systems have configs distributed in this way. Those that do,
can be configured using the commands mentioned in the table below.
|Indy, Indigo2 (R4k), Challenge S
|Indigo2 Impact (R10k)
Using the running kernel config from the installation media
All of the Gentoo installation images provide a kernel config option as part of
the image itself, accessible as /proc/config.gz. This may be used
in many cases. It is best though if your kernel source matches closely, the
kernel that is currently running. To extract it, simply run it through
zcat as shown below.
Code Listing 2.1: Extracting .config from /proc/config.gz
# zcat /proc/config.gz > .config
This kernel config is set up for a netboot image. That is, it will expect to
find a root filesystem image somewhere nearby, either as a directory for
initramfs, or a loopback device for initrd. When you run make menuconfig
below, don't forget to go into General Setup and disable the options for
The Hardware Compatibility Database
As an aid to users in finding working settings, a hardware compatibility
database was set up. This database lists the support for various MIPS devices,
and allows users to contribute kernel configurations that are known to work.
The address for this site is
If you find this service useful, you're welcome to contribute your notes and
.config files so that others may benefit from your experience. It should be
noted however that there is no guarantee that any of the configuration files
downloaded from this site will work.
Customising the configuration for your needs
Once you have found a configuration, download it into your kernel source
directory, and rename it to .config. From there, you can run
make oldconfig to bring everything up to date, and allow you to
customise the configuration before compiling.
Code Listing 2.2: Configuring the kernel
# cd /usr/src/linux
# cp /path/to/example-config .config
# make oldconfig
# make menuconfig
In the Kernel Hacking section, there is an option named "Are You Using A Cross
Compiler?". This tells the kernel Makefiles to prepend "mips-linux-" (or
mipsel-linux ... etc) to gcc and as commands when
compiling the kernel. This should be turned off, even if cross-compiling.
Instead, if you do need to call a cross-compiler, specify the prefix using the
CROSS_COMPILE variable as shown in the next section.
There is a known issue with JFS and ALSA on Octane systems where the ALSA fails
to work. Given the experimental nature of JFS on MIPS, it is recommended that
people avoid using JFS for the time being.
Compiling and Installing
Now that your kernel is configured, it is time to compile and install it. Exit
the configuration and start the compilation process:
On 64-bit machines, you need to specify
CROSS_COMPILE=mips64-unknown-linux-gnu- (or mips64el-... if on a
little-endian system) to use the 64-bit compiler.
Code Listing 2.3: Compiling the kernel
# make vmlinux modules modules_install
# make vmlinux modules modules_install CROSS_COMPILE=mips64-unknown-linux-gnu-
# make vmlinux modules CROSS_COMPILE=mips64-unknown-linux-gnu-
# make modules_install INSTALL_MOD_PATH=/somewhere
When compiling a 64-bit kernel for the Indy, Indigo2 (R4k), Challenge S and O2,
use the vmlinux.32 target instead of vmlinux. Otherwise, your
machine will not be able to boot. This is to work around the PROM not
understanding the ELF64 format.
Code Listing 2.4: Using the vmlinux.32 target
# make vmlinux.32
When the kernel has finished compiling, copy the kernel image to
On Cobalt servers, the bootloader will expect to see a compressed kernel image.
Remember to gzip -9 the file once it is in /boot.
Code Listing 2.5: Installing the kernel
# cp vmlinux /boot/kernel-2.6.34-mips
# gzip -9v /boot/kernel-2.6.34-mips
7.c. Kernel Modules
Configuring the Modules
You should list the modules you want automatically loaded in
/etc/conf.d/modules. You can add extra options to
the modules too if you want.
To view all available modules, run the following find command. Don't
forget to substitute "<kernel version>" with the version of the kernel you
Code Listing 3.1: Viewing all available modules
# find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko' | less
For instance, to automatically load the 3c59x.ko module (which is the
driver for a specific 3Com network card family), edit the
/etc/conf.d/modules file and enter the module name in it.
Code Listing 3.2: Editing /etc/conf.d/modules
# nano -w /etc/conf.d/modules
Continue the installation with Configuring your
[ << ]
[ < ]
[ Home ]
[ > ]
[ >> ]
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-2.5 license. The Gentoo Name and Logo Usage Guidelines apply.