In association with heise online

Compilation

The next steps for compiling and installing the custom kernel configuration are identical to those for manually configuring a Linux kernel. In the current versions of Fedora and openSUSE, the following two instructions are all that's required; the -j 8 parameter enables make to start up to eight compiler jobs, and use as many processor cores, in parallel

make -j 8 bzImage modules
sudo make modules_install install

In these two distributions, the install make target will leave a part of the kernel installation to the distribution-specific /sbin/installkernel script, which will conveniently create an appropriate initial ramdisk (initrd) for the custom kernel, as well as an entry in the GRUB configuration. In Ubuntu, both of these tasks must be done manually.

Integration

Alternatively, you can integrate your custom system's drivers directly into the kernel instead of compiling them as modules. Modern kernels can create this type of configuration semi-automatically as well – simply use the localyesconfig make target instead of localmodconfig, which will also disable any drivers that aren't required.

Both make targets can also generate kernel configurations for other systems – for example when a system is so underpowered that it would take hours to compile a kernel. For this purpose, write the target system's list of loaded modules to a file

lsmod > module_target

Transfer this file to the computer that will compile the kernel. If this computer's kernel version differs from that of the target system, the target system's kernel configuration file should also be copied and saved as .config in the directory that contains the kernel sources. To make localmodconfig use the target system's list of required modules, launch it with

make LSMOD=${HOME}/module_target localmodconfig

The distribution that is used to compile the kernel must be designed for the same CPU architecture; if suitable cross compilers are available, the kernel can be compiled for a different CPU architecture by adding ARCH=<target-arch> to the make call.

Once compiled, copy the kernel image and modules to the target computer – for instance by transferring the entire source code tree and then launching the modules_install and install make targets on the target computer.

Other targets

Linux kernel version 2.6.36 offers further new make targets that can be helpful when configuring a kernel. Calling

make oldnoconfig

will disable any options in the kernel configuration file that weren't enabled before. A list of all the options that aren't enabled in .config can be displayed by calling the listnewconfig make target. The alldefconfig make target creates a configuration file in which all options are set to the default values listed in the Kconfig files. Make provides an overview and short description of these and other targets when make help is run in the directory that contains the Linux sources.

Print Version | Permalink: http://h-online.com/-1403046
  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit
 


  • July's Community Calendar





The H Open

The H Security

The H Developer

The H Internet Toolkit