Which Two Functions Configure Hardware and Begin the Computer Boot Process? Linux

Regardless of the computer or operating system, standard ("IBM-compatible") desktop PCs and laptops all power on and starting time up using one of two means: the traditional BIOS-MBR method and the newer UEFI-GPT method, used past the latest versions of Windows, Linux, and Mac OS X on newer PCs, laptops, and tablets. This article summarizes the process by which traditional BIOS PCs load an operating system, covering the basics and details of the BIOS, MBR, and bootsector.

This article has been unofficially dubbedEverything you lot always wanted to know about how your PC boots, part 1.

Contents

  • 1 Overview of the BIOS/MBR Boot Procedure
  • ii Components of the Kicking Process
    • 2.one The BIOS
      • ii.1.1 The Post Process
      • ii.one.2 BIOS Boot Handoff
    • two.2 The Kick Device
    • 2.three The Master Boot Record (MBR)
      • 2.3.1 The Partition Table
      • two.three.ii Bootstrap Code
      • 2.iii.3 Boot Signature
    • 2.4 The Partition Boot Sector
      • 2.4.1 The 2nd-stage bootloader
    • two.5 The Bootloader
      • 2.5.1 Boot Configuration Files
      • 2.v.2 Pop Bootloaders
        • ii.5.two.i NTLDR
        • two.v.two.two BOOTMGR
        • ii.5.two.3 GRUB
        • 2.5.2.4 Chow 2
  • 3 The Kicking Process
  • 4 Determination
  • v Troubleshooting the Bootloader
  • six Encounter Also

Overview of the BIOS/MBR Boot Process

In the diagram beneath, the kick sequence for all standard computers and operating systems is shown:

MBR Boot Sequence

As yous can run into, the kicking process is broken down into several major components, each of which is a completely-separate subsystem with many different options and variations. The implementations of each component can differ greatly depending on your hardware and operating system, but the rules they follow and the procedure by which they work are ever the same.

Components of the Boot Process

 The BIOS

The BIOS is where hardware meets software for the first time, and where all the boot magic begins. The BIOS lawmaking is baked into the motherboard of your PC, usually stored on what is called an EEPROM1 and is considerably hardware-specific. The BIOS is the lowest level of software that interfaces with the hardware as a whole,ii and is the interface past ways of which the bootloader and operating system kernel can communicate with and command the hardware. Through standardized calls to the BIOS ("interrupts" in computer parlance), the operating arrangement can trigger the BIOS to read and write to the deejay and interface with other hardware components.

When your PC is first powered up, a lot happens. Electrical components of the PC are initially responsible for bringing your computer to life, every bit debouncing circuits take your push button of the ability button and trigger a switch that activates the power supply and directs current from the PSU to the motherboard and, mainly through it, to all the various components of your PC. As each individual component receives life-giving electricity, it is powered upwardly and brought online to its initial country. The startup routines and overall functionality of the simpler components similar the RAM and PSU is hardwired into them every bit a serial of logic circuits (AND/NAND and OR/NOR gates), while more complicated parts such every bit the video card have their own microcontrollers that act as mini-CPUs, controlling the hardware and interfacing with the rest of your PC to consul and oversee the piece of work.

The Postal service Procedure

Once your PC has been powered on, the BIOS begins its piece of work equally office of the POST (Power-On Self Exam) process. Information technology bridges all the various parts of your PC together, and interfaces betwixt them as required, setting up your video brandish to have bones VGA and show it on the screen, initializing the retentivity banks and giving your CPU access to all the hardware. It scans the IO buses for attached hardware, and identifies and maps access to the hard disks y'all accept connected to your PC. The BIOS on newer motherboards is smart enough to even recognize and identify USB devices, such as external drives and USB mice, letting yous boot from USB sticks and use your mouse in legacy software.

