|[Home] [Credit Search] [Category Browser] [Staff Roll Call]||The LINUX.COM Article Archive|
|Originally Published: Monday, 23 October 2000||Author: Matt Michie and Mike Baker|
|Published to: interact_articles_live/Live!||Page: 1/1 - [Printable]|
Remember the Atlanta Linux Showcase? I do, we were there just a couple of weeks ago! While we were hanging out at the OSDN booth, the Linux.com Live! section presented a quick guide to maintaining kernel modules! Mike Baker wrote the presentation, and Matt Michie wrote a fantastic follow-up to the presentation that you can read here. Enjoy!
|Page 1 of 1|
The first question anyone asks when first confronted by the plethora of Linux distributions is, "what are the differences between all of these?" Instead, the first question one should ask is, "how are all of these similar?" The answer is simple; all share the same heart, the kernel. This tutorial will give you an overview of what the kernel does, as well as instructions on compiling and customizing it to suit your desires.
The kernel is a piece of computer code, that when properly configured and compiled runs and manages all of your programs, user input, disks, memory, and other devices. Typically, after it is compiled, it is stored as a binary in either /vmlinuz or /boot/vmlinuz depending on your setup.
The first piece of information you need to know, is how to identify different versions of the Linux Kernel. You'll hear someone say something like, "I'm running the 2.2.16 kernel." Let's dissect this number piece by piece. The first number specifies the the overall version number, which in this case, is two. The second number indicates whether the kernel is a "development" kernel or a "stable" kernel. All dev kernels are "odd" and stable kernels are "even". In our example, two is even, therefore this kernel is stable. The final number indicates the minor version number.
The first step in compiling a kernel is to download the source code. A system of FTP mirrors is setup around the world for this exact purpose. To use the closest mirror substitute your country code (ie .jp, .us, .ca, etc.) for the xx in ftp.xx.kernel.org. For example purposes, we'll use (ftp://ftp.us.kernel.org/pub/linux/kernel/v2.2/).
Instead of downloading a the complete source code (linux-*.tar.bz2) which is now over 14 megabytes compressed, we can instead download a patch. These patches are only the differences between each full kernel version. So instead of downloading the entire source every time, you can download the full version once and patch it thereafter.
As an example, we'll be downloading patch-2.2.17.bz2 from our local kernel mirror (ftp://ftp.us.kernel.org/pub/linux/kernel/v2.2/). this file is 744k compressed and contains changes since 2.2.16. The kernel source is stored in /usr/src/linux, so move the patch there. Next, from that directory run patch like so:
bzip2 -dc patch-2.2.17.bz2 | patch -p1
(bzip2 -dc uncompresses the file and sends it to stdout, patch -p1 will patch the sources. The -p1 option here is the relative path to use, most kernel patches are made from /usr/src since we're in /usr/src/linux we have to skip a directory using -p1. This command is the same as bzip2 -d patch-2.2.17.bz2; patch -p1 < patch-2.2.17)
There are several ways that you can configure the kernel, all of the following commands will work from the /usr/src/linux, pick one.
This is the original method which will ask you *every* question one at a time in order with no way to go back. Only recommended for experts.
This method is slightly friendly, there is menu system driven arranges everything in a simple and compact manner. Recommended if you aren't running X
This is the X11 interface to kernel config, this is a GUI system, and is recommended if you are running X.
There are three options in each configuration: enabled, modular and disabled (represented by "y", "m", "n"). Modules allow you to load support for new hardware as needed and remove it afterwords. There are disadvantages with the delay loading the module and the extra memory taken up by load and unload portions of the module. If you're low on memory you may wish to compile most things as modules and have them only when needed leaving more memory available. Essential components required to boot the system must be compiled into the kernel.bootlogo
To show the customization of Linux can be we'll be doing a few modifications to the frame-buffer to make an (almost) full-screen logo. The hard work for doing this has already been done ahead of time so for now all we'll be doing is downloading the files from the links at:
and running the install script. Instructions are included for creating your own logo.
This is a virtual file-system for retrieving information from the kernel, such as process information. It is also possible to change kernel settings at run-time through /proc/sys.openwall
This is a set of patches to increase the security of a Linux machine, particularly useful if you intend on running the machine as a server on the Internet. These patches provide a new menu in config called "security options" giving the following options:
non-executable stack area
programs use an area of memory known as the stack to store data, careful manipulation of the data can lead to arbitrary commands being executed. This patch will save you from most of them.
restricted access to /proc users will only see their own processes.
Patching the kernel is done in the same fashion the patch-2.2.17.bz2 was done, instructions are included.
Buried in a menu of config called "kernel hacking" this option provides a set of built in hotkeys to be used in cases of emergency when you are unable to login. Combinations of alt-sysrq and another key will enable you to sync the disks, unmount and reboot as well as killing processes.See section below about kernel hotkeys
When enabled the kernel can associate any file with any program, this is to allow file formats such as dos executable to be automatically executed in dosemu. Binfmt is able to associate any file with any program so there's nothing stopping you from associating mp3 files with an mp3 player, although that's typically the job of mailcap to make such associations.
MTRR stands for Memory Type Range Register, on Pentium Pro, AMD K6-2 and later CPUs this options allows you to redefine the way the CPU accesses certain memory segments such as video memory. By setting the MTRR to use write-combining for video memory you can get a speed increase sometimes as much as 2.5x
|Page 1 of 1|