-2

So to my understanding the BIOS is firmware, i.e. software that's built into the hardware and is OS-independent.

But then we have bootloaders that boot up the operating system.

But then we have things like GRUB which are bootloaders, but also appear to be Linux-centric bootloaders?

I'm sort of confused why this is the case. Does every BIOS use GRUB? Does all hardware come with a built-in bootloader? Does something like GRUB boot up Windows, Linux, Mac, etc?

I'm trying to understand the cutoff point at which we move from OS-independence to OS-dependence, from the hardware/firmware side to the "whatever OS we've installed" side.

EDIT:

Trying to phrase this another way.

Let's say I go into a store and buy a pre-built Windows laptop. I hand it to you and you inspect it and say, "Okay, it's using this BIOS, this bootloader, this operating system."

I say "Cool. Now can you wipe Windows away and install Ubuntu on this instead? I want this laptop to be an Ubuntu laptop, not Windows."

Would this be possible? Would you need to change the bootloader? How would you know what to change it to? What if I had handed you a Macbook Pro instead? Could we wipe it and make it a Windows computer? Could we wipe it and make it a Ubuntu computer?

What determines compatibility and necessity here? When a laptop is sold does it come with a pre-loaded bootloader depending on the OS? What determines what we can change it to depending on the OS we want? What determines what OS we can run in the first place?

I am trying to wrap my head around the relationship between the hardware, BIOS, bootloader, and OS.

closed as too broad by Panther, Pilot6, Charles Green, Zanna, waltinator Oct 2 '17 at 14:05

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • See opensource.com/article/17/2/linux-boot-and-startup or similar and ask a more specific question if you have one. – Panther Oct 1 '17 at 17:20
  • @bodhi.zazen I've seen this -- it's not what I'm asking. It says "There are three boot loaders used by most Linux distributions, GRUB, GRUB2, and LILO. GRUB2 is the newest and is used much more frequently these days than the other older options." but I am asking about a more generalized case and compatibility with OS. – user742926 Oct 1 '17 at 17:24
5

Please don't get confused the steps are:

The basic steps are:

 1. The BIOS/UEFI locates and executes the boot program or bootloader.
 2. The bootloader loads the kernel.
 3. The kernel starts the `init` process (with a PID of 1).
 4. init manages system initialization, using conventional 'sysvinit' startup scripts, or
          using 'Upstart' or systemd.

The OS-independent steps ends when the GRUB is loaded by the BIOS/UEFI. It's job is to load whatever bootloader is present.

From the link given by bodhi.zazen:

GRUB has been designed to be compatible with the multiboot specification which allows GRUB to boot many versions of Linux and other free operating systems; it can also chain load the boot record of proprietary operating systems → Windows.

Now GRUB isn't pre-installed by all hardware if you were to wipe Windows, then you will install GRUB to help boot up Ubuntu. It is usually stored in a section called MBR Master Boot Record, where the BIOS/UEFI will look. The MBR about 512MB in size.

          MBR
      ---------  -----
      |          |
      |          |
      |          | 446 bytes --- GRUB program code.
      |          |
      |          |
      |          |
      |          -----
512   |          -----                                            ----------
bytes |          | Partition 1 - 16 bytes                                  |
      |          |----                                                     |
      |          | Partition 2 - 16 bytes              <----Partiton Table |
      |          |----                                                     |
      |          | Partition 3 - 16 bytes                                  |--> 64byts
      |          |----                                                     |
      |          | Partition 4 - 16 bytes { 0x55AA } -> Magic Number       |
      |          |                                                         |
      ---------  -----                                            ---------|

You ask:

"What determines the compatibility and support? The hardware? The bootloader? I don't understand the interrelationships"

The kernel is the interface between hardware and the user and determines if the OS will work with your kernel, it is built to work or interact with your hardware. If the bootloader loads the kernel and that doesn't work with your hardware then your loader will complain but it's up to the kernel to determine if the hardware is a good match for the compiled modules found in it.

Windows has its own bootloader called EFI bootloader, GRUB is for Linux based systems and not for Windows. Take a look at this for different bootloaders.

Please note that UEFI (Unified Extensible Firmware Interface) is a newer type of BIOS on newer systems:

The Unified Extensible Firmware Interface (UEFI) is a specification that defines a software interface between an operating system and platform firmware. UEFI replaces the Basic Input/Output System (BIOS) firmware interface originally present in all IBM PC-compatible personal computers, with most UEFI firmware implementations providing legacy support for BIOS services.

Further reading:

https://opensource.com/article/17/2/linux-boot-and-startup

https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface

  • Right but my question is entirely about step 1 here. For instance in the past I bought a Lenovo computer with Windows and a friend helped me wipe it / install Ubuntu on it. Did that computer use GRUB the whole time? Or is GRUB something that's only installed to the firmware when loading a Linux OS? Do different bootloaders only load certain types of OS's? How is it determined which bootloader comes with the hardware, what it will boot, how do know which loader to use, which to install, etc? What is the criteria / cutoff here? – user742926 Oct 1 '17 at 17:27
  • GRUB is a boot loader that you installed after removing Windows, it's not there by default – George Udosen Oct 1 '17 at 17:29
  • The reason I ask is because I am frustrated that every single online tutorial immediately jumps straight into talking about GRUB and here I am confused as to why this is the case, since I know different hardware can install a variety of different OS, Linux or not. Is GRUB something that is installed only when you want to boot directly into a Linux OS? Do we use different bootloaders for different OS? What determines the compatibility and support? The hardware? The bootloader? I don't understand the interrelationships. – user742926 Oct 1 '17 at 17:30
  • (I added more detail to my post) – user742926 Oct 1 '17 at 17:37
  • 1
    And so if we are "dual booting" Windows and Ubuntu let's say, we need a bootloader that supports both? In this case it looks like GRUB would be able to according to the chart, and if we decided to boot Windows then GRUB would use the Windows bootloader? – user742926 Oct 1 '17 at 17:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.