Grand Unified Bootloader

from Wikipedia, the free encyclopedia
GRUB

logo logo
Screenshot
Screenshot of Debian's GRUB menu
Basic data

developer The GRUB team
Publishing year 1995
Current  version 2.04
( July 5, 2019 )
operating system Installation: Unix derivatives ; Duration: cross-platform
programming language Assembly language , C
category Bootloader
License GPL 3+ ( Free Software )
German speaking Yes
gnu.org/software/grub

Grand Unified Bootloader ( GRUB for short , English for Large Unified Bootloader ) is a free bootloader program that is often used to start Unix- like operating systems such as B. Linux is used.

GRUB was developed as a boot loader within the GNU Hurd project and is made available under the GPL . Due to its greater flexibility, GRUB replaced the traditional boot loader Linux Loader (LILO) in many Linux distributions . GRUB is also used in Solaris 10 x86. The current version, GRUB 2 , which was first published in June 2012, represents a complete revision of the 0.9x series. This is therefore referred to as GRUB Legacy (English legacy , “Altlast”, “Erbe”, “Nachlassenschaft”).

Performance characteristics

  • Reads different file systems :
  • Boot different operating systems via selection menu and automatic timing (Linux and Windows as multi-boot system ).
  • Boot operating systems from hard disks, floppy disks, CD and DVD drives and flash disks.
  • Has a built-in command line interpreter (shell).
  • Can be configured relatively easily (colors, background image, structure, etc.).
  • Can be secured with a password .
  • Can boot Linux kernels provided via TFTP .

functionality

GRUB Customizer, a configuration tool for GRUB 2
GNU GRUB on MBR partitioned hard drive
GNU GRUB on a GPT partitioned hard disk
boot.imgis exactly 446 bytes and is located together with the partition table in the MBR (sector 0). core.imgis written in the empty sectors between the MBR and the first partition, if available (the first partition usually starts at sector 63 or 4096 instead of sector 1, but this does not have to be the case). The directory /boot/grubcan be on its own partition or on the / partition.

GRUB general and GRUB legacy

Usually the GRUB boot loader , the so-called Stage 1, is written to the Master Boot Record (MBR), which is located in the first 512 bytes of the primary drive. Due to the additional space limited by the partition table , stage 1 can only load the first sector of so-called stage 2. This sector contains the program code and a block list for reading the remaining sectors of Stage 2.

Stage 2 can be on any partition . On Unix systems it is usually located under / boot / grub / stage2. Stage 2 contains the file system drivers , the program code for the selection menu and the GRUB command line, as well as the load routine for the kernel .

After Stage 2 has been loaded, the configuration file /boot/grub/menu.lst, if available, is read in and processed. In this file the entries of the selection menu are defined, which are now displayed in the console . The operating system to be booted can now be selected from the menu or commands can be sent directly to GRUB via the command line. Stage 2 thus represents the actual boot loader, which loads a kernel or the boot sector of a partition.

This two-stage division of the boot loader had the disadvantage that the boot loader was no longer bootable after moving or changing Stage 2. That is why an intermediate stage, Stage 1.5, was introduced between Stage 1 and 2. This is located on the data blocks between MBR or Stage 1 and the first block of the first partition and is able to read exactly one file system. The variant that supports the file system of the partition on which Stage 2 is located is installed. Stage 1.5 is currently available for the FAT , Minix , ext2 , ext3 , JFS , ReiserFS , UFS2 , XFS and Joliet file systems . Support for Reiser4 and ext4 is provided by third-party patches.

GRUB 2

A complete redesign was carried out for the successor GRUB 2 and backwards compatibility with GRUB Legacy was waived. Stage 2 was divided into a kernel (kernel.img) and many loadable modules (* .mod). The kernel contains only essential code with decompression, ELF loader for modules, hard disk access and a rescue shell. During installation, the modules for the file system, which contains the remaining components, are attached to the kernel and stored as the core.img file. One of the compression methods LZMA or LZO is used here, so that the compressed file z. B. can still be stored in the boot area behind the MBR (when using a GPT , this storage takes place in a specially designed BIOS boot partition). After loading the code is unpacked and the configuration file /boot/grub/grub.cfg is loaded. If necessary, modules for other file systems, boot menus , boot routines for various operating systems and GRUB Shell are loaded from the file system. In addition to the shell- like scripting language, GRUB 2 also offers support for the Lua language .

GRUB 2 can also be used as a payload for the free BIOS alternative coreboot . GRUB does not have to be written to the MBR as usual, but is written together with coreboot directly to the system's flash memory component ("BIOS chip"). During the boot process, after having initialized the hardware, coreboot transfers control to GRUB, which then displays a menu as usual and allows a kernel to be loaded.

The supported platforms and architectures are in addition to IA-32 , i.e. both 32-bit x86 and x64 (Linux-common "amd64", but also often referred to as x86-64, i.e. x86 64-bit), now also Open- Firmware -based PowerPC computers ( Power Mac and Pegasos ) and from GRUB 2.02 also ARM and ARM64 (64-bit, from ARMv8 ) .. We are working on the support of UltraSparc .

Special features of GRUB

GRUB can access the operating system kernels stored as normal files via the file system. For a long time, other boot loaders, such as LILO, relied on configuration data that specifies which data blocks the kernel is in. This information can change after a kernel update and the corresponding configuration data must be rewritten. This step is not necessary with GRUB.

Extensions

As described above, the standard GRUB provides its own boot block. As a result, GRUB normally cannot be started from an existing operating system. The GRUB shell is accessible under Linux , an alternative is provided by the GRUB4DOS project, which extends GRUB in such a way that it can be started as a program under DOS or as GRLDR from the Windows XP / NT boot menu. The latter saves the laborious extraction of the Linux boot block ddinto a file. However, Grub4dos is only available for DOS and 32-bit Windows systems that are compatible with it. DOS programs cannot be run on 64-bit systems.

With TrustedGRUB, an extension of GRUB is currently being developed that supports Trusted Platform Module (TPM).

See also

Web links

Commons : GNU GRUB  - collection of images, videos and audio files

Individual evidence

  1. www.gnu.org . (accessed on September 29, 2016).
  2. GRUB 2.04 release . July 5, 2019 (accessed July 5, 2019).
  3. GRUB 2.00 Boot Loader Officially Released. Retrieved November 25, 2017 .
  4. Source code from Grub 0.97 ( Gzip ; 972 kB)
  5. [PATCH] - support joliet extension in iso9660 filesystem
  6. ^ Reiser4 Howto / GRUB
  7. [PATCH] RFE: ext4 support in grub
  8. GRUB 2 as coreboot payload
  9. GRUB on ARM ( Memento of the original from January 28, 2016 in the Internet Archive ) Info: The archive link was inserted automatically and has not yet been checked. Please check the original and archive link according to the instructions and then remove this notice. (English), accessed October 18, 2015; " Both ARM and ARM64 are now supported in upstream GRUB - both are available in the grub 2.02 betas, and included in several Linux distributions. The ARM port supports U-Boot (but should shortly support also UEFI), and the ARM64 port supports UEFI. " @1@ 2Template: Webachiv / IABot / wiki.linaro.org
  10. GNU GRUB FAQ , accessed October 18, 2015;
    " The current release is working on Intel / AMD PCs, OpenFirmware-based PowerPC machines (PowerMac and Pegasos), EFI-based PC (IntelMac) and coreboot (formerly, LinuxBIOS), and is being ported to UltraSparc. "
  11. Wordpress Blog : GRUB on Sparc , accessed on October 18, 2015
  12. TrustedGRUB project page on SourceForge.net