Kernel26Compilation

From SlackWiki
Revision as of 14:12, 9 December 2011 by Rworkman (talk | contribs) (Reverted edits by Esmapebb (talk) to last revision by Erik)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to build a 2.6.x Kernel on Slackware

Note: Maybe this replaces the 2.6 part of the kernel compile tutorial already here.

Warning!

If you work on your kernel and do something wrong you may destroy your system in a way you have to reinstall it. All actions on your own risk! Noone assures that all actions described here are 100% right and work in any case. We are not responsible for damages caused by following this tutorial!

Prerequisites

  • Get the kernel sources you want from ftp://ftp.de.kernel.org or from a mirror (http://www.kernel.org/mirrors/).
  • Make sure you are able to boot your Slackware original kernel after kernel update (You have to install 2.6.13 from "testing" to do this-slack12 uses 2.6.21.5 by default, no need to install it)

image = /boot/vmlinuz-generic-2.6.13
root = /dev/ #Your root partition. Get this from another kernel entry or from original /etc/lilo.conf label = Backup read-only

Now run "lilo" once as root

  • If you want to play safe you may now reboot and try if the kernel boots without errors.
  • Uncompress your kernel sources below /usr/src
  • The symlink /usr/src/linux has to point to the directory of the new kernel. For example: /usr/src/linux -> /usr/src/linux-2.6.14.4

Configure the kernel

  • Change to the kernel directory.

cd /usr/src/linux

  • Configure your kernel:
    • From scratch, then you may choose from

make config (You get prompted for all possible options) make menuconfig (You get a nice menu where you may navigate with cursor keys. Needs curses-5.x) make xconfig (You may configure in X, of course needs working X installation) make gconfig make qtconfig

  • From old configuration:

Copy the config file of the old kernel to ./.config. If you want to come from orignal Slackware kernel, then:

cp /boot/config .config

After that "make oldconfig" to configure new features (you may acceppt all questions with "Enter" to use the default values) and use "make menuconfig" (or any other of the above list) to change things if you like.

Important! Be sure to compile the alsa modules (or you won't have sound). You have also to do this if you used "make oldconfig" (for example using "make menuconfig") as the original kernel is compiled without alsa.

Compile and install kernel

  • The real compiling can start:

make (Now, depending on your computer, you may go drinking some coffee, watch a movie or go on your balcony to smoke one ;-) )

If this finished without errors (we assume this) then your kernel and your kernel modules should be compiled.

  • Remove symlinks. If you still run your original slackware kernel, then "vmlinuz" and "System.map" are Symlinks to the kernel files. To get sure that we don't override this files, we delete the symlinks

rm /boot/vmlinuz /boot/System.map

  • Install the kernel

Install the kernel modules with:
make modules_install

and the kernel with:
make install

  • If all steps have been done successful you may now use your new (self-made) kernel.

Troubleshooting

  • Help, the kernel doesn't work!

Choose your backup kernel on lilo, check your kernel configuration and recompile.

  • Choose your backup kernel sounds easy, but...

Now you know why you should keep a running kernel before you install a new one. Either your system is as usable as you are able to check the kernel configuration or you may boot from your slackware setup CD, mount your root partition to /mnt, chroot /mnt and recompile your kernel from there or install slackware packages of a running kernel.

german version