1. Determine user login mode
The login mode shown below is listed in "/etc/inittab", which mainly includes single-person maintenance mode, multi-user no network mode, text interface multi-user mode, and X-Windows multi-user mode. The single-person maintenance mode (runlevel 1) is similar to the "safe mode" in Windows. In this case, the system does not load complex modes to enable the system to boot normally. The most common of these modes is 3 or 5, where the default is 5 in this system, which is X-Windows multi-user mode.
#Default runlevel. Therunlevels usedby RHS are:
# 0 - halt (Do NOT set initdefault tothis)
# 1 - Single user mode
# 2 - MulTIuser, without NFS (The same as 3, if you do not have networking)
# 3 - Full mulTIuser mode (text interface startup mode)
# 4 - unused
# 5 - X11 (Graphic interface startup mode)
# 6 - reboot (Do NOT set initdefault tothis)
#
Id:5:initdefault:
Init stage (2)
2. Execute the script /etc/rc.d/rc.sysinit
After determining the login mode, it is necessary to start reading the Linux host information into the Linux system. The content is in the file "/etc/rc.d/rc.sysinit". Looking at this file, you can see that the default path, host name, network information recorded in "/etc/sysconfig/network", etc. are determined here.
#System iniTIalizaTIon.
Si::sysinit:/etc/rc.d/rc.sysinit
Init stage (3)
3. Start the kernel's plug-in module and scripts for each runlevel
Here, the main module is to read the module load configuration file (/etc/modules.conf) to confirm which modules need to be loaded. The embedded system learns the meaning of the penguin for a long time, and then runs the "/etc/rc.d/rc" script with parameters (runlevel) according to different runlevels. Module, start system service. The init process will wait for the return of the "/etc/rc.d/rc" script.
L0:0:wait:/etc/rc.d/rc 0
L1:1:wait:/etc/rc.d/rc 1
L2:2:wait:/etc/rc.d/rc 2
L3:3:wait:/etc/rc.d/rc 3
L4:4:wait:/etc/rc.d/rc 4
L5:5:wait:/etc/rc.d/rc 5
L6:6:wait:/etc/rc.d/rc 6
Init stage (4)
4. Enter the user login interface
The system also needs to configure some processing parts for abnormal shutdown. Finally, several virtual terminals (tty1~tty6) are opened by "/sbin/mingetty" for user login. If the run level is 5 (graphical interface startup), run the xdm program to provide the user with the login mode of the xdm graphical interface. If a virtual terminal is opened locally, when the terminal times out no one logs in or if no one hits the key for a long time, the terminal will exit execution. The "respawn" in the script tells the init process to reopen the terminal, otherwise it will be over a period of time. After that, we will find that this terminal has disappeared and cannot use ALT+Fn to switch.
Init stage (5)
#Trap CTRL-ALT-DELETE
Ca::ctrlaltdel:/sbin/shutdown-t3 -r now
#When our UPS tells us power has failed, assume we have a few minutes
Pf::powerfail:/sbin/shutdown-f -h +2 "Power Failure; System Shutting Down"
#If power was restored before the shutdown kicked in, cancel it.
Pr:12345:powerokwait:/sbin/shutdown-c "Power Restored; Shutdown Cancelled"
#Run gettysin standard runlevels
1:2345:respawn:/sbin/mingettytty1
2:2345: respawn:/sbin/mingettytty2
3:2345: respawn:/sbin/mingettytty3
4:2345: respawn:/sbin/mingettytty4
5:2345: respawn:/sbin/mingettytty5
6:2345: respawn:/sbin/mingettytty6
#Run xdmin runlevel5
x:5:respawn:/etc/X11/prefdm-nodaemon
The program flow chart is as follows:
Brushless DC Permanent Magnet Gear Motor
Brushless Dc Motor,Brushed Dc Motor,Industrial Machine Dc Motor,Brushless Dc Permanent Magnet Gear Motor
NingBo BeiLun HengFeng Electromotor Manufacture Co.,Ltd. , https://www.hengfengmotor.com