Linux system startup process (2)

Source: Internet
Author: User

Kernel design style:

RedHat, SUSE
Core: Dynamic load kernel module
Kernel:/lib/modules/"kernel version number command directory"/
vmlinuz-2.6.32
/lib/modules/2.6.32/

Redhat5:ramdisk-->initrd
Redhat6:ramfs-->initramfs






Single core: Linux (LWP lightweight process)
Core: KO (Kernel object)



So ()

Microkernel: Windows, Solaris (threads)

Chroot:chroot/path/to/temproot [COMMAND ...]
Chroot/test/virrrot/bin/bash

Ldd/path/to/binary_file: Shows the shared libraries on which the binaries depend




MBR (bootloader)--Kernel-INITRD (INITRAMFS)--(ROOTFS)--/sbin/init (/etc/inittab)
/etc/inittab,/etc/init/*.conf
Upstart

Init/etc/inittab
Id:runlevels:action:process

Id:5:initdefault:

Si::sysinit:/etc/rc.d/rc.sysinit
OS Initialization

L0:0:WAIT:/ETC/RC.D/RC 0
rc0.d/
k*
Stop
s*
Start

/ETC/RC.D/INIT.D,/ETC/INIT.D

Service class Script:
Start

SysV:/ETC/RC.D/INIT.D
Start|stop|restart|status
Reload|configtest

Chkconfig

# chkconfig:runlevels SS KK when chkconfig command to create a link for this script in the RC#.D directory, runlevels represents a link that is created by default to start with s*-a link that does not have a level default of s*; The default is to create a link that starts with k*;
The start priority at the back of S is the number represented by SS, and the number after K is closed in order of precedence for KK;
# Description: A simple function to illustrate this script; \, continue.

Chkconfig--list: View the startup settings of all independent daemons; Independent daemon!
Chkconfig--list service_name

Chkconfig--add service_name

Chkconfig--del service_name

Chkconfig [--level runlevels] service_name {On|off}
If the ellipsis level is specified, the default is level 2,345;


Sample script:
#!/bin/bash
#
# chkconfig:2345 77 22
# description:test Service
#
Lockfile=/var/lock/subsys/myservice

Status () {
If [-e $LOCKFILE]; Then
echo "Running ..."
Else
echo "Stopped."
Fi
}

Usage () {
echo "' basename $ ' {start|stop|restart|status}"
}

Case $ in
Start
echo "Starting ..."
Touch $LOCKFILE;;
Stop
echo "Stopping ..."
Rm-f $LOCKFILE &>/dev/null
;;
Restart
echo "Restarting ...";;
Status
status;;
*)
usage;;
Esac


/etc/rc.d/rc.local: The system finally starts a service, exactly said, should execute a script;


/etc/inittab's Mission:
1, set the default operating level;
2, run the system initialization script;
3. Run the script in the directory corresponding to the specified run level;
4, set the operation of Ctrl+alt+del combination key;
5, define the UPS power supply in the power failure/recovery operation performed;
6, start the virtual terminal (2,345 level);
7, start the graphics terminal (5 level);



Type of daemon:
Independent Daemon Process
XINETD: Super Daemon, Agent
Transient daemon: No need to correlate to runlevel



Core:/boot/vmlinuz-version
Kernel module (KO):/lib/modules/version/

Kernel design:
Single Core
Modular design
Micro-core

Loading module:
Insmod
Modprobe

Www.kernel.org:



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


To set kernel parameter values:
echo VALUE >/proc/sys/to/somefile
Sysctl-w kernel.hostname=

be effective immediately, but not permanently;

Permanently valid:/etc/sysctl.conf

Once the modified file is complete, the following command will take effect immediately:
Sysctl-p
SYSCTL-A: Show all kernel parameters and their values



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

Depmod/path/to/modiles_dir

Linux system startup process (2)

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.