KERNEL kernel compilation Redhat Linux
*********************************************************** ********************
* The following steps have a lot of primary commands or explains, because even Linux newbie,
* Walking a lot of detours during the compilation process, spend a lot of time to find a variety of solutions, so
* All the corresponding commands have been written, I hope that the same will be the same for the same time.
* Newcomers compile the kernel are helpful!
*
* Kilvon 05-MAR-2003
*********************************************************** *******************
Basic compilation Description: Even the current version is: Redhat Linux 8.0
(Machine has dual operating system: Linux and Windows 2000)
The kernel version is 2.4.18-14, the hardware is a model of notebook Compaq,
The downloaded kernel version is 2.4.20 (in
Can be found on www.kernel.org,
Recommend the high version when compiling kernel, not compiled on the previous version,
See the description of step 7.1
Before the start of the compilation, it is recommended to use the relevant software to make a hardware in Windows.
Detailed statistics, including hardware types, manufacturers, chip versions, etc., especially notebooks
And brand machine, because many parts are OEM other manufacturers, and print it
Out of use for the configured kernel. (Can also be used under Linux: System Tools ->
Hardware browser to view)
In addition, it is recommended to prepare a few pieces of paper and pen, and you can always think about the information you think.
Of course, the error message is included to help determine and solve the problem later.
1. Put the kernel source code package Linux-2.4.20.tar.bz2 copy to / usr / src directory:
#CP Linux-2.4.20.tar.bz2 / usr / src
#CD / USR / SRC
2. Remove the Symbol Link pointing to the previous kernel version
#RM -F Linux-2.4
3. Unpack the compressed package with the following command
# bzip2 -d Linux-2.4.20.tar.bz2
#tar -xvf linux-2.4.20.tar
4. Create a new Symbol Link to link to the directory where the source code that is just unlocked
#LN -s Linux-2.4.20 Linux-2.4
5. Enter the working directory shrimp when compiled later:
#CD /USR/SRC/LINUX-2.4
6. This command guarantees that there is no incorrect .o file (ie Object file, compiling C language) in the source code directory.
When the words are generated, the purpose is to use the use of the LINK when compiled into an executable code) and the files
Relying on the relationship. The first time compiled the source package without this order without this command, but if this is used multiple times
Some source code compile the kernel, then you must first run this command.
#make mrproperty
7. In order not to affect the available kernel (such as the kernel that is loaded when installing Linux), now
Save the previously available kernel (to make compilation failure "can still" start Linux),
And we have to identify an easy identification mark on this compiled kernel, the following steps
Compilation is temporarily independent.
7.1 Even GRUB is used as Boot Manager, so modify the grub.conf file,
#cp /boot/grub/grub.conf /boot/grub/grub.conf.bck
(It is recommended to print an original grub.conf file, see Seven.4 steps)
#emacs /boot/grub/grub.conf
(Emacs Tips: Ctrl X S is the saved result, Ctrl X C is turned off Emacs,
Deleting the N-line text is: first put the cursor in the beginning of the beginning of the text Ctrl U, then knock in
The number of rows that delete, such as 4, last CTRL K)
The following is an even GRUB.CONF content:
DEFAULT = 1
TIMEOUT = 10
SplashImage = (HD0, 6) /grub/splash.xpm.gz
Title Psyche (2.4.18-14 standard)
Root (HD0, 6)
Kernel /Vmlinuz-2.4.18-14.standard Ro root = / dev / hda8initrd /initrd-2.4.18-14.standard.img
Title Windows 2000
Rootnoverify (HD0, 0)
ChainLoader 1
Note Kernel ... and Initrd ... two statements because of the following modifications:
#RM -F /BOOT/SYSTEM.MAP
#RM -F / Boot / VMLinuz
#cp /boot/system.map-2.4.18-14 /boot/system.map-2.4.18.standard
#LN -S /Boot/system.map-2.4.18.standard /boot/system.map
#CP /BOOT /VMLINUZ-2.4.18-14 /Boot/VMLINUZ-2.4.18-14.Standard
#LN -S /BOOT/VMLINUZ-2.4.18-14.Standard / Boot / VMLinuz
#cp /boot/initrd-2.4.18-14.img /boot/initrd-2.4.18-14.standard.img
(Initrd only uses Copy, because even the compilation of a high version of the kernel, not the same version
The ability to recompile, compiling high versions is that the system will establish another directory without
Override the previous version with newly compiled (probably wrong), look at the / lib / modules directory
I will understand.)
7.2 How do I know where your root directory "/" is on:
#df
The following is part of the dual machine:
FileSystem 1K-block Used Available Use% MOUNTED ON
/ DEV / HDA8 4137264 2136592 1790508 55% /
...
Look at where your system root is important, because later you will see the system installation compiled kernel in the command in which the grub.conf is inserted in the command = label = / hdc = IDE-SCSI
It may cause the following error when system boot:
VFS: Cannot Open Root Device "OR 00:00
Please append a correct "root =" boot option
KERNEL PANIC: VFS: Unable to mount root fs 00:00
So to modify its command in grub.conf to: root = / dev / hda8
7.3 Ok, after doing these preparations, we want to
Restart the machine, don't worry, you should first confirm the correctness of the work of the 7.1 step, so as not to put the 7.1 error
Brought into the following steps. (Compile the kernel must be very cautious, can't be impatient, otherwise, 嘿嘿 ...)
7.4 If there is a problem during the restart, you can temporarily change the GRUB to the GRUB boot interface.
Guide parameters, the relevant commands are:
e - Edit Boot Command
ESC button - Back to the top "directory
o - insert a line of order
B - Start boot system
D - Delete a line
In fact, you can delete the commands on the GRUB console (only affect this startup), then follow
The command in /boot/grub/grub.conf is manually knocked in the GRUB console and the same effect.
7.5 If you can use the reconfigured grub command correctly start the system, let us start real
Compile work !!!!
7.6 First, we guarantee that we are in the compiled work directory:
#CD /USR/SRC/LINUX-2.4
Then edit the Makefile (this file is used to control compilation), find this line:
EXTRAVERSION =
Modification is (in eclipt, it can be any legal string, such as "-SEMA-V.4")
EXTRAVERSION = -kilvon.001
8. Even is compiled under X WINDOW:
#make xconfig
8.1 If you are in text mode, use
#make menuconfig
8.2 In fact, the most difficult thing in compilation step is the configuration of the kernel parameters. I spent a lot of time here, and even more miserable, I didn't realize this, thinking is the use of those orders ... So, then look:
8.3 The principle of choice is to compile the partial function code that is far from other partial relationships of the kernel and is not often used as a loadable module (which is far away. It is also the understanding of people's understanding of Linux and operating system concept. Help of the configuration item, facilitates the reduction of the length of the kernel, reduce the memory consumption of kernel consumption, simplifies the impact of the kernel during the corresponding environment changes; no need to choose; close and frequently used Some functional code is directly compiled into the kernel. The following describes the commonly used options:
/ 1. Code Maturity Level Options
Mature code. There is only one item here:
Prompt for development and / or incomplete code / drivers
If you want to test the functionality that is still in the experimental phase, such as khttpd, IPv6, etc.
Select this item as y; otherwise you can choose to N.
/ 2. Loadable Module Support
Support for modules. There are three items in this:
Enable loadable module support:
This item should be required unless you are ready to compile all the contents to the kernel.
Set Version Information On All Module Symbols:
You can don't choose it.
KERNEL MODULE LOADER:
Let the kernel have the ability to load the required module during startup, and it is recommended to select.
/ 3. Processor Type and Features
The CPU type, the option is a lot, and it will be introduced. Several as follows:
Processor Family:
Select the CPU type according to your own situation.
High memory support:
High-capacity memory support. You can support 4G, 64G, usually not available.
Math Emulation:
Cooperation processor simulation, the coordinator is the pet in the 386 era, and now it is no longer available.
MTTR Support: MTTR support. Optional.
SYMMETRIC MULTI-Processing Support:
Symmetric multi-processing support. Unless you are rich in multiple CPUs, you don't have to choose.
/ 4. General setup
Here is the most common attributes. This part of the content is very large, usually using the default settings. Let's introduce some of the options that are often used:
NetWorking Support:
Network support, must be selected, no network card is also recommended.
PCI Support:
PCI support, must.
PCI Access Mode:
PCI Access Mode. Alternative to BIOS, Direct and Any, choose ANY.
Support for Hot-Pluggabel Devices:
Hot swap equipment support, optional.
PCMCIA / Cardbus Support:
PCMCIA / Cardbus support, PCMCIA is necessary.
System V IPC
BSD Process Accounting
Sysctl Support:
The above three is related to process processing / IPC calls, mainly in both SYSTEM V and BSD style.
If you are not using BSD, follow the default.
Power Management Support: Power Management Support, optional, especially notebooks.
Advanced Power Management BIOS Support: Advanced Power Management BIOD support.
/ 5. Memory Technology Device (MTD) MTD device support
Optional.
/ 6. Parallel Port Support
Serial port support. If you don't plan to use the serial port, don't choose.
/ 7. Plug and play configuration
Plug and play support. Select it, you can experience the feeling of plugging and playing under Linux.
/ 8. Block Devices
Block equipment support, you need to choose the specific situation of everyone:
Normal PC Floppy Disk Support: Ordinary PC floppy support, generally choose, I have no,
No choice
XT Hard Disk Support:
Compaq Smart2 Support:
MULEX DAC960 / DAC1100 PCI RAID Controller Support: RAID mirroring.
Loopback Device Support:
Network Block Device Support: Network block device support. If you want to access online neighbors
Something, just choose.
Logical Volume Manager (LVM) Support: Logical Volume Management Support.
Multiple Devices Driver Support: Multi-device Drive Support.
RAM Disk Support: RAM disk support.
/ 9. Networking Options
Network options. The network protocol is configured here. Look at yourself.
In addition to being sure to select TCP / IP Networking, do other things to do
/ 10. Telephony Support
Calling cards can be supported under Linux so you can provide voice services using normal phones on IP. Details can look at HELP content.
/ 11. ATA / IDE / MFM / RLL Support
This is the hard disk / optical drive / tape / floppy disk support for various interfaces, and the content is too much.
Options, occasionally PCMCIA card, and each manner is different.
/ 12. SCSI Support
Support for SCSI devices, if you use SCSI hard drive / optical drive / tape, you can find it.
/ 13. IEEE 1394 (FireWire) Support
Even is ash, don't worry about it)
/ 14. I2O Device Support
Use in the intelligent input / output (i2o) system interface, not, use default.
/ 15. Network Device Support
Network device support. The protocol is selected above, and this selection device is now.
In order to avoid trouble, compile it into the kernel, don't choose M, choose Y. Patience, usually you can find your own network card. If not, you have to go to the manufacturer to drive,
Or go
Www.mydrivers.com
/ 16. Amateur Radio Support
No, no choice.
/ 17. Irda (Infrared) Support
This is going to support, I have.
/ 18. Isdn Subsystem
If you use the ISDN to access the Internet, this is indispensable.
/ 19. Old CD-ROM Drivers (Not SCSI, Not IDE)
Dedicated to the optical drive of non-SCSI / IDE mouth, but who is still using so old Dongdong, choose it.
/20.input Core Support
This option is very important, except for the Joystick (Game Remote Rod), "M" is selected. Remember!
/ 21. CHARACTER DEVICES
Character device. This content is too much, first use the default settings, you will modify it yourself: I2C Support: I2C is the low speed serial line used in the pHILIPS highly driven microcontrol application
Bus protocol. If you want to choose the following Video for Linux, this must be selected.
Mice: mouse. If it is a notebook, it is recommended to select "Y" in Bus Mouse Support.
Joysticks: Handle. Even in linux, the handle is not very much
WatchDog Cards: Although it is called Cards, this can be implemented in pure, of course,
Hardware. If you choose this, you will create a name in your / dev
Watchdog's file, it can record your system's operation, until the system is re-
1 minute initiated. With this file, you can recover the status before the system is restarted.
Video for Linux: Supports audio / video cards.
FTAPE, The Floppy Tape Device Driver:
PCMCIA Character Device Support:
/ 22.Multimedia Devices
For capture of Audio / Video, if you are interested, see HELP
/ 23. File Systems
File system. There are too many content, it is recommended to make changes on the basis of the default option.
Introduce the following:
Quota Support: Quota can limit the upper limit of the hard disk space you can use for each user, which is very valid in the case of multi-user uses a host.
DOS FAT FS Support:
Support for the DOS FAT file format, you can support FAT16, FAT32.
ISO 9660 CD-ROM FILE SYSTEM Support: The disc is used by the ISO 9660 file format.
NTFS File System Support: NTFS is the file format used by NT, you have to select it in the Mount NTFS partition under Linux. Remember at Mount,
Only IOCHARSET = CP936 can be added, CODEPAGE = 936 cannot be added.
/ proc file system support: / proc file system is Linux provided to users and systems
Mutual channels, suggestions, otherwise some features cannot be executed correctly.
There are also three major categories to regulate it here: NetWork File Systems,
Partition Types, Native Language Support (Local Language Support).
It is worth mentioning that both of the NetWork file systems: NFS and SMB are Linux and
Windows accesses the file system used by each other in the form of a network neighbor, and selects it as needed.
/ 24 Console Drivers
Default
/ 25 Sound
What kind of sound card you use? Select.
/ 26 USB Support
Very important, at least choose the following options
Support for USB
Uchi Alternate Deriver (JE) Support
Ochi (Compaq, IMACS ...
USB Audio ...
USB MIDI ...
USB Human Interface Device (Full HID) Support
HID Input Layer Support
/ dev / hiddev raw hid ...
USB LCD DEVICE Support
Because the even hardware requires USB HID support, so there is a lot here.
* If some options are not allowed, you can refer to: /usr/src/linux-2.4/documentation/configure.help
You can also see which files are in Search's entire system and see related words:
#find / usr -name "*. *" -Print -Exec GREP
-q -s mousedev {} /; -print
This long order is useful
8.4 Don't forget to save your configuration to a file, otherwise you have to re-selection when compiling!
Load Configuration from File
Such as saved to /Home/kilvon/conf/kernel-kilvon.001
8.5 Read the following command to make it effective:
#make dep
#make clean
9. Start compiling kernels and modules
#make bzimage
#make modules
#make modules_install
10. Move the compiled file to / boot; if it is wrong above, most of the situation is due to
When you configure the kernel option, some current version can only be compiled into modules to compile into the kernel,
I have encountered this situation several times. I should be sure
Www.kernel.org Publish a stable kernel,
(I don't have Down, these alpha, beta version) 90% 9 can be successfully compiled.
#move /usr/src/linux-2.4/system.map /Boot/system.map-2.4.20-kilvon.001
#move /usr/src/linux-2.4/arch/i386/boot/bzimage
/BOOT /VMLINUZ-2.4.20-kilvon.001
#RM -F System.map
#RM -F VMLinuz
#LN -S /BOOT/SYSTEM.MAP-2.4.20-kilvon.001 /boot/system.map
#LN -S /BOOT/VMLINUZ-2.4.20-kilvon.001 / boot / vmlinuz
11. Do some end:
# New-kernel-pkg --install - DepMod --Mkinitrd 2.4.20-kilvon.001
- Mkinitrd is Initial Ramdisk, you can take a picture directly Mkinitrd -h
--Depmod Check the kernel in the kernel unresolved Symbol
- Install a startup option in GRUB
12. Take a look at the relevant explanation of step 7.2, now please modify the /boot/grub/grub.conf file,
The following is a modified grub.conf:
DEFAULT = 2
TIMEOUT = 10
SplashImage = (HD0, 6) /grub/splash.xpm.gz
Title psyche (2.4.20-kilvon.001)
Root (HD0, 6)
Kernel /Vmlinuz-2.4.20-kilvon.001 Ro root = / dev / hda8
Initrd /initrd-2.4.20-kilvon.001.img
Title Psyche (2.4.18-14 standard)
Root (HD0, 6)
Kernel /Vmlinuz-2.4.18-14.standard Ro root = label = / hdc = IDE-SCSI
Initrd /initrd-2.4.18-14.standard.img
Title Windows 2000
Rootnoverify (HD0, 0)
ChainLoader 1
13. Let's check if the file name under / boot is tapped (there are many MVs, CP actions in front)
[root @ localhost boot] # l l
Total 8880
5824 September 6 04:53 Boot.b
612 September 6 04:53 chain.b
42150 September 5 01:47 Config-2.4.18-14
1024 March 5 21:32 GRUB
130983 March 5 03:49 INITRD-2.4.18-14.img130983 March 4 20:21 Initrd-2.4.18-14.standard.img
65499 March 5 21:31 INITRD-2.4.20-kilvon.001.img
473 March 5 03:49 kernel.h
12288 March 5 03:44 Lost Found
23108 Sep 2006 22:05 Message
21282 Sep 2006 22:05 Message.ja
21 March 5 03:49 Module-Info -> Module-Info-2.4.18-14
15436 September 5 01:47 Module-Info-2.4.18-14
15436 March 4 20:21 Module-Info-2.4.18.standard
16834 March 5 21:17 Mykernelsetup-kilvon.001
640 September 6 04:53 OS2_D.B
28 March 5 19:32 System.map -> system.map-2.4.20-kilvon.001
507814 September 5 01:47 System.map-2.4.18-14
507814 March 4 20:20 System.map-2.4.18-14.standard
588175 March 5 21:24 System.map-2.4.20-kilvon.001
3236438 September 5 01:47 vmlinux-2.4.18-14
31 March 5 12:51 VMLinuz -> /Boot/vmlinuz-2.4.20-kilvon.001
1125194 September 5 01:47 VMLinuz-2.4.18-14
1125194 March 4 20:19 vmlinuz-2.4.18-14.standard
1458790 March 5 21:24 VMLinuz-2.4.20-kilvon.001
14. Ok, come on:
#reboot
15. If there is any fault, it is unable to start. If this goes back to the GRUB console and start with the previous kernel, remember? The "additional" work in step 7 will save you a lot of time at this time ...
16. If the system can start to the login screen and can be logged in, but there is a failed item during the startup process, see: /var/log/boot.log or this directory search, see what is the problem, I will encounter similar problem,
Later, by changing the configuration of the kernel, solves these annoying red texts