LinuxIsEasyAsWin 04
From Hacklab
- compiling a custom kernel
* Getting it
You need several things installed on your machine in order to build a kernel. Most notable a compiler(gcc) and build tools (make, binutils). Most importantly tho, you need the kernel source code. This can be retrieved from ftp://ftp.kernel.org/pub/linux/kernel/v2.4/linux-2.4.26.tar.bz2 which is the most recent stable kernel at present
to extract the contents of the archive:
- cd /usr/src
- tar -jxvf <pathto>/linux-2.4.26.tar.bz2
this will create a directory with all the source code in it.
before you can build a kernel you must configure it. First of all 'cd' into the directory:
- cd linux-2.4.26
* Configuring it
you have several options for configuring a kernel, they all do the same thing, but provide differing interfaces. If you have a graphical desktop running, try:
- make xconfig
or if you are using a terminal/console:
- make menuconfig
* Modular or Monolithic
There are two differnt styles of kernel you can build, referred to as 'modular' and 'monolithic'. The former has many of the components of the kernel built into seperate files that get loaded as and when the kernel needs them, things like hardware drivers, networking code and a plethora of other things. The alternative is to build one, larger, kernel that has everything compiled into it.
If you are just starting out with building kernels, you should opt for a monolithic kernel, as its a lot easier trying to get it to boot up, you dont need to worry about how and when modules get loaded. In order to choose which type of kernel you want, go into the menu section labeled 'Loadable module support', and disable it.
* Processor Type
Now go to the item labeled 'Processor type and features' and change the 'Processor Family' option to one which matches the CPU of the machine you want to run this kernel on. This has the effect of optimizing the kernel for that specific processor. If you try and compile for an Athlon, and you've actually got a Pentium II, the kernel will more than likely not boot up.
* What to not include and what to include
There are many other options which you can opt to compile into a new kernel, and at first its tempting to enable everything. Resist this temptation, unless you either enjoy watching things scroll past your screen, or you've got a very fast computer. Compiles can take anything from minutes to hours depending on the speed of your computer.
* Network cards
Important things to ensure are compiled in, assuming you have them, are network cards. These live under 'Network device support', you'll probably want to start looking under the sub section labeled 'Ethernet (10 or 100Mbit). If you see something that sounds vaguely like what you have, enable it.
* What hardware do you have
You can find out what hardware (PCI cards in this case) that you have installed by running this from another shell: $ lspci This should give you an idea of what words to keep an eye out for while configuring your kernel.
* building it
* installing it
* configuring your boot loader
- using apt to install upgrade
- dpkg --install
- traditional install from source
- synapti/dselect
Documentation:
