Compile a kernel
For experienced Linux users, it is normal to frequently re-compile a new kernel because these users want
the newest features and the latest tweaks for their PC.Newbies are often shocked that it is possible to construct an OS built entirely from the source code. No surprise: Whoever compiled M$ Win with de-activated "features" before? No one!
Comment: If X11 is running,
Instead of starting X as root you should add root into the
`.Xauthority' of the user who owned the X session. Now the root can
access X without xhost. Look at
The first start-up of make xconfig could take a while because this
configuration program is included with its source code and is compiled
during the first call.
The basic rule: Everything that is not absolute necessary for booting does not
belong in the kernel and should to be loaded as a module. The exception should
only be make if you constructed a stand alone firewall, a router or
something similar. This is referred to as a "monolithic" kernel. On these machines usually are few hardware components
and just a few programs are running.
But there are exceptions for everything. If a module did not work but it
would function if you you included it into the kernel or just the other way
around, then make it the way it works.
Please read the help for every component you select or deselect!
As a module you should compile (if needed):
The reason is very simple: These rules save memory because the modules would be
loaded only if they were really needed. After a specified time, the modules will be
removed. It is more flexible because you can advise I/O addresses and
IRQs in the moment you load the module. If the device were included in the
kernel you would have to reload the system completely.
You should always set `Network support' to "YES" and at least bind one
`dummy' network device into the system. Many programs use a network
device even if no network card is included (because Linux is a network OS :).
X windows is such a candidate; the printer spooler lpd also needs a
network. If you own a real network you do not need the `dummy' device
any longer, but it doesn't disturb anything if it's there.
After you finished the configuration, you `Exit', save with a
click on `Yes' and type
After the compilation is finished, you will find a file with the name zImage at
/usr/src/linux/arch/i386/boot/ which is the new kernel. You copy this
one into the `root' directory (or to /boot, it is just
important that the file has to be on the root partition) and add the following
lines into the `/etc/lilo.conf' (if you used LILO to boot):
Execute a
/sbin/lilo
and lilo should use the new kernel as an additional option to boot from.
It is not complicated to boot from a Dos or Windows via `LOADLIN'. Locate the old
kernel you used before (usually on a DOS partition). Then you copy the new
kernel e.g. called `new.img' in the same directory and use this
one as the kernel file that is specified in the parameters of `LOADLIN' Read the docs on `LOADLIN' for more info.
LinksShort instruction
Become root and change directories to '/usr/src/linux'. Start a
make menuconfig and everything that follows should be clearly described.
make xconfig can be used and you can point and click to assemble your kernel
components. You might have to execute xhost +localhost before.
Now the root should be able to open an X windows on your X session. This would
not be necessary if you started X as root, but you should avoid
this because you expose the machine to many security problems.
>> man mkxauth
long instruction
The default kernel has a quite good configuration that can be changed to your
wishes. But if you tried something because it would sound cool you could be in
big trouble. Also, the documentation should be read (RTFM - that's always recommended :D ).
The standard settings
You should activate the following options at least (also for computers without a
network device)
MTRR
make dep clean modules zImage
modules_install (the order after dep clean
does not matter). Now it takes about 10 minutes (P166, 32MB) up to ten hours
(386DX-33, 8MB) to compile the kernel. Of course, you can work on the computer in another
console while you wait.
Installation of the kernel
image = /boot/zImage # path to the new kernel file
label = NewKernel # max. 15 letters
This method requires a existing configured `lilo.conf' and does not
change the existing settings (`root, boot, prompt', etc).
After a reboot, you can choose the new NewKernel at the
`LILO:' prompt.
If the new kernel has run perfectly for a few days and you wanted to keep it
as the standard kernel to boot you would edit the `/etc/lilo.conf'
again. Just place the new lines in front of the lines of the first entry (or just add default=NewKernel to the first stanza of lilo.conf). Execute /sbin/lilo
and everything is ready again.
This text is a part of the Linux USER FAQ and Jens Benecke allowed us to
reprint it. He is one of the authors of this FAQ.
Author's homepage (Jens Benecke): http://www.jensbenecke.de
Linux USER FAQ (German version): http://www.linuxfaq.de
Talkback Area
Enter Own Comment