词条 | GNU GRUB |
释义 |
| name = GNU GRUB | logo = {{nowrap|}} | screenshot = Debian Unstable GRUB2 (2015).png | caption = GRUB v2 running in text mode | collapsible = | author = Erich Boleyn | developer = GNU Project | released = {{Start date and age|1995}} | latest release version = 2.02 (GRUB 2) | latest_release_date = {{Start date and age|2017|04|26}}[1] | latest preview version = 2.02~rc2 (GRUB 2)[2] | latest preview date = {{Start date and age|2017|03|15}} | programming language = Assembly, C[3] | operating_system = Linux, macOS, BSD, Solaris (x86 port) and Windows (through chainloading) | platform = IA-32, x86-64, IA-64, ARM, PowerPC, MIPS and SPARC | size = | language = English and others | status = Active | genre = Bootloader | license = GNU GPL version 3[4] | website = {{URL|https://www.gnu.org/software/grub/}} }} 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 was developed from a package called the Grand Unified Bootloader (a play on Grand Unified Theory[5]). It is predominantly used for Unix-like systems. The GNU operating system uses GNU GRUB as its boot loader, as do most Linux distributions and the Solaris operating system on x86 systems, starting with the Solaris 10 1/06 release. Operation{{Anchor|MAP-FILE}}Booting{{See also|UEFI disk device compatibility}}When a computer is turned on, BIOS finds the configured primary bootable device (usually the computer's hard disk) and loads and executes the initial bootstrap program from the master boot record (MBR). The MBR is the first sector of the hard disk, with zero as its offset (sectors counting starts at zero). For a long time, the size of a sector has been 512 bytes, but since 2009 there are hard disks available with a sector size of 4096 bytes, called Advanced Format disks. {{As of|2013|10}}, such hard disks are still accessed in 512-byte sectors, by utilizing the 512e emulation.[6] The legacy MBR partition table supports a maximum of four partitions and occupies 64 bytes. Together with 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,[7] 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 thus split into pieces, where the smallest piece fits into and resides within the MBR, while larger piece(s) are stored in other locations (for example, into empty sectors between the MBR and the first partition) and invoked by the boot loader's MBR code. Operating system kernel images are in most cases files residing on appropriate file systems, but 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 to load kernel images is by directly accessing hard disk sectors without understanding the underlying file system. Usually, an additional level of indirection is required, in form of maps or map files{{snd}} 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 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.[8] 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 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 the kernel images are added or moved around. 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 the actual booting of any kernel images. As a result, the possibility for things to go wrong during various system updates is significantly reduced. As a downside, such boot loaders have increased internal complexity and even bigger footprints.[8] GNU GRUB uses the second approach, by understanding the underlying file systems. The boot loader itself is split into multiple stages, allowing for itself to fit within the MBR boot scheme. Two major versions of GRUB are in common use: GRUB version 1, called GRUB legacy, is only prevalent in older releases of Linux distributions, some of which are still in use and supported, for example CentOS 5. GRUB 2 was written from scratch and intended to replace its predecessor, and is now used by a majority of Linux distributions. Version 1 (GRUB Legacy)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 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 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 {{anchor|GRUB 2}}Version 2 (GRUB 2)Startup on systems using BIOS firmware
Startup on systems using UEFI firmware
After startupGrub presents 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 {{Keypress|Shift}} while the computer is booting makes it possible to access the boot menu.[9] In the operating system selection menu GRUB accepts a couple of commands:
Once boot options have been selected, GRUB loads 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. HistoryGRUB was initially developed by Erich Boleyn as part of work on booting the operating system GNU/Hurd, developed by the Free Software Foundation.[11] In 1999, Gordon Matzigkeit and Yoshinori K. Okuji made GRUB an official software package of the GNU Project and opened the development process to the public.[11] {{As of|2014}}, the majority of Linux distributions have adopted GNU GRUB 2, as well as other systems such as Sony's PlayStation 4.[12] DevelopmentGRUB version 1 (also known as "GRUB Legacy") is no longer under development and is being phased out.[13] The GNU GRUB developers have switched their focus to GRUB 2,[14] a complete rewrite with goals including making GNU GRUB cleaner, more robust, more portable and more powerful. GRUB 2 started under 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 was officially released on June 26, 2012.[15][16] Three of the most widely used Linux distributions use GRUB 2 as their mainstream boot loader.[17][18][19] Ubuntu adopted it as the default boot loader in its 9.10 version of October 2009.[20] Fedora followed suit with Fedora 16 released in November 2011.[21] OpenSUSE adopted GRUB 2 as the default boot loader with its 12.2 release of September 2012.[22] Solaris also adopted GRUB 2 on the x86 platform in the Solaris 11.1 release.[23] In late 2015 the exploit of pressing backspace 28 times to bypass the login password was found and quickly fixed.[24][25] {{Anchor|TRUSTED}}VariantsGNU GRUB is free and open-source software, so several variants have been created. Some notable ones, which have not been merged into GRUB mainline:
UtilitiesGRUB configuration toolsThe 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. For GRUB 2 there are KDE Control Modules.[32][33] GRLDR ICE is a tiny tool for modifying the default configuration of grldr file for GRUB4DOS.[34] Boot repair utilities[https://www.supergrubdisk.org/super-grub2-disk/ Super Grub2 Disk/] helps you to boot into most any Operating System (OS) even if you cannot boot into it by normal means. It's built in Grub2's bash-like script. A 20MB ISO image that can be booted from USB or CD. [https://www.supergrubdisk.org/category/download/supergrub2diskdownload/super-grub2-disk-stable/ Download] Boot-Repair is a simple graphical tool for recovering from frequent boot-related problems with GRUB and Microsoft Windows bootloader. This application 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. Installer for WindowsGrub2Win 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.02 to an NTFS partition. A Windows GUI application is then used to customize 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. Alternative boot-managers{{Portal|Free and open-source software|Computer science}}The strength of Grub is the wide range of supported platforms, file-systems, operating systems, making it the default choice for distributions and embedded systems.If you have a boring old desktop PC or Mac, boot-managers targeted at the end user can give you a more friendly user experience, graphical OS selector and simpler configuration:
Non-graphical alternative, that's simpler to configure:
External linksHow-Tos and troubleshootingDistribution wikis have many solutions for common issues and custom setups, that might help you:
Documentation
Introductory articles
Technicalities
See also
References1. ^{{cite mailing list |url=http://lists.gnu.org/archive/html/grub-devel/2017-04/msg00077.html |title=GRUB 2.02 release |date=April 26, 2017 |accessdate=April 27, 2017 |mailinglist= grub-devel |first=Vladimir |last=Serbinenko}} {{Commons category}}{{Wikibooks|GRUB Installation After Windows Installation}}{{GNU|state=collapsed}}2. ^ftp://alpha.gnu.org/gnu/grub/ 3. ^{{cite web |url=http://www.ohloh.net/p/grub |title=Ohloh Analysis Summary – GNU GRUB |publisher=Ohloh |accessdate=2010-05-12 }} 4. ^{{cite web|url=http://bzr.savannah.gnu.org/lh/grub/trunk/grub/annotate/head:/COPYING |archive-url=https://archive.is/20130911174027/http://bzr.savannah.gnu.org/lh/grub/trunk/grub/annotate/head:/COPYING |dead-url=yes |archive-date=2013-09-11 |title=GNU GRUB license }} 5. ^EnterpriseLinux.com Definitions Definition of GRand Unified Bootloader 6. ^{{cite web | last = Smith | first = Ryan | title = Western Digital’s Advanced Format: The 4K Sector Transition Begins | publisher = AnandTech | date = December 18, 2009 | url = http://www.anandtech.com/show/2888 | accessdate = October 10, 2013}} 7. ^{{cite web | url = http://mbldr.sourceforge.net/ | title = mbldr (Master Boot LoaDeR) | year = 2009 | accessdate = October 10, 2013 | website = mbldr.SourceForge.net}} 8. ^1 {{cite web | url = http://www-uxsup.csx.cam.ac.uk/pub/doc/suse/suse9.0/adminguide-9.0/node8.html | title = Booting and Boot Managers | accessdate = 2013-10-10 | publisher = SuSE}} 9. ^{{cite web|url=http://www.howtogeek.com/196655/how-to-configure-the-grub2-boot-loaders-settings/|title=How to Configure the GRUB2 Boot Loader’s Settings|website=HowToGeek.com |first=Chris |last=Hoffman |date=September 22, 2014}} 10. ^{{cite web |url=https://www.gnu.org/software/grub/grub-documentation.html |title=GNU GRUB documentation}} 11. ^1 [https://www.gnu.org/software/grub/manual/html_node/History.html GRUB Manual – 1.2 Grub History]. Gnu.org (2012-06-23). Retrieved on 2012-12-01. 12. ^{{cite web | url = http://www.extremetech.com/gaming/159476-ps4-runs-orbis-os-a-modified-version-of-freebsd-thats-similar-to-linux | title = PS4 runs Orbis OS, a modified version of FreeBSD that's similar to Linux | date = 2013-06-24 | accessdate = 2013-10-23 | website = extremetech.com}} 13. ^[https://www.gnu.org/software/grub/grub-legacy.html GNU GRUB – GRUB Legacy]. Gnu.org. Retrieved on 2012-12-01. 14. ^{{cite web |url=https://www.gnu.org/software/grub/grub-2.en.html |title=GNU GRUB – GRUB 2 |accessdate=2014-04-18 |deadurl=bot: unknown |archiveurl=https://web.archive.org/web/20080607115918/https://www.gnu.org/software/grub/grub-2.en.html |archivedate=June 7, 2008 |df=mdy-all }}. 15. ^{{cite mailing list |url=http://lists.gnu.org/archive/html/grub-devel/2012-06/msg00093.html |title=GRUB 2.00 released |date=June 28, 2012 |accessdate=December 1, 2012 |mailinglist= grub-devel |first=Vladimir |last=Serbinenko}} 16. ^{{cite web|last=Larabel|first=Michael|title=GRUB 2.00 Boot-Loader Officially Released|url=https://www.phoronix.com/scan.php?page=news_item&px=MTEyODc|website=Phoronix.com|accessdate=28 June 2012}} 17. ^{{cite web |url=http://www.webjunction.org/documents/webjunction/An_Introduction_to_Ubuntu.html |title=An Introduction to Ubuntu |last=Haddon |first=Tom |date=26 January 2012 |publisher=WebJunction |accessdate=21 September 2012 |deadurl=yes |archiveurl=https://web.archive.org/web/20121028160701/http://www.webjunction.org/documents/webjunction/An_Introduction_to_Ubuntu.html |archivedate=October 28, 2012 |df=mdy-all }} 18. ^{{cite web |url=http://www.techopedia.com/definition/15777/red-hat-enterprise-linux-rhel |title=What is Red Hat Enterprise Linux (RHEL)? |last=Janssen |first=Cory |publisher=Technopedia |accessdate=21 September 2012}} 19. ^{{cite web |url=http://www.itwire.com/business-it-news/open-source/56686-suse-chief-lists-progress-since-privatisation |title=SUSE chief lists progress since privatisation |last=Varghese |first=Sam |date=2012-09-20|accessdate=21 September 2012}} 20. ^{{cite web|title=9.10 Karmic GRUB version|url=http://distrowatch.com/table.php?distribution=ubuntu|publisher=Distrowatch.com|accessdate=8 July 2012}} 21. ^GRUB 2. FedoraProject. Retrieved on 2012-12-01. 22. ^openSUSE:Upcoming features – openSUSE {{webarchive|url=https://web.archive.org/web/20120920065446/http://en.opensuse.org/openSUSE%3AUpcoming_features |date=September 20, 2012 }}. En.opensuse.org. Retrieved on 2012-12-01. 23. ^Solaris 11.1. Oracle Retrieved 2015-03-19. 24. ^{{cite web |url=http://thehackernews.com/2015/12/hack-linux-grub-password.html |website=thehackernews.com |title=You can Hack into a Linux Computer just by pressing 'Backspace' 28 times |date=December 16, 2015 |first=Swati |last=Khandelwal}} 25. ^{{cite web |url=http://hmarco.org/bugs/CVE-2015-8370-Grub2-authentication-bypass.html#exploit |title=Back to 28: Grub2 Authentication 0-Day |first1=Hector |last1=Marco and |first2=Ismael |last2=Ripoll |date=December 2015}} 26. ^x86: Modifying Boot Behavior by Editing the GRUB Menu at Boot Time {{webarchive|url=https://web.archive.org/web/20110719115732/http://dlc.sun.com/osol/docs/content/SYSADV1/getov.html |date=July 19, 2011 }}, Modifying Solaris Boot Behavior on x86 Based Systems (Task Map) – System Administration Guide: Basic Administration 27. ^x86: Supported GRUB Implementations {{webarchive|url=https://web.archive.org/web/20091021160244/http://docs.sun.com/app/docs/doc/819-2379/getnk?a=view |date=October 21, 2009 }}, (System Administration Guide: Basic Administration) – Sun Microsystems 28. ^>{{cite web | last = Peng | first = Tao | title = Grub4ext4 | url = https://code.google.com/archive/p/grub4ext4/ | accessdate = June 13, 2017}} 29. ^2.3 Why does Syllable have its own version of GRUB? {{webarchive|url=https://web.archive.org/web/20110107003333/http://web.syllable.org/documentation/FAQ.html |date=January 7, 2011 }}, Syllable Documentation 30. ^{{cite web | url = http://sourceforge.net/projects/trustedgrub/ | title = TrustedGRUB project | accessdate = November 18, 2014 | website = Sourceforge.net}} 31. ^[https://biosbits.org: BIOS Implementation Test Suite], Official BITS website 32. ^GRUB2 Bootloader Editor. Kde-apps.org (2012-06-18). Retrieved on 2012-12-01. 33. ^{{cite web|url=http://kde-apps.org/content/show.php/Grub2+Kcm?content=137886|title=Grub2 KCM|website=KDE-Apps.org|accessdate=2011-01-27}} 34. ^{{cite web|url=http://microsaint.narod.ru/_Info_Grub4Dos/Grub4dos_tutorial.html|title=Grub4dos tutorial|website=Narod.ru}} 6 : Free boot loaders|Free software primarily written in assembly language|Free software programmed in C|GNU GRUB|GNU Project software|Research projects |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。