|
This is just some notes about how I compiled my Linux kernel. This is done using an Intel® based computer running RedHat Linux v6.2 (kernel updated to 2.2.16-3) and some of it is added after running RedHat Linux v7.2 (kernel updated to 2.4.9-31).
For more information, see "The Linux Kernel HOWTO".
Why compile the kernel?
Mostly I upgrade the kernel because I want the ability to talk to more types of
hardware (that is, they have more device drivers) or I want to fix bugs in the older
versions.
Get the new code.
If I want to fix some bugs by installing a new kernel, I obtain the source via anonymous ftp from ftp.kernel.org in
/pub/linux/kernel/vx.y, where x.y is the version. Then unpack it in /usr/src. But first rename the /usr/src/linux first like this:
"mv /usr/src/linux /usr/src/linux-old"
Now, in /usr/src, unpack the source with:
"tar zxpvf linux-x.y.z.tar.gz"
Configuring the kernel.
To configure the options and modules in the kernel, several tools can be used:
"make config"
; Simple configure script
"make menuconfig"
; Configure script with menus using ncurses
"make xconfig" ;
Run's from X with Tk installed
I will not mention anything about the several options to choose between here. See
"The Linux
Kernel HOWTO" for more info.
Compiling the kernel.
- "make dep" ;
Run this step to fix all source dependencies. In essence, this command will allow the
compilation of the kernel to be more efficient.
- "make clean" ;
This step will clean up any residuals from previous compilations. This command will delete
unnecessary files.
- "make zImage"
; The command will rebuild the compiler image. This step will point out any errors in the
compilation. This command will take awhile to run..... If your kernel
gets big, use "make bzImage"
instead.
- ("make zlilo"
; Because I use LILO, this will install the kernel, run LILO on it, and get you all
ready to boot (if kernel is "/vmlinuz",
lilo is in "/sbin", and lilo
config, "/etc/lilo.conf"
agrees with this.)
(If the kernel is too large, run "make
bzlilo" instead.)
- "make install"
; Put's the stuff in "/boot".
I uses this one because after running the command above the new kernel still is
located in "/usr/src/linux/arch/i386/boot".
Modules.
Usually I want to load some modules for certain devices I use. To make these work,
reboot with the new kernel, got to "/usr/src/linux"
and I do (in RedHat Linux v7.x this should not be necessary):
- "make modules"
; Compiles all of the modules which you did not specify in the kernel
configuration mentioned above, and places links to them in "/usr/src/linux/modules".
- "make modules_install"
; Installs them in "/lib/modules/x.y.z",
where x.y.z is the kernel release.
Notes.
When compiling a new kernel on RedHat 6.2 with upgraded 2.2.16-3 binary kernel RPM I
got the following error message:
In file included from /usr/include/errno.h:36,
from scripts/split-include.c:26:
/usr/include/bits/errno.h:25: linux/errno.h: No such file or directory
make: *** [scripts/split-include] Error 1
According to the README-file in the top level of /usr/src/linux this does the trick:
"ln -sf /usr/src/linux/include/linux
/usr/include/linux"
Lilo.
After compiling the kernel, you have to edit "/etc/lilo.conf"
Insert the correct entry for the new kernel, and run "/sbin/lilo
-v" to make it active. The lilo.conf for the one I just made
using RedHat 7.2, kernel 2.4.9-31 looks like this:
prompt
timeout=50
default=linux-custom
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear
image=/boot/vmlinuz-2.4.9-31custom
label=linux-custom
read-only
root=/dev/hda3
image=/boot/vmlinuz-2.4.9-31
label=linux
read-only
root=/dev/hda3
image
|