RedHat Linux 8.0 Kernel compile steps and instructions _unix Linux

Source: Internet
Author: User
Tags bz2 parent directory

***********************************************************************
* Many of the following steps are very elementary commands or explanations, because I am a novice to Linux,
* In the process of compiling a lot of detours, spent a lot of time to find solutions, so
* The corresponding commands are written out, I hope to be the same as the introduction of the soon and want to
* The novice to compile the kernel helps!
*
* Kilvon 05-mar-2003
**********************************************************************

Basic Compilation Description: My current version is: RedHat Linux 8.0
(machines have dual operating systems: Linux and Windows 2000)
The kernel version is 2.4.18-14, and the hardware is a model of the notebook Compaq,
The kernel version of the download is 2.4.20 (available on www.kernel.org),
It is recommended that the kernel be compiled with a high version rather than compiled on a previous version.
See the explanation of Step 7.1

Before compiling, it is recommended that you first use the relevant software in Windows to make a
Detailed statistics, including hardware types, manufacturers, chip versions, etc., especially notebooks
and brand machine, because many of the parts are OEM other manufacturers, and to print it
For use when configuring the kernel. (Linux can also be used: System Tools->
Hardware browser to view)

It is also recommended that you prepare a few sheets of paper and pens beside you and keep in mind the information you deem important.
Of course, the error message is included to help judge and solve the problem later.

1. The kernel source package linux-2.4.20.tar.bz2 Copy to the/USR/SRC directory:
#cp LINUX-2.4.20.TAR.BZ2/USR/SRC
#cd/USR/SRC

2. Remove symbol link to previous kernel version
#rm-F linux-2.4

3. Unlock 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 is just unlocked
#ln-S linux-2.4.20 linux-2.4

5. Go to the working directory for later compilation shrimp:
#cd/usr/src/linux-2.4

6. This command guarantees that there is no incorrect. o file in the source code directory (that is, the object file, compiling the C language
Speech, the goal is to build the next step into the executable code when link is used, and the file's mutual
reliance on relationships. The first time you compile the source package that you just downloaded does not need this command, but if you use it more than once
Some source code to compile the kernel, then must run this command first.
#make Mrproper

7. In order not to affect the already available kernels (such as installing Linux in the kernel), you now need
Save the previous available kernels (so that the compilation fails to "easily" start Linux),
And we're going to identify an easily identifiable tag for this compiled kernel, with the following steps
Compilation is temporarily irrelevant.

7.1 I use GRUB as the boot manager, so to modify the grub.conf file,
#cp/boot/grub/grub.conf/boot/grub/grub.conf.bck
(It is recommended that you print a copy of the original grub.conf file, for reasons see step 7.4)
#emacs/boot/grub/grub.conf
(Emacs Tip: Ctrl + x +s to save the result, CTRL + X +c to close Emacs,
Delete N line text as: first place the cursor at the beginning of the text you want to delete Ctrl + U, and then type to
Number of rows deleted, such as 4, last Ctrl + K

Here's what I grub.conf:
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/hda8
Initrd/initrd-2.4.18-14.standard.img
Title Windows 2000
Rootnoverify (hd0,0)
Chainloader +1

Pay attention to kernel ... and initrd ... Two statements because you want to correspond to the following changes:
#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 I compile a high version of the kernel, not the same version
The kernel recompile, the advantage of compiling a high version is that the system will create another directory without
Overwrite the previous version with the newly compiled (possibly wrong) version, and look at the/lib/modules directory
I understand.)

7.2 How do I know your root directory "\" on which partition? The command is:
#df
The following is part of the output of the even machine:
FileSystem 1k-blocks Used Available use% mounted on
/dev/hda8 4137264 2136592 1790508 55%/
...

It is important to look at where your system root is installed, because you will see that the system installs the compiled kernel and root=label=/it in the grub.conf Insert command HDC=IDE-SCSI
The following error may be raised when booting the system:
Vfs:cannot Open Root Device "" or 00:00
Please append a correct "root=" boot option
Kernel panic:VFS:Unable to Mount root FS on 00:00
So to modify its command in grub.conf: root=/dev/hda8

7.3 Well, after these preparations, we will
Restart the machine,:) not urgent, should be first to confirm the correctness of the 7.1-step work, so as to avoid 7.1 errors
Take it to the next step. (Compile the kernel must be very cautious, not impatient, otherwise, hehe ...)

7.4 If there is a problem with the system during reboot, you can temporarily change the Grub primer on the Grub Boot interface
Guide parameters, related orders are:
e-Edit Boot command
ESC key-Go back to the parent directory
O-Insert a line command
B-Start booting the system
D-delete a row
You can actually delete the commands on the Grub console (which only affects this startup), and then follow
The/boot/grub/grub.conf's command, which was manually tapped on the Grub console, was equally effective.

