Kernel of Linux system start-up process

Source: Internet
Author: User

Kernel of Linux system start-up process


1, the kernel parameter modification method:

2, within Core kernel module management:

3, within Nuclear compilation

How user space accesses and monitors the kernel:/proc,/sys

Pseudo file System

/proc/sys: Many of the files in this directory are readable and writable

/sys/: Some files can be written

1, the kernel parameter modification method:

echo VALUE >/proc/sys/to/somefile

Sysctl-w kernel.hostname=


[[email protected] vm]# free-m
  total   used    free   shared    buffers     Cached
mem:     7983  541  7442  0  149  269
-/+ buffers/cache:  123   7860
Swap:& nbsp;   4094    0 4094
[[email protected] Vm]# echo 1 >/proc/sys/vm/drop_caches
[[email protected] vm]# free-m
 total  used & nbsp free  shared  buffers   Cached
mem:  7983  125   7857   0  0   9
-/+ buffers/cache:115  7867
swap:4094  0  4094

[Email protected] kernel]# sysctl-w Vm.drop_caches=1
Vm.drop_caches = 1
[Email protected] kernel]# free-m
Total used free shared buffers Cached
mem:7983 7857 0 0 9
-/+ buffers/cache:115 7868
swap:4094 0 4094


[Email protected] kernel]# cat /proc/sys/kernel/hostname
Localhost.localdomain
[Email protected] kernel]# echo wfx >/proc/sys/kernel/hostname
[Email protected] kernel]# hostname
Wfx

[Email protected] kernel]# sysctl-w kernel.hostname= "local.com"
Kernel.hostname = local.com
[Email protected] kernel]# hostname
Local.com


[Email protected] kernel]# cat /proc/sys/net/ipv4/ip_forward
0

[[email protected] kernel]# vim /etc/sysctl.conf # modified file permanently valid, but not immediately effective

# Kernel sysctl configuration file for Red Hat Linux

# for binary values, 0 are disabled, 1 is enabled. See Sysctl (8) and
# sysctl.conf (5) for more details.
# Controls IP Packet forwarding
Net.ipv4.ip_forward = 1 # 0 modified to 1
...

[[email protected] kernel]# sysctl-p # Immediate effect
Net.ipv4.ip_forward = 1
Net.ipv4.conf.default.rp_filter = 1
Net.ipv4.conf.default.accept_source_route = 0
KERNEL.SYSRQ = 0

[[email protected] kernel]# cat /proc/sys/net/ipv4/ip_forward # Verification
1

[Email protected] kernel]# sysctl-a |wc-l #显示所有内核参数及其值
635


2, within Core kernel module management:

Lsmod: View

Modprobe mod_name: Loading a module

Modprobe-r mod_name: Uninstalling a module

Modinfo mod_name: View specific information about the module

Insmod/path/to/module_file: Load Module

Rmmod mod_name: Uninstalling a module

Depmod/path/to/modiles_dir the kernel module must be the same version when installing the driver

[Email protected] kernel]# lsmod |grep Floppy
Floppy 95465 0
[Email protected] kernel]#Modprobe-rFloppy #删除模块floppy
[Email protected] kernel]# lsmod |grep Floppy
[Email protected] kernel]#modprobeFloppy #加载模块floppy
[Email protected] kernel]# lsmod |grep Floppy
Floppy 95465 0
[Email protected] kernel]#ModinfoFloppy
Filename:/lib/modules/2.6.18-164.el5/kernel/drivers/block/floppy.ko#file path
alias:block-major-2-*
License:gpl#License
Author:alain L. Knaff
srcversion:f532f52860888e835bb857c
depends:#No dependent modules
Vermagic:2.6.18-164.el5 SMP mod_unload gcc-4.1
Parm:floppy:charp
Parm:FLOPPY_IRQ:int
Parm:FLOPPY_DMA:int
Module_sig : 883f3504a8b7cf4bd273d74512bb1123df09e372bd75c92d020dd4b4fc61c617dd1534e826ec209f4bf9199f6f44b9471d2683a52c2b99aead71e


