Linux System Management 12---Kernel compilation upgrade

Source: Internet
Author: User
Tags echo command

First, the Core Foundation

1. Kernel www.kernel.org

2, kernel core stored in:/boot/vmlinuz-version, with the uname-r command to query the version number.
Kernel modules stored in:/lib/modules/version


3. Linux kernel Design: Single core + module

4, User space access, monitoring the kernel way: by modifying/proc,/sys, the contents of the files in these two directories, to access, modify, monitor the characteristics of the kernel.

/proc: Most of them are read-only.
/proc/sys: Most are readable and writable.
How to set the kernel values:
Modify the file under the/proc/sys, can not be opened directly with VIM (the following methods, restart will expire, can immediately take effect)
(1) To use the echo command.
such as: Echo >1/proc/sys/vm/drop_caches
(2) sysctl command. Sysctl-w Vm.drop_caches=1

A permanent, but not immediately effective method:
After you modify the/etc/sysctl.conf file, the execution sysctl-p can take effect permanently.
Sysctl-a View all kernel parameter values.


5. Kernel Module Management

Lsmod command: View all modules loaded by the kernel.

Modproble Module Name: Loading a module

MODPROBLE-R Module Name: Uninstalls a module.

Modinfo Module Name: View the specific information and dependencies of the module.

Insmod module Path: Load module. Use Modinfo to find the module path first.
RMMOD Module Name: The Unload module is the same as the Modproble-r function.

The kernel module must be fully consistent with the kernel version.

6, core non-core functions at compile time can do three kinds of choices:
Do not use this feature
Compiling into kernel modules
Compile into kernel


Second, manually compile and upgrade the kernel

1, download the appropriate kernel, and then extract to the/USR/SRC directory.
2, to the extracted kernel directory to do a soft link in the current directory. such as; Ls-s linux-3.0.40 Linux
3, to Linux installation development tools and development library, that is, GCC and ncurses-devel-5.7-3.20090208.el6.x86_64.rpm software.
4, in the kernel directory, that is,/usr/src/linux directory, input make menuconfig, Menuconfig graphical interface. Also make xconfig or makes Gconfig, you must first install the two desktop programs to use.
5, Menuconfig Interface Introduction:

(1) Operation: * To compile into the kernel, M-form into the module, empty means do not compile this function, with the spacebar to cycle the three options.

After selecting all the options in Menuconfig, save exit, and a. Configure file is generated under current source directory Linux.
Because the. Configure file is easy to select errors, in order to ensure the correctness of the configuration, we can go to the/boot directory, the running kernel configuration files copied to the current Linux directory, After replacing the current. Configure file, go to the Menumconfig program and modify it so that the success will be maximized.

6. Make Bzimages//create a compressed kernel image
7. Make modules//compile module

Note: The make command can replace steps 6 and 72 above.

8, make modules_instll first install the module (it is recommended to prepare the original module data before running this command, because after running this command will overwrite the original, stored in the/lib/modules/kernel version of the directory)
9. Make install kernel.
10. Enter the grub.conf configuration file in the/boot/grub directory and change the default boot kernel to the new kernel number. 0 represents the first, and 1 represents the second one.


Third, kernel main file

1. Kernel Required files: Kernel file image and vmlinuz-version number and System.map file.
The two files are automatically copied to the boot directory after compiling and executing make install.

Manual Copy Method:
cp/usr/src/linux/arch/x86/boot/bzimage/boot/vmlinuz-3.0.40//Copy the compiled kernel image to the/boot directory and change the name to vmlinuz-3.0.40.

cp/usr/src/linux/system.map/boot/system.map-3.0.40//Manually copy the System.map file to copy to the/boot directory


Iv. Common error resolution at compile time
1. When using make install kernel in VMware virtual machine, prompt
ERROR:modinfo:could not find module Vmware_balloon cannot find the Vmware_balloon modules.
There are 2 reasons:
First, confirm that your. config file has config_vmware_balloon=m in it, or you can use make menuconfig to go to the Kernel compilation menu, select Device Drivers, MISC devices-& Gt VMware Balloon Driver is M or *
Second, and this module in the later version, has been renamed to Vmw_balloon, so you can use the following command to solve:
Cd/lib/modules/3.x.xx/kernel/drivers/misc #将版本号改成你自己的
Ln-s Vmw_balloon.ko Vmware_balloon.ko #建立软连接
The last make install when there are many could not find module XXXX error, and you do not know that it corresponds to the. config in which the time, you can use this command: Grep-r--include=makefile ' \bna me\.o\b '

2. When you use make menuconfig in the kernel in the advanced version of Ubuntu: ' Make Menuconfig ' requires the ncurses libraries.
The ncurses library needs to be installed and installed using the Apt-get install Libncurses5-dev

This article is from the "Network Line World" blog, please make sure to keep this source http://kuangkuang.blog.51cto.com/838/1678946

Linux System Management 12---Kernel compilation upgrade

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.