KernelNewbies:

How do I compile a kernel?

(These instructions assume we are installing version 2.6.0 of the kernel, replace all instances with the version you are trying to build. These instructions are also x86-specific; other architecture's build procedures may differ.)

         tar xivf linux-2.6.0.tar.bz2

         make

         make modules_install

         make install 

If your distribution uses lilo:

         image = /boot/vmlinuz-2.6.0
         label = 2.6.0

If your distribution uses grub:

          title=Linux 2.6.0
          root (hd0,1) #  or whatever your current root is 
          kernel /boot/vmlinuz-2.6.26 root=/dev/hda1 # or whatever... 

          title=My very latest kernel install
          root (hd0,1) #  or whatever your current root is 
          kernel /boot/vmlinuz root=/dev/hda1 # or whatever... 

If you get modversion problems (symbols ending in _Rxxxxxxxx), have a look at [http://www.tux.org/lkml/#s8-8 this question] in the linux-kernel mailing list FAQ to solve the problem.

Still not getting it? Try this [http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html more indepth tutorial]


Note on /usr/src

If you're just trying out this procedure, do the unpacking and building in your home directory as discussed above. In a professional environment, though, the source would be stored in /usr/src or /usr/local/src, where compiling would also be done. To allow this, and at the same time avoid becoming root for the entire procedure, use your favorite GNOME or KDE utilities to create a group "devel" (or "hack" or whatever) and add yourself to that group. Then change the group owner of /usr/src to the new group and grant write privileges to the group.

That way you can unpack the kernel tarball into /usr/src (or whatever) and configure and build there without doing everything as root. Of course, you'll still need to sudo or become root when you install the new kernel and edit the lilo/grub configuration files.


/!\ Edit conflict - other version:



Note on /usr/src

If you're just trying out this procedure, do the unpacking and building in your home directory as discussed above. In a professional environment, though, the source would be stored in /usr/src or /usr/local/src, where compiling would also be done. To allow this, and at the same time avoid becoming root for the entire procedure, use your favorite GNOME or KDE utilities to create a group "devel" (or "hack" or whatever) and add yourself to that group. Then change the group owner of /usr/src to the new group and grant write privileges to the group.

That way you can unpack the kernel tarball into /usr/src (or whatever) and configure and build there without doing everything as root. Of course, you'll still need to sudo or become root when you install the new kernel and edit the lilo/grub configuration files.


/!\ Edit conflict - your version:



/!\ End of edit conflict



["CategoryFAQ"]

KernelNewbies: FAQ/KernelCompilation (last edited 2008-12-29 03:10:28 by c-68-58-135-168)