I want to test an (upstream) custom kernel on Fedora.

The plan so far is:

  • use a recent fedora config as starting point, e.g. /boot/config-3.6.6-1.fc17.x86_64
  • lookup build dependencies
  • lookup right make commands
  • execute some make commands
  • cp resulting vmlinuz/System.map to /boot
  • adjust grub

But what about the initramfs...img file ? How do I generate it?

What else is important?


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.
  • Extract the kernel file to some directory (e.g. your home directory).
  • 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
  • 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!

For more information and more accurate steps as well as tips, Linux Kernel in a Nutshell by Greg Kroah-Hartman (O'Reilly) may help.

| improve this answer | |
  • +1 for Good Answer. If you explain the configure the kernel option detail, it will be more helpful. – Md Mahbubur Rahman Nov 17 '12 at 12:44
  • @MahbuburRAaman Thank you for your vote. As you know, the exact options depend on the hardware. It's impossible to show. – Fity Nov 17 '12 at 14:45
  • 1
    Perhaps you can address the initramfs image topic? Do I need to generate it? If not, why not ... etc. – maxschlepzig Nov 17 '12 at 15:33
  • To install your freshly built kernel, it is enough to do "make modules_install install" (in Fedora at least), that sets up everything. – vonbrand Jan 16 '13 at 16:05
  • weird, with 3.14.0.rc5, I still need to run modules_install before install, else I get "could not open module dir" errors – elmarco Mar 6 '14 at 14:48

One way: First install the linux-source or kernel-source package, then I believe that you do the following steps (Its been awhile):

cd /usr/src/kernels/*whereverthekernelsourcesare*
make config
make modules
make modules_install
make install
| improve this answer | |
  • 1
    does this take care of creating a initramfs file? – maxschlepzig Nov 17 '12 at 8:22
  • It has to be "modules_install install" in that order, the install step creates the initramfs and requires the installed modules. – vonbrand Jan 19 '13 at 23:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.