# [Outdated] KC11: Kernel compiling for the beginner.

## wilburpan

This FAQ has been updated and extended, please see KC11 - kernel compiling for the beginner instead

Navigation:  [Kernel Compilation] [Table of Contents]

Kernel compiling for the beginner

I was a complete beginner when I first tried installing Gentoo.  At that time, that was also my first attempt at compiling a kernel.  These are some things I would keep in mind for any other beginners at kernel compiling:  

1. It is much more important to have a working kernel than an optimized kernel at first.  

Again, it is much more important to have a working kernel than an optimized kernel at first. You can always try to optimize and recompile later.  

2. Keep it simple at first.  All you really need to get the kernel and Gentoo going at first is what's outlined in step 15 of the install docs and networking.  To reiterate the install documentation, you need to:

-- under "Code maturity level options":

-- select "Prompt for development and/or incomplete code/drivers"

-- under "File systems":

-- select "Virtual memory file system support (former shm fs)"

     -- select "/proc file system support"

     -- select "/dev file system support (EXPERIMENTAL)"

     -- select "Automatically mount at boot"

     -- unselect "/dev/pts file system for Unix98 PTYs"

     -- select all of the hard disk filesystems you are using (reiserfs, ext2, ext3, JFS, XFS)

The first time I got the kernel working (this was install attempt #5 for me) I literally did not include anything in the gentoo-sources kernel except for the appropriate file systems and my network card.  I did not have scanner support, I didn't have printer support, but by god, I had a working system.  You can always add the other stuff later.  

Since I was still very much a beginner at that time, the only way that I was able to do even this simple thing was to take a pen and highlight the corresponding lines in the install doc as I set each of the above configurations in the kernel -- this way I was able to make sure that everything got done. 

I would definitely make sure you get a working system that boots, recognizes your video card, mouse, keyboard and connects to the internet before worrying about your scanner, Zip drive, CD burner, and SCSI card.  Remember -- these can be added later. 

3. Monolithic kernel vs. modules: I would compile everything directly into the kernel at first.  You can decide what can be compiled as modules later.  This will avoid the problem where something that the kernel needs at boot time is actually compiled as a module.  If this happens, you can't boot, since you need to boot the kernel before modules get loaded. 

4. In keeping with rule #1 above, once you have installed a working kernel in your /boot partition, it would be a very good idea to install recompiled kernels, alternate kernels, development kernels, etc., as separate files.  Both grub and lilo have ways of making a simple menu so that you can have multiple kernels and pick which of your kernels you want to boot.

For example, in my boot partition, I have three different kernels:

```
ls /boot

bzImage-2.4.20-gentoo

bzImage-2.5.69-mm8

bzImage-2.5.70-mm5

bzImage-2.4.20-gentoo.old

bzImage-2.5.69-mm8.old

bzImage-2.5.70-mm5.old

```

In my case I have the latest gentoo-sources kernel, the 2.5.69 mm-sources kernel, which I run most of the time, and the 2.5.70 kernel which I play around with in my ever shrinking free time.  

Also note that none of the kernels have the generic "bzImage" name, and that there are backup versions of each kernel.  It is a very good idea to have a quick and easy way of documenting which version of the kernel each file was compiled from.

If I recompile a kernel, I always copy my working version of that kernel to a backup file (hence the *.old files) before copying the freshly compiled kernel to the /boot partition.  In this way, if my new kernel won't boot, I can always go back to my working copy.  

5. Resources:

-- Compiling A Kernel (linuxbeginner.org)

-- www.kernel.org

-- The Linux Kernel HOWTO

[edited to incorporate suggested changes.  Thanks!]

----------

## pjp

Comments on this FAQ to [FAQF] KC11: Kernel compiling for the beginner.

Thanks for the FAQ.

----------

## Earthwings

Moved from Frequently Asked Questions to Documentation, Tips & Tricks. This FAQ has been updated and extended, please see KC11 - kernel compiling for the beginner

----------