7.5 If you can use the reconfigured Grub command to start the system properly, let's start the real
Compile work!!!!

7.6 To ensure that we are in the compiled working directory:
#cd/usr/src/linux-2.4
Then edit the makefile (this file is used to control the compilation) and find this line:
Extraversion =
Modified to (as an example of even this compilation, it can also be any legitimate string, such as "-sema-v.4")
Extraversion =-kilvon.001

8. I compile under X window:
#make Xconfig

8.1 If you are in text mode, use the
#make Menuconfig

8.2 In fact, the most difficult part of the compilation process is the configuration of kernel parameters, I spent a lot of time here,
Even worse, the beginning did not realize this, thought is the use of those commands ... So, let's see:


8.3 The principle of choice is to compile the partial functional code that is far away from the other parts of the kernel and not often used as a loadable module (which is far away?). Look at the understanding of Linux and the concept of operating systems, as well as the help of the configured items, to reduce the length of the kernel, reduce the memory consumed by the kernel, Simplify the impact of the corresponding changes in the environment on the kernel, do not choose the features you do not need to compile into the kernel, with some of the functional code that the kernel cares about closely and often uses. The following are a few of the common options:

/1. Code Maturity Level Options
Code maturity level. There is only one item here:
Prompt for development and/or incomplete code/drivers
If you want to experiment with functions that are still in the experimental stage, such as KHTTPD, IPV6, etc., you must
Select the item y, or you can select it as N.

/2. Loadable Module Support
Support for the module. Here are three items:

Enable loadable Module Support:
Unless you are ready to compile all the required content into the kernel, the item should be optional.
Set version information on the All module symbols:
You can not choose it.
Kernel Module Loader:
It is recommended that the kernel have the ability to load the required modules at startup.

/3. Processor Type and Features
CPU type, a lot of options, not to be introduced, the relevant several are as follows:

Processor Family:
Select the CPU type according to your own situation.
High Memory Support:
Large-capacity memory support. can support to 4G, 64G, generally can not choose.
Math emulation:
Coprocessor Simulation, coprocessor is the darling of the 386 era, now no longer used.
MTTR support:mttr Support. I don't choose.
Symmetric multi-processing Support:
Symmetric multi-processing support. Unless you're rich with multiple CPUs, you don't have to choose.

/4. General Setup
Here are some of the most common properties to set. This part of the content is very much, generally use the default settings on it. Here are some of the most frequently used options:

Networking Support:
Network support, must be selected, no network card is also recommended to select.
PCI Support:
PCI support, required.
PCI access mode:
PCI access mode. Available with BIOS, direct, and any, select any.
Support for Hot-pluggabel devices:
Hot-swappable device support, optional.
Pcmcia/cardbus Support:
Pcmcia/cardbus support, there is a PCMCIA will be selected.
System V IPC
BSD Process Accounting
SYSCTL Support:
The above three items are about process processing/IPC calls, mainly the System V and BSD two styles.
If you are not using BSD, follow the default.
Power Management Support: powered management support, optional, especially for notebooks.
Advanced Power Management BIOS Support: Advanced source management biod support.

/5. Memory Technology Device (MTD)
MTD Device Support
I don't choose.

/6. Parallel Port Support
Serial port support. If you don't intend to use a serial port, don't choose.

/7. Plug and Play Configuration
Plug and Play support. Choose, you can experience the Linux Plug and play feeling.

/8. Block devices
Block device support needs to be selected for each person's specific situation:

Normal PC floppy disk support: General PC floppy support, general to choose, my No,
There's no choice.
XT Hard disk Support:
Compaq SMART2 Support:
Mulex dac960/dac1100 PCI RAID Controller support:raid mirroring.
Loopback Device Support:
Network blocks device support: Network block device support. If you want to access your Network Neighborhood's
Something, just pick it up.
Logical Volume Manager (LVM) Support: Logical volume management support.
Multiple devices Driver support: Multi-device driver support.
RAM disk Support:ram disk support.

/9. Networking options
Network options. The network protocol is configured here. See for yourself.
In addition to be sure to select the TCP/IP networking, other see do it

/10. Telephony Support
Linux can support calling cards, so you can use a regular phone on IP to provide voice services. See Help content for details.

/11. ATA/IDE/MFM/RLL Support
This is for the various interfaces of hard disk/optical drive/tape/floppy support, too much content, using the default
option, I have a PCMCIA card, each machine is different.

/12. SCSI Support
SCSI device Support, if you use a SCSI hard drive/CD/DVD/tape device, you can find it yourself.

/13. IEEE 1394 (FireWire) support
I'm gray, don't worry,:))

/14. I2O Device Support
Used in the Intelligent input/output (I2O) system interface, no, use the default bar.

