Complete kernel compilation steps and instructions in RedHat8.0
Source: Internet
Author: User
Article title: complete kernel compilation steps and instructions in RedHat8.0. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
**************************************** *******************************
* Many of the following steps are basic commands or explanations, because I am a beginner in linux,
* Many detours were taken during the compilation process and it took a lot of time to find various solutions.
* I have written all the corresponding commands and want to get started soon just like me.
* It is helpful for beginners to compile the kernel!
*
* Kilvon 05-Mar-2003
**************************************** ******************************
Basic compilation description: The current version is RedHat linux 8.0.
(The machine has dual operating systems: linux and windows 2000)
The kernel version is 2.4.18-14, and the hardware is a model of the compaq notebook,
The downloaded kernel version is 2.4.20 (available on www.kernel.org ),
We recommend that you use a later version to compile the kernel instead of the previous version,
For the reason, see step 7.1.
Before compilation starts, we recommend that you use the relevant software in windows to create
Detailed statistics, including hardware types, manufacturers, chip versions, and so on, especially laptops
And brand machines, because many of their components are from OEM and other manufacturers, and print them
Used to configure the kernel. (for linux, you can also use the system tool.->
Hardware browser)
In addition, it is recommended that you prepare several sheets of paper and pen at your side to take down the information you think is important at any time,
Of course, the error information is included to help identify and solve the problem in the future.
1.copy the internal source code package linux-2.4.20.tar.bz2 to the/usr/src Directory:
# Cp linux-2.4.20.tar.bz2/usr/src
# Cd/usr/src
2. delete the symbol link pointing to the previous kernel version.
# Rm-f linux-2.4
3. use the following command to uncompress the compressed package
# Bzip2-d linux-2.4.20.tar.bz2
# Tar-xvf linux-2.4.20.tar
4. create a new symbol 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 future compilation:
# Linux-2.4/cd/usr/src/
6. this command ensures that there is no incorrect. o file in the source code directory (that is, the object file, compile c language)
The purpose is to use the link when the code can be compiled in the next step .)
Dependencies. This command is not required for the first compilation of the source code package, but if you use this command multiple times
To compile the kernel with some source code, you must first run this command.
# Make mrproper
7. in order not to affect the available kernel (such as the linux kernel installed at the time of installation ),
Save the previous available kernels (to enable linux to be started if compilation fails ),
In addition, we need to easily identify the kernel identifier of this compilation. the following steps are as follows:
Compilation has nothing to do with it.
7.1 even if grub is used as the boot manager, modify the grub. conf file,
# Cp/boot/grub. conf/boot/grub. conf. bck
(We recommend that you print a copy of the original grub. conf file with conditions. for the reason, see step 7.4)
# Emacs/boot/grub. conf
(Emacs tips: ctrl + x + s is the result of saving, ctrl + x + c is to disable emacs,
Delete n lines of text: place the cursor at the beginning of the text to be deleted ctrl + u, and then press
Number of deleted rows, such as 4, and ctrl + k)
The following figure shows 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
Note that the two statements kernel... and initrd... must 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 it is used to compile a kernel of a higher version, not the same version.
The advantage of compiling a later version is that the system will create another directory instead
Overwrite the previous version with the newly compiled (possibly wrong) version. check the/lib/modules Directory.
You will understand .)
7.2 How do I know the partition on which your root directory "\" is located? Command:
# Df
The following are some outputs of an even machine:
Filesystem 1K-blocks Used Available Use % Mounted on
/Dev/hda8 4137264 2136592 1790508 55%/
...
It is important to see where your system root directory is installed, because you will see grub when the system installs the compiled kernel. root = LABEL =/hdc = ide-scsi
The following error may occur during 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 on
Therefore, modify the command in grub. conf to: root =/dev/hda8.
7.3 OK. after completing these preparations, we will --
Restart the machine, :) Don't worry. you should first confirm the correctness of the work in step 1 to avoid 7.1 errors.
In the subsequent steps. (you must be very careful when compiling the kernel, so you cannot be impatient. otherwise, hey ...)
7.4 if the system is faulty during the restart process, you can temporarily modify the grub reference on the grub boot interface.
Export parameters. related commands include:
E-edit pilot command
ESC key-return to the parent directory
O-insert a command line
B-start the boot system
D-delete a row
In fact, you can delete all the commands on the grub console (only this startup is affected), and then follow
Commands in/boot/grub. conf are manually typed in the grub console, which is the same effect.
7.5 if you can use the reconfigured grub command to correctly start the system, let's start the real
Compile the program !!!!
7.6 first ensure that we are in the compiled working directory:
# Linux-2.4/cd/usr/src/
Edit Makefile (this file is used to control compilation) and find this line:
EXTRAVERSION =
Modify to (for example, this compilation can also be any legal string, such as "-sema-v.4 ")
EXTRAVERSION =-kilvon.001
8. Compile in X Window:
# Make xconfig
8.1 if you are in text mode, use
# Make menuconfig
8.2 In fact, the most difficult part of the compilation process is the kernel parameter configuration. I spent a lot of time here,
Even worse, I didn't realize this at the beginning. I thought it was the use of those commands... so, let's take a look:
8.3 The principle of selection is to compile some functional code that is far away from other parts of the kernel and is not frequently used into a loadable module (which is far away? The degree of understanding of linux and Operating System Concepts, and the help of the configuration items are helpful to reduce the kernel length and reduce the memory consumed by the kernel, the impact on the kernel when the corresponding environment change of this function is simplified; do not select a function that is not required; compile some function code that is closely related to and frequently used by the kernel directly into the kernel. The following describes 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 test functions that are still in the experimental stage, such as khttpd and IPv6, you must
Select Y. otherwise, select N.
/2. Loadable module support
Module support. There are three items:
Enable loadable module support:
Unless you want to compile all the required content into the kernel, this item should be required.
Set version information on all module symbols:
You can leave it unselected.
Kernel module loader:
We recommend that you select the required modules when starting the kernel.
/3. Processor type and features
The CPU type has many options. I will not describe them one by one. The following are some of the related items:
Processor family:
Select the CPU type as needed.
High Memory Support:
Large memory capacity. It can be 4 GB or 64 GB.
Math emulation:
Co-processor simulation, co-processor is the darling of the 386 era, and now it is no longer used.
MTTR support: supported by MTTR. Optional.
Invalid Ric multi-processing support:
Supports multiple symmetric processing. Unless you are rich enough to have multiple CPUs, you do not need to choose.
/4. General setup
Here are some of the most common attributes. This part contains a lot of content. Generally, you can use the default settings. The following describes some frequently used options:
Networking support:
Network Support. this parameter is required and is recommended if no network adapter is available.
PCI support:
PCI support, required.
PCI access mode:
PCI access mode. Options include BIOS, Direct, and Any. select Any.
Support for hot-pluggabel devices:
Optional.
PCMCIA/carw.support:
PCMCIA/Caria support. it is required if PCMCIA is available.
System V IPC
BSD Process Accounting
Sysctl support:
The above three items are related to process processing/IPC calls, mainly System V and BSD.
If you are not using BSD, follow the default setting.
Power Management support: available for Power Management, especially for laptops.
Advanced Power Management BIOS support: Advanced Power Management BIOD support.
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