Goals for this chapter:
|
rpm packages covered in this chapter:
|
|
|
|
The kernel is the heart of the operating system. All the services included in the system: the File System, the device drivers, the memory, the network cards, video card drivers, process control, and other services depend on the kernel.
The concept of a monolithic-like UNIX was born in the 60s. In recent years, people who study operating systems have been exploring the concept of the micro-kernel. This new concept offers the possibility of loading small services that interact with a minimal kernel. Linux is implemented as a monolithic system like UNIX, discarding the micro kernel functions because these are very "delicate" and difficult to implement.
Linux, however, offers the possibility of loading so-called "modules" that can be included in the kernel at the boot time or removed when their services are not necessary.
The kernel is a set of object files, (files whose names end with ".o"), each one having a specific purpose: managing a network card, controlling the process table, etc. All of these are linked together in a single and unique file.
In version 2.0, the complete Linux kernel consists of around 470,000 lines of C code and some 8,000 lines of assembler for Intel architecture.
The main advantage of the Linux kernel is that the source is available to everyone. This includes the kernel of the commercial distributions like Caldera OpenLinux or RedHat, which have been tested in detail to detect any possible error or weakness.
An Introduction to the Kernel 2.4.10
The Kernel included in RedHat 7.0 is 2.2.16. We prefer here to introduce the latest Kernel 2.4.2 (Feb 22, 2001), more updated.
To obtain the kernel 2.4.2, we advice to download it from our server ftp.futuretg.com/pub/ftosx/step6/. Our kernel is ready for ReiserFS.
The directory where the sources are present (if you install it) is "/usr/src/linux/".
To install the new kernel 2.4.2, you need uncompress it.
Please run
tar xvfz linux-2.4.2.tgz
Now, we advice that you rename the "linux" directory to a "linux-version-directory". Therefore you need to run the command:
[root@ftosx1 src]# ln -s linux-2.4.2 linux
Now, you will have:
[root@ftosx1 src]# ls -al
drwxr-xr-x 10 root root
594 Mar 3 16:47 .
drwxr-xr-x 24 root root
565 Dec 10 13:22 ..
-rw-r--r-- 1 root
root 12263 Mar 3 16:41
.config
lrwxrwxrwx 1 root
root 11 Feb
22 15:32 linux -> linux-2.4.2
drwxr-xr-x 18 root root
771 Jan 6 19:12 linux-2.2.14
drwxr-xr-x 15 root root
656 Feb 17 16:24 linux-2.2.17
-rw-r--r-- 1 root
root 18521047 Feb 1 18:17 linux-2.2.17.tgz
drwxr-xr-x 14 root root
463 Aug 10 2000 linux-2.4.0-test6
-rw-r--r-- 1 root
root 96808960 Feb 17 16:51 linux-2.4.0-test6.tar
drwxr-xr-x 14 root root
692 Feb 28 17:39 linux-2.4.1
-rw-r--r-- 1 root
root 25601470 Jan 31 17:13 linux-2.4.1.tgz
drwxr-xr-x 14 root root
606 Mar 3 17:23 linux-2.4.2
-rw-r--r-- 1 root
root 110643200 Feb 22 07:26 linux-2.4.2.tar
-rw-r--r-- 1 root
root 34621250 Mar 3 16:50 linux-2.4.2.tgz
drwxr-xr-x 14 root root
633 Feb 12 13:00 linux.old
lrwxrwxrwx 1 root
root 11 Mar
3 15:00 linux.vanilla -> linux-2.4.2
-rw-r--r-- 1 root
root 6496426 Mar 3 14:58 patch-2.4.2-ac10
drwxr-xr-x 12 root root
285 Mar 1 12:50 redhat
drwxr-xr-x 3 root
root 55 Sep
23 10:21 xig
[root@ftosx1 src]#
Like we see is possible to work with different kernels (one for time) in the same system. To load one or other kernel you need simply to install the appropriate kernel in your LILO Configuration file: "/etc/lilo.conf".
You can now enter in the "Linux Kernel hierarchy".
[root@ftosx1 linux]# ls -al Makefile
-rw-r--r-- 1 root
root 15691 Mar 3 15:00
Makefile
[root@ftosx1 linux]#
A Make file is present in the directory "/usr/src/linux".
The kernel building process is just a compilation!
Therefore, running the make file you run a compilation a create a binary called "vmlinuz", which is installed in the main directory "/" of the system.
These directories contain everything necessary for building a kernel ... including its source:
[root@ftosx1 linux]# ls -F
COPYING Documentation/ Makefile
REPORTING-BUGS System.map drivers/ include/ ipc/
lib/ mm/ scripts/
CREDITS MAINTAINERS
README Rules.make arch/
fs/ init/ kernel/
linux@ net/ vmlinux*
[root@ftosx1 linux]#
For example, the "drivers" directories contains various sub-directories which include all the sources for the code that manages network cards, the Serial MultiPort, sound cards, ISDN cards, etc.; in other words, all the hardware that can be installed and supported in the system:
[root@ftosx1 drivers]# ls -F
Makefile acpi/ block/
char/ fc4/ i2o/ ieee1394/ isdn/
md/ misc/ net/ parport/
pcmcia/ s390/ scsi/ sound/ telephony/ video/
acorn/ atm/
cdrom/ dio/ i2c/ ide/ input/
macintosh/ media/ mtd/ nubus/ pci/
pnp/ sbus/ sgi/ tc/
usb/ zorro/
[root@ftosx1 drivers]##
Sometimes it is necessary to copy a "new" driver that supports a new network card. The source, available on the Internet, must be copied into the "drivers/net" directory because it is relevant to the network.
In the same way, the Linux kernel includes all the source code for supporting the various file systems that can be mounted on the Linux system.
[root@ftosx1 drivers]# cd ../fs
[root@ftosx1 fs]# ls -F
ChangeLog autofs/
binfmt_elf.c block_dev.c dcache.o
dquot.c fcntl.o filesystems.c
iobuf.c locks.c nfs/ open.o
ramfs/ select.c sysv/
Config.in autofs4/
binfmt_elf.o block_dev.o devfs/
efs/ fifo.c
filesystems.o iobuf.o locks.o nfsd/
openpromfs/ read_write.c select.o udf/
Makefile bad_inode.c
binfmt_em86.c buffer.c devices.c
exec.c fifo.o fs.o
ioctl.c minix/ nls/ partitions/
read_write.o smbfs/ ufs/
adfs/ bad_inode.o
binfmt_misc.c buffer.o devices.o
exec.o file.c hfs/
ioctl.o msdos/ noquot.c pipe.c
readdir.c stat.c umsdos/
affs/ bfs/
binfmt_misc.o coda/
devpts/ ext2/ file.o
hpfs/ isofs/
namei.c noquot.o pipe.o
readdir.o stat.o vfat/
attr.c binfmt_aout.c
binfmt_script.c cramfs/ dnotify.c
fat/ file_table.c inode.c
jffs/ namei.o ntfs/ proc/
reiserfs/
super.c
attr.o binfmt_aout.o
binfmt_script.o dcache.c dnotify.o
fcntl.c file_table.o inode.o
lockd/ ncpfs/ open.c qnx4/
romfs/ super.o
[root@ftosx1 fs]##
Like you can check, the new kernel 2.4.1, now support also the ReiserFS.
These directories also contain the sources for other platforms (or architectures) supported by Linux:
[root@ftosx1 arch]# ls -F
alpha/ arm/ i386/ ia64/
m68k/ mips/ mips64/ parisc/ ppc/ s390/
sh/ sparc/ sparc64/
[root@ftosx1 arch]#
Like you can check, The new kernel 2.4.1, now support 13 different platforms !
The Documentation is also available in the directory:
[root@redhead Documentation]#[root@ftosx1
Documentation]# ls -F
00-INDEX
SubmittingDrivers digiepca.txt ide.txt
kernel-parameters.txt mkdev.ida
parport.txt sgi-visws.txt
sysrq.txt
BUG-HUNTING
SubmittingPatches dnotify.txt initrd.txt
kmod.txt
modules.txt
pci.txt
smart-config.txt telephony/
Changes
VGA-softcursor.txt exception.txt ioctl-number.txt
locks.txt
moxa-smartio pcwd-watchdog.txt
smp.tex unicode.txt
CodingStyle
arm/
fb/ isapnp.txt
logo.gif
mtrr.txt
pm.txt
smp.txt usb/
Configure.help binfmt_misc.txt
filesystems/ isdn/
logo.txt
nbd.txt
powerpc/
sound/
video4linux/
DMA-mapping.txt cachetlb.txt
floppy.txt java.txt
m68k/
networking/
ramdisk.txt sparc/
vm/
DocBook/
cciss.txt ftape.txt
joystick-api.txt
magic-number.txt nfsroot.txt
riscom8.txt specialix.txt
watchdog.txt
IO-mapping.txt cdrom/
hayes-esp.txt joystick-parport.txt
mandatory.txt nmi_watchdog.txt
rtc.txt
spinlocks.txt xterm-linux.xpm
IRQ-affinity.txt computone.txt
highuid.txt joystick.txt
mca.txt
oops-tracing.txt s390/
stallion.txt zorro.txt
LVM-HOWTO
cpqarray.txt i2c/
kbuild/
md.txt
paride.txt
scsi-generic.txt svga.txt
README.DAC960
devices.txt i386/
kernel-doc-nano-HOWTO.txt memory.txt
parisc/
scsi.txt
sx.txt
README.moxa
digiboard.txt ia64/
kernel-docs.txt
mkdev.cciss
parport-lowlevel.txt serial-console.txt sysctl/
[root@ftosx1 Documentation]#
where we find the file called "Changes" that includes a summary of all the changes included in the new kernel.
Some of the files in this hierarchy have an old date that represents the creation date or the date when the special feature was added to the kernel.
In fact, in the file "smp.txt" dated Dec 18 (last year), we find information on how to set up Linux in a system with multiple processors. Other files explain new features and their work flow. The file "devices.txt" includes all the supported devices and the major and minor numbers of each one.
An important update in the documentation is the "DocBook". This is a simple set of pre-SGML files that can be generated running the command:
[root@ftosx1 linux]# make sgmldocs
chmod 755 /usr/src/linux-2.4.1/scripts/docgen ...
The kernel is loaded at boot time.
If the kernel label is "linux", then we write in the file "/etc/lilo.conf", so that we will see the message:
Loading linux ....
This message shows us that the kernel file "vmlinuz" has been moved into memory so that it may begin to take control of the system.
The kernel is installed in "/boot" after the installation.
[root@ftosx1 linux]# ls -al /boot
total 8290
drwxr-xr-x 3 root
root 988 Mar
3 17:23 .
drwxr-xr-x 21 root
root 621 Mar
3 17:23 ..
lrwxrwxrwx 1 root
root 16 Mar
3 09:12 System.map -> System.map-2.4.1
-rw-r--r-- 1 root
root 236618 Dec 29 20:47 System.map-2.2.14-5.0
-rw-r--r-- 1 root
root 230505 Jan 23 12:52 System.map-2.2.17
-rw-r--r-- 1 root
root 470624 Jan 23 11:07 System.map-2.4.1
-rw-r--r-- 1 root
root 469769 Jan 23 11:29 System.map-2.4.1-pre8
-rw-r--r-- 1 root
root 6116 Jan 27 22:30
boot-menu.b
-rw-r--r-- 1 root
root 6116 Jan 27 22:18
boot-menu.old
-rw-r--r-- 1 root
root 4364 Jan 27 22:30
boot-text.b
-rw-r--r-- 1 root
root 4364 Jan 27 22:18
boot-text.old
-rw-r--r-- 1 root
root 512 Sep 23 15:18
boot.0300
lrwxrwxrwx 1 root
root 11 Jan
27 22:18 boot.b -> boot-menu.b
-rw-r--r-- 1 root
root 4604 Jan 27 22:17
boot.old
-rw-r--r-- 1 root
root 608 Jan 27 22:30
chain.b
-rw-r--r-- 1 root
root 608 Jan 27 22:18
chain.old
-rw-r--r-- 1 root
root 237 Sep 23 09:21
kernel.h
-rw------- 1 root
root 93696 Mar 3 17:23
map
lrwxrwxrwx 1 root
root 22 Sep
23 15:06 module-info -> module-info-2.2.14-5.0
-rw-r--r-- 1 root
root 11773 Mar 8
2000 module-info-2.2.14-5.0
-rw-r--r-- 1 root
root 640 Jan 27 22:30
os2_d.b
-rw-r--r-- 1 root
root 640 Jan 27 22:18
os2_d.old
-rwxr-xr-x 1 root
root 1650666 Mar 8 2000 vmlinux-2.2.14-5.0
lrwxrwxrwx 1 root
root 14 Jan
23 12:52 vmlinuz -> vmlinuz-2.2.17
-rw-r--r-- 1 root
root 778235 Dec 29 20:47 vmlinuz-2.2.14-5.0
-rw-r--r-- 1 root
root 807509 Jan 23 12:52 vmlinuz-2.2.17
-rw-r--r-- 1 root
root 1041025 Jan 27 16:37 vmlinuz-2.4.1
-rw-r--r-- 1 root
root 1033333 Jan 23 11:29 vmlinuz-2.4.1-pre8
-rw-r--r-- 1 root
root 1041025 Jan 23 11:07 vmlinuz.old
[root@ftosx1 linux]#
If you recompile, the kernel generally is installed in "/".
[root@ftosx1 /]# ls -al /
total 6264
drwxr-xr-x 21 root root
621 Mar 3 17:23 .
drwxr-xr-x 21 root root
621 Mar 3 17:23 ..
drwxr-xr-x 2 root
root 35 Feb
17 2000 .automount
drwx------ 4 root
root 117 Oct 20 13:47
.kde
-rw-r--r-- 1 root
root 461505 Mar 3 17:23 System.map
-rw-r--r-- 1 root
root 460930 Mar 3 16:28 System.old
drwxr-xr-x 2 root
root 2019 Oct 28 15:51
bin
drwxr-xr-x 3 root
root 988 Mar
3 17:23 boot
drwxr-xr-x 8 root
root 50952 Mar 3 19:04
dev
drwxr-xr-x 47 root root
4817 Mar 3 19:07 etc
drwxr-xr-x 13 root root
304 Feb 25 19:22 home
drwxr-xr-x 4 root
root 3124 Nov 22 20:28
lib
drwxr-xr-x 2 root
root
0 Mar 3 17:28 misc
drwxr-xr-x 9 root
root 191 Feb 12 09:32
mnt
-rw-r--r-- 1 root
root 1474560 Jan 24 15:32 new_caldera.img
drwxr-xr-x 7 root
root 153 Jan
5 13:22 opt
dr-xr-xr-x 100 root root
0 Mar 3 17:28 proc
drwxr-x--- 103 root root
12637 Mar 4 08:23 root
drwxr-xr-x 3 root
root 3847 Jan 27 22:30
sbin
drwxr-xr-x 3 root
root 56 Sep
23 15:11 tftpboot
drwx------ 12 root root
615 Mar 4 08:50 tmp
drwxr-xr-x 24 root root
565 Dec 10 13:22 usr
drwxr-xr-x 27 root root
553 Feb 25 19:16 var
-rw-r--r-- 1 root
root 974454 Mar 3 17:23 vmlinuz
-rw-r--r-- 1 root
root 932689 Feb 28 15:19 vmlinuz-2.4.1
-rw-r--r-- 1 root
root 1041809 Jan 23 13:02 vmlinuz-2.4.1-pre8
lrwxrwxrwx 1 root
root
7 Feb 28 15:20 vmlinuz-2.4.2 -> vmlinuz
-rw-r--r-- 1 root
root 972009 Mar 3 16:28 vmlinuz.old
[root@ftosx1 /]#
In this chapter, we will explain the steps to follow in order to build a new Linux kernel.
In fact, the directories that has to do with the processors supported in version 2.4.1 are:alpha/ arm/ i386/ ia64/ m68k/ mips/ mips64/ parisc/ ppc/ s390/ sh/ sparc/ sparc64/
Also, the support for each processor family is more complete. For example, the Intel family processor now displays the compatibility level between Pentium and AMD K6, with the following choices:

This means that the new Intel Pentium 4 and Cruose processors are supported, as well as multi-processors.
Now, we will check the kernel 2.4.1

At first glance, we note:
What is scalability? You can run applications that require a high ammount of memory, the system . The first time you run the application, the system "saves" the application's requeriments. The second time you run this application the system "knows" the applications requeriment and offers the appropriate resource.
For example, the first time you run, StarOffice may takes 20 seconds. The second time ... will take 3 seconds.
Therefore, scalability is the operating system's possibility to adapt to application memory requirements and offers the appropriate resource to each application separately.
A note on the Kernel in RedHat 7.1
The kernel in Red Hat 7.1, is the following dialog:

RedHat Inc, release its 7.0 version including a gcc compiler that is not capable to compile the kernel.