Linux compiled kernel

Source: Internet
Author: User

To view the kernel:

#uname [OPTION]

[OPTION]

-R Displays the kernel version and the release number.


How user space accesses and monitors the kernel:

/proc

/sys


Pseudo File System:

Many files in the/proc/sys directory are readable and writable.

/sys Some files can be written


To set kernel parameter values:

Temporary effect, restart after the failure:

#echo VALUE >/proc/sys/file

#sysctl-W DIR. File=value

/proc/sys can be ignored in the/proc/sys directory, and the remaining paths are represented by Dir.file.


For example:

#echo 1 >/proc/sys/vm/dorp_caches

#sysctl-W Vm.dorp_caches=1

#sysctl-W kernel.hostname=test.com

#sysctl-W net.ipv4.ip_forward=1


Permanently valid, not immediately effective:

Modify the/etc/sysctl.conf file. After modification, use SYSCTL-P to let the system reread the file for immediate results.


The editing format is as follows:

DIR. File=value


#sysctl [OPTION] DIR. File=value

[OPTION]

-W temporarily changes the value of a parameter.


-p file loads the system parameters from the specified FILE and takes effect immediately. Load from/etc/sysctl.conf if not specified.


-a displays all kernel parameters and their values.



Kernel Module Management:

#lsmod lists the modules and module names that are loaded in the current kernel.

The display format is as follows:

Module name

Size sizes

Information such as used by usage, which file is called.


#modprobe [OPTION] modname loads a module with the name ModName. The dependencies between modules are processed.

[OPTION]

-R Unload Module


#modinfo modname View the module details.


#insmod moddir load module.


#rmmod modname unload the module.


#depmod moddir build dependencies between modules. and saved to the directory.



For example:

#lsmod |grep Floppy

#modproble-R Floppy

#modinf Mii

#insmod/lib/modules/kernel_version/kernel/drivers/net/mii.ko

#rmmod Mii



Features in the kernel, in addition to the core functionality, at compile time, most features have 3 choices:

1. Do not use this feature.

2. Compile into a kernel module.

3. Compile into the kernel.


Compile kernel:

0. Install the development libraries and tools:

#yum Groupinstall "Development Tools" "Development libaries"


1. After the kernel download is complete, the decompression is stored under/USR/SRC. You can create soft links to simplify access.


#tar-xf kernelfile-c/usr/src

/usr/src/kernelversion

#cd/USR/SRC

#ln-S Kernelversion simplename


2. Copy the current kernel's configuration file to the. config file of the kernel to be compiled. This effectively avoids a certain degree of the creation of the. config file because the feature selection is inappropriate or the dependency causes the failure to start, and multiple compilations are repeated.


#cp/boot/config-kernel_version/usr/src/simplename/.config


3. Start compiling:

#cd Simplename


Under the graphical interface:

Need to install the graphical interface Development library.


Used #make Geconfig GNOME environment. GNOME Software Development


#make kconfig KDE environment. KDE Software Development


Text:

#make Menuconfig

which

*: Compile into kernel.

M: Compiling into modules

Null: Do not use this feature.

#make

Install the kernel module #make modules_install.

#make Install


4. Compiling INITRD

Create a initrd file #mkinitrd initrdfile kernelversion.


Common scenarios for compiling kernels:


1. Interrupt during kernel compilation:

Use the screen tool.


2. Compile again after compiling:

Delete the entire folder and unzip it after the compilation.


Or

If necessary, back up the. config file first.

#make clean cleans up the previously compiled two-level module.

#make Mrproper Clean up all the operations that were previously compiled.


This article is from "Small Private blog" blog, please be sure to keep this source http://ggvylf.blog.51cto.com/784661/1614900

Linux compiled kernel

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.