Here are some interesting facts about running Linux kernel. Following information is quite useful if you are planning to compile your own custom kernel
But where is my kernel stored?
Your compiled kernel is always installed in /boot directory:
Here is listing of all installed kernel in my system (filename -> description)
$ ls -l /boot/
- config-2.6.12-1-386 --> Kernel configuration file generated by make menuconfig/make xconfig/make gconfig
- System.map-2.6.12-1-386 --> This file has a map of positions of symbols in the kernel. Device driver such as USB pen uses hot plug, which depend upon symbols generated by depmod utility
- vmlinuz-2.6.12-1-386 -- > Actual Kernel file
- initrd.img-2.6.12-1-386 --> Contains device drivers which are required to boot and load rest of operating system from disk. Usually SCSI and IDE drivers are stored in this file
- grub --> It is a directory, which stores grub Boot loader configuration file
- config --> Soft link to current kernel configuration file
- vmlinuz -> Soft link to current running kernel file
- System.map --> Soft link to current running kernel system map file
But what is 2.6.12 ... yup you are right it is kernel version
How do I find out version of running Linux kernel?
Use any one of the following command:
uname -r
OR
cat /proc/version
How do I find out where running kernel modules (device drivers) are stored?
Use any one of the following command:
ls /lib/modules/$(uname -r)
ls -d /lib/modules/$(uname -r)
How do I load kernel modules at boot time?
/etc/modules file should contain the names of kernel modules that are
to be loaded at boot time, one per line.
$ cat /etc/modules
How do I install latest binary kernel?
Find out if latest version available or not via following command
apt-cache search kernel-image| grep VERSION
An example to see if 2.6.xx.xx series new kernel available or not (Debian Linux):
apt-cache search kernel-image| grep 2.6
Compare version with existing running kernel if it is greater than running kernel, run following command to install new kernel (run it as a root user and assuming that 2.6.12.1 is latest the kernel available):
apt-get install linux-image-2.6.12-1-386
Difference between monolithic and Modular kernel:
Monolithic kernel
- Single binary file [ directory ls -d /lib/modules/$(uname -r) does NOT exists ]
- All drivers included in kernel itself
Modular kernel
- Multiple files for kernel
- Drivers can be loaded or unloaded into kernel using modprob command, see man page of
lsmod, modprob etc [directory ls -d /lib/modules/$(uname -r) exists to store drivers] - Almost all drivers are build and linked against kernel
How Do I build modular kernel?
You can built modular kernel by setting option in kernel configuration option:
Enable loadable module support (CONFIG_MODULES) [Y/n/?]
If you set above option to Y then kernel becomes modular and three possibilities occurs for each and every feature/driver:
m - you can compile driver as module
y - built into kernel itself
n - Don't include feature/driver
Type command make menuconfig
make menuconfig
1) Select Loadable module support and press enter/return key:

Loadable module support
2) Select Enable Loadable module support option and other options, see following figure:

Enable Loadable module support
For more information
* Compiling Linux kernel 2.6
* Text books :
|
This book covers Memory management including file buffering, process swapping, and Direct memory Access (DMA), The Virtual Filesystem and the Second Extended Filesystem, Process creation and scheduling, Signals, interrupts, and the essential interfaces to device drivers, Timing, Interprocess Communication (IPC), Program execution etc. A must read to master kernel concepts |
If you wants starting hacking kernel then this perfect book for you. This book can be also use with your CS (college course) to get more indepth information on operating systems - it helps gain a better idea of kernel conepts. Try following book: |
{ 1 trackback }
{ 2 comments… read them below or add one }
Thanks for the information
Thanks for the info…