This article introduces RedHatAS4 Kernel configuration change and re-compilation-general Linux technology-Linux programming and kernel information. The following is a detailed description. I. kernel memory configuration check:
You can use the following method to check whether the kernel supports 64 GB memory at startup.
First, find out which kernel is used during startup
[Root @ study ~] # Cat/boot/grub. conf
...
Default = 0 (indicating that the first entry is started by default)
Timeout = 5
Splashimage = (hd0, 0)/grub/splash.xpm.gz
Hiddenmenu
Title Red Hat Enterprise Linux AS (2.6.9-34. ELsmp)
The corresponding kernel compilation file during installation is
/Boot/config-2.6.9-34.ELsmp
Check high memory support
[Root @ study ~] # More/boot/config-2.6.9-34.ELsmp | grep 4G
# CONFIG_X86_4G is not set
# CONFIG_X86_4G_VM_LAYOUT is not set
# CONFIG_HIGHMEM4G is not set
CONFIG_HIGHMEM64G = y indicates that 64 GB memory is selected during kernel compilation,
Only 4G Support is similar:
[Root @ study ~] # More/boot/config-2.6.9-34.EL | grep 4G
# CONFIG_X86_4G is not set
# CONFIG_X86_4G_VM_LAYOUT is not set
CONFIG_HIGHMEM4G = y
# CONFIG_HIGHMEM64G is not set
-----------------------
Ii. customized kernel:
-----------------------
If you want to change the kernel's support for high memory, you need to re-compile the kernel. There are two methods to customize the kernel
1) redhat is proprietary. An rpm kernel package can be obtained in the middle for installation or sharing with others.
2) It is used in all linux distributions and will not get the rpm package to generate your customized kernel from the original code.
Only the first type is described here.
Warning:
The customized kernel is out of service scope and support process. This may cause your system to lose the RedHat Support Service. At your own risk.
If you want to change the Kernel configuration of a redhat system that has been put into operation, follow the steps I mentioned to minimize the impact.
1. Check related Toolkit
[Root @ study ~] # System-config-packages
On the "add or delete software package" page that appears, select "development tools" and check its details,
Kernel-devel, kernel-smp-devel, kernel-hugemem-devel, they will generate the following folders:
If you have not registered a Red Hat Network, you can only download and install it manually. (I guess this package can be found on the CD, but I cannot test the CD)
Compile all the packages on the i686 platform (here the uname-m command will get the i686 result), so that all the packages described above will be generated,
Or change to rpmbuild-bb -- target = 'uname-M'./The kernel-2.6.spec to compile only non-src. rpm.
All packages are generated under/usr/src/redhat/RPMS/i686.
If you only need sourcecode and not all rpm packages, modify the following lines when modifying the spec file:
% Ifarch noarch
% Define builddoc 1
% Define buildsource 0 --------------- here 0 is changed to 1
Use rpmbuild-ba -- target = noarch./kernel-2.6.spec during compilation so that only sourcecode and doc packages are compiled,
It saves a lot of time.
3. Configure the kernel
To identify our customized kernel in the future, we can distinguish it from the existing kernel:
[Root @ study kernel-2.6.9] # cd/usr/src/redhat/BUILD/kernel-2.6.9/linux-2.6.9/
[Root @ study linux-2.6.9] # vi Makefile
Change EXTRAVERSION to the following format:
EXTRAVERSION =-custom-2.6.9-34
Because my/boot/config-2.6.9-34.EL kernel does not support 64 GB memory, I want to "clone" a new and support 64 GB memory.
[Root @ study linux-2.6.9] # diff. config/boot/config-2.6.9-34.EL compare the two configuration files,
Generally, there is no output, that is, no difference. If there is a difference:
[Root @ study linux-2.6.9] # cp/boot/config-2.6.9-34.EL. config
Cp: overwrite '. config '? Y
Our purpose is to modify the memory configuration only on the basis of the original. This. config file determines the options for compiling the kernel.
We do not recommend that you modify. config directly, but use the following method:
[Root @ study: linux-2.6.9] # make menuconfig
Select Processor type and features --->
Select High Memory Support (4 GB) --->
() Off
() 4 GB
(X) 64 GB
Exit, exit, and then exit. When the following information appears, select yes.
Do you wish to save your new kernel configuration?
4. Compile and install the kernel
There are two options. The results are consistent. Choose either of them.
1) at this time, you can create an rpm
[Root @ study linux-2.6.9] # make rpm
This kernel rpm package is installed
[Root @ study linux-2.6.9] # RPMS/i386/kernel-2.6.9custom2.6.934-2.i386.rpm rpm-ivh/usr/src/redhat/RPMS/
We can see that our new Kernel File vmlinuz-2.6.9-custom-2.6.9-34 is missing under/boot.
The 2.6.9-custom-2.6.9-34 folder is added under/lib/modules, which contains all modules of the new kernel.
Create a memory disk for our new kernel to ensure that the new kernel can be started
[Root @ study linux-2.6.9] # mkinitrd/boot/initrd-2.6.9-custom-2.6.9-34.img 2.6.9-custom-2.6.9-34
Add a new Kernel configuration in the configuration file of the boot loader grub.
[Root @ study: linux-2.6.9] # vi/boot/grub/conf
Default = 2 because the configuration segment of my new kernel is 3rd bits, the new kernel is used as the default startup Item.
...
Title Red Hat Enterprise Linux AS (2.6.9-34 custom)
The new kernel, initrd, and system. map are automatically copied to the/boot directory, and the new kernel is automatically added to the grub. conf startup list.
After completing one of the above two steps
The customized kernel is used when the system restarts.
[Root @ study linux-2.6.9] # reboot
Check the running status of the system and various services. If any error occurs, you can change the default value of/boot/grub. conf and select the original configuration segment,
After the restart, the original kernel is restored.
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.