Chain loading is a method used by computer programs to replace the currently executing program with a new program, using a common data area to pass information from the current program to the new program. It occurs in several areas of computing.
34-585: GNU GRUB (short for GNU GRand Unified Bootloader , commonly referred to as GRUB ) is a boot loader package from the GNU Project . GRUB is the reference implementation of the Free Software Foundation 's Multiboot Specification , which provides a user the choice to boot one of multiple operating systems installed on a computer or select a specific kernel configuration available on a particular operating system's partitions. GNU GRUB
68-506: A CALL CHAIN or CALL LINK statement that performs chain loading, preserving the contents of COMMON storage . This is not the same as the unrelated LINK subroutine in GNU Fortran . OS/360 and successors use the XCTL (for "transfer control") macro for chain loading. Because of the operating system's memory management this may or may not result in replacement of the code of
102-546: A UUID to uniquely identify an instance. The UUID is created when a partition is formatted. The UUID is part of the file system and written to the superblock . All operations other than formatting should leave the UUID unaltered. It is possible to change the UUID or duplicate it by using dd to clone an entire partition. The file grub.cfg is used to configure GRUB. It contains commands to be executed during each start-up. Without an existing and valid grub.cfg , GRUB will present
136-459: A chain operation. Chain loading permits BASIC programs to execute more program code than could fit into available program and variable memory. Applications written in BASIC could thus be far larger than the size of working memory, via a set of cooperating programs that CHAIN back and forth amongst themselves as program flow moves within the overall application. Many versions of Fortran include
170-452: A driver for each of the supported file systems, so they can be understood and accessed by the boot loader itself. This approach eliminates the need for hardcoded locations of hard disk sectors and existence of map files, and does not require MBR updates after kernel images are added or moved around. The configuration of a boot loader is stored in a regular file, which is also accessed in a file system-aware way to obtain boot configurations before
204-446: A menu where the user can choose from operating systems (OS) found by grub-install. GRUB can be configured to automatically load a specified OS after a user-defined timeout. If the timeout is set to zero seconds, pressing and holding ⇧ Shift while the computer is booting makes it possible to access the boot menu. In the operating system selection menu GRUB accepts a couple of commands: Once boot options have been selected, GRUB loads
238-564: A portion of the running program. Like the use of overlays, the use of chain loading increases the I/O load of an application. In operating system boot manager programs, chain loading is used to pass control from the boot manager to a boot sector . The target boot sector is loaded in from disk , replacing the in-memory boot sector from which the boot manager itself was bootstrapped, and executed. In Unix (and in Unix-like operating systems),
272-485: A prompt. An absolute minimal grub.cfg might contain only the following two commands (cf. initial ramdisk ): A fancier grub.cfg will describe a menu to be presented, use multiple colors, and may specify a background picture. GRUB was initially developed by Erich Boleyn as part of work on booting the operating system GNU / Hurd , developed by the Free Software Foundation . In 1999, Gordon Matzigkeit and Yoshinori K. Okuji made GRUB an official software package of
306-428: A single sector. For a long time, the size of a sector has been 512 bytes. Since 2009 there are hard disks available with a sector size of 4096 bytes, called Advanced Format disks, but as of October 2013, such hard disks are still accessed in 512-byte sectors, using the 512e emulation . The legacy MBR partition table supports a maximum of four partitions and occupies 64 bytes, combined. Together with
340-419: Is available under GNU GPL license . Boot-Repair can repair GRUB on multiple Linux distributions including, but not limited to, Debian, Ubuntu, Mint , Fedora, openSUSE, and Arch Linux . Grub2Win is a Windows open-source software package. It allows GNU GRUB to boot from a Windows directory. The setup program installs GNU GRUB version 2.12 to an NTFS partition. A Windows GUI application is then used to customize
374-419: Is only prevalent in older releases of Linux distributions. GRUB 2 was written from scratch and intended to replace its predecessor, and is now used by a majority of Linux distributions. GRUB 0.x follows a two-stage approach. The master boot record (MBR) usually contains GRUB stage 1, or can contain a standard MBR implementation which chainloads GRUB stage 1 from the active partition's boot sector . Given
SECTION 10
#1732780029373408-412: Is required, in form of maps or map files – auxiliary files that contain a list of physical sectors occupied by kernel images. Such maps need to be updated each time a kernel image changes its physical location on disk, due to installing new kernel images, file system defragmentation, etc. Also, in case of the maps changing their physical location, their locations need to be updated within
442-517: The GNU Project and opened the development process to the public. As of 2014, the majority of Linux distributions have adopted GNU GRUB 2, as well as other systems such as Sony's PlayStation 4 . GRUB version 0 (also known as "GRUB Legacy") is no longer under development and is being phased out. The GNU GRUB developers have switched their focus to GRUB 2, a complete rewrite with goals including making GNU GRUB cleaner, more robust, more portable and more powerful. GRUB 2 started under
476-556: The GRUB console (available after loading normal.mod ) a list of all available hard disks and partitions can be obtained. For example, ls (hd0,5)/ ) will show numbers that can be assigned to actual hard disks and partitions. As it cannot be guaranteed that the " hd0" style numbering of hard disks via device numbers is consistent, GNU GRUB can use a Universally Unique Identifier (UUID) to identify partitions (actually file system instances). The file systems ext2, ext3, ext4 and xfs use
510-428: The exec() system call is used to perform chain loading. The program image of the current process is replaced with an entirely new image, and the current thread begins execution of that image. The common data area comprises the process' environment variables , which are preserved across the system call. In addition to the exec() process level chain loading Linux supports the kexec () system call to replace
544-506: The line number from which execution is to commence, rather than the default of the first line of the new program). The common data area varies according to the particular dialect of BASIC that is in use. On BBC BASIC , for example, only a specific subset of all variables are preserved across a CHAIN. On other BASICs, the COM statement can be used in conjunction with CHAIN to specify which variables are to be preserved as common data across
578-482: The GRUB boot menu, themes, UEFI boot order, scripts etc. All GNU GRUB scripts and commands are supported for both UEFI and legacy systems. Grub2Win can configure GRUB for multiboot of Windows, Ubuntu, openSuse, Fedora and many other Linux distributions. It is freely available under GNU GPL License at SourceForge . The strength of GRUB is the wide range of supported platforms, file systems, and operating systems, making it
612-531: The Wikimedia System Administrators, please include the details below. Request from 172.68.168.226 via cp1108 cp1108, Varnish XID 222497634 Upstream caches: cp1108 int Error: 429, Too Many Requests at Thu, 28 Nov 2024 07:47:09 GMT Chain loading Chain loading is similar to the use of overlays . Unlike overlays, however, chain loading replaces the currently executing program in its entirety. Overlays usually replace only
646-469: The actual booting of any kernel images. Thus, fewer things can go wrong during system updates. As a downside, such boot loaders are larger and more complex. GNU GRUB uses the second approach, by understanding the underlying file systems. The boot loader itself is split into multiple stages so that it fits in the MBR boot scheme. Two major versions of GRUB are in common use: GRUB version 0, called GRUB legacy,
680-419: The boot loader's MBR code, so the sectors indirection mechanism continues to work. This is not only cumbersome, but it also leaves the system in need of manual repairs in case something goes wrong during system updates. Another approach is to make a boot loader aware of the underlying file systems, so kernel images are configured and accessed using their actual file paths . That requires a boot loader to contain
714-446: The computer POSTs , the hard disk connected to a specific motherboard port could be assigned the same identifier, for example hd0, hd1, … . But what if such consistency cannot be guaranteed? What if the constellation of connected hard disks changed from one start up to another? What if a hard disk will be connected to another computer? By entering ls into either the GRUB rescue console (available after loading core.img ) or
SECTION 20
#1732780029373748-556: The concept of a file system is unknown to the BIOS. Thus, in BIOS-based systems, the duty of a boot loader is to access the content of those files, so it can be loaded into the RAM and executed. One possible approach for boot loaders is to load kernel images by directly accessing hard disk sectors without understanding the underlying file system. Usually, an additional level of indirection
782-407: The default choice for distributions and embedded systems. However, there are boot managers targeted at the end user that give more friendly user experience, graphical OS selector and simpler configuration: Non-graphical alternatives: Distribution wikis have many solutions for common issues and custom setups that might help you: Boot loader Too Many Requests If you report this error to
816-637: The entire operating system kernel with a different version. The new kernel boots as if it were started from power up and no running processes are preserved. In BASIC programs, chain loading is the purview of the CHAIN statement (or, in Commodore BASIC , the LOAD statement), which causes the current program to be terminated and the chained-to program to be loaded and invoked (with, on those dialects of BASIC that support it, an optional parameter specifying
850-432: The first partition. In case this space is not available (unusual partition table, special disk drivers, GPT or LVM disk) the install of stage 1.5 will fail. The stage 1.5 image contains file system drivers, enabling it to directly load stage 2 from any known location in the filesystem, for example from /boot/grub . Stage 2 will then load the default configuration file and any other modules needed. GRUB presents
884-447: The lead developer cited personal reasons for not actively developing the program. GRUB Customizer is also available for Arch-based distributions. For GRUB 2 there are KDE Control Modules. GRLDR ICE is a tiny tool for modifying the default configuration of grldr file for GRUB4DOS. Boot-Repair is a simple graphical tool for recovering from frequent boot-related problems with GRUB and Microsoft Windows bootloader. This application
918-757: The name PUPA . PUPA was supported by the Information-technology Promotion Agency (IPA) in Japan. PUPA was integrated into GRUB 2 development around 2002, when GRUB version 0.9x was renamed GRUB Legacy. Some of the goals of the GRUB ;2 project include support for non-x86 platforms , internationalization and localization , non-ASCII characters, dynamic modules, memory management , a scripting mini-language , migrating platform specific (x86) code to platform specific modules, and an object-oriented framework. GNU GRUB version 2.00
952-459: The optional disk signature (four bytes) and disk timestamp (six bytes), this leaves between 434 and 446 bytes available for the machine code of a boot loader. Although such a small space can be sufficient for very simple boot loaders, it is not big enough to contain a boot loader supporting complex and multiple file systems , menu-driven selection of boot choices, etc. Boot loaders with bigger footprints are therefore split into pieces, where
986-501: The selected kernel into memory and passes control to the kernel. Alternatively, GRUB can pass control of the boot process to another boot loader, using chain loading . This is the method used to load operating systems that do not support the Multiboot Specification or are not supported directly by GRUB. A computer can have multiple hard disks connected to it. These could be identified via their SATA port. Each time
1020-402: The small size of a boot sector (512 bytes), stage 1 can do little more than load the next stage of GRUB by loading a few disk sectors from a fixed location near the start of the disk (within its first 1024 cylinders). Stage 1 can load stage 2 directly, but it is normally set up to load the stage 1.5. , located in the first 30 KiB of hard disk immediately following the MBR and before
1054-460: The smallest piece fits in the MBR, while one or more larger pieces are stored in other locations such as empty sectors between the MBR and the first partition. The code in the MBR then does little more than starting the second part. The purpose of the remaining part(s) of the boot loader is to actually boot an operating system by configuring it and starting the kernel . Kernels are in most cases stored as files residing on appropriate file systems, but
GNU GRUB - Misplaced Pages Continue
1088-797: The x86 platform in the Solaris ;11.1 release. Buildroot also uses GNU GRUB for x86 and x86_64 targets. In late 2015, the exploit of pressing backspace 28 times to bypass the login password was found and quickly fixed. GNU GRUB is free software , so several variants have been created. Some notable ones, which have not been merged into GRUB mainline: The setup tools in use by various distributions often include modules to set up GRUB. For example, YaST2 on SUSE Linux and openSUSE distributions and Anaconda on Fedora / RHEL distributions. StartUp-Manager and GRUB Customizer are graphical configuration editors for Debian-based distributions. The development of StartUp-Manager stopped on 6 May 2011 after
1122-528: Was developed from a package called the Grand Unified Bootloader (a play on Grand Unified Theory ). It is predominantly used for Unix-like systems. When a computer is turned on, its BIOS finds the primary bootable device (usually the computer's hard disk) and runs the initial bootstrap program from the master boot record (MBR). The MBR is the first sector of the hard disk. This bootstrap program must be small because it has to fit in
1156-481: Was officially released on June 26, 2012. Three of the most widely used Linux distributions use GRUB 2 as their mainstream boot loader. Ubuntu adopted it as the default boot loader in its 9.10 version of October 2009. Fedora followed suit with Fedora 16 released in November 2011. OpenSUSE adopted GRUB 2 as the default boot loader with its 12.2 release of September 2012. Solaris also adopted GRUB 2 on
#372627