Live data from Hacker News

Ask HN: Where can I find a primer on how computers boot?

news.ycombinator.com

71–80 of 96 posts

Re: Ask HN: Where can I find a primer on how computers boot?

#72
post #62

Earlier quoted context omitted.

I also recommend the Starman for good documentation over the decades. Basically you're supposed to know BIOS/MBR booting quite well in order to make the best progress on UEFI/GPT. Originally upon powerup the BIOS would run from ROM and then boot control to a program known as the Master Boot Record which would reside on the first 440 bytes of sector 0 of the HDD. The partition table took up the final bytes of sector 0…

>The MBR checked which of the 4 possible primary partitions was flagged as active, and then booted control to the Volume Boot Record (Boot Sector) residing at the first sector of that particular partition which would then (usually, but specifically according to BOOT.INI on Windows [BCD today] or GRUB configs for Linux) load the OS contained within that partition. Usually by reading files from the filesystem beyond th…

Good to see your message jaclaz.

You're another one like Starman who can fill in details like no-one else, in case people are not aware. Please kindly post a link to the message board where your most valuable information still can be found!

What I'm seeing now is when Windows 8+ is installed to an MBR partition, and boots normally from a plain NT6 BOOT folder using BOOT\BCD in legacy CSM mode no differently than Vista (whether the boot folder is on a separate hidden volume or the same partition as Windows itself), the same Windows files on that partition can also boot using UEFI if available, from an alternative EFI\BOOT folder (plus accompanying EFI\Microsoft\BOOT\BCD) on the same or similar media.

In the first case with BIOS it ends up running winload.exe, but under UEFI the firmware runs winload.efi instead, since both the "DOS" executable and the EFI executable are both present in the Windows\System32 folder, you have your choice here too.

Re: Ask HN: Where can I find a primer on how computers boot?

#73

Earlier quoted context omitted.

> It’s firmware time. Your machine has a motherboard, there is a chip on it which has had BIOS (Basic Input/Output System) flashed on it. I wonder if it's worth it to call out the "processor microcode" firmware? Any cool startup things happen at that low level as well?

Way out of my depth! However, the stuff I saw the folks from Oxide [1] talk about comes to mind. Hardware stuff with Rust. If you want to look at a specific project, Hubris [2] is a kernel for "deeply-embedded" systems. [1] https://oxide.computer/blog/building-big-systems-with-remote... [2] https://github.com/oxidecomputer/hubris

Hubris is a part of booting on our systems in that it executes on both our root of trust and on our service processor -- but both of these execute long before the host CPU. To understand how we boot our host CPU (AMD Milan) on an Oxide compute sled, see my OSFC 2022 talk[0][1], as well as the episode of our Oxide and Friends podcast on holistic boot.[2]

[0] https://speakerdeck.com/bcantrill/i-have-come-to-bury-the-bi...

[1] https://www.osfc.io/2022/talks/i-have-come-to-bury-the-bios-...

[2] https://share.transistor.fm/s/24beb248

Re: Ask HN: Where can I find a primer on how computers boot?

#74
post #25

Most of the links here help with your immediate questions, but if starting with base concepts and first principles is appealing to you, I have to recommend: - the MIT Operating Systems Engineering OCW course [^1] - specifically, Lecture #2 [^2] which describes the bootloader for 'xv6', a reimplementation of Unix v6, which does a great job showing what a solid OS with all the basics look like [^1]: https://ocw.mit.edu…

This is cool, although I wish (and maybe I'm missing them) that there were lecture videos or recordings to go along with this. It seems like good material with not a lot of explanation.

E: Sibling comment posted updated course with videos: https://pdos.csail.mit.edu/6.S081/2020/schedule.html

Re: Ask HN: Where can I find a primer on how computers boot?

#75

Booting process of Linux: https://en.wikipedia.org/wiki/Booting_process_of_Linux Booting process of Windows NT since Vista: https://en.wikipedia.org/wiki/Booting_process_of_Windows_NT_... UEFI > Secure Booting, Boot Stages: https://en.wikipedia.org/wiki/UEFI#Boot_stages The EFI system partition is conventionally /boot/efi on a Linux system; and there's a signed "shim loader" that GRUB launches, which JMP- launches th…

>The EFI system partition is conventionally /boot/efi on a Linux system;

Still often mounted as /boot/efi but physically residing on the root of the hidden ESP volume as EFI/boot & EFI/ubuntu, for distros like ubuntu.

So when mounted you have something like /boot/efi/boot/bootx64.efi and boot/efi/ubuntu/grub etc. if visible and accessible.

Re: Ask HN: Where can I find a primer on how computers boot?

#76
post #4

I would say start at wikipedia looking up terms and consider a couple of weeks to grasp the simple notions of what's involved. Start with MBR, limits on old drives, dig into various tricks to get around limitations ... not really relevant present day but it's good insight. Problems with bootlaoders are generally specific to the system it's on and how the drive(s) is / are set up. https://www.linux.org/threads/linux-b…

Nothing beats experimentation when you really need to find out for yourself and documentation is not ideal to begin with.

Re: Ask HN: Where can I find a primer on how computers boot?

#77

Didn't see these two mentioned yet: UNIX and Linux System Administration Handbook, 5th Edition, Chapter 2: Booting and System Management Daemons "Code" by Charles Petzold, 2nd Edition, Chapter Twenty-Six: The Operating System The first one is totally fine to read stand-alone. "Code" makes more sense to read cover to cover, though the chapter on its own isn't totally useless.

"Code" was such a great read even though I already knew a lot of what's in it. I highly recommend it.

Re: Ask HN: Where can I find a primer on how computers boot?

#78
post #62

Earlier quoted context omitted.

>The MBR checked which of the 4 possible primary partitions was flagged as active, and then booted control to the Volume Boot Record (Boot Sector) residing at the first sector of that particular partition which would then (usually, but specifically according to BOOT.INI on Windows [BCD today] or GRUB configs for Linux) load the OS contained within that partition. Usually by reading files from the filesystem beyond th…

Good to see your message jaclaz. You're another one like Starman who can fill in details like no-one else, in case people are not aware. Please kindly post a link to the message board where your most valuable information still can be found! What I'm seeing now is when Windows 8+ is installed to an MBR partition, and boots normally from a plain NT6 BOOT folder using BOOT\BCD in legacy CSM mode no differently than Vist…

Thanks for the comparison, though of course the Starman's site is a much better source than my scattered posts, mainly on:

https://msfn.org/board/

and:

http://reboot.pro/

(on this latter under the nick of Wonko the Sane)

About your Windows 8+ report, yes, what you describe is perfectly normal, what many people tend to forget is that UEFI does not necessarily means GPT, a UEFI can access "MBR style disks" just fine (the opposite, BIOS acccessing a GPT disk needs special provisions, so-called hybrid MBR's and "special" code in them).

You evidenced however yet another aspect of more recent NT Windows booting, until XP NTLDR was both the boot manager and the OS loader, now BOOTMGR (and bootmgr.efi) is just the boot manager and it chainloads a separate OS loader, the WINLOAD.EXE (or winload.efi).

Re: Ask HN: Where can I find a primer on how computers boot?

#79
Someone else mentioned the Arch wiki under "Arch boot process" specifically. Since you mentioned GRUB, though, also check out the Arch wiki's article on GRUB: https://wiki.archlinux.org/title/GRUB

I found it invaluable when debugging some issues a few years back. Try unpacking the initramfs and reading the scripts contained in there, too: https://wiki.archlinux.org/title/Arch_boot_process#initramfs

Post reply on HN