Linux Kernel compilation steps (novice) solution-general Linux technology-Linux programming and kernel information. The following is a detailed description. For new linux users, it is relatively difficult to compile the kernel, and I don't even know how to start with it. Now I have summarized it and wrote this article as a detailed step, I hope this will be helpful to new users.
1. Install the kernel
If the kernel has been installed (the/usr/src/directory has a linux subdirectory), skip if not installed, place the linux installation CD in the drive, find the kernel-source-2.xx.xx.rpm file (xx represents a number, indicates the version number of the kernel), such as RedHat linux RPMS directory is/RedHat/RPMS/directory, and then use the command rpm-ivh kernel-source-2.xx.xx.rpm to install the kernel if no disk is installed, you can go to the linux site or www.kernel.org to download the package.
2. Clear the residual. o files and unnecessary associations during previous kernel compilation.
Cd/usr/src/linux
Make mrproper
3. Configure the kernel and modify relevant parameters. For more information, see make xconfig in the graphic interface. On the Character interface, make menuconfig correctly sets kernel options in the Kernel configuration menu and saves and exits.
4. correctly set the associated file
Make dep
5. Compile the kernel
For large kernels (such as SCSI support), make bzImage
For small kernels, make zImage
6. Compilation Module
Make modules
7. Installation Module
Make modules_install
8. Use the new kernel
Copy the new Kernel File bzImage/zImage in the/usr/src/linux/arch/i386/boot/directory to the/boot directory,
Then modify the/etc/lilo. conf file, add a startup option, and start it with the new kernel bzImage/zImage. The format is as follows:
Boot =/dev/hda
Map =/boot/map
Install =/boot. B
Prompt
Timeout = 50
Linear
Default = linux-new ### tell lilo to start linux using the new kernel by default ###
Append = "mem = 256 M"
Image =/boot/vmlinuz-2.2.14-5.0
Label = linux
Read-only
Root =/dev/hda5
Retain the old boot options to ensure that the new kernel cannot be booted. You can also perform other operations in linux.
After saving and exiting, do not forget the most important step. Run/sbin/lilo to make the modification take effect.
9. regenerate the ram disk
If/etc/lilo. conf does not use the ram disk option initrd, skipped If/etc/lilo in your system. conf uses the ram disk option initrd, and uses the mkinitrd initrd-kernel version number command to regenerate the ram disk file, such as my Redhat 6.2:
Mkinitrd initrd-2.2.14-5.0 2.2.14-5.0
Then point initrd in/etc/lilo. conf to the new initrd-2.2.14-5.0 file:
Initrd =/boot/initrd-2.2.14-5.0
The ram disk can optimize the system performance as much as possible. For details, see the/usr/src/linux/Documents/initrd.txt file.
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