GNU GROUP

botond published 2019/12/21, Sat - 17:33 time

Content

 

Overview

GRUB is a software package that loads the GNU Project operating system, which allows you to choose which system to boot when you start your computer, if you have more than one installed on your computer, or to run a specific kernel configuration on a partition of that operating system.

The GNU GRUB a Gr and U nified Bootloader was developed from a package called ootloader, which is used mainly for Unix-like operating systems. The GNU operating system uses GNU GRUB as the boot loader, like most Linux distributions and the Solaris operating system on xXNUMX, starting with Solaris XNUMX XNUMX/XNUMX.

 

 

operation

When you turn on your computer, BIOS finds the primary boot device (usually a hard drive on your computer, but can also boot from a CD / DVD or USB device) and loads and then executes the selected device In his MBR (Master Boot Record) found a boot loader program. MBR is the first sector of the hard disk that is numbered with zero.

For a long time, the size of the sectors was 512 bytes, but since 2009 there are hard disks with a sector size of 4096 bytes, so-called advanced format. However, as of October 2013, such hard disks will still be available with 512-byte sector sizes using 512e emulation.

The MBR record takes up 512 bytes of space, which may be enough for the machine code of a very simple boot loader, but not large enough to fit in a complex, multi-file system, menu-driven, and so on. boot. Therefore, larger bootloaders are divided into several pieces, where the small boot part fits into the MBR, which transfers control to the larger part stored elsewhere on the hard disk, which can already display a menu-driven user interface, with multiple file system support, custom settings , etc.

Image files for operating system kernels are in most cases files in the file system of the operating system that you want to load, which are not directly accessible by the BIOS because the structure of that file system is unknown to the BIOS. Therefore, on BIOS-based systems, bootloaders are responsible for accessing, loading, and executing kernel files. Booters can do this with two approaches:

One possible approach to loading kernel images is to access the sectors of the hard disk directly without knowing the structure of the underlying file system. For this method, an additional so-called it is also necessary to use "map files", which are additional files that contain a list of physical sectors occupied by kernel images. These files must be updated each time the physical location of the kernel image file on disk changes, such as when updating the kernel or defragmenting the file system, and so on. Additionally, if the location or size of the map files changes, their positions must also be updated in the boot code in the MBR for the method to continue to work. Not only is this cumbersome, but it also requires manual system repairs if something goes wrong during system upgrades.

The other approach is for the boot loader to recognize the underlying file systems so that it can access the kernel images based on their actual file path within the file system. To do this, the boot loader must include the drivers for the supported file systems to recognize them. This approach eliminates the need for a hard-coded location of hard disk sectors and the use of map files, and does not require MBR updates when adding, modifying, or moving kernel image files. In this case, the boot loader configuration is stored in a standard file, which is also accessible with the knowledge of the file system, which you can load before running the kernel so that the operating system kernel can start with the selected configuration. As a result, the possibility of an error slipping into the boot process during system upgrades is significantly reduced. The only downside is that such more complex bootloaders take up more space on your hard drive.

GNU GRUB uses the latter method to find the kernel image files in many filesystems. GRUB itself is divided into several parts, allowing the boot part to fit into the MBR boot sector of the hard drive.

You can also use GRUB to boot from another operating system, such as a Windows Loader on another hard drive, which may also contain more bootable versions of Windows.

 

versions

There are two main versions of GRUB in use: Version 1 of GRUB by GRUB legacycalled, occurs only in older releases of Linux distributions. some of which are still in use and supported, such as CentOS 5. Development of GRUB version 2 was started from scratch and was intended to replace its predecessor, which is now used by most Linux distributions today.