The Linux Kernel HOWTO
The Linux Kernel HOWTO
Table of Contents
The Linux Kernel HOWTO...............................................................................................................................1 Brian Ward [email protected] , Al Dev (Alavoor Vasudevan) alavoor[AT]yahoo.com ...............1 1. Introduction .........................................................................................................................................1 2. Quick Steps Kernel Compile............................................................................................................1 3. Important questions and their answers ................................................................................................1 4. How to actually configure the kernel ..................................................................................................1 5. Compiling the kernel ..........................................................................................................................1 6. Patching the kernel..............................................................................................................................2 7. Additional packages.............................................................................................................................2 8. Some pitfalls .......................................................................................................................................2 9. Note for upgrade to version 2.0.x, 2.2.x..............................................................................................2 10. Modules.............................................................................................................................................2 11. Tips and tricks ...................................................................................................................................2 12. Other relevant HOWTOs that might be useful..................................................................................3 13. Misc...................................................................................................................................................3 14. Other Formats of this Document.......................................................................................................3 . 1. Introduction .........................................................................................................................................3 1.1 Read this first! (I mean it)..................................................................................................................3 1.2 A word on style..................................................................................................................................4 2. Quick Steps Kernel Compile............................................................................................................4 2.1 Precautionary Preparations...............................................................................................................4 2.2 Building Kernel................................................................................................................................4 2.3 Troublshoot Common Mistakes .........................................................................................................7 The System Hangs at LILO........................................................................................................7 No init found...............................................................................................................................8 The 'depmod' gives "Unresolved symbol error messages".........................................................8 Kernel Does Not Load Module "Unresolved symbols" Error Messages................................9 Kernel fails to load a module .....................................................................................................9 Loadable modules.......................................................................................................................9 2.4 Post Kernel Building ......................................................................................................................10 2.5 Sample lilo.conf .............................................................................................................................11 3. Important questions and their answers ..............................................................................................12 3.1 What does the kernel do, anyway? .................................................................................................12 3.2 Why would I want to upgrade my kernel? ......................................................................................12 3.3 What kind of hardware do the newer kernels support?...................................................................12 3.4 What version of gcc and libc do I need? .........................................................................................12 3.5 What's a loadable module? .............................................................................................................12 3.6 How much disk space do I need? ....................................................................................................12 3.7 How long does it take?....................................................................................................................13 4. How to actually configure the kernel ................................................................................................13 4.1 Getting the source ...........................................................................................................................13 4.2 Unpacking the source......................................................................................................................13 4.3 Configuring the kernel ....................................................................................................................13 Kernel math emulation (Processor type and features)..............................................................14 Enhanced (MFM/RLL) disk and IDE disk/cdrom support (Block Devices)............................14 Networking support (General Setup)........................................................................................14 System V IPC (General Setup).................................................................................................15 Processor family (Processor type and features)........................................................................15 i
Table of Contents
SCSI support.............................................................................................................................15 Network device support............................................................................................................15 Filesystems ................................................................................................................................15 But I don't know which filesystems I need! ..............................................................................16 Character devices .....................................................................................................................16 Sound........................................................................................................................................16 Other configuration options......................................................................................................16 Kernel hacking .........................................................................................................................17 4.4 Now what? (The Makefile) .............................................................................................................17 5. Compiling the kernel ........................................................................................................................17 5.1 Cleaning and depending..................................................................................................................17 5.2 Compile time ...................................................................................................................................17 5.3 Other ``make''ables .........................................................................................................................18 5.4 Installing the kernel.........................................................................................................................18 6. Patching the kernel............................................................................................................................19 6.1 Applying a patch .............................................................................................................................19 6.2 If something goes wrong.................................................................................................................19 6.3 Getting rid of the .orig files.............................................................................................................20 6.4 Other patches ..................................................................................................................................20 7. Additional packages...........................................................................................................................20 7.1 kbd...................................................................................................................................................21 7.2 utillinux ..........................................................................................................................................21 7.3 hdparm.............................................................................................................................................21 7.4 gpm..................................................................................................................................................21 8. Some pitfalls .....................................................................................................................................21 8.1 make clean ......................................................................................................................................21 8.2 Huge or slow kernels ......................................................................................................................21 8.3 The parallel port doesn't work/my printer doesn't work..................................................................22 8.4 Kernel doesn't compile....................................................................................................................22 8.5 New version of the kernel doesn't seem to boot..............................................................................22 8.6 You forgot to run LILO, or system doesn't boot at all ....................................................................22 . 8.7 It says `warning: bdflush not running' ............................................................................................23 8.8 I can't get my IDE/ATAPI CDROM drive to work.......................................................................23 8.9 It says weird things about obsolete routing requests ......................................................................24 8.10 Firewalling not working in 1.2.0...................................................................................................24 8.11 ``Not a compressed kernel Image file''..........................................................................................24 8.12 Problems with console terminal after upgrade to 1.3.x.................................................................24 8.13 Can't seem to compile things after kernel upgrade........................................................................24 8.14 Increasing limits.............................................................................................................................25 9. Note for upgrade to version 2.0.x, 2.2.x............................................................................................25 10. Modules...........................................................................................................................................25 10.1 Installing the module utilities........................................................................................................25 10.2 Modules distributed with the kernel..............................................................................................26 11. Tips and tricks .................................................................................................................................26 11.1 Redirecting output of the make or patch commands ....................................................................26 11.2 Conditional kernel install ..............................................................................................................26 11.3 Kernel updates ..............................................................................................................................27 12. Other relevant HOWTOs that might be useful................................................................................27 ii
Table of Contents
13. Misc.................................................................................................................................................27 13.1 Author ...........................................................................................................................................27 13.2 To do..............................................................................................................................................28 13.3 Contributions ................................................................................................................................28 13.4 Copyright notice, License, and all that stuff..................................................................................29 14. Other Formats of this Document.....................................................................................................29 . 14.1 Acrobat PDF format.....................................................................................................................30 14.2 Convert Linuxdoc to Docbook format .........................................................................................31 14.3 Convert to MS WinHelp format ..................................................................................................31 14.4 Reading various formats ..............................................................................................................31
iii
This is a detailed guide to kernel configuration, compilation, upgrades, and troubleshooting for ix86based systems.
1. Introduction
1.1 Read this first! (I mean it) 1.2 A word on style
The Linux Kernel HOWTO 5.3 Other ``make''ables 5.4 Installing the kernel
7. Additional packages
7.1 kbd 7.2 utillinux 7.3 hdparm 7.4 gpm
8. Some pitfalls
8.1 make clean 8.2 Huge or slow kernels 8.3 The parallel port doesn't work/my printer doesn't work 8.4 Kernel doesn't compile 8.5 New version of the kernel doesn't seem to boot 8.6 You forgot to run LILO, or system doesn't boot at all 8.7 It says `warning: bdflush not running' 8.8 I can't get my IDE/ATAPI CDROM drive to work 8.9 It says weird things about obsolete routing requests 8.10 Firewalling not working in 1.2.0 8.11 ``Not a compressed kernel Image file'' 8.12 Problems with console terminal after upgrade to 1.3.x 8.13 Can't seem to compile things after kernel upgrade 8.14 Increasing limits
1. Introduction
Should you read this document? Well, see if you've got any of the following symptoms: ``Arg! This wizzo46.5.6 package says it needs kernel release 2.8.193 and I still only have release 1.0.9!'' There's a device driver in one of the newer kernels that you just gotta have You really have no idea at all how to compile a kernel ``Is this stuff in the README really the whole story?'' You came, you tried, it didn't work You need something to give to people who insist on asking you to install their kernels for them
(The bin86*.rpm and 'as86' is required only for OLDER Linux systems like redhat 5.x. Get Intel assembler 'as86' command from dev86*.rpm on cdrom or from bin86mandrake , bin86kondara ). 3. Start Xwindows with 'startx'. If you are not able to start Xwindow then see next step below.
bash# bash# bash# bash# man startx startx cd /usr/src/linux make xconfig
The "make xconfig" or "make menuconfig" brings up a user friendly GUI interface. And "make config" brings up commandline console mode interface. You can load the configuration file from /usr/src/linux/.config (dot config file. Note the dot before config). 5. Within 'make xconfig' you must do these to avoid problems Select proper CPU type Pentium 3, AMD K6, Cyrix, Pentium 4, Intel 386, DEC Alpha, PowerPC otherwise kernel will not boot!! Select SMP support whether single CPU or multiple CPUs Filesystems Select Windows95 Vfat, MSDOS, NTFS as part of kernel and not as loadable modules. (My personal preference but you are free to pick your own option). Enable the Loadable kernel modules support! With this option you can load/unload the device drivers dynamically on running linux system on the fly. See these man pages
bash# rpm i /mnt/cdrom/Redhat/RPMS/modutils*.rpm
6. Save and Exit "make xconfig". All the options which you selected is now saved into configuration file at /usr/src/linux/.config (dot config file). And now, do
bash# make dep bash# make clean
7. Read the following file (to gain some knowledge about kernel building. Tip: Use the color editor gvim for better readability.
bash# gvim R /usr/src/linux/arch/i386/config.in bash# man less bash# less /usr/src/linux/arch/i386/config.in Type 'h' for help and to navigate press i, j, k, l, h or arrow, page up/down keys.
9. After bzImage is successful, copy the kernel image to /boot directory. You must copy the new kernel image to /boot directory, otherwise the new kernel MAY NOT boot. And then read the manual page on lilo (see also http://www.linuxdoc.org/HOWTO/LILOcrashrescueHOWTO.html) and see the sample lilo.conf file. Always give a date extension to the filename, because it tells you when you built the kernel, as shown below:
bash# cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage.myker.26mar2001 bash# man lilo bash# man lilo.conf And edit /etc/lilo.conf file and put these lines image=/boot/bzImage.myker.26mar2001 label=myker root=/dev/hda1 readonly You can check device name for 'root=' with the command bash# df /
You must rerun lilo even if the entry 'myker' exists, everytime you create a new bzImage. 11. Reboot the machine and at lilo press tab key and type 'myker' If it boots then you did a good job! Otherwise at lilo select your old kernel, boot and retry all over again. Your old kernel is still INTACT and SAFE at say /boot/vmlinuz2.0.340.6 12. If your new kernel 'myker' boots and works properly, you can create the boot disk. Insert a blank floppy into floppy drive and
bash# cd /usr/src/linux bash# make bzdisk See also mkbootdisk bash# rpm i mkbootdisk*.rpm bash# man mkbootdisk
13. LOADABLE MODULES: This step is required ONLY if you had enabled Loadable module support in step 3 above. Loadable module are located in /lib/modules. You MUST do this step if you enabled or disabled any modules, otherwise you will get 'unresolved symbols' errors during or after kernel boot. Check for insmod command which is extensively used for loading the modules.
bash# cd /usr/src/linux bash# make modules bash# make modules_install
This will copy the modules to /lib/modules directory. For example to load the module /lib/modules/2.4.22/kernel/drivers/block/loop.o, you would do :
The Linux Kernel HOWTO Solution: Power on the machine and press DEL key to do setup of the BIOS (Basic Input Output system). Select the IDE settings and set proper primary hard disk partition and slave drives. When the system boots it looks for the primary IDE hard disk and the Master Boot Record partition. It reads the MBR and starts loading the Linux Kernel from the hard disk partition.
No init found
The following mistake is commited very frequently by new users. If your new kernel does not boot and you get
Warning: unable to open an initial console Kernel panic: no init found. Try passing init= option to kernel
The problem is that you did not set the "root=" parameter properly in the /etc/lilo.conf. In my case, I used root=/dev/hda1 which is having the root partition "/". You must properly point the root device in your lilo.conf, it can be like /dev/hdb2 or /dev/hda7. The kernel looks for the init command which is located in /sbin/init. And /sbin directory lives on the root partition. For details see
bash$ su root bash# man depmod bash# depmod depmod: *** Unresolved depmod: *** Unresolved depmod: *** Unresolved depmod: *** Unresolved depmod: *** Unresolved
in in in in in
Reason: You did not make modules and install the modules after building the new kernel with "make bzImage". Solution: After you build the new kernel, you must do:
No init found
cd /usr/src/linux make dep make clean nohup make bzImage & tail f nohup.out make modules make modules_install
Loadable modules
You can install default loadable modules with The step given below may not be required but is needed ONLY FOR EMERGENCIES where your /lib/modules files are damaged. If you already have the /lib/modules directory and in case you want replace them use the force to replace the package and select appropriate cpu architecture. For new versions of linux redhat linux 6.0 and later, the kernel modules are included with kernel2.2*.rpm. Install the loadable modules and the kernel with
This will list the already installed package. bash# rpm qa | grep i kernel bash# rpm U force (or) bash# rpm U force (or) bash# rpm U force /mnt/cdrom/Redhat/RPMS/kernel2.2.145.0.i686.rpm /mnt/cdrom/Redhat/RPMS/kernel2.2.145.0.i586.rpm /mnt/cdrom/Redhat/RPMS/kernel2.2.145.0.i386.rpm
This is only for old versions of redhat linux 5.2 and before. Boot new kernel and install the loadable modules from RedHat Linux "contrib" cdrom
If your card is not detected automatically, then you can use the expert option and select the "Unlisted card". If your monitor is not listed then select the generic monitor type SVGA 1024x768. Sound card configuration: Connect your external speakers to the sound card's audio port. Connect your CDROM audio wire to sound card's audio 4pin socket. (Otherwise your cdrom drive will not play the music from your music cd) Refer to HOWTO docs on 'Sound' at http://www.linuxdoc.org
bash$ su root bash# man sndconfig bash# /usr/sbin/sndconfig
Then start Xwindow 'KDE desktop' with 'startx' command. Click on 'K Start>ControlCenter>SoundServer>General>Test Sound'. This should play the test sound. Then click on 'K Start>MultiMedia>SoundMixer>SoundVolumeSlider' and adjust the sound volume. Network card configuration: Use /sbin/linuxconf Or use KDE control panel Refer to HOWTO docs on 'Networking' at http://www.linuxdoc.org 2.4 Post Kernel Building 10
The Linux Kernel HOWTO Configure Firewall and IP Masquerading : For Linux kernel version 2.4 and above, the firewall and IP Masquerading is implemented by NetFilter package. Hence in kernel config you should enable Netfilter and run the Firewall/IPMasq script. Download the scripts from FirewallIPMasq scripts , main page of Netfilter is at http://netfilter.samba.org. Related materials at firewallingmatures and NetfilterFAQ. For kernel version below 2.4 you should install the firewall rpms from rpmfind.net or firewall.src.rpm. Configuration of other devices: Refer to HOWTO docs relating to your devices at http://www.linuxdoc.org
boot=/dev/hda map=/boot/map install=/boot/boot.b prompt timeout=50 default=firewall image=/boot/vmlinuz2.2.145.0 label=ker2214 readonly root=/dev/hda9 image=/boot/vmlinuz2.2.1714 label=ker2217 readonly root=/dev/hda9 #image=/usr/src/linux/arch/i386/boot/bzImage # label=myker # root=/dev/hda7 # readonly image=/boot/bzImage.myker.11feb2001 label=myker11feb root=/dev/hda9 readonly image=/boot/bzImage.myker.01jan2001 label=myker01jan root=/dev/hda9 readonly image=/boot/bzImage.mykerfirewall.16mar2001 label=firewall root=/dev/hda9 readonly
11
3. Important questions and their answers 3.1 What does the kernel do, anyway?
The Unix kernel acts as a mediator for your programs and your hardware. First, it does (or arranges for) the memory management for all of the running programs (processes), and makes sure that they all get a fair (or unfair, if you please) share of the processor's cycles. In addition, it provides a nice, fairly portable interface for programs to talk to your hardware. There is certainly more to the kernel's operation than this, but these basic functions are the most important to know.
12
The Linux Kernel HOWTO The command `make config' while in /usr/src/linux starts a configure script which asks you many questions. It requires bash, so verify that bash is /bin/bash, /bin/sh, or $BASH. However, there are some much more pleasant alternatives to `make config' and you may very well find them easier and more comfortable to use. `make menuconfig' is probably the most widelyused. Whatever you choose, it's best to get familiar with the interface because you may find yourself back at it sooner than you think. For those ``running X,'' you can try `make xconfig' if you have Tk installed (`clickorama' Nat). `make menuconfig' is for those who have (n)curses and would prefer a textbased menu. These interfaces have a rather clear advantage: If you goof up and make a wrong choice during configuration, it is simple to go back and fix it. The configuration options will appear in hierarchies with `make menuconfig' and `make xconfig'. You are ready to answer the questions, usually with `y' (yes) or `n' (no). Device drivers typically have an `m' option. This means ``module,'' meaning that the system will compile it, but not directly into the kernel, but as a loadable module. A more comical way to describe it is as ``maybe.'' Some of the more obvious and noncritical options are not described here; see the section ``Other configuration options'' for short descriptions of a few others. With `make menuconfig', the space bar toggles the selection. In 2.0.x and later, there is a `?' option, which provides a brief description of the configuration parameter. That information is likely to be the most uptodate. Here are a listing of some of the important features, which hierarchy they are in, and brief description.
14
SCSI support
If you have SCSI devices, say `y'. You will be prompted for further information, such as support for CDROM, disks, and what kind of SCSI adapter you have. See the SCSIHOWTO for greater detail.
Filesystems
The configure script then asks if you wish to support the following filesystems: Standard (minix) Newer distributions don't create minix filesystems, and many people don't use it, but it may still be a good idea to configure this one. Some ``rescue disk'' programs use it, and still more floppies may have a minix filesystem, since the minix filesystem is less painful to use on a floppy. Second extended This is the standard Linux filesystem. You almost definitely have one of these, and need to say `y'. msdos If you want to use your MSDOS hard disk partitions, or mount MSDOS formatted floppy disks, say `y'. There are various other foreign operating system filesystem types available. /proc (idea from Bell Labs, I guess). One doesn't make a proc filesystem on a disk; this is a filesystem interface to the kernel and processes. Many process listers (such as `ps') use it. Try `cat /proc/meminfo' or `cat /proc/devices' sometime. Some shells (rc, in particular) use /proc/self/fd (known as /dev/fd on other systems) for I/O. You should almost certainly say `y' to this; many important linux tools depend on it. NFS If your machine lives on a network and you want to use filesystems which reside on other systems System V IPC (General Setup) 15
The Linux Kernel HOWTO with NFS, say `y'. ISO9660 Found on most CDROMs. If you have a CDROM drive and you wish to use it under Linux, say `y'.
Look at each line; the word next to `type' is the filesystem type. In this example, my / and /usr filesystems are second extended, I'm using /proc, and there's a floppy disk mounted using the msdos (bleah) filesystem. You can try `cat /proc/filesystems' if you have /proc currently enabled; it will list your current kernel's filesystems. The configuration of rarelyused, noncritical filesystems can cause kernel bloat; see the section on modules for a way to avoid this and the ``Pitfalls'' section on why a bloated kernel is undesirable.
Character devices
Here, you enable the drivers for your printer (parallel printer, that is), busmouse, PS/2 mouse (many notebooks use the PS/2 mouse protocol for their builtin trackballs), some tape drives, and other such ``character'' devices. Say `y' when appropriate. Note: gpm is a program which allows the use of the mouse outside of the X window system for cut and paste between virtual consoles. It's fairly nice if you have a serial mouse, because it coexists well with X, but you need to do special tricks for others.
Sound
If you feel a great desire to hear biff bark, say `y', and you can tell the configuration program all about your sound board. (A note on sound card configuration: when it asks you if you want to install the full version of the driver, you can say `n' and save some kernel memory by picking only the features which you deem necessary.) If you are serious about sound card support, have a look at both the free drivers at http://www.linux.org.uk/OSS/ and the commercial Open Sound System at http://www.opensound.com/.
The Linux Kernel HOWTO started and maintained by Axel Boldt ([email protected]) and it's the online help. It's also available as one big file at the Documentation/Configure.help in your Linux kernel source tree as of version 2.0.
Kernel hacking
>From Linus' README: the ``kernel hacking'' configuration details usually result in a bigger or slower kernel (or both), and can even make the kernel less stable by configuring some routines to actively try to break bad code to find kernel problems (kmalloc()). Thus you should probably answer `n' to the questions for a ``production'' kernel.
The Linux Kernel HOWTO build a bzImage because the older methods can't handle a kernel that's just too large.
The `image =' is set to the currently installed kernel. Most people use /vmlinuz. `label' is used by lilo to determine which kernel or operating system to boot, and `root' is the / of that particular operating system. Make a backup copy of your old kernel and copy the bzImage which you just made into place (you would say `cp bzImage /vmlinuz' if you use `/vmlinuz'). Then, rerun lilo on newer systems, you can just run `lilo', but on older stuff, you might have to do an /etc/lilo/install or even an /etc/lilo/lilo C /etc/lilo/config. If you would like to know more about LILO's configuration, or you don't have LILO, get the newest version from your favorite ftp site and follow the instructions. To boot one of your old kernels off the hard disk (another way to save yourself in case you screw up the new kernel), copy the lines below (and including) `image = xxx' in the LILO config file to the bottom of the file, and change the `image = xxx' to `image = yyy', where `yyy' is the full pathname of the file you saved your backup kernel to. Then, change the `label = zzz' to `label = linuxbackup' and rerun lilo. You may need to put a line in the config file saying `delay=x', where x is an amount in tenths of a second, which tells LILO to wait that much time before booting, so that you can interrupt it (with the shift key, for example), and type in the label of the backup boot image (in case unpleasant things happen).
18
prints all files who live in the current directory or any subdirectories with a .rej extension to the standard output. If everything went right, do a `make clean', `config', and `dep' as described in sections 3 and 4. There are quite a few options to the patch command. As mentioned above, patch s will suppress all messages except the errors. If you keep your kernel source in some other place than /usr/src/linux, patch p1 (in that directory) will patch things cleanly. Other patch options are welldocumented in the manual page.
and if it reports that it succeeded (no fails), then you can continue on with a configuration and compilation. The config.in.rej file will remain, but you can get delete it.
19
The Linux Kernel HOWTO If you encounter further problems, you might have installed a patch out of order. If patch says `previously applied patch detected: Assume R?', you are probably trying to apply a patch which is below your current version number; if you answer `y', it will attempt to degrade your source, and will most likely fail; thus, you will need to get a whole new source tree (which might not have been such a bad idea in the first place). To back out (unapply) a patch, use `patch R' on the original patch. The best thing to do when patches really turn out wrong is to start over again with a clean, outofthebox source tree (for example, from one of the linuxx.y.z.tar.gz files), and start again.
will take care of it for you. Versions of patch which use # for rejects use a tilde instead of .orig. There are better ways to get rid of the .orig files, which depend on GNU xargs:
find . name '*.orig' | xargs rm
7. Additional packages
Your linux kernel has many features which are not explained in the kernel source itself; these features are typically utilized through external packages. Some of the most common are listed here.
20
7.1 kbd
The linux console probably has more features than it deserves. Among these are the ability to switch fonts, remap your keyboard, switch video modes (in newer kernels), etc. The kbd package has programs which allow the user to do all of this, plus many fonts and keyboard maps for almost any keyboard, and is available from the same sites that carry the kernel source.
7.2 utillinux
Rik Faith ([email protected]) put together a large collection of linux utilities which are, by odd coincidence, called utillinux. These are now maintained by Andries Brouwer ([email protected]). Available via anonymous ftp from sunsite.unc.edu in /pub/Linux/system/misc, it contains programs such as setterm, rdev, and ctrlaltdel, which are relevant to the kernel. As Rik says, do not install without thinking; you do not need to install everything in the package, and it could very well cause serious problems if you do.
7.3 hdparm
As with many packages, this was once a kernel patch and support programs. The patches made it into the official kernel, and the programs to optimize and play with your hard disk are distributed separately.
7.4 gpm
gpm stands for general purpose mouse. This program allows you to cut and paste text between virtual consoles and do other things with a large variety of mouse types.
If mkdir tells you that the directory already exists, just ignore it. Now, cd to the place where the working kernel image was. Note that
/mnt + /usr/src/linux/arch/i386/boot /usr = /mnt/src/linux/arch/i386/boot
Place a formatted disk in drive ``A:'' (not your boot or root disk!), dump the image to the disk, and configure it for your root filesystem:
cd /mnt/src/linux/arch/i386/boot dd if=bzImage of=/dev/fd0 rdev /dev/fd0 /dev/hda1
You should now be able to reboot your system as normal from this floppy. Don't forget to run lilo (or whatever it was that you did wrong) after the reboot! As mentioned above, there is another common alternative. If you happened to have a working kernel image in / (/vmlinuz for example), you can use that for a boot disk. Supposing all of the above conditions, and that my kernel image is /vmlinuz, just make these alterations to the example above: change /dev/hda3 to /dev/hda1 (the / filesystem), /mnt/src/linux to /mnt, and if=bzImage to if=vmlinuz. The note explaining how to derive /mnt/src/linux may be ignored. Using LILO with big drives (more than 1024 cylinders) can cause problems. See the LILO miniHOWTO or documentation for help on that.
The Linux Kernel HOWTO soundblaster interface a third IDE port (IRQ11, or so I'm told). This causes problems with linux in that versions 1.2.x don't support a third IDE interface (there is support in starting somewhere in the 1.3.x series but that's development, remember, and it doesn't autoprobe). To get around this, you have a few choices. If you have a second IDE port already, chances are that you are not using it or it doesn't already have two devices on it. Take the ATAPI drive off the sound card and put it on the second interface. You can then disable the sound card's interface, which saves an IRQ anyway. If you don't have a second interface, jumper the sound card's interface (not the sound card's sound part) as IRQ15, the second interface. It should work.
Normally, there is a link called linux in /usr/include to the include/linux directory of your kernel source (/usr/src/linux/include/linux in the typical system). If this link is not there, or points to the wrong place, most things will not compile at all. If you decided that the kernel source was taking too much room on the disk and deleted it, this will obviously be a problem. Another way it might go wrong is with file permissions; if your root has a umask which doesn't allow other users to see its files by default, and you extracted the kernel source without the p (preserve filemodes) option, those users also won't be able to use the C compiler. Although you could use the chmod command to fix this, it is probably easier to reextract the include files. You can do this the same way you did the whole source at the beginning, only 8.9 It says weird things about obsolete routing requests 24
Note: ``make config'' will recreate the /usr/src/linux link if it isn't there.
10. Modules
Loadable kernel modules can save memory and ease configuration. The scope of modules has grown to include filesystems, ethernet card drivers, tape drivers, printer drivers, and more.
`drv_hello' is the name of the module, it uses one page (4k) of memory, and no other kernel modules depend on it at the moment. To remove this module, use `rmmod drv_hello'. Note that rmmod wants a 8.14 Increasing limits 25
The Linux Kernel HOWTO module name, not a filename; you get this from lsmod's listing. The other module utilities' purposes are documented in their manual pages.
11. Tips and tricks 11.1 Redirecting output of the make or patch commands
If you would like logs of what those `make' or `patch' commands did, you can redirect output to a file. First, find out what shell you're running: `grep root /etc/passwd' and look for something like `/bin/csh'. If you use sh or bash,
(command) 2>&1 | tee (output file)
will place a copy of (command)'s output in the file `(output file)'. For csh or tcsh, use
(command) |& tee (output file)
26
to the end of your LILO configuration file, you can choose to run a newly compiled kernel without touching your old /vmlinuz (after running lilo, of course). The easiest way to tell LILO to boot a new kernel is to press the shift key at bootup time (when it says LILO on the screen, and nothing else), which gives you a prompt. At this point, you can enter `new_kernel' to boot the new kernel. If you wish to keep several different kernel source trees on your system at the same time (this can take up a lot of disk space; be careful), the most common way is to name them /usr/src/linuxx.y.z, where x.y.z is the kernel version. You can then ``select'' a source tree with a symbolic link; for example, `ln sf linux1.2.2 /usr/src/linux' would make the 1.2.2 tree current. Before creating a symbolic link like this, make certain that the last argument to ln is not a real directory (old symbolic links are fine); the result will not be what you expect.
27
Even though I try to be attentive as possible with mail, please remember that I get a lot of it every day, so it may take a little time to get back to you. Especially when emailing me with a question, please try extra hard to be clear and detailed in your message. If you're writing about nonworking hardware (or something like that), I need to know what your hardware configureation is. If you report an error, don't just say ``I tried this but it gave an error;'' I need to know what the error was. I would also like to know what versions of the kernel, gcc, and libc you're using. If you just tell me you're using thisorthat distribution, it won't tell me much at all. I don't care if you ask simple questions; remember, if you don't ask, you may never get an answer! I'd like to thank everyone who has given me feedback. If your question does not relate to the kernel, or is in some language that I don't understand, I may not answer. If you mailed me and did not get an answer within a resonable amount of time (three weeks or more), then chances are that I accidentally deleted your message or something (sorry). Please try again. I get a lot of mail about thing which are actually hardware problems or issues. That's OK, but please try to keep in mind that I'm not familiar with all of the hardware in the world. I use AMD processors, Adaptec and Sybios SCSI controllers, and IBM SCSI disks. Version 0.1 was written on October 3, 1994. This document is available in SGML, PostScript, TeX, roff, and plaintext formats.
13.2 To do
The ``Tips and tricks'' section is a little small. I hope to expand on it with suggestions from others. So is ``Additional packages.'' More debugging/crash recovery info needed.
13.3 Contributions
A small part of Linus' README (kernel hacking options) is inclusive. (Thanks, Linus!) [email protected] (Ulrich Callmeier): patch s and xargs. [email protected] (Daniel Quinlan): corrections and additions in many sections. nat@[email protected] (Nat Makarevitch): mrproper, tar p, many other things [email protected] (Axel Boldt): collected descriptions of kernel configuration options on the net; then provided me with the list [email protected] (Steve Lembark): multiple boot suggestion [email protected] (Keith Briggs): some corrections and suggestions [email protected] (Ryan McGuire): makeables additions 13.2 To do 28
The Linux Kernel HOWTO [email protected] (Eric Dumas): French translation [email protected] (Yasutada Shimazaki): Japanese translation [email protected] (Juan Jose Amor Iglesias): Spanish translation [email protected] (Martin Wahlen): Swedish translation [email protected] (Zoltan Vamosi): Hungarian translation [email protected] (Bartosz Maruszewski): Polish translation [email protected] (Michael J Donahue): typos, winner of the ``sliced bread competition'' [email protected] (Richard Stallman): ``free'' documentation concept/distribution notice [email protected] (David Kastrup): NFS thing [email protected] (Eric Raymond): various tidbits The people who have sent me mail with questions and problems have also been quite helpful.
The Linux Kernel HOWTO This howto document is located at http://www.linuxdoc.org and click on HOWTOs and search for howto document name using CTRL+f or ALT+f within the webbrowser. You can also find this document at the following mirrors sites http://www.caldera.com/LDP/HOWTO http://www.linux.ucla.edu/LDP http://www.cc.gatech.edu/linux/LDP http://www.redhat.com/mirrors/LDP Other mirror sites near you (networkaddresswise) can be found at http://www.linuxdoc.org/mirrors.html select a site and go to directory /LDP/HOWTO/xxxxxHOWTO.html You can get this HOWTO document as a single file tar ball in HTML, DVI, Postscript or SGML formats from ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO/otherformats/ and http://www.linuxdoc.org/docs.html#howto Plain text format is in: ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO and http://www.linuxdoc.org/docs.html#howto Single HTML file format is in: http://www.linuxdoc.org/docs.html#howto Single HTML file can be created with command (see man sgml2html) sgml2html split 0 xxxxhowto.sgml Translations to other languages like French, German, Spanish, Chinese, Japanese are in ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO and http://www.linuxdoc.org/docs.html#howto Any help from you to translate to other languages is welcome. The document is written using a tool called "SGMLTools" which can be got from http://www.sgmltools.org Compiling the source you will get the following commands like sgml2html xxxxhowto.sgml (to generate html file) sgml2html split 0 xxxxhowto.sgml (to generate a single page html file) sgml2rtf xxxxhowto.sgml (to generate RTF file) sgml2latex xxxxhowto.sgml (to generate latex file)
man sgml2latex sgml2latex filename.sgml man dvips dvips o filename.ps filename.dvi distill filename.ps man ghostscript
30
Or you can use Ghostscript command ps2pdf. ps2pdf is a workalike for nearly all the functionality of Adobe's Acrobat Distiller product: it converts PostScript files to Portable Document Format (PDF) files. ps2pdf is implemented as a very small command script (batch file) that invokes Ghostscript, selecting a special "output device" called pdfwrite. In order to use ps2pdf, the pdfwrite device must be included in the makefile when Ghostscript was compiled; see the documentation on building Ghostscript for details.
And you may have to manually edit some of the minor errors after running the perl script. For e.g. you may need to put closing tag < /Para> for each < Listitem>
bash$ sgml2html xxxxhowto.sgml (to generate html file) bash$ sgml2html split 0 xxxxhowto.sgml (to generate a single page html file)
Then use the tool HtmlToHlp. You can also use sgml2rtf and then use the RTF files for generating winhelp files.
The Linux Kernel HOWTO Publishing | TeX menu buttons. To read dvi document give the command
xdvi geometry 80x90 howto.dvi man xdvi
And resize the window with mouse. To navigate use Arrow keys, Page Up, Page Down keys, also you can use 'f', 'd', 'u', 'c', 'l', 'r', 'p', 'n' letter keys to move up, down, center, next page, previous page etc. To turn off expert menu press 'x'. You can read postscript file using the program 'gv' (ghostview) or 'ghostscript'. The ghostscript program is in ghostscript*.rpm package and gv program is in gv*.rpm package in Redhat Linux which can be located through ControlPanel | Applications | Graphics menu buttons. The gv program is much more user friendly than ghostscript. Also ghostscript and gv are available on other platforms like OS/2, Windows 95 and NT, you view this document even on those platforms. Get ghostscript for Windows 95, OS/2, and for all OSes from http://www.cs.wisc.edu/~ghost To read postscript document give the command
gv howto.ps ghostscript howto.ps
You can read HTML format document using Netscape Navigator, Microsoft Internet explorer, Redhat Baron Web browser or any of the 10 other web browsers. You can read the latex, LyX output using LyX a XWindows front end to latex.
32