During the POST procedure, quick tests are conducted where possible, and errors acquired past incompatible hardware, disconnected devices, or declining components are frequently caught.Information technology's the BIOS that'due south responsible for a variety of error letters such as " keyboard fault or no keyboard present" or warnings almost mismatched/unrecognized memory. At this point, the majority of the BIOS' work has completed and information technology's almost fix to move on to the next stage of the kicking process. The only thing left is to run what are chosen "Addition ROMs": some hardware attached to the motherboard might crave user intervention to complete its initialization and the BIOS really hands off command of the entire PC to software routines coded into hardware similar the video card or RAID controllers. They presume control of the reckoner and its display, and let y'all do things like gear up RAID arrays or configure display settings before the PC has fifty-fifty truly finished powering upwardly. When they're washed executing, they pass control of the estimator back to the BIOS and and the PC enters a basic, usable state and is set to begin.

BIOS Boot Handoff

Subsequently having configured the bones input and output devices of your PC, the BIOS at present enters the final stages where it's nonetheless in control of your reckoner. At this point, you'll normally be presented with an choice to rapidly hit a primal to enter the BIOS setup from where you can configure hardware settings and control how your PC boots. If you choose zip, the BIOS will begin the kickoff footstep in actually "booting" your PC using the default settings.

Earlier nosotros mentioned that an important part of the BIOS' work is to detect and map connected hard disks. This list now comes in handy, as the BIOS will load a very small programme from the get-go hard disk drive to the memory and tell the CPU to execute its contents, handing off control of the computer to whatever is on the difficult bulldoze and ending its agile office in loading your PC. This hard bulldoze is known every bit "the boot device," "startup disk," or "drive 0" and tin can usually exist picked or set in the BIOS setup.

The Kicking Device

Regardless of whether the BIOS was configured to kicking from a local difficult disk or from a removable USB stick, the handoff sequence is the aforementioned. Once the BIOS Postal service and AddOn ROM procedures accept completed, the BIOS loads the first 512 bytes from the difficult drive of the selected kicking device – these 512 bytes are what is commonly known equally the MBR, or the Master Kicking Record.

The Master Kicking Record (MBR)

The MBR is the start and most important component on the software side of things in the kick procedure on BIOS-based machines. Every hard disk has an MBR, and information technology contains several important pieces of information.

Master Boot Record

The Partition Table

First and foremost, the MBR contains something called the partition table, which is an index of up to 4 partitions that exist on the aforementioned disk, a tabular array of contents, if you lot will. Without it (such equally on floppy disks), the entire disk could but contain one sectionalization, which means that you lot tin't have things like unlike filesystems on the same drive, which in turn would hateful you could never install Linux and Windows on the same disk, for example.

Bootstrap Code

Secondly, the MBR also contains a very of import chip of code known equally the "bootstrap lawmaking." The first 4403 of these 512 bytes can contain literally anything – the BIOS will load it and execute its contents equally-is, kicking off the bootloader procedure. 440 bytes is incredibly minor. How small? Well, to put things in context, 440 bytes is but 0.iii% of the capacity of an ancient one.44 MiB floppy disk – barely enough to fit any form of useful code – and manner, way besides minor to do something as complicated every bit call up the operating system kernel from the disk.

Given how tiny the bootstrap code section of the MBR is, the only useful purpose it tin really serve is to expect up another file from the disk and load information technology to perform the bodily kick process. Every bit such, this bootstrap code is ofttimes termed a "stage one bootloader." Depending on the operating organisation, the exact identify the bootstrap code searches for the "phase 2 bootloader" tin change, just on Windows the stage ane bootloader volition search the segmentation table of the MBR for a partition marked equally "active" which is MBR-speak for "bootable," indicating that the start of the partition contains the next portion of the boot lawmaking in its starting sectors (besides known as its "bootsector"). On a correctly-created MBR disk, only one partition can exist marked as active at a time.iv

