Linux can boot Linux from a floppy disk or hard drive. When booting Linux from a floppy disk, the boot sector contains code that reads only the first hundreds of blocks of data (of course, depending on the kernel size) to a predetermined memory location. On a Linux boot floppy, there is no system and the kernel has contiguous sectors because it simplifies the boot process.
Floppy Boot Linux
After Linux is loaded, it initializes the hardware and device drivers and then runs Init. Init can start other processes to http://www.aliyun.com/zixun/aggregation/18736.html ">" and allow the user to log in and do something else. The details of this section are discussed below.
In order to shut down a Linux system, first all processes are told to end (this allows them to close all files, complete the other things necessary to make it end neatly), then unmount the file system and swap partitions, and finally print the information to the console that can turn off the power. Terrible things can happen if you don't follow the right process. The most important file system buffer cache may not be writeback, which means that all of the data in it will be lost, the disk file system is incomplete, and may not be available.
Hard Drive Boot
When booting from the hard disk, the master boot Record's code checks the partition table (also in the Master Boot Record area), confirms the active partition (which is marked as a bootable partition), reads the boot sector from the partition, and then launches the code for the boot sector. The code for the boot sector of the partition is the same as the floppy disk: read the kernel from the partition and start it. But the details are different because it's useless to make a separate partition for the kernel image, so the code in the partition boot sector cannot read the disk sequentially, it must find the file system and put it in which sectors. There are several ways to solve this problem, but the most common approach is to use grub.
When booted with GRUB, it reads in and boots the default kernel. You can also set grub so that it can boot one of several cores, or even other operating systems. You can also let the user choose which kernel or operating system to boot at boot time.
Contrast
Booting from floppy disks and hard drives has the advantage, but usually it's better to boot from the hard drive because it avoids the conflict on the floppy disk and is fast. However, installing the same boot from the hard drive may have more trouble, so many people first boot with a floppy disk, and then when the system works well, then install grub to boot from the hard drive.
The Linux kernel is read into memory to represent the real Linux boot, as outlined below:
The Linux kernel is compressed and installed, so it has to decompress itself first. The kernel image begins with an uncompressed applet.
Then, the kernel checks for other hardware (hard disk, floppy disk, Nic ...). and configure the appropriate device drivers. At the same time, output the search results of the data. For example, when I boot, I get information similar to the following.
Loading Linux.
Console:colour ega+ 80x25, 8 Virtual consoles
Serial driver version 3.94 with no Serial options enabled
Tty00 at 0x03f8 (IRQ = 4) is a 16450
Tty01 at 0x02f8 (IRQ = 3) is a 16450
LP_INIT:LP1 exists (0), using polling driver
memory:7332k/8192k available (300k kernel code, 384k reserved, 176k data)
FileName Drive (s): Fd0 is 1.44M, FD1 is 1.2M
Loopback DeVice Init
Warning WD8013 Board not found at I/o = 280.
The Math coprocessor using irq13 Error reporting.
Partition Check:
HDA:HDA1 hda2 Hda3
vfs:mounted Root (ext filesystem).
Linux version 2.4.18-12thiz (root@haven) 05/01/2002 14:12:20