This is a detailed guide to kernel configuration, compilation,
upgrades, and troubleshooting for ix86-based systems.
______________________________________________________________________
Table of Contents
1. Introduction
2. Quick Steps - Kernel Compile
2.1 Precautionary Preparations
2.2 For the Impatient
2.3 Building Kernel - Explanation of Steps
2.4 Troubleshoot Common Mistakes
2.4.1 The System Hangs at LILO
2.4.2 No init found
2.4.3 Lots of Compile Errors
2.4.4 The 'depmod' gives "Unresolved symbol error messages"
2.4.5 Kernel Does Not Load Module - "Unresolved symbols" Error Messages
2.4.6 Kernel fails to load a module
2.4.7 Loadable modules
2.5 Post Kernel Building
2.6 Sample lilo.conf
3. A word on style
4. Important questions and their answers
4.1 What does the kernel do, anyway?
4.2 Why would I want to upgrade my kernel?
4.3 What kind of hardware do the newer kernels support?
4.4 What version of gcc and libc do I need?
4.5 What's a loadable module?
4.6 How much disk space do I need?
4.7 How long does it take?
5. How to actually configure the kernel
5.1 Getting
5.2 Unpacking the source
5.3 Configuring the kernel
5.3.1 Kernel math emulation (Processor type and features)
5.3.2 Enhanced (MFM/RLL) disk and IDE disk/cdrom support (Block Devices)
5.3.3 Networking support (General Setup)
5.3.4 System V IPC (General Setup)
5.3.5 Processor family (Processor type and features)
5.3.6 SCSI support
5.3.7 Network
5.3.8 Filesystems
5.3.8.1 But I don't know which filesystems I need!
5.3.9 Character devices
5.3.10 Sound
5.3.11 Other configuration options
5.3.12 Kernel hacking
5.4 Now what? (The Makefile)
6. Compiling the kernel
6.1 Cleaning and depending
6.2 Compile time
6.3 Other ``
6.4 Installing the kernel
7. Patching the kernel
7.1 Applying a patch
7.2 If something goes wrong
7.3 Getting rid of the .orig files
7.4 Other patches
8. Additional packages
8.1 kbd
8.2 util-linux
8.3 hdparm
8.4 gpm
9. Some pitfalls
9.1 make clean
9.2 Huge or slow kernels
9.3 The parallel port doesn't work/my printer doesn't work
9.4 Kernel doesn't compile
9.5 New version of the kernel doesn't seem to
9.6 You forgot to run LILO, or system doesn't boot at all
9.7 It says `warning: bdflush not running'
9.8 I can't get my IDE/ATAPI CD-ROM drive to work
9.9 It says weird things about obsolete routing requests
9.10 Firewalling not working in 1.2.0
9.11 ``Not a compressed kernel Image file''
9.12 Problems with console terminal after upgrade to 1.3.x
9.13 Can't seem to compile things after kernel upgrade
9.14 Increasing limits
10. Note for upgrade to version 2.0.x, 2.2.x
11. Modules
11.1 Installing the module utilities
11.2 Modules distributed with the kernel
12. Tips and tricks
12.1 Redirecting output of the make or patch commands
12.2 Conditional kernel install
12.3 Kernel updates
13. Other relevant HOWTOs that might be useful
14. Misc
14.1 Author
14.2 To do
14.3 Contributions
14.4 Copyright notice, License, and all that stuff
15. Other Formats of this Document
15.1 Acrobat PDF format
15.2 Convert Linuxdoc to Docbook format
15.3 Convert to MS WinHelp format
15.4 Reading various formats
______________________________________________________________________
1. Introduction
You compile Linux kernel for one of following reasons:
· You are doing kernel development
· You are adding a new hardware to
· You want to customize the kernel and do not want the default kernel
shipped out to you.
· For Defence Industries or Military applications, you must read the kernel source code and compile with your own hands. No exceptions!! (U.S Dept of Defence compiles the Linux kernel before distributing computers).
· Every country and every Govt. compiles the kernel on site for security. Every Govt. audits each and every line of kernel before using the computer.
· Each and every University in the world compiles the kernel before using any computer!
· For your education and knowledge of Linux kernel and ofcourse, just for fun!
· For very advanced scientific applications - you may need to do kernel compile
· And for many hundreds of reasons - too numerous to list!
If your time is precious then go straight to chapter 2 "Quick Steps". And, if you are successful in compiling the Linux kernel then you can skip the remaining chapters.
2. Quick Steps - Kernel Compile
This section is written by Al Dev (alavoor[AT]yahoo.com) (The latest version of this document is at <http://www.milkywaygalaxy.freeservers.com>. You may want to check there for changes). Mirror sites are at - angelfire <http://www.angelfire.com/country/aldev0>, geocities
<http://www.geocities.com/alavoor/index.html>. These sites have lots of linux goodies and tips.
Kernel re-compile is required in order to make the kernel very lean and which will result in FASTER operating system . It is also required to support any new devices.
2.1. Precautionary Preparations
Before you build kernel, it is a good idea to do a backup of the system. If you had not backed up your system recently then you can do it now. You can use commercial backup tools like BRS Backup-Recovery- Software <http://24.221.230.253> (also in this page you can find open-
source/freeware backup tools listed under 'Backup and Restore Utility'). Backup is just a suggestion and it is not mandatory to do backup before building the Linux kernel.
2.2. For the Impatient
1. Unpack the sources
2. Optional - You can copy the .config file from your old linux kernel source tree to new kernel tree (may save time, if you want to reuse the old settings).
3. make clean; make mrproper
4. make xconfig
5. make dep
6. make
7. make bzImage
8. make modules
9. make install
10.make modules_install
11. configure LILO or GRUB.
12.Optional - make clean (If you want to free up disk space)
See details of above steps in next section....
2.3. Building Kernel - Explanation of Steps
Details of the steps mentioned in the previous section:
Note: Below 'bash#' denotes the bash prompt, you should type the commands that appear after the 'bash#' prompt. Below are commands tested on Redhat Linux Kernel 2.4.7-10, but it should work for other distributions with very minor changes. It should also work for
kernel versions like 2.2, 2.0 and 1.3. It should also work for future or newer versions of kernel (with little changes - let me know).
· Note: You can have many kernel images on your system. By following the steps below you do not overwrite or damage your existing kernel. These steps are very safe and your current kernel will be intact and will not be touched.
1. Unpack the sources: Login in as 'root' throughout all these steps.
Mount Redhat linux cdrom and install the linux kernel source rpm
___________________________________________________________________
bash$ su - root
bash# cd /mnt/cdrom/RedHat/RPMS
bash# rpm -i kernel-headers*.rpm
bash# rpm -i kernel-source*.rpm
bash# rpm -i dev86*.rpm
bash# rpm -i bin86*.rpm
___________________________________________________________________
(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 bin86-mandrake <http://rpmfind.net/linux/RPM/man
drake/7.1/Mandrake/RPMS/bin86-0.4-12mdk.i586.html> , bin86-kondara
<http://rpmfind.net/linux/RPM/kon
2. Optional : You can copy the .config file from your old linux kernel source tree to new kernel tree (may save time, if you want to reuse the old settings).
___________________________________________________________________
bash# cd /usr/src/linux
bash# cp ../linux-old-tree/.config .
___________________________________________________________________
or alternatively, you can use "make oldconfig" which default all questions based on the contents of your existing ./.config file.
3. Clean : Before doing mrproper below, you may want to backup the .config file.
___________________________________________________________________
bash# cd /usr/src/linux
bash# make clean
bash# make mrproper # Must do this if want to start clean slate
___________________________________________________________________
4. Configure:
· Start X-windows with 'startx'. If you are not able to start X-window then see next step below.
___________________________________________________________________
bash# man startx
bash# startx
bash# cd /usr/src/linux
bash# make xconfig
___________________________________________________________________
· If you are not able to start X-window above then try -
___________________________________________________________________
bash# export TERM=xterm
bash# make menuconfig
If you find scrambled display, then use different terminal emulators like vt100, vt102, vt220 or ansi. The display will be scrambled and will have garbage characters in cases where you use telnet to login to remote linux. In such cases you should use the terminal emulators like vt100, vt220.
For example:
bash# export TERM=vt220
bash# export TERM=ansi
At a lower level of VT, use:
bash# export TERM=vt100
bash# make menuconfig
If the menuconfig command fails then try -
bash# make config
___________________________________________________________________
The "make xconfig" or "make menuconfig" brings up a user friendly GUI interface. And "make config" brings up command-line console mode interface. You can load the configuration file from /usr/src/linux/.config (dot config file. Note the dot before config).
Click on button "Load Configuration from File".
Within 'make xconfig' you must do these (to avoid problems) -
· VERY IMPORTANT !!! : Select proper CPU type - Pentium 3, AMD K6, Cyrix, Pentium 4, Intel 386, DEC Alpha, PowerPC otherwise kernel compile will fail and even if it compiles 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
___________________________________________________________________
bash# rpm -i /mnt/cdrom/Redhat/RPMS/modutils*.rpm
bash# man lsmod
bash# man insmod
bash# man rmmod
bash# man depmod
bash# man modprobe
___________________________________________________________________
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).
5. Dep : And now, do -
___________________________________________________________________
bash# make dep
___________________________________________________________________
6. Give Name to Kernel: You can give a name to your kernel, so that it is unique and does not interfere with others.
___________________________________________________________________
bash# cd /usr/src/linux
bash# vi Makefile
___________________________________________________________________
Here look for EXTRAVERSION = -19.8.0blahblah and change to EXTRAVER SION = -19.8.0MyKer.26Jan03
7. Do make: Read the following file (to gain some knowledge about kernel building. Tip: Use the color editor gvim <http://www.linuxdoc.org/HOWTO/Vim-HOWTO.html> 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.
___________________________________________________________________
Now, give the make command -
______________________________________________________________________
bash# cd /usr/src/linux
bash# man nohup
bash# nohup make bzImage &
bash# man tail
bash# tail -f nohup.out (.... to monitor the progress)
This will put the kernel in /usr/src/linux/arch/i386/boot/bzImage
______________________________________________________________________
8. bzImage: 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.
___________________________________________________________________
bash# cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage.myker.26mar2001
___________________________________________________________________
NOTE : For latest kernels (kernel versions 2.4.0 or greater) you may want to give these commands, so that /boot/initrd*.img is created as well entries in grub are made automatically:
______________________________________________________________________
bash# make install
______________________________________________________________________
9. Configure LILO or GRUB : There are two options for boot loading under Redhat Linux -
· LILO
· GRUB
Configure LILO: Read the manual page on lilo (see also <http://www.linuxdoc.org/HOWTO/LILO-crash-rescue-HOWTO.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# 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
read-only
You can check device name for 'root=' with the command -
bash# df /
Now give -
bash# lilo
bash# lilo -q
___________________________________________________________________
You must re-run lilo even if the entry 'myker' exists, everytime you create a new bzImage.
Configure GRUB: GRUB differs from bootloaders such as LILO in that it can lie to Windows and make Windows believe that it's installed on the first partition even if it's not. So you can keep your current Linux system where it is and install Windows on the side. See
· <http://www.tldp.org/HOWTO/Linux+Win9x+Grub-HOWTO/intro.html>
· GNU GRUB <http://www.gnu.org/software/grub>
· Redhat Manual
<http://www.redhat.com/docs/manuals/linux/RHL-7.2-Manual/ref-
guide/ch-grub.html>.
· Multiboot-with-GRUB minihowto
<http://www.tldp.org/HOWTO/mini/Multiboot-with-GRUB.html>
· Grub Manual <http://www.mcc.ac.uk/grub/grub_toc.html>
___________________________________________________________________
bash# man grub
bash# man grubby # (command line tool for configuring grub, lilo, and elilo)
bash# man grub-install
___________________________________________________________________
Edit the file /etc/grub.conf to make entries for the new kernel.
10.
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 re-try all over again. Your old kernel is still
INTACT and SAFE at say /boot/vmlinuz-2.0.34-0.6
11.
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
___________________________________________________________________
12.
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.2-2/kernel/drivers/block/loop.o, you would do :
______________________________________________________________________
bash# man insmod
bash# modprobe loop
bash# insmod loop
bash# lsmod
______________________________________________________________________
You can set PATH the insmod searches in /etc/modules.conf
13.
Clean: Optional - make clean (If you want to free up disk space)
14.
Optional - Initrd.img :
To create /boot/initrd.img see the documentation at /usr/src/linux/Documentation/initrd.txt and Loopback-Root-mini- HOWTO <http://www.tldp.org/HOWTO/mini/Loopback-Root-
FS-3.html#ss3.3>. You do not need to create as you use the existing /boot/initrd.img.
2.4. Troubleshoot Common Mistakes
2.4.1. The System Hangs at LILO
Sympton: After you build the kernel and reboot, the system hangs just before LILO.
Reason: Probably you did not set the BIOS to pick up the proper Primary Master IDE and Secondary Slave IDE hard disk partition.
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.
2.4.2. 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# man init
______________________________________________________________________
2.4.3. Lots of Compile Errors
The 'make', 'make bzImage', 'make modules' or 'make modules_install' gives compile problems. You should give 'make mrproper' before doing make.
______________________________________________________________________
bash# make mrproper
______________________________________________________________________
If this problem persists, then try menuconfig instead of xconfig. Sometimes GUI version xconfig causes some problems:
______________________________________________________________________
bash# export TERM=VT100
bash# make menuconfig
______________________________________________________________________
2.4.4. The 'depmod' gives "Unresolved symbol error messages"
When you run depmod it gives "Unresolved symbols". A sample error
message is given here to demonstrate the case:
______________________________________________________________________
bash$ su - root
bash# man depmod
bash# depmod
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/linear.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/multipath.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/raid0.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/raid1.o
depmod: *** Unresolved symbols in /lib/modules/version/kernel/drivers/md/raid5.o
______________________________________________________________________
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:
______________________________________________________________________
bash$ su - root
bash# cd /usr/src/linux
bash# make modules
bash# make modules_install
______________________________________________________________________
2.4.5. Kernel Does Not Load Module - "Unresolved symbols" Error Messages
When you boot kernel and system tries to load any modules and you get "Unresolved symbol : __some_function_name" then it means that you did not clean compile the modules and kernel. It is mandatory that you should do make clean and make the modules. Do this -
______________________________________________________________________
bash# cd /usr/src/linux
bash# make dep
bash# make clean
bash# nohup make bzImage &
bash# tail -f nohup.out (.... to monitor the progress)
bash# make modules
bash# make modules_install
______________________________________________________________________
2.4.6. Kernel fails to load a module
If the kernel fails to load a module (say loadable module for network card or other devices), then you may want to try to build the driver for device right into the kernel. Sometimes loadable module will NOT work and the driver needs to be built right inside the kernel. For example - some network cards do not support loadable module feature - you MUST build the driver of the network card right into linux kernel. Hence, in 'make xconfig' you MUST not select loadable module for this device.
2.4.7. 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 kernel-2.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 /mnt/cdrom/Redhat/RPMS/kernel-2.2.14-5.0.i686.rpm
(or)
bash# rpm -U --force /mnt/cdrom/Redhat/RPMS/kernel-2.2.14-5.0.i586.rpm
(or)
bash# rpm -U --force /mnt/cdrom/Redhat/RPMS/kernel-2.2.14-5.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
______________________________________________________________________
bash# rpm -i /mnt/cdrom/contrib/kernel-modules*.rpm
....(For old linux systems which do not have insmod pre-installed)
______________________________________________________________________
2.5. Post Kernel Building
After successfully building and booting the Linux kernel, you may be required to do these additional steps to make some of the devices to work with Linux. (The steps below were tested on Redhat Linux but should work with other distributions as well.)
Video card/Monitor configuration:
· Please see the video card manual which is usually shipped with the PC. You should look for a "Technical Specifications" page.
· Please see the monitor's manual and look for a "Technical Specifications" page.
You can configure the Video card and monitor by using these commands:
___________________________________________________________________
bash$ su - root
bash# man Xconfigurator
bash# /usr/bin/X11/Xconfigurator --help
bash# /usr/bin/X11/Xconfigurator
bash# /usr/bin/X11/Xconfigurator --expert
See also:
bash# man xf86config
bash# /usr/bin/X11/xf86config
___________________________________________________________________
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 4-pin 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 X-window '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->Sound Mixer->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>
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
Firewall-IPMasq scripts <http://www.BoingWorld.com/workshops/linux/iptables-tutorial> , main
page of Netfilter is at <http://netfilter.samba.org>. Related materials at firewalling-matures
<http://www.linuxsecurity.com/feature_stories/kernel-netfilter.html> and Netfilter-FAQ <http://netfilter.filewatcher.org/netfilter- faq.html>.
For kernel version below 2.4 you should install the firewall rpms from rpmfind.net
<http://rpmfind.net/linux/rpm2html/search.php?query=firewall> or firewall.src.rpm
<http://rpmfind.net/linux/RPM/contrib/noarch//SRPMS//firewall-2.2-3.src.html>.
Configuration of other devices: Refer to HOWTO docs relating to your devices at <http://www.linuxdoc.org>
2.6. Sample lilo.conf
Read this section only if you are using LILO and if you are using GRUB skip this section. Given below is a sample /etc/lilo.conf file. You should follow the naming conventions like ker2217 (for kernel 2.2.17), ker2214 (for kernel 2.2.14). You can have many kernel images on the same /boot system. On my machine I have something like:
______________________________________________________________________
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
default=firewall
image=/boot/vmlinuz-2.2.14-5.0
label=ker2214
read-only
root=/dev/hda9
image=/boot/vmlinuz-2.2.17-14
label=ker2217
read-only
root=/dev/hda9
#image=/usr/src/linux/arch/i386/boot/bzImage
# label=myker
# root=/dev/hda7
# read-only
image=/boot/bzImage.myker.11feb2001
label=myker11feb
root=/dev/hda9
read-only
image=/boot/bzImage.myker.01jan2001
label=myker01jan
root=/dev/hda9
read-only
image=/boot/bzImage.myker-firewall.16mar2001
label=firewall
root=/dev/hda9
read-only
______________________________________________________________________
3. A word on style
All the chapters from this here are written by Brian Ward <http://www.o--o.net>.
Text that looks like this is either something that appears on your screen, a filename, or something that can be directly typed in, such as a command, or options to a command (if you're looking at a plain- text file, it doesn't look any different). Commands and other input
are frequently quoted (with ` '), which causes the following classic punctuation problem: if such an item appears at the end of a sentence in quotes, people often type a `.' along with the command, because the American quoting style says to put the period inside of the quotation
marks. Even though common sense (and unfortunately, this assumes that the one with the ``common sense'' is used to the so-called American style of quotation) should tell one to strip off the punctuation first, many people simply do not remember, so I will place it outside
the quotation marks in such cases. In other words, when indicating that you should type ``make config'' I would write `make config', not `make config.'
4. Important questions and their answers
All the chapters from this here are written by Brian Ward
<http://www.o--o.net>.
4.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.
4.2. Why would I want to upgrade my kernel?
Newer kernels generally offer the ability to talk to more types of hardware (that is, they have more device drivers), they can have better process management, they can run faster than the older versions, they could be more stable than the older versions, and they fix silly bugs in the older versions. Most people upgrade kernels because they want the device drivers and the bug fixes.
4.3. What kind of hardware do the newer kernels support?
See the Hardware-HOWTO <http://www.tldp.org/HOWTO/Hardware-HOWTO> . Alternatively, you can look at the `config.in' file in the linux source, or just find out when you try `make config'. This shows you all hardware supported by the standard kernel distribution, but not everything that linux supports; many common device drivers (such as the PCMCIA drivers and some tape drivers) are loadable modules maintained and distributed separately.
4.4. What version of gcc and libc do I need?
Linus recommends a version of gcc in the README file included with the linux source. If you don't have this version, the documentation in the recommended version of gcc should tell you if you need to upgrade your libc. This is not a difficult procedure, but it is important to follow the instructions.
4.5. What's a loadable module?
These are pieces of kernel code which are not linked (included) directly in the kernel. One compiles them separately, and can insert and remove them into the running kernel at almost any time. Due to its flexibility, this is now the preferred way to code certain kernel features. Many popular device drivers, such as the PCMCIA drivers and the QIC-80/40 tape driver, are loadable modules.
4.6. How much disk space do I need?
It depends on your particular system configuration. First, the compressed linux source is nearly 14 megabytes large at version 2.2.9. Many sites keep this even after unpacking. Uncompressed and built with a moderate configuration, it takes up another 67 MB.
4.7. How long does it take?
With newer machines, the compilation takes dramatically less time than older ones; an AMD K6-2/300 with a fast disk can do a 2.2.x kernel in about four minutes. As for old Pentiums, 486s, and 386s, if you plan to compile one, be prepared to wait, possibly hours, days..
If this troubles you, and you happen to have a faster machine around to compile on, you can build on the fast machines (assuming you give it the right parameters, that your ulilities are up-to-date, and so on), and then transfer the kernel image to the slower machine.
5. How to actually configure the kernel
5.1. Getting the source
You can obtain the source via anonymous ftp from ftp.kernel.org in /pub/linux/kernel/vx.y, where x.y is the version (eg 2.2), and as mentioned before, the ones that end with an odd number are development releases and may be unstable. It is typically labelled linux- x.y.z.tar.gz, where x.y.z is the version number. The sites also typically carry ones with a suffix of .bz2, which have been compressed with bzip2 (these files will be smaller and take less time to
transfer).
It's best to use ftp.xx.kernel.org where xx is your country code; examples being ftp.at.kernel.org for Austria, and ftp.us.kernel.org for the United States.
5.2. Unpacking the source
Log in as or su to `root', and cd to /usr/src. If you installed kernel source when you first installed linux (as most do), there will already be a directory called `linux' there, which contains the entire old source tree. If you have the disk space and you want to play it safe, preserve that directory. A good idea is to figure out what version your system runs now and rename the directory accordingly. The command `uname -r' prints the current kernel version. Therefore, if
`uname -r' said `1.0.9', you would rename (with `mv') `linux' to `linux-1.09'. If you feel mildly reckless, just wipe out the entire directory. In any case, make certain there is no `linux' directory in /usr/src before unpacking the full source code.
Now, in /usr/src, unpack the source with `tar zxpvf linux- x.y.z.tar.gz' (if you've just got a .tar file with no .gz at the end, `tar xpvf linux-x.y.z.tar' works.). The contents of the source will
fly by. When finished, there will be a new `linux' directory in /usr/src. cd to linux and look over the README file. There will be a section with the label `INSTALLING the kernel'. Carry out the
instructions when appropriate -- symbolic links that should be in place, removal of stale .o files, etc.
If you have a .bz2 file and the bzip2 program (read about it at http://www.muraroa.demon.co.uk/), do this:
bz2cat linux-x.y.z.tar.bz2 | tar xvf -
5.3. Configuring the kernel
Note: Some of this is reiteration/clarification of a similar section in Linus' README file.
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 widely-used. 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 (`click-o- rama' - Nat). `make menuconfig' is for those who have (n)curses and would prefer a text-based 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 non-critical 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 up-to-date. Here are a listing of some of the important features, which hierarchy they are in, and brief description.
5.3.1. Kernel math emulation (Processor type and features)
If you don't have a math coprocessor (you have a bare 386 or 486SX), you must say `y' to this. If you do have a coprocessor and you still say `y', don't worry too much -- the coprocessor is still used and the emulation ignored. For any halfway modern machine, the answer will be
no, but don't worry if you say yes accidentally; if not needed, it is not used.
5.3.2. Enhanced (MFM/RLL) disk and IDE disk/cdrom support (Block Devices)
You probably need to support this; it means that the kernel will support standard PC hard disks, which most people have. This driver does not include SCSI drives; they come later in the configuration.
You will then be asked about the ``old disk-only'' and ``new IDE'' drivers. You want to choose one of them; the main difference is that the old driver only supports two disks on a single interface, and the new one supports a secondary interface and IDE/ATAPI cdrom drives. The
new driver is 4k larger than the old one and is also supposedly ``improved,'' meaning that aside from containing a different number of bugs, it might improve your disk performance, especially if you have newer (EIDE-type) hardware.
5.3.3. Networking support (General Setup)
In principle, you would only say `y' if your machine is on a network such as the internet, or you want to use SLIP, PPP, term, etc to dial up for internet access. However, as many packages (such as the X window system) require networking support even if your machine does
not live on a real network, you should say `y'. Later on, you will be asked if you want to support TCP/IP networking; again, say `y' here if you are not absolutely sure.
5.3.4. System V IPC (General Setup)
One of the best definitions of IPC (Interprocess Communication) is in the Perl book's glossary. Not surprisingly, some Perl programmers employ it to let processes talk to each other, as well as many other packages (DOOM, most notably), so it is not a good idea to say n unless you know exactly what you are doing.
5.3.5. Processor family (Processor type and features)
(in older kernels: Use -m486 flag for 486-specific optimizations)
Traditionally, this compiled in certain optimizations for a particular processor; the kernels ran fine on other chips, but the kernel was perhaps a bit larger. In newer kernels, however, this is no longer true, so you should enter the processor for which you are compiling the kernel. A ``386'' kernel will work on all machines.
5.3.6. SCSI support
If you have SCSI devices, say `y'. You will be prompted for further information, such as support for CD-ROM, disks, and what kind of SCSI adapter you have. See the SCSI-HOWTO for greater detail.
5.3.7. Network device support
If you have a network card, or you would like to use SLIP, PPP, or a parallel port adapter for connecting to the Internet, say `y'. The config script will prompt for which kind of card you have, and which
protocol to use.
5.3.8. 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 MS-DOS
0 comments:
Post a Comment