Kernel 2.4.4

Jeffrey Wong jmwong at math.ed.hawaii.edu
Sun Apr 29 01:58:42 PDT 2001


On Sat, 28 Apr 2001, Julio Gutierrez wrote:

>   I actually would like to know what do I need to know in order to modify
> or build a kernel, what programming languages are needed to do this?
> I know this question seems kinda stupid but it has been bothering me since
> I started using linux
>
> would someone tell me =-)
> and yes I would be interested on your new Kernel, tell me how can I get it
>

What you need to do depends on what you are trying to do.  If you simply
want to reconfigure the kernel to something that more closely meets your
individual system requirements, all you may need to do is rebuild your
kernel.  If this is not what you want skip down to the bottom.

WARNING!!
Be careful when installing a new kernel, always make sure you can back out
of any changes you do.  I can't count the number of times I've built a
kernel that didn't even boot.

To reconfiure the kernel, assuming that you are using RedHat or something
with a similar rpm based install, is make sure you have the following rpms
installed:

kernel-headers
kernel-source

In addition you need a working C compiler, usually gcc, but if you are
using RH 7.0 you need (IIRC) kgcc.  I'm not sure what the exact rpms are,
but I'm pretty sure that you at least need the binutils rpm.  If you
installed the C development rpms then you should have everything you need.

If you are using X Windows then you might want to install the kernelcfg
rpm.  Personally, I don't use kernelcfg so I don't how well it works.

If you have those installed, and do not want to use the X Windows kernel
config program do this.

cd /usr/src/linux
make mrproper
make menuconfig

This will bring up a text menu based utility where you can look through
the commonly configured settings, like what type of cpu specific
optimizations to use, what type of hardware drivers you want to
enable/disable, etc.

Then to rebuild a new kernel with your settings use (This is assuming you
are working with a 2.1 or later kernel, the 2.0 kernel is slightly
different)

make dep
make clean
make bzImage
make modules
make modules_install

This will give you a new kernel located at (assuming your working with
linux on an x86 type system)

/usr/src/linux/arch/i386/boot/bzImage

You can move that file to your /boot and then edit /etc/lilo.conf to
reflect your new kernel.  I'm getting kinda tired of typing so i'm just
going to point you to the the man pages for lilo.conf

man lilo.conf

Make sure you leave on entry in lilo.conf so you can go back to your old
kernel!  Once you have a new kernel working okay you can get rid of the
old kernel entry if you want. Once you have a new lilo.conf file, install
it with

lilo -v -v

and you should be good to go.

For more info on kernel building like this there is a HOWTO written on it
called 'Kernel-HOWTO'  it might have been installed on your linux box as
/usr/doc/HOWTO/Kernel-HOWTO. If not a quick web search should turn it up.

----------

If you've already gone through all of that and still need to make more
changes, the linux kernel is written in C and assembly.  Unless you need
to port linux to another architecture, everything you want to change is
probably in part of the C code.  IIRC the assembly stuff is mostly
involved with getting the kernel to load in the first place and a few
other places which you probably shouldn't be touching unless you truely
grok operating system theory.  If this is the kind of stuff you want, here
are a couple of books that I thought was pretty good. (Although they are a
bit outdated, they are based on the 2.0 kernel).

Linux Kernel Internals Second Edition
by M. Beck, et al
published by Addison-Wesley
ISBN 0-201-33143-8

The Linux Kernel Book
by Remy Card, et al
published by Wiley
ISBN 0-471-98141-9

Both of these books were seen at Borders (both hawaii branches) at one
time or another.

Jeff Wong



More information about the LUAU mailing list