Roll your own kernel

From SaruWiki
Revision as of 22:32, 24 May 2008 by Saruman! (talk | contribs) (Page started)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

PRO's and Con's

There are both advantages and disadvantages to compiling your own Linux kernel. This is an attempt at siding the pro's and con's, as we see them

PRO

  • It's fun! (no, really!)
  • Better performance than a stock Debian kernel, because of system specific optimizations
  • Better hardware support, because we can use a newer kernel with newer drivers
  • Extra features, because we can use a newer kernel with those newer features

CON

  • No automatic security system à la APT: if there's a security issue in the kernel that you're using, you'll have to find out about it, and then compile a new kernel. As con's go, this is a pretty big one, we reckon. Still, we run our own kernels...
  • You'll need to delve into hardware specific things, expressed in obscure kernel-hacking terms (what's "sparse memory support" for, anyway?)
  • Like everything, this takes time to master, and time to implement. Time spent on kernel compiling tasks (be it learning or executing) cannot be spent on other tasks

Prerequisites

To compile your own kernel, you'll need some software. First up, you'll need to install the following packages, using "apt-get install <package>" or aptitude. This is the list of packages we advise you to install:

bzip2
ftp
make
libncurses5-dev (lus all its dependencies, including the gcc GNU C Compiler)

Now it's time to get that kernel. To get it on a base server, there are many ways; we'll outline two of them.

Putting a kernel source on your server using WinSCP

This is pretty easy, although it requires the following things

  1. First up, you'll need to have the SSH server installed (which we presuppose anyway)
  2. Next, you'll need a computer on your network running Microsoft Windows, on which you need to install WinSCP.
  3. After installing WinSCP, you start it up, fill in the host name or IP number of your server, your user name (as it exists on the Debian server, and which must have rights to use the SSH server), and click "save" (we advise you never to save your password in WinSCP for security reasons).
  4. After saving the SSH account, you can find it under "stored sessions"; select it and click "login". A login window should appear, and you're asked for your password. After providing that, you're presented with a GUI, that allows you to copy and move files from and to the server. While you can theoretically save to and read from any location on the server, restrictions apply that have to do with the rights of the ordinary user that you are, so for simplicity we assume you'll put files in your home directory (e.g. /home/saruman), and then from a shell on the server move the files to the proper location.
  5. Now, you download the kernel source from the famous kernel.org. From a European location, the latest v2.6 kernel source can be found in here. Download the newest file that is named "linux-2.6.xxxxxx.tar.bz2" (like linux-2.6.25.4.tar.bz2), or alternatively, the same file in .gz instead of .bz2. The bz2 files are compressed slightly better, but uncompressing it requires the bzip2 program, which is not available on every Unix platform - fortunately it is on Debian.
  6. Use WinSCP to upload the kernel source file to your home directory on the server

Getting the kernel source on your server straight from the 'Net

Extracting the kernel source

  1. Log on to the server using your user account, either onto the console, or on an SSH shell (e.g. using PuTTy on a Windows client)