2 - System Boot

Lecture



In this lecture we will talk about how and what happens when you boot the Linux operating system from the moment you press the power button on the system unit to the invitation to enter a password to register with the system. So, you press the power button, a special signal is sent to the processor, by which it starts to execute the program located on your motherboard BIOS chip.

The program performs the initial setup (initialization) of computer devices (motherboard, processor, memory, hard disk, video subsystem, etc.) and finds out from which device the download will continue. Typically, such a device is a hard disk ("hard drive") on which the boot record is recorded - MBR ( Master Boot Record ). This record is located on the very first sector of the hard disk and occupies only 512 bytes in size. These 512 bytes include the boot loader (446 bytes), the partition table of the disk (64 bytes) and the so-called special code in 511th and 512th bytes, which indicates that the disk is bootable (contains MBR ). Just by checking these two last bytes of BIOS and determines whether the disk is bootable or not. Figure 1 shows more clearly.

  2 - System Boot

Picture 1

The task of the boot loader is to determine the active disk partition and load the kernel loader of the operating system into memory. These Linux loaders are LILO (short for Linux Loader ) and GRUB ( GRand Unified Bootloader ). The GRUB bootloader is a newer, more capable bootloader and is used in most modern distributives. LILO , which has been a standard for a long time, slowly losing ground, giving way to the more modern GRUB . The main advantage of GRUB is that it can access the Linux file system. (I recommend reading about GRUB at the official site http://www.gnu.org/software/grub/ )

The task of the loader is to load the kernel of the operating system into memory and transfer control to it. The Linux kernel is located in the / boot file and has a name like vmlinuz-2.6.24 , where the numbers indicate the number (version) of the kernel. File size ranges from about 400 KB to 2 MB. The kernel on the disk is in a compressed form, so there is still such a procedure as unpacking the kernel and then it is recorded in the area of ​​RAM that is not available to user processes. The kernel, after being written into memory, takes control into “its own hands” and re-initializes the hardware. The fact is that Linux in its work does not use BIOS functions, but “communicates” with iron directly. Windows can work with hardware through BIOS functions. In order not to go into details, I will explain with an example. On modern motherboards it is possible to create raids . For example, combine two hard drives in raid 1 (mirror). This is implemented just with the help of BIOS. So, Windows will work with such a raid, as it knows how to access BIOS. Linux , too, will be able to handle the raid, but only if support for such a raid will be implemented in the kernel.

The loader may pass some parameters to the kernel that affect the system boot. For example, if you pass the single parameter to the kernel, then Linux will boot into single user mode (you can roughly compare it with the safe mode of Windows XP ). Parameters passed to the kernel are written in the configuration file. For GRUB, this is the file /boot/grub/menu.lst . How to work with GRUB while we will not stop, we will return to this issue in the future if there is time.

Then the kernel loads several system processes: a memory manager and a process manager. And only then the first user process is loaded - init . The init process is the main (parent) process with ID 1. This is the first process to which the system administrator has access. The Linux system runs as long as the init process is alive. After receiving control, init executes the algorithm described in the / etc / inittab configuration file. As a result of the init work, the scripts collected in the /etc/init.d/ directory are launched.

Next, run the processes that allow you to register in the system. These processes are called getty (short for get teletype). Each getty process is associated with a virtual (and not only virtual) console, which is displayed using a video adapter and allows the user to work with this console after the user registers in the system. This is the so-called text or alphanumeric mode of operation with the system. There are six of these processes running by default.

Parallel loading service - X Server to work in graphical mode. In addition to X Server, a program called display manager is launched in graphical mode. The most popular display managers are xdm, gdm, kdm . The main objective of these programs is to register the user in the system, only already in graphical mode.

When we see an invitation on the screen in text or graphic mode, we can assume that the system is almost loaded. Next you need to enter a username and password. I draw your attention to the fact that in text mode, when entering a password, information is not displayed on the screen (that is, there are neither "asterisks" nor circles). When you are registered in text mode, a so-called shell program is loaded, in which users work further. We will talk about the shell (also called the command interpreter ) until I just say that there are several types of shells - csh, tcsh, zsh, bash , but we will work in bash .

In conclusion, I want to say about the choice of distribution. For this course, it doesn’t matter what distribution you choose to learn Linux . It will even be good if you have a great distribution from the one we use in class. For beginners, the recommendation is to buy a separate hard drive for 10, 20 GB and install the system there, if you are afraid that you could harm the data on the main hard drive.

  2 - System Boot

I will add a few words from myself. On the courses, we still use the Knoppix distribution (based on the Debian distribution), I work at Ubuntu at home and at work. If you do not have a distribution kit, then I recommend to visit http://linuxiso.com.ua, where all popular distributions are presented today. If you have a good channel you can download an iso-image and burn it to a CD, if not, you can order a disk by mail.

created: 2014-09-13
updated: 2021-03-13
132478



Rating 9 of 10. count vote: 2
Are you satisfied?:



Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

LINUX operating system

Terms: LINUX operating system