Wednesday, August 14, 2013

How to build a modified kernel on Fedora?


When you compile your Linux kernel in your Fedora, most dependencies should not trouble you. So, what you need to do is just the follow steps:
  • Download kernel source from either kernel.org or github; usually a tar.gz file.
    • wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.4.44.tar.gz
  • Extract the kernel file to some directory (e.g. your home directory).
    • tar -xvf linux-3.4.44.tar.gz
  • Configure the kernel. This is the most important step I suppose. You can use your old .config file which is in /usr/src/linux using the make oldconfig command, or you can configure it all by yourself using the make menuconfig command. If you need some GUI tools, you need to install some extra packages, Both Qt based and GTK based GUI are available. In fact, the most important and often dangerous step is, how to get the right drivers and how to make sure you really need a kernel function or not.
    •  make menuconfig
  • if gcc is not installed: install gcc using command :->yum install gcc .
    if ncurses-devel not installed: install it using :-> yum install ncurses-devel  .
  •  compile 
    • make
    • make modules
    • make install. For most new kernel, we needn't run make modules_install any more.
  • Put the kernel image into the boot directory and edit the grub menulist.
  • Reboot your system, your kernel will work!
    • reboot
References:
 [1] Linux Kernel in a Nutshell by Greg Kroah-Hartman (O'Reilly) http://mastermac.free.fr/vrac/lkn.pdf

No comments:

Post a Comment