So the job of the bootstrap code segment in the MBR is pretty simple: look up the active partition from the sectionalisation table, and load that lawmaking into the memory for execution past the CPU equally the adjacent link in the boot concatenation. Depending on the Bone y'all're loading, it might really look up a hard-coded segmentation instead of the active partition (east.k. ever load the bootsector of the tertiary sectionalization) and the offset of the boot code within the partition bootsector might alter (eastward.yard. instead of being the first 2 KiB of the partition, information technology might be the second KiB or 6 KiB starting from the 2nd multiple of the electric current phase of the moon) – but the bones concept remains the same. However, for legacy compatibility reasons, the MBR near e'er loads the first sector of the active partition, meaning another only-512 bytes.

Boot Signature

On IBM-uniform PCs (basically, everything) the final two bytes of the 512-byte MBR are chosen thekicking signature and are used by the BIOS to determine if the selected boot drive is actually bootable or not. On a disk that contains valid bootstrap lawmaking, the concluding two bytes of the MBR should always exist 0x55 0xAA.5If the last two bytes of the MBR do not equal 0x55 and 0xAA respectively, the BIOS will assume that the disk isnot bootable and is not a valid boot option – in this case, it will autumn back to the next device in the kicking order list (every bit configured in the BIOS setup). For example, if the first boot device in the BIOS is set as the USB stick and the 2nd is the local hd, if a USB stick without the correct boot signature is plugged in, the BIOS will skip information technology and move on to try to load from the local disk. If no deejay in the boot device listing has the correct 0x55 0xAA boot signature, the BIOS will then display an mistake such as the infamous "No boot device is available" or "Reboot and select proper boot device."

The Partition Kicking Sector

As covered higher up, the bootstrap code in the MBR will usually load a sequence of bytes from the offset of the active partition. The exact layout of a division depends what filesystem the sectionalisation has been created or formatted with, but mostly looks something like this:

Partition on Disk

Again, depending on the Bone and filesystem, the exact layout of the sectionalisation volition certainly differ. Only this represents a close approximation to what you'll normally see:

  • A single JMP (jump) instruction, which is the assemblyhalf-dozen equivalent of agoto command.
  • The filesystem header, which will comprise information specific to and important for the filesystem itself.
  • Another bootstrap code segment, containing the side by side phase of the bootloader procedure.
  • An end-of-sector marker, very like to the 0x55 0xAA boot signature nosotros saw earlier in the MBR.

This is all normally packed into the starting time sector of the partition, which is normally again just 512 bytes long, and again, tin't fit too much data or instructions. On modernistic filesystems for newer operating systems, the bootstrap code can take advantage of enhanced BIOS functionality to read and execute more than only 512 bytes, simply in all cases, the basic steps remain the same:

  1. The MBR loads the first 512 bytes of the active division into the memory and instructs the CPU to execute them.
  2. The very first (three) bytes of the partition bootsector contain a unmarried JMP educational activity, telling the CPU to skip xx bytes alee and execute the next stage of the bootloader from there.
  3. The CPU follows the JMP instruction and seeks to the beginning of the bootstrap code contained within the partition bootsector, and starts to execute.

The bootstrap lawmaking in the partition is non the end of the road, it'southward only another stride along the way. Because of how piffling infinite is allocated for the bootstrap code in the partition bootsector, the code information technology contains normally ends with another JMP command instructing the CPU to bound to theadjacent sector in the sectionalisation, which is oft set bated for the rest of the partitioning code. Depending on the filesystem, this can be several sectors in length, or all the same long it needs to exist to fit this stage of the bootloader.

The 2d-phase bootloader

The second stage of the bootloader, stored in the partitioning bootsector in the bootstrap section and, optionally, standing beyond information technology, carries out the side by side step in the bootloader process: information technology looks up a file stored on the sectionalisation itself (as a regular file), and tells the CPU to execute its contents to begin the final part of the kick process.

