# Exactly How Does FreeBSD Boot ?



## mikey777 (Apr 19, 2020)

Hello
New to FreeBSD.
Exactly what does FreeBSD do when it starts ? I'm looking for lower level stuff, not, "it gives you login;"
Stuff like;
loads u-boot ?
loads loader ?
loads FreeBSD 
uses this file 1st;
this file 2nd;
3rd;
etc


----------



## jmos (Apr 20, 2020)

https://www.freebsd.org/ -> Documentation -> Handbook -> System Administration -> The FreeBSD Booting Process -> FreeBSD Boot Process


----------



## Emrion (Apr 20, 2020)

The beginning of the process (at least) depends whether you boot from EFI or legacy BIOS, the scheme of your booting disk (GPT or MBR) and also on the root filesystem type (UFS or ZFS). So there is no simple answer to give.

Anyway, the system reaches the loader(8) (the boot menu with the beastie). After that, it loads and executes the kernel, then init(8) which launches rc(8) scripts. This part is well documented in the Handbook.


----------



## SirDice (Apr 20, 2020)

jmos said:


> https://www.freebsd.org/ -> Documentation -> Handbook -> System Administration -> The FreeBSD Booting Process -> FreeBSD Boot Process


Note that this only describes the "traditional" CSM (aka BIOS) boot.

GPT works slightly different. Instead of loading the master boot record it loads the code from the freebsd-boot partition. Then it follows the same stage 3 as CSM booting.

EFI boots by loading and executing the /EFI/BOOT/BOOTx64.EFI from the efi partition. This in turn loads stage 3. See efi(7)


----------



## Emrion (Apr 20, 2020)

> GPT works slightly different. Instead of loading the master boot record it loads the code from the freebsd-boot partition. Then it follows the same stage 3 as CSM booting.


In case of legacy BIOS booting on a GPT scheme, the MBR is actually loaded (pmbr). This code is responsible for locating and loading the code inside freebsd-boot (BTX client: gptboot or gptzfsboot).


----------



## mikey777 (May 12, 2020)

Thx Thanks for all the replies...I have to lol as there seems to be 10 variations for every process regarding booting. I don't yet have the handbook on any unix box as my lab in not on the net, but cd-net for now. thx Thanks again.


----------

