«

»

Dec 07

How to build a linux kernel (Ubuntu)

Create a .config file for your new kernel using the config file of your existing kernel.
# cp /boot/<config-kernel_version_#> <kernel_dir>/.config

If the .config file is modified using an editor like vim, etc, do
# make oldconfig

The kernel configuration can also be modified by
# make menuconfig

Make changes and then save and exit.

To build and install the kernel, do the following:

  • # make all -j #proc_cores (to build the kernel in parallel)
    For me (#cores+1) is the fastest.
  • # make module_install
  • # make install

There should now be three new files in /boot
# ls /boot

  1. config-<new_kernel_name>
  2. System.map-<new_kernel_name>
  3. vmlinux-<new_kernel_name>

On Ubuntu distributions v10.10 and above, the initrd.img file has to created manually. For doing so:

  • # sudo update-initramfs -c -k <new_kernel_name>
  • # sudo update-grub

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>