Difference between revisions of "GhostBSD Boot Process"
Line 3: | Line 3: | ||
{{Navbar System}} | {{Navbar System}} | ||
{{Navbar GhostBSD Boot Process}} | {{Navbar GhostBSD Boot Process}} | ||
+ | |||
==Introduction== | ==Introduction== | ||
Revision as of 14:41, 23 March 2020
Welcome to GhostBSD Boot Process. |
This page is in maintenance! Please do not change this page without to contact the author or use Discussion! |
GhostBSD Boot Process | |||
---|---|---|---|
MBR and GPT | UEFI | OpenRC | /boot/ |
Back to the System |
Contents
Introduction
The process of starting a computer and loading the operating system is referred to as “the bootstrap process”, or “booting”. The GhostBSD boot process provides a great deal of flexibility in customizing what happens when the system starts, including the ability to select from different operating systems installed on the same computer, different versions of the same operating system, or a different installed kernel.
The GhostBSD boot process differs from the FreeBSD boot process. On this page we will show you the similarities and differences.
GhostBSD Boot Process
Turning on a computer
On x86 hardware
The Basic Input/Output System (BIOS) is responsible for loading the operating system. The BIOS looks on the hard disk for the Master Boot Record (MBR), which must be located in a specific place on the disk. The BIOS has enough knowledge to load and run the MBR, and assumes that the MBR can then carry out the rest of the tasks involved in loading the operating system, possibly with the help of the BIOS.
The code within the MBR (/boot/mbr ) is typically referred to as a boot manager, especially when it interacts with the user. The boot manager usually has more code in the first track of the disk or within the file system. Examples of boot managers include the standard GhostBSD/FreeBSD boot manager /boot/boot0, also called Boot Easy, and Grub, which is used by many Linux® distributions.
If only one operating system is installed, the MBR searches for the first bootable (active) slice on the disk, and then runs the code on that slice to load the remainder of the operating system. When multiple operating systems are present, a different boot manager can be installed to display a list of operating systems so the user can select one to boot.
GPT bootcode for UFS on BIOS-based computers
gptboot is used on BIOS-based computers to boot from a UFS partition on a GPT-partitioned disk. /boot/gptboot is installed in a Ghost/FreeBSD-boot partition with gpart(8).
When it starts, gptboot first reads the GPT and determines which drive and partition to boot from. If it does not find an eligible partition, or if the user hits a key within three seconds, gptboot switches from auto-boot to interactive mode. Interactive mode allows manual selection of the disk, partition, filename, and boot option flags, as described in boot(8).
The GPT standard allows a variable number of partitions, but gptboot only boots from tables with 128 partitions or less.
For normal usage, the user does not have to set or manage any of the partition attributes. gptboot will boot from the first UFS partition found.
gptboot first reads the partition table. All freebsd-ufs partitions with only the bootonce attribute set, indicating a failed boot, are set to bootfailed. gptboot then scans through all of the freebsd-ufs partitions. Boot behavior depends on the combination of bootme and bootonce attributes set on those partitions.
If neither bootonce nor bootme attributes are found on any partitions, booting is attempted from the first Ghost/FreeBSD-ufs partition on the disk.
Bootstrap Process
By default, a three-stage bootstrap is employed, and control is automatically passed from the boot blocks (bootstrap stages one and two) to a separate third-stage bootstrap program, loader(8). This third stage provides more sophisticated control over the booting process than it is possible to achieve in the boot blocks, which are constrained by occupying limited fixed space on a given disk or slice.
FILES
- /boot/boot1 first stage bootstrap file
- /boot/boot2 second stage bootstrap file
- /boot/loader third stage bootstrap
The automatic boot will attempt to load /boot/loader from partition `a' of either the floppy or the hard disk. This is the final stage of Ghost/FreeBSD's kernel bootstrapping process.
During initialization, loader will probe for a console and set the console variable.
Next, FICL is initialized, the builtin words are added to its vocabulary, and /boot/boot.4th is processed.
After that, /boot/loader.rc is processed. These files are processed through the include command, which reads all of them into memory before processing them, making disk changes possible.
GhostBSD/FreeBSD provides for booting from both the older MBR standard and the newer GUID Partition Table (GPT). Once the kernel boot process is finished, the kernel passes control to the user process init(8), which is located at /sbin/init. The /boot/defaults/loader.conf states as GhostBSD defaults: rc_system="openrc".