I. Linux system start-up process
1. First computer power-on self-test, into the BIOS, through the MBR load bootloader, and then by the bootloader load kernel in memory to complete the decompression, then the control to the kernel, the kernel to complete the detection of hardware and then access INITRD, and then execute the INIT process
2.Linux system is a single core, it has a kernel module and other peripheral modules, peripheral modules in the/lib/modules/kernel version number named directory/down
3. Establish a separate small system on the existing system
A. Create a test root directory under the root home directory
mkdir-pv/root/test/vimroot//root/test/vimroot/{lib,bin}
B. Copy the/bin/bash file to the/root/test/vimroot/bin/directory
cp/bin/bash/root/test/vimroot/bin/
You can use the which command to see where a binary file is.
Which bash
C. Use the LDD command to see which library files The bash file depends on
Ldd/bin/bash
d. Copy dependent library files to the appropriate directory
cp/lib/libc.so.6/root/test/vimroot/lib/
E. Switching the root file system with the chroot command
chroot/root/test/vimroot/
Operating level--runlevel at 4.Linux
Operating level: 0-6
0:halt (OFF)
1:single user mode, log in directly as Administrator (single user mode), s,s,single,1
2:multi user mode, no NFS (multi-user mode with network function)
3:multi user mode, text mode (multi-user mode, character interface)
4:reserved (Reserved level)
5:multi user mode, graphic mode (multi-user mode, graphical interface)
6:reboot (restart)
5./etc/inittab file Set default run level
Id:3:initdefault:
6.bootloader (MBR master boot Record)
Lilo:linux Loader: Large hard drives are not supported, but used in embedded systems
Grub:grand Unified Bootloader
Stage1: in MBR
Stage1_5: Used to identify different file systems
Stage2: In/boot/grub/
/etc/grub.conf file
Default=0 # Sets the number of the default start title, numbering starting from 0
Timeout=5 # waits for the user to select the timeout length, in seconds
Splashimage= (hd0,0)/grub/splash.xpm.gz # Grub Background image
Hiddenmenu # Hidden Menu
Password--md5 $1$hkxj51$b9z8a. X//xa. Atzu1.kug. # To set the password for grub, must precede the title
Title Red Hat Enterprise Linux Server (2.6.18-308.el5) # kernel header, or operating system name, string, can be freely modified
Root (hd0,0) # The device where the kernel file resides. For grub, all types of hard drives are HD, in the format (hd#,n); hd#, #表示第几个磁盘; the last N indicates the partition of the corresponding disk
Kernel/vmlinuz-2.6.18-308.el5 ro root=/dev/vol0/root rhgb quiet # Kernel file path, and parameters passed to the kernel. In the/proc/cmdline file
INITRD/INITRD-2.6.18-308.EL5.IMG # RAMDisk file path, mirror device file
7. Set the grub password using the Grub-md5-crypt command
RunLevel command--view run level
Who-r--View current run level
uname-r--viewing the kernel version number
8. Install GRUB (grub corruption, fix grub)
A. Manual damage bootloader
DD If=/dev/zero OF=/DEV/SDA bs=400 count=1
B. Go to the GRUB command line and install Grub STAGE1
Grub
C. Specify the partition where the kernel resides
grub> Root (hd0,0)
D. Install grub and specify to install on that disk
Grub> Set (hd0)
E. Then restart the
Shutdown-r now
Install grub the second way:
# Grub-install--root-directory=/path/to/boot ' S_parent_dir/path/to/device
This article is from "Luo Chen's blog" blog, please be sure to keep this source http://luochen2015.blog.51cto.com/9772274/1650105
Linux system boot level and grub configuration (i)