From d6deb72ed42a0d145f5fc6f825d5b0ae090baafd Mon Sep 17 00:00:00 2001 From: Klaatu Date: Fri, 22 Jun 2012 23:37:52 -0400 Subject: Added and corrected docbook markup. Added content to the very sparse section on slackpkg Added a section about rpm2tgz in the package management section Added some obvious indexterms and xref ids --- chapter_19.xml | 171 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 110 insertions(+), 61 deletions(-) (limited to 'chapter_19.xml') diff --git a/chapter_19.xml b/chapter_19.xml index bc49aed..e819fe5 100644 --- a/chapter_19.xml +++ b/chapter_19.xml @@ -5,7 +5,7 @@ The Linux Kernel -
+
What Does the Kernel Do? @@ -26,9 +26,18 @@ of software on your computer and the most complex.
-
+
Working with Modules + + kernel + modules + + + +modules + + The complexity of a modern linux kernel is staggering. The source code for the kernel weighs in at nearly 400MB uncompressed. There are @@ -49,11 +58,15 @@ It's important to realize that Slackware will automatically handle loading most modules for you. When your system boots, udevd(8) is started and begins to probe your system's hardware. For each device it finds, it loads the proper module -and created a device node in /dev. This usually +and created a device node in /dev. This usually means that you will not need to load any modules in order to use your computer, but occasionally this is necessary. + + lsmod + + So what modules are currently loaded on your computer and how do we load and unload them? Fortunately we have a full suite of tools for @@ -61,7 +74,7 @@ handling this. As you might have guessed, the tool for listing modules is lsmod(8). -darkstar:~# lsmod +darkstar:~# lsmod Module Size Used by nls_utf8 1952 1 cifs 240600 2 @@ -77,6 +90,13 @@ In addition to showing you what modules are loaded, it displays the size of each module and tells you what other modules are using it. + + modprobe + + + insmod + + There are two applications for loading modules: insmod(8) and @@ -87,9 +107,9 @@ preferred because it can load any module dependencies. Using either is straight-forward. -darkstar:~# insmod ext3 -darkstar:~# modprobe ext4 -darkstar:~# lsmod | grep ext +darkstar:~# insmod ext3 +darkstar:~# modprobe ext4 +darkstar:~# lsmod | grep ext ext4 239928 1 jbd2 59088 1 ext4 crc16 1984 1 ext4 @@ -98,6 +118,10 @@ jbd 48520 1 ext3 mbcache 8068 2 ext4,ext3 + + rmmod + + Removing modules can be a tricky process, and once again we have two programs for removing them: rmmod(8) and @@ -105,49 +129,61 @@ programs for removing them: rmmod(8) and modprobe, you'll need to use the -r argument. -darkstar:~# rmmod ext3 -darkstar:~# modprobe -r ext4 -darkstar:~# lsmod | grep ext +darkstar:~# rmmod ext3 +darkstar:~# modprobe -r ext4 +darkstar:~# lsmod | grep ext
-
+
Compiling A Kernel and Why to do So + + kernel + compiling + + Most Slackware users will never need to compile a kernel. The huge and generic kernels contain virtually all the support you will need. + + + However, some users may need to compile a kernel. If your computer contains bleeding edge hardware, a newer kernel may offer improved support. Sometimes a kernel patch my be available that corrects a problem you are experiencing. In these cases a kernel compile is -probably warranted. Users who simply want the latest and greatest +probably warranted. Users who simply want the latest and greatest version or who believe using a custom compiled kernel will give them -greater performance can certainly upgrade, but are unlikely to notice -any major changes. If you still think compiling your own kernel is -something you want or need to do, this section should walk you through -the many steps. +greater performance can certainly upgrade, but are unlikely to +actually notice any major changes. + + + +If you still think compiling your own kernel is something you want or +need to do, this section should walk you through the many steps. Compiling and installing a kernel is not that difficult, but there are a number of mistakes that can be made along the way, many of which can prevent your computer from booting and cause major frustration. -The first step is ensuring you have the kernel source code installed on -your system. The kernel source package is included in the "k" disk set -in the Slackware installer, or you can download another version from -http://www.kernel.org/. +The first step is ensuring you have the kernel source code installed +on your system. The kernel source package is included in the +"k" disk set in the Slackware installer, or you can download +another version from http://www.kernel.org/. Traditionally, the kernel source is located in -/usr/src/linux, a symbolic link that points to the -specific kernel release used, but this is by no means set in stone. You -can place the kernel source code virtually anywhere without -encountering any problems. +/usr/src/linux, a symbolic link that +points to the specific kernel release used, but this is by no means +set in stone. You can place the kernel source code virtually anywhere +without encountering any problems. -darkstar:~# ls -l /usr/src -lrwxrwxrwx 1 root root 14 2009-07-22 19:59 linux -> linux-2.6.29.6/ -drwxr-xr-x 23 root root 4096 2010-03-17 19:00 linux-2.6.29.6/ +darkstar:~# ls -l /usr/src +lrwxrwxrwx 1 root root 14 2009-07-22 19:59 linux -> linux-2.6.29.6/ +drwxr-xr-x 23 root root 4096 2010-03-17 19:00 linux-2.6.29.6/ @@ -170,14 +206,14 @@ compile the kernel again and again until you get it right. The best kernel .config files to start with are those used by Slackware's default kernels. You can find them on your Slackware install disks or at your favorite mirror in the -kernels/ directory. +kernels/ directory. -darkstar:~# mount /mnt/cdrom -darkstar:~# cd /mnt/cdrom/kernels -darkstar:/mnt/cdrom/kernels# ls -VERSIONS.TXT huge.s/ generic.s/ speakup.s/ -darkstar:/mnt/cdrom/kernels# ls genric.s +darkstar:~# mount /mnt/cdrom +darkstar:~# cd /mnt/cdrom/kernels +darkstar:/mnt/cdrom/kernels# ls +VERSIONS.TXT huge.s/ generic.s/ speakup.s/ +darkstar:/mnt/cdrom/kernels# ls genric.s System.map.gz bzImage config @@ -191,26 +227,29 @@ and thus creates a smaller kernel image, but it usually requires the use of an initrd. -darkstar:/mnt/cdrom/kernels# cp generic.s/config /usr/src/linux/.config +darkstar:/mnt/cdrom/kernels# cp generic.s/config /usr/src/linux/.config - -The Slackware kernel file lacks the "dot" while the kernel -file includes it. If you forget, or simply copy the -config to /usr/src whatever -.config file was already present will be used -instead. - + + + The Slackware kernel file lacks the "dot" while the kernel file + includes it. If you forget, or simply copy the + config to + /usr/src whatever + .config file was already present will be used + instead. + + If you want to use the configuration for the currently running kernel as your base, you may be able to locate it at -/proc/config.gz. This is a special kernel-related +/proc/config.gz. This is a special kernel-related file that includes the entire kernel configuration in a compressed format and requires that your kernel was built to support it. -darkstar:~# zcat /proc/config.gz > /usr/src/linux/.config +darkstar:~# zcat /proc/config.gz > /usr/src/linux/.config @@ -230,14 +269,14 @@ options. Since options are added at virtually every kernel release, this is generally a good thing to do. -darkstar:/usr/src/linux# make oldconfig -scripts/kconfig/conf -o arch/x86/Kconfig -* -* Restart config... -* -* -* File systems -* +darkstar:/usr/src/linux# make oldconfig +scripts/kconfig/conf -o arch/x86/Kconfig +* +* Restart config... +* +* +* File systems +* Second extended fs support (EXT2_FS) [M/n/y/?] m Ext2 extended attributes (EXT2_FS_XATTR) [N/y/?] n Ext2 execute in place support (EXT2_FS_XIP) [N/y/?] n @@ -281,6 +320,11 @@ Automatically append version information to the version string (LOCALVERSION_AUT Support for paging of anonymous memory (swap) (SWAP) [Y/n/?] + + kernel + menuconfig + + Fortunately, there are two much easier ways to configure your kernel, menuconfig and xconfig. Both of these create a @@ -302,13 +346,16 @@ the arrow keys. - -If you are compiling a kernel that is the same release as the stock -Slackware kernel, you must set the "Local version" option. This is -found on the "General setup" submenu. Failure to set this will result -in your kernel compile over-writing all the modules used by the stock -kernels. This can quickly render your system unbootable. - + + + If you are compiling a kernel that is the same release as the + stock Slackware kernel, you must set the "Local version" + option. This is found on the "General setup" submenu. Failure to + set this will result in your kernel compile over-writing all the + modules used by the stock kernels. This can quickly render your + system unbootable. + + Once you've finished configuring the kernel, it's time to begin @@ -339,7 +386,8 @@ configuration first. Compile errors are usually caused by a fault we're still not entirely finished, as we need to build the modules. -darkstar:/usr/src/linux# make modules + +darkstar:/usr/src/linux# make modules CHK include/linux/version.h CHK include/linux/utsrelease.h SYMLINK include/asm -> include/asm-x86 @@ -358,8 +406,9 @@ images located there. Traditionaly kernel images are named appended. -darkstar:/usr/src/linux# cat arch/x86/boot/bzImage > /boot/vmlinuz-release_number-local_version -darkstar:/usr/src/linux# make modules_install + + darkstar:/usr/src/linux# cat arch/x86/boot/bzImage > /boot/vmlinuz-release_number-local_version + darkstar:/usr/src/linux# make modules_install -- cgit v1.2.3