Unlike the previous bootstrap segments of the MBR and the division bootsector, the next stride in the boot process is not stored at a defended first within the partition (i.e. the bootstrap code can't simply tell the CPU to JMP to location 0xABC and execute the boot file from in that location) – it's a normal file stored amongst other normal files in the filesystem on the deejay.

This significantly more than-complicated bootstrap code must really read the table-of-contents for the filesystem on the partition,7 The second-stage bootloader from older versions of file systems oftentimes placed complicated restrictions on the bootloader files they needed to load, such as requiring them to appear in the get-go several kilobytes of the sectionalization or existence unable to load non-contiguously allocated files on the partitioning. This file is the final piece of the bootloader puzzle, and at that place are usually no restrictions as to its size or contents, significant information technology can exist as large and every bit complicated as it needs to be to load the operating system kernel from the disk and pass on command of the PC to the Os.

The Bootloader

The actual bootloader files on the disk form the terminal parts of the boot loading process. When people talk most bootloaders and kicking files, they are often referring to this final, critical step of the kicking process.

Bootloader Sequence

Once command of the PC has been handed-off from the BIOS to the bootstrap code in the MBR and from the MBR to the bootstrap code in the partition bootsector, and from there at that place to the executable boot files on the agile partition, the actual logic involved in determining which operating arrangement to load, where to load it from, which parameters/options to pass on to information technology, and completing any interactions with the user that might be available, the actual procedure of starting the operating organization begins.

Boot Configuration Files

While the executable bootloader files could theoretically contain hard-coded information pertaining to the operating systems to be loaded from the deejay, that wouldn't be very useful at all. Every bit such, almost all bootloaders separate the bodily, executable bootloader from the configuration file or database that contains information about the operating system(s) to load. All of the major bootloaders mentioned below accept back up for loading multiple operating systems, a process known as "dual-booting" or "multi-booting."

Popular Bootloaders

As discussed previously, there are many dissimilar bootloaders out there. Each operating system has its own bootloader, specifically designed to read its filesystem and locate the kernel that needs to be loaded for the Os to run. Hither are some of the more-popular bootloaders – and their essential configuration files – for some of the common operating systems:

NTLDR BOOTMGR GRUB

Each of the popular operating systems has its ain default bootloader. Windows NT, 2000, and XP every bit well as Windows Server 2000 and Windows Server 2003 utilise the NTLDR bootloader. Windows Vista introduced the BOOTMGR bootloader, currently used past Windows Vista, vii, 8, and ten, equally well as Windows Server 2008 and 2012. While a number of different bootloaders have existed for Linux over the years, the two predominant bootloaders were Lilo and Grub, but at present most Linux distributions accept coalesced around the all-powerful GRUB2 bootloader.

NTLDR

NTLDR is the one-time Windows bootloader, first used in Windows NT (hence the "NT" in "NTLDR," short for "NT Loader"), and currently used in Windows NT, Windows 2000, Windows XP, and Windows Server 2003.

NTLDR stores its kick configuration in a unproblematic, text-based file called Boot.INI, stored in the root directory of the active division (often C:\Boot.ini). In one case NTLDR is loaded and executed past the second-stage bootloader, it executes a helper plan called NTDETECT.COM that identifies hardware and generates an index of information about the system. More information about NTLDR, Kick.INI, and NTDETECT.COM tin be plant in the linked manufactures in our knowledgebase.

BOOTMGR

BOOTMGR is the newer version of the bootloader used by Microsoft Windows, and it was outset introduced in the beta versions of Windows Vista (then Windows Codename Longhorn). Information technology's currently used in Windows Vista, Windows 7, Windows eight, Windows eight.1, and Windows x, besides as Windows Server 2008 and Windows Server 2012.

BOOTMGR marked a significant departure from NTLDR. Information technology is a cocky-contained bootloader with many more than options, especially designed to be compatible with newer functionality in modern operating systems and designed with EFI and GPT in heed (though just certain versions of BOOTMGR back up loading Windows from a GPT disk or in a UEFI/EFI configuration). Unlike NTLDR, BOOTMGR stores its configuration in a file called the BCD – short for Kicking Configuration Database. Unlike BOOT.INI, the BCD file is a binary database that cannot exist opened and edited by hand.eight Instead, specifically designed command-line tools like bcdedit.exe and more convenient GUI utilities such equally EasyBCD must be used to read and change the list of operating systems.

Chow

Grub was the predominantly-used bootloader for Linux in the 1990s and early 2000s, designed to load non just Linux, but any operating system implementing the open multiboot specification for its kernel. Grub'southward configuration file containing a whitespace-formatted listing of operating systems was oft called card.lst or grub.lst, and found under the /boot/ or /kicking/grub/ directory. As these values could exist changed by recompiling Chow with different options, different Linux distributions had this file located under different names in different directories.

Chow ii

While Grub eventually won out over Lilo and eLilo, it was replaced with GRUB 2 around 2002, and the old GRUB was officially renamed "Legacy Chow." Confusingly, Chow 2 is now officially called Chow, while the old GRUB has officially been relegated to the name of "Legacy Chow," but you'll thankfully find almost resources online referring to the newer incarnation of the GRUB bootloader as Grub 2.

GRUB 2 is a powerful, modular bootloader more akin to an operating organization than a bootloader. It tin can load dozens of different operating systems, and supports custom plugins ("modules") to introduce more functionality and support circuitous boot procedures.

The bodily bootloader file for GRUB 2 is not a file called GRUB2, but rather a file usually called core.img. Dissimilar Legacy Chow, the Chow ii configuration file is more than of a script and less of traditional configuration file. The grub.cfg file, usually located at /boot/chow/chow.cfg on the kick partition, bears resemblance to beat out scripts and supports advanced concepts similar functions. The core functionality of GRUB 2 is supplemented with modules, commonly constitute in a subdirectory of the /kick/grub/ directory.

The Boot Process

As previously mentioned, the stage of the boot process is a little more than involved than the previous steps, primarily due to the additional complexity of reading the filesystem. The bootloader must also obtain information about the underlying machine hardware (either via the BIOS or on its own) in guild to correctly load the desired operating organization from the right partitioning and provide any additional files or data that might be needed. It must also read its ain configuration file from a regular file stored on the kicking partition's filesystem, so it needs to at the very least have total read support for whatever filesystem it resides on.

Bootloader Flowchart

  • Initiate filesystem admission
    Before anything else can happen, when the bootloader is first run it must load and run the primitive filesystem "drivers" that give it the ability to read, at the very least, the filesystem information technology is located on. Since it's unable to read the filesystem before this, by necessity the lawmaking that provides this functionality must be compiled into the core bootloader file itself.
  • Load and read configuration file(s)
    With support for the filesystem loaded, the bootloader can at present read the list of operating systems from the disk and the the consequence that at that place are multiple operating systems specified, prepare information technology for display.
  • Load and run supporting modules
    For bootloaders that are not wholly self-independent (such as NTLDR and GRUB ii), the bootloader now loads any supporting modules or helper programs (such every bit NTDETECT.COM) from the disk. The list of modules to load can be specified in the configuration file that was just read or hard-coded/compiled into the bootloader itself. Usually, each module will be executed as it is located and loaded from the disk.
  • Brandish the boot menu
    At this signal, with all the relevant configuration in mitt, the bootloader can display what is usually known as the boot menu on the screen. If multiple operating systems are installed, it is via the kick menu that the user of the computer tin can navigate a list of operating systems and choose which to load. From hither, certain bootloaders also make it possible to specify run-time options, such equally whether to load the selected operating organization in safe fashion.
  • Load the Os kernel
    Once the user'south selection has been recorded, the bootloader moves on to the final and final stage of the boot process. Depending on the Bone and the type of kernel, the bootloader will load the kernel image from the path specified in the configuration file (with the help of whatever submodules, if needed) into the memory. It so instructs the CPU to JMP to a certain location within the newly-loaded kernel and begin executing from in that location.

Decision

Thus ends the lengthy journey that begins with the push of a button and ends with an operating arrangement's kernel loaded into the retention and executed. The bootloader procedure is certainly a lot more nuanced and complicated than most realize, and information technology has both been designed and evolved to work in a adequately-standardized fashion across different platforms and under a variety of operating systems.

The individual components of the bootloader are, mostly, self-sufficient and self-independent. They tin be swapped out individually without affecting the whole, meaning you lot can add disks and boot from different devices without worrying about upsetting existing configurations and operating systems. It also means that instead of having 1, single bit of hardware/software to configure, setup, maintain, and debug, you instead are left with a intricate and frequently very frail chain with multiple points susceptible to breakage and failure. When working properly, the boot process is a well-oiled auto, but when disaster strikes, it can be a very difficult procedure to sympathize and debug.

Troubleshooting the Bootloader

The complicated nature of the boot process ways that in that location's a lot that needs to be prepare and configured, and a lot that could potentially go incorrect. Some resources that can come handy when troubleshooting the bootloader are listed below:

  • Easy Recovery Essentials for Windows: a point-and-click bootable recovery CD that will recreate the entire above-described boot chain to get y'all dorsum into Windows pretty much no affair what went wrong.
  • EasyBCD: An easy-to-use utility that allows you to fix up and configure a dual-boot or multi-kick between Windows, Linux, Mac, FreeBSD, and more.
  • Super GRUB2 Disk: A bootable GRUB2 disk that can be used to boot into Linux when your Chow or GRUB2 is misconfigured or malfunctioning.

See Also

These boosted manufactures and resources in our wiki and from other websites online contain additional information relevant to this topic:

  • The EFI/GPT boot procedure: this document covered the basics of the BIOS/MBR boot process, now read and learn about how newer PCs with UEFI and GPT kicking.
  • The differences between EFI/GPT and BIOS/MBR

Propose an edit


  1. Originally, the BIOS was stored on what was termed a ROM ("read-simply retentivity") chip: the BIOS lawmaking was hard-coded into the chip and could never be changed. Updates to the BIOS were rare and far in between, and could only be washed by physically replacing the BIOS chip on the motherboard. Over fourth dimension and with better engineering, erasable ROM chips were developed that could be cleared by placing them in a box and blasting them with a dosage of UV (ultraviolet) radiations, and so reprogramming their contents with ROM fleck programming hardware. When that got old and tiring, electrically-erasable programmable ROM (EEPROM for curt) was adult – with it, an electronic bespeak on specially-selected pins of the EEPROM flake would trigger an erase, and the chip could be programmed directly from where information technology was located on the motherboard. Easy-peasy-lemon-squeezy, equally my wife would say!! ↩

  2. Nearly every major hardware component now has firmware decision-making it baked into its logic hardware, simply we're ignoring microcontroller firmware here. ↩

  3. Depending on the operating arrangement and platform, the bootstrap lawmaking might actually only exist anywhere from 434 to 446 bytes every bit parts of that region might exist set aside for other purposes, such every bit the disk signature and disk timestamp. On nearly modernistic operating systems, 440 is the upper limit as the concluding half dozen bytes are set aside for the four-byte disk signature at start 0x01B8 and a 2-byte field indicating the read-write state of the drive at showtime 0x01BC (with 0x00 indicating read-write and 0x5A5A indicating a read-only drive). ↩

  4. There is a huge caveat emptor here: the bootable/active flag is actually a property of the individual (one of four) division record, and not the partition table (listing of partitioning records) or the MBR itself. What that means is thattechnically the actual bit indicating that a partition is bootable can really exist present (ready to a value of 0x80) one more than one (or all!) sectionalisation(southward) simultaneously! This is an invalid configuration and can cause many different boot problems though! ↩

  5. On a little-endian auto like all x86 CPUs, that would be a single give-and-take 0xAA55 while on a big-endian architecture like PowerPC, it would be read and written as 0x55AA. ↩

  6. Assembly is the near primitive programming language, and consists of individual instructions straight read and executed by the CPU. ↩

  7. On NTFS, this is called the master file table, or MFT for short. On FAT32, this is chosen the Fatty (file allotment table). ↩

  8. In fact, the BCD file is a standard Windows registry hive, and it can be mounted for editing with tools like regedit.exe. ↩

0 Response to "Which Two Functions Configure Hardware and Begin the Computer Boot Process? Linux"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel