Article title: change the Linux core. 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.
Author: ols3@www.tnc.edu.tw
Changing the Linux core is a problem that every Linux host manager often faces. This article concatenates some files for your reference.
Changing the Linux Kernel will be a little difficult for new Linux managers. In fact, you only need to try it several times and soon you will feel familiar.
In the early days of Linux Kernel replacement, only the original code was used for compiling. in recent years, the suite management mode has become popular, so there has been another new option. RPM is one of the most popular methods.
Note! No matter which method you plan to use, you should make a boot film first, just in case
The method for creating a boot pad is as follows:
1. uname-r
For example, the following message appears:
2.4.18-10
2. after placing it in the following command, put it into a blank disk:
Mkbootdisk -- device/dev/fd0
Complete command:
Mkbootdisk -- device/dev/fd0 2.4.18-10
Then you can change the core with peace of mind.
The following describes how to compile and install the original code: (by OLS3 technical file)
I. original code Kernel conversion:
Process:
1. go to ftp.tnc.edu.tw/sysop/Linux-kernels/
Or http://www.kernel.org to Download Linux core
Among them, version code 2.4 starts with the stable version (recommended), and 2.5 is the experimental version (not recommended ).
2. set the kernel option
3. Compile the kernel
4. compile modules and install modules
5. install kernel
6. set boot loader
7. Reboot
Steps:
1. cd: The linux directory under the decompressed Directory
2. make mrproper
3. make xconfig (menuconfig or config), which is saved as. config
This step is the most difficult, because you must understand the meaning of many options! This part is also a part of practice!
4. make dep
5. make bzImage
6. make modules
7. make modules_install
8. cp arch/boot/i386/bzImage/boot
9. edit/etc/lilo. conf or/boot/grub. conf.
10. example of modifying lilo. conf:
11.
12. boot =/dev/hda
13. map =/boot/map
14. install =/boot. B
15. prompt
16. timeout = 50
17. linear
18. default = linuxnew
19.
20. image =/boot/vmlinuz-2.2.14-5.0
21. label = linux
22. read-only
23. root =/dev/hda1
24.
25. image =/boot/bzImage
26. label = linuxnew
27. read-only
28. root =/dev/hda1
29.
30. ================================
31. sample of grub. conf modification:
32.
33. default = 0
34. timeout = 3
35. splashimage = (hd0, 0)/grub/splash.xpm.gz
36. title Red Hat Linux (2.4.18-10)
37. root (hd0, 0)
38. kernel/vmlinuz-2.4.18-10 ro root =/dev/hda3
39. initrd/initrd-2.4.18-10.img
40. title Red Hat Linux (2.4.18-5)
41. root (hd0, 0)
42. kernel/vmlinuz-2.4.18-5 ro root =/dev/hda3
43. initrd/initrd-2.4.18-5.img
44. title Red Hat Linux (2.4.18-3)
45. root (hd0, 0)
46. kernel/vmlinuz-2.4.18-3 ro root =/dev/hda3
Initrd/initrd-2.4.18-3.img
47. run lilo-v. if grub is used, it is not necessary.
48. reboot
· For the sake of security, we should keep the old core in lilo, so as not to start up in case of any problems with the new core.
Note:
1. make mrproper removes unnecessary residual files from the previous conversion of the core, which can avoid unnecessary interference to the original code directory tree. when you execute make mrproper, the configuration file is cut down. config. if you think it is important, back up it.
2. make config is a text option mode and a traditional method. the disadvantage of this method is that you cannot go back during the selection.
Make menuconfig is the text menu mode.
Make xconfig is a graphic menu mode and requires X Windows. (this mode is recommended)
When making config, it will first execute/bin/sh scripts/Config arch/i386/config. in
2. use RPM to replace the core:
Note that your hard drive is IDE or SCSI, and your host CPU is single or dual!
In addition, I suggest you install urh before replacing the core, and update most of the kits automatically. It also updates the RPM related to the core, such as kernel-header *. rpm: the following actions are performed after urh is executed!
A. If it is an IDE hard drive, the replacement method is very simple:
1. if autoURPM (ftp.tnc.edu.tw/sysop/urh) is installed,
Cd/var/spool/autoupdate
Rpm-ivh kernel-2.2.19-6.2.16 *. rpm
If autoURPM is not installed,
You can go to the tutorial network center ftp.tnc.edu.tw/sysop/rpms to download
Kernel-2.2.19 *. rpm
For dual-CPU, install the kernel-smp *. rpm suite.
2. edit/etc/lilo. conf to the following:
Boot =/dev/hda
Map =/boot/map
Install =/boot. B
Prompt
Timeout = 50
Linear
Default = linuxnew
Image =/boot/vmlinuz-2.2.14-5.0
Label = linux
Read-only
Root =/dev/hda1
Note! Your boot zone may not be/dev/hda1
It depends on the original settings of your host lilo. conf.
3. lilo-v
4. restart the instance. (note that the new core is used to start the instance)
If you use GRUB to start the instance, you only need to execute the following command:
Rpm-ivh kernel-2.2.19-6.2.16 *. rpm
No need to modify/boot/grub. conf
This is because when the kernel RPM kit is installed, it will automatically help you modify grub. conf
The only thing you need to do is change the boot sequence in grub. conf to the new core.
For example, the following default = 0 indicates that the system is powered on by the latest kernel.
Default = 0
Timeout = 3
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Title Red Hat Linux (2.4.18-10)
Root (hd0, 0)
Kernel/vmlinuz-2.4.18-10 ro root =/dev/hda3
Initrd/initrd-2.4.18-10.img
Title Red Hat Linux (2.4.18-5)
Root (hd0, 0)
Kernel/vmlinuz-2.4.18-5 ro root =/dev/hda3
Initrd/initrd-2.4.18-5.img
Title Red Hat Linux (2.4.18-3)
Root (hd0, 0)
Kernel/vmlinuz-2.4.18-3 ro root =/dev/hda3
Initrd/initrd-2.4.18-3.img
B. SCSI hard drive:
If it is a SCSI hard drive and/boot has an initrd image
Do one more action: (Note: If you are installing a version later than RedHat 7.2,
Similar to the IDE hard drive,
Use rpm-ivh kernel *. rpm to upgrade)
Image =/boot/vmlinuz-2.2.19-6.2.16
Label = linuxnew
Root =/dev/sda1 (depending on your original root =/dev/sda ?? )
Initrd =/boot/initrd-2.2.19-6.2.16.img
Read-only
Then lilo-v
Reboot Once
Of course, boot bootdisk must be prepared first.
If not ?, You can directly upgrade the RedHat 7.3 CD.
Upgrade the suite in large quantities with urh-7.3. (Download Address: ftp.tnc.edu.tw/sysop/urh)
(The above is the response of OLS3 in the network management forum)
C. You may encounter the following problems! (SCSI hard drive)
Below is a transcript of the two advanced network management dialogs in the discussion area of the county Network Management Forum, which may be helpful to you.
======================================
Sammy message:
LI
No more than two words.
Fortunately, I have a boot chip for the old kernel,
Temporarily enable the server to work with the boot chip
I guess it's lilo-v.
My computer thinks my boot disc is hda,
So I write the boot program into hda, but my real boot disc is sda.
But I do not know whether the actual situation is like this.
Currently, only magnetic films can be used for boot.
What should I do?
======================================
Hsmhsm replies to sammy as follows:
When I went to Zhongshan for a class, the teacher said that the ide hard drive would be read first.
So he added two rows in the middle of the first two rows.
(But when the fashion is trustix)
Boot =/dev/sda
Disk =/dev/sda
Bios = 0x80
Map =/boot/map
Do you want to try it if you have a boot chip ??
======================================
Sammy replies to hsmhsm as follows:
From the summer vacation till now,
I have been using the boot pad for a month.
I finally have a try today.
After the two lines are added,
Thanks for the success.
D. In addition, there are two documents. we suggest you take a look at them first!
1.: RedHat/rhl-cg-en-7.2/kernel.html
2.: Upgrading the Linux Kernel on Red Hat Linux systems
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