14. Kernel
14.1 Types
1. Monolithic
o Drivers compiled into kernel directly.
o Uses more memory because unused drivers take up space.
o Generally slows system down due to memory usage.
o However, communicates with hardware faster.
2. Modular
o Drivers are compiled as modules.
o Uses less memory since only necessary drivers can be loaded.
o More flexible because more drivers can be compiled as modules.
14.2 Modules
1. Overview
o Auto loaded by kmod (a kernel thread).
o Module options specified in /etc/modules.conf
o install module # Specify command to use to install modules (default: insmod)
o remove module # Specify command to use to remove modules (default: rmmod)
o alias eth0 tulip # Creates an alias for the tulip module
o options tulip irq=9 # Pass IRQ that device is using to module
o pre-install tulip # Execute before loading the tulip module
o post-install tulip # Execute after loading the tulip module
o pre-remove tulip # Execute before removing the tulip module
o post-remove tulip # Execute after removing the tulip module
2. Dependencies
depmod -a – Build dependencies for all modules
3. Managing
o Viewing
o lsmod
o cat /proc/modules
o Loading
o modprobe tulip # Load a single module
o modprobe -t net * # Load all modules in “net” category
o modprobe * # Load all modules
o Unloading
o modprobe -r 3c503 # Unload 3c503 module
o rmmod -r 3c503 # Unload 3c503 module and all of it’s dependencies
14.3 Installing From Source
1. Required Packages
o kernel-headers
o kernel-source
o dev86
o make
o glibc-devel
o cpp
o ncurses (For “make menuconfig”)
o ncurses-devel (For “make menuconfig”)
o binutils
o gcc
NOTE: A working X installation is required if you wish to use “make xconfig
2. Installation steps
3. cd /usr/src
4. bzcat linux-2.4.17.tar.bz tar xvf –
5. cd linux
6. make config make menuconfig make xconfig
7. make dep
8. make clean
9. make bzImage
10. make modules (if modular kernel)
11. make modules_install (if modular kernel)
12. cp System.map /boot/System.map-2.4.17
13. cp arch/i386/boot/bzImage /boot/vmlinuz-2.4.17
14. cp .config /boot/config-2.4.17
15. mkinitrd /boot/initrd- # Depending on kernel configuration
16. Update LILO or GRUB
17. Reboot into new kernel
18. new-kernel-pkg
New to RH 7.2 is a script called “new-kernel-pkg”. This script performs several of the necessary kernel installation steps such as building module dependencies, creating an initial ramdisk, and updating the grub configuration.
For example, to install kernel 2.4.18, build modules dependencies, and create an initial ramdisk, execute the following command:
new-kernel-pkg –install –depmod –mkinitrd 2.4.18
NOTE: If you are using lilo, you will have to manually update it’s configuration file.
14.4 Installing from RPM
1. Required Packages
o kernel
o kernel-pcmcia-cs (for laptops)
2. Packages that may need to be upgraded
o mkinitrd
o SysVinit
o initscripts
3. Optional Packages
o kernel-headers
o kernel-source
o kernel-doc
o kernel-debug
4. Install Steps
5. rpm -Uvh mkinitrd-.rpm # If necessary
6. rpm -Uvh SysVinit-.rpm # If necessary
7. rpm -Uvh initscripts-.rpm # If necessary
8. rpm -Uvh kernel-headers-.rpm # Optional
9. rpm -Uvh kernel-source-.rpm # Optional
10. rpm -ivh kernel-.rpm –force
11. rpm -ivh kernel-pcmcia-cs-.rpm –force # For laptops
12. mkinitrd /boot/initrd- # Depending on kernel configuration
13. Update LILO or GRUB
14. Reboot into new kernel
NOTE: It is recommended that you install and not upgrade the kernel and kernel-pcmcia-cs packages. That way if the new kernel doesn’t work, you can boot into a previous kernel that does.
14.5 Adding a module to an already compiled kernel
For those times where you need to add a new driver to a modular kernel, you can just compile the needed module and install it without recompiling the entire kernel. Just follow these steps:
cd /usr/src/linux
make config make menuconfig make xconfig
(Choose the driver as a module)
make dep
make modules
make modules_install
depmod -a
You should now be able to use the new module.

Download the Ensurepass Latest 2013 RHCE EX300 Practise Test PDF to pass RHCE EX300 exam.

Comments are closed.