[[email protected] kernel]# modprobe-r floppy # Delete module floppy
[[email protected] kernel]# insmod floppy # mount module, instead of specifying a name, specify the file name path
Insmod:can ' t read ' floppy ': No such file or directory
[Email protected] kernel]# insmod /lib/modules/2.6.18-164.el5/kernel/drivers/block/floppy.ko
[[email protected] kernel]# lsmod |grep Floppy # Verify loading Module floppy success
Floppy 95465 0
[[email protected] kernel]# rmmod Floppy # Remove Module Floppy Method two
[Email protected] kernel]# lsmod |grep Floppy
[Email protected] kernel]#

3, within Nuclear compilation

Features in the kernel, in addition to the core functions, at compile time, most of the features have three choices:

1, do not use this function;

2, compile into kernel module;

3, compile into the kernel;

How to manually compile the kernel:

Make Gconfig:gnome desktop environment, need to install the Graphics Development Library Group: GNOME softwaredevelopment

Make KCONFIG:KDE desktop environment, need to install graphics development Library

[Email protected] yum.repos.d]#Yum grouplist
Loaded Plugins:rhnplugin, security
Repository CD-ROM is listed more than once in the configuration
This system isn't registered with the portal.
Portal support would be disabled.
Setting up Group Process
Cd-rom/group | 1.0 MB 00:00
Installed Groups:
...
Available Groups:
Authoring and Publishing
Development Libraries
Development Tools
...

[email protected] linux]# Yum groupinstall "Development Tools" "Development Libraries"-y

Running time: 10-100min

[email protected] yum.repos.d]# Yum grouplist
Installed Groups:

Development Libraries
Development Tools

...
Available Groups:
Authoring and Publishing
...


Kernel pack: https://www.kernel.org/pub/linux/kernel/v2.6/

14-aug-2004 11:13 43M

[Email protected] ~]# tar XF linux-2.6.8.1.tar.gz-c/usr/src/
[Email protected] ~]# cd/usr/src/
[[email protected] src]# ls
Kernels Linux linux-2.6.8.1 Redhat
[Email protected] src]# LN-SV linux-2.6.8.1 Linux
' linux/linux-2.6.8.1 ', ' linux-2.6.8.1 '
[[email protected] src]# ls
Kernels Linux linux-2.6.8.1 Redhat
[[Email protected] src]# CD Linux

[Email protected] linux]# Ls-al
...
-rw-r--r--1 root root 79210 2007-10-31 02:01. config

...

[Email protected] linux]# Cp/boot/config-2.6.23.1-42.fc8/usr/src/linux/.config
Cp:overwrite '/usr/src/linux/.config '? Y

[[email protected] linux]# ls-al # make two edits with native kernel version files to reduce the error rate

...

-rw-r--r--1 root root 79210 2016-11-19 15:49. config

...

[email protected] linux]# make menuconfig #必须在linux目录下执行后进入文本模式

30min--5h the edited settings into the. config

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/8A/6F/wKioL1gwBWfg4rW6AABtMjCyfVY249.png-wh_500x0-wm_3 -wmp_4-s_711200342.png "title=" compile kernel. png "alt=" wkiol1gwbwfg4rw6aabtmjcyfvy249.png-wh_50 "/>

1th step, make Menuconfig: Open the graphics window under text

2nd step, make

3rd Step, make Modules_install

4th step, make install


Screen command: The connection can be broken and opened again

Screen-ls: Displays the already established screen

Screen: Open a new display directly

CTRL + A, D: Remove screen, can restore back

Screen-r ID: Revert back to a screen

Exit: Exit

[email protected] linux]# Yum install screen

[R[email protected] ~]# Screen-ls
There is screens on:
8231.pts-4.fox (Detached)
8200.pts-0.fox (Detached)
2 Sockets in/var/run/screen/s-root.
[Email protected] ~]# screen-r 8231

Two compile-time cleanup, before cleaning, back up the configuration file, if necessary. config:

Making clean cleans up the prepared binary modules

Make Mrproper clears all remaining files, including the. config file

---end---

Kernel of Linux system start-up process

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.