Previous Page | Next Page

  1. Introduction
  2. Abbreviated Boot
  3. The Boot Process
  4. Startup and Run Levels
  5. Initialization Scripts
  6. Runlevel Scripts
  7. Login Process
  8. Bash Shell
  9. Filesystems
  10. LILO, Kernel and Root Filesystem
  11. The Kernel
  12. Passwords, Users, Groups, and Quotas
  13. The Environment
  14. The /etc/sysconfig directory
  15. The /proc filesystem
  16. Process Control
  17. Devices
  18. Daemons Services
  19. Inetd and Network Services
  20. Programs and Libraries
  21. Security and PAM
  22. The printer services
  23. Mouse support with gpm
  24. Mail
  25. News
  26. UUCP
  27. LDAP
  28. NFS and RPC
  29. Samba, NetBIOS, WINS, nmbd
  30. Identd (auth)
  31. Telnet and FTP
  32. Apache web server
  33. DNS and named
  34. How X Works
  35. X Scripts
  36. Support for Text
  37. Keymapping for Programs
  38. Keycode Table
  39. Example Keymap File
  40. Terminfo Commands
  41. VT100 ESC sequences
  42. Kernel Revisited
  43. Configuration Files
  44. Credits

Linux Kernel

The best document I have ever found to explain the Linux kernel in everyday readable language is "The Linux Kernel" by David A Rusling. Another excellent source is "A Tour of the Linux Kernel Source" by Alessandro Rubini. If you want more information, read the Linux kernel source code. This section gives a brief synopsis of some functions performed by the Linux kernel in an effort to help the user use the system through better understanding.

The kernel acts as a mediator for your programs and your hardware. First, it performs memory management for all of the running programs, and manages the time slices of the processor's cycles that they get. It provides a portable interface for programs to talk to your hardware.

The kernels main functions:

Device drivers:Interfacing to hardware through device drivers for character, block and network interface devices
Process Management:Controlling processes and the address space they have access to
Allocating time slices for processes
Inter-process communication including process to network card communication
Memory management: Virtual memory addressing control
Filesystem control and structuring
Networking

When the kernel is loaded, it begins in 8086 real mode. It moves parts of itself to two different addresses. The kernel identifies some of the hardware characteristics of the system. At this point, it may ask the user to choose the video mode they want to run the console at. Then it moves its system area from an address higher up in memory to 1000 hexadecimal. Then it enters protected mode and decompresses itself. It stores the decompressed code and data, begins execution of the decompressed code, sets up the processors register tables for memory management, and sets up memory paging.
The following parts of the kernel are initialized:

  • Memory bounds are set
  • The traps, IRQ channels and scheduling are initialized
  • The command line is parsed
  • The device drivers and disk buffering are initialized
  • The delay loop, called the BogoMips number is calculated
  • Tests the to see if interrupt 16 works with the coprocessor

The kernel begins user mode and forks the init process.
The init process tries to run the first of the following programs it can find:

/sbin/init, /etc/init, bin/init, or /bin/sh.

If the last is run, it forks a root shell on the first terminal.

Kernel Module Support

Most kernels (except those for floppy boot disks or small remote systems) are compiled so modular support is required.
The package modules.tar.gz contains all the programs needed to manage modules. This should already be installed on most distributions. The kernel modules are usually in a directory pertinent to the kernel version in /lib/modules. Modules can be found in "lib/modules/2.2.12-20" for kernel version 2.2.12-20. They are loadable modules ending in ".o" that are used to support the kernel.
To load a module type "insmod module" where "module" is the name of the module to load. Ex: insmod /lib/modules/2.2.12-20/misc/ftape.o

Programs used to manage modules are:

  • insmod - Installs a loadable kernel module into the running kernel.
  • lsmod - Lists all the currently loaded kernel modules
  • rmmod - Unloads modules, Ex: rmmod ftape
  • depmod - Creates a dependency file, "modules.dep" in the directory "/lib/modules/x.x.x", later used by modprobe to automatically load the relevant modules.
  • modprobe - Used to load a module or set of modules. Loads all modules specified in the file "modules.dep".

Modules are loaded from startup script files using "modprobe" to handle loadable modules automatically.

FILES:

  • /etc/conf.modules - A list of alias names for modules used to help determine system required modules. See the man page on depmod.

modprobe -l |moreLists all the modules available for your kernel
rmmod module_nameRemove a module from the kernel

Kernel parameter modification

The "sysctl" program is a tool used to modify kernel parameters, or what is actually variables and data structures. If you type "sysctl -a |more" you will see a long list of kernel parameters. You can use this sysctl program to modify these parameters. However, I have been unable to add new parameters.