1. BIOS: basic input/output system, which records the motherboard chip set and related settings, such as the communication frequency between the cpu and the interface, the search sequence of the startup device, and the interrupt information. After the machine is powered on, the system starts to read the BIOS. when the system obtains the BIOS settings, the system performs self-check. When the hardware is obtained...
1. BIOS: basic input/output system, which records the motherboard chip set and related settings, such as the communication frequency between the cpu and the interface, the search sequence of the startup device, and the interrupt information.
After the machine is powered on, the system starts to read the BIOS. when the system obtains the BIOS settings, the system performs self-check. After obtaining the hardware information, the host tries to load the operating system from the storage media, and then read the hard disk MBR from the BIOS, what is recorded on the MBR is the grub loader that directs the loading of the operating system. why not directly guide the loading of the operating system? Because MBR storage is limited, it can only store KB of space at most. Then the grub or LILO boot program loads the operating system. To enable the boot program to load the operating system, the boot program must be able to identify the core features.
In addition to specifying the core folder to start the boot program, you can also specify a super block boot loader to take over the starting core loading process, this also shows that the boot program can exist in MBR and super block, which is why multiple systems can exist. Windows boot programs are forcibly installed in MBR and super blocks. linux can be installed in MBR or super block. Therefore, when Windows and linux systems are installed, you need to install Windows first and then install Linux, or the Window boot program cannot identify the linux core file.
After the boot program starts to read the core file (/boot/vmlinuz), Linux decompress the core to the main memory and use the core functions and the corresponding driver, start testing the hardware device corresponding to the driver. When loading the core, the system will only load the root directory and load it in read-only mode. In addition, for some functions that can be read by using files, when the system starts, create a virtual DISK (ram disk), which requires the use of initrd and linuxrc, collaborative startup process.
After the core is loaded, the system is ready and the program starts to run. Run the first program/sbin/init (PID = 1). after obtaining the runlevel from the/etc/inittab, run/etc/rc. d/rc. the sysinit script sets the system environment. in the execution of the sysinit script, files in/etc/sysconfig are called by default to set the system environment, dmesg can be used to view information loaded by the system. If you want to load a custom module, write the entire module to the etc/sysconfig/modules/*. modules Directory, as long as the file ends with. modules. If the new hardware is added, but the system does not support what needs to be done: 1. recompile the core and add the latest hardware driver source code.
2. Compile the hardware driver into a module and load the module at startup.
After the above steps are completed, the system runs smoothly and requires system-related services and network services to be started, in this case, the running level obtained by/etc/inittab is used to load the corresponding system and network services. each level corresponds to a startup Directory, corresponding to/etc/rc. d/rc. n, these startup directories store some link files and link them to init. d. All files in this directory start with K and S. S indicates the files required for startup, and K indicates the files required for shutdown.
The/etc/init. d Directory contains the service startup script, while/etc/sysconfig is the startup script set by the system to set the system environment.
Therefore, you can use init runlevel to switch between different running levels. services loaded with different running levels are different. If you execute custom commands with the system startup, you can use the/etc/rc. d/rc. local file to execute them. This file is equivalent to the autoexec. bat file in the window.
Startup process:
BIOS-à MBR --- à Kernel code-à/sbin/init -- à sysinit (used during/etc/sysconfig)-à/etc/rc. d/rc. n (use/etc/initd. d) -- à/etc/rc. d/rc. in local, the service is started at/etc/rc. d/rc. n and/etc/rc. d/rc. local.
Core modules:
Core:/boot/vmlinuz
Ram disk required for core decompression:/boot/initrd
Core Module:/lib/modules/version/kernel
Core source code:/usr/src/linux
The information recorded when the core is loaded into the system.
Core version:/proc/version
System core functions:/proc/sys/kernel
To process the core modules, you need to understand the relevance between the modules provided by the core. linux provides some module-dependent solutions,/lib/modules. the dep file records the associations between modules. the depmod command can be used to update dependencies between modules. Lsmod can be used to view the modules loaded by the core, modinfo can view the corresponding information of the module, and insmod and rmmod are used for manual loading and deletion of the module, but the dependency relationship is not solved, modprobe can be used to load dependencies.