/15. Network Device Support
Network device support. The choice of the protocol, now the selection of equipment.
In order to avoid trouble, compile into the kernel well, do not select m, select Y. Be patient, generally you can find your own network card. If not, you have to go to the manufacturer to be driven,
or go see www.mydrivers.com.

/16. Amateur Radio Support
No, not a choice.

/17. IrDA (infrared) support
This wants infrared support, I have.

/18. ISDN Subsystem
If you use ISDN to surf the Internet, this is essential.

/19. Old CD-ROM drivers (not SCSI, not IDE)
Specifically for the CD-ROM scsi/ide, but who is still using so old Dongdong Ah, choose it yourself.

/20.input Core Support
This option is very important, except joystick (game remote joystick) is recommended to choose "M". Remember!

/21. Character devices
Character devices. This content is too much, first use the default settings, you need to modify yourself:

I2C SUPPORT:I2C is a low speed serial used in Philips's highly-driven micro-control application
Bus protocol. This is required if you want to select the video for Linux below.
Mice: Mouse. If it is a notebook, it is recommended that the bus Mouse support selected "Y".
Joysticks: Handle. Even under Linux, it doesn't make sense to drive the handle.
Watchdog Cards: Although called Cards, this can be achieved with pure soft, of course, there are
Hardware. If you select this, you will create a name in your/dev.
Watchdog file, it can record the operation of your system until the system is re
Started about 1 minutes. With this file, you can restore the system to the state before the reboot.
Videos for Linux: Support for related audio/video cards.
Ftape, the floppy tape device driver:
PCMCIA Character Device Support:

/22.multimedia devices
For capturing Audio/video use, if interested to see Help

/23. File Systems
File system. There is too much content, and it is recommended that you modify it based on the default options.
Introduces the following:

Quota Support:quota can limit the amount of hard disk space that can be used by each user, and is very effective in situations where multiple users use a single host together.
DOS FAT FS Support:

DOS FAT file format support, can support FAT16, FAT32.
ISO 9660 CD-ROM file system support: The CD uses the ISO 9660 file format.
The NTFS file system SUPPORT:NTFS is the format used by NT, and if you are going to mount an NTFS partition under Linux, you must select it. Remember when the Mount,

Only iocharset=cp936 can be added, codepage=936 cannot be added.
The/proc File system Support:/proc filesystem is supplied by Linux to users and systems for delivery
Mutual channel, recommend to choose, otherwise some function cannot execute correctly.

There are three other big classes that are here: Network file Systems (Network file system),
Partition Types (partition type), Native Language Support (native language support).
It's worth mentioning two of the network File Systems: NFS and SMB, respectively, Linux and
Windows accesses each other's file systems in the form of a network neighbor and chooses them as needed.

/24 Console Drivers
With the default

/25 Sound
What sound card do you use? Choose it.

/26 USB Support
It is important to select at least 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 a lot of my hardware requires USB HID support, so there are a lot of choices

* If there are certain options that are not allowed, you can refer to:
/usr/src/linux-2.4/documentation/configure.help
You can also search the entire system and see what files appear in the relevant text:
#find/usr-name "*.*"-print-exec grep
-q-s Mousedev {} \; -print
This long command is useful.

8.4 Don't forget to save your configuration to a file, otherwise the next time you compile it again!
Load Configuration from File
Like saving to/home/kilvon/conf/kernel-kilvon.001.

8.5 To use the following command to read just the configuration data to make it effective:
#make DEP
#make Clean

9. Start compiling kernel and module
#make Bzimage
#make Modules
#make Modules_install

10. Move the compiled file to/boot; if there is a mistake above, most of the cases are due to
When configuring kernel options, some of the current versions can be compiled into the kernel only modules.
I have met several times like this. should be for since Www.kernel.org released a stable kernel,
(I do not down those 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. To do some finishing work:
#new-kernel-pkg--install--depmod--mkinitrd 2.4.20-kilvon.001
--MKINITRD for initial RAMDisk, you can just knock a mkinitrd-h to see
--depmod Check if there are unresolved symbol in the kernel
--install Install a startup option in Grub

12. Take a look at the relevant explanations in step 7.2, now modify the/boot/grub/grub.conf file,
The following are the 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. Take a good look at the/boot under the name of the right to knock (there are a lot of MV,CP action in front)
[Root@localhost boot]# LL
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.img
130983 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 September 6 22:05 message
21282 September 6 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 the error fails to start, this goes back to the Grub console and starts with the previous kernel, remember? The "extra" work in the 7th step will save you a lot of time ...

16. If the system can boot to the login interface and can log in, but the boot process has failed items, view:/var/log/boot.log or the directory search for a while to see what the problem, I encountered a similar problem,
Later, by changing the configuration of the kernel compiler to solve these nasty red text, okay, it's written here
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.