This tutorial is about how-to compile kernel Linux on Ubuntu 12.04 LTS with old school way. It's necessary to do recompile your Linux with latest kernel? Well... Depends. If you need new driver/modules to support your hardware, if you're kernel developer or interest with Linux kernel, or want to tuning your system, or maybe just interest Linux kernel, maybe recompiling latest kernel is good for you.
- Before you recompile new vanilla Linux kernel, install Ubuntu dependencies first,
sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev linux-source libncurses5 libncurses5-dev fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge kernel-package
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.6.10.tar.bz2
- Extract the archive to other folder but this is only optional,
tar jxvf linux-3.6.10.tar.bz2 -C /usr/src/
- Change into kernel directory,
cd /usr/src/linux-3.6.10/
- From this top kernel directory actually you can start to configure the kernel. But my advice is copy your current Linux kernel configuration to new kernel source. For me this is safest method if something bad happen after recompile new kernel.
cp /boot/config-`uname -r` .config
make oldconfig
- Since the 2.6.32 kernel, a new feature allow you to update the configuration to only compile modules that are actually used in your system, as above make selections if prompted, otherwise hit enter for defaults,
make localmodconfig
- The next step is to configure the kernel to your needs. This is the most fun part. Select necessary modules wisely,
make menuconfig
- Now you're ready to start the build. You can speed up the compilation process by enabling parallel make with -j flag. The recommended use is 'processor cores +1', e.g. if you have a quad core processor,
make -j5
- This command will compile the kernel and create a compressed binary image of the kernel. After first step, the kernel image can be found at arch/i386/boot/bz/image (for x86 based processor). Once the initial compilation has completed, install dynamically loadable kernel modules,
sudo make modules_install
- All modules are installed in a subdirectory of "/lib/modules", named after the kernel version. Finally we install the kernel,
sudo make install
- After finish, reboot your system and check with this command,
uname -r
- Make sure you run on new kernel. If it does not works, restart again and choice old kernel then reconfigure it again with "make menuconfig" and the rest. Have fun... ;)
No comments:
Post a Comment