2.3. Boot Process

Boot Loader

The source code for the bootloader can be found in cookbook/recipes/bootloader/source after a successful build or can be accessed here.

BIOS Boot

In x86 systems utilizing BIOS, the very first code executed is located in the boot sector, known as stage 1. This part is written in Assembly and can be found in asm/x86-unknown-none/stage1.asm. Stage 1 is responsible for loading the stage 2 bootloader from the disk, which is also written in Assembly. At this point, the system transitions into 32-bit mode and loads the final bootloader, stage 3, which is written in Rust. All three stages are combined into a single executable and stored within the first megabyte of the storage device. From here, the bootloader moves into the unified boot process that is shared across all booting methods, explained later.

UEFI Boot

(TODO)

Common Boot Sequence

The bootloader sets up the memory map and display mode, both of which depend on firmware operations that can no longer be accessed once control is passed to the kernel. After initializing these, the bootloader locates the NyxFS partition on the disk and loads the kernel, along with the bootstrap and initfs files, into memory. The kernel is mapped to its designated virtual memory address, and control is handed off to its entry point.

Kernel

The VortexOS kernel performs architecture-specific setup during the kstart function. Once complete, it transitions to the kmain function. The bootstrap process in user space—a pre-processed executable to minimize kernel parsing—then initializes the initfs scheme and launches the init program.

Init Process

VortexOS uses a multi-stage init system designed to allow the dynamic loading of drivers for disk access and other functions. This is referred to as the init RAMdisk.

RAMdisk Init

The RAMdisk init stage loads drivers required to access the root filesystem, then passes control to the filesystem init stage. This includes drivers for ACPI, the framebuffer, and support for IDE, SATA, and NVMe storage devices. Once the disk drivers are in place, the NyxFS driver is activated using the UUID of the partition where the kernel and boot files are stored. It scans the drivers for this partition, mounts it, and continues the initialization process.

Filesystem Init

In this stage, drivers for non-disk-related tasks, such as audio and networking, are loaded. Once these essential drivers are initialized, the system displays the login prompt. If the display server Orbital is enabled, it is launched at this point.

Login

After all drivers and services are initialized, the user is able to log in. The login program prompts for a username, with "user" being the default, and displays the /etc/motd file. It then launches the user’s default shell, typically ion, providing full access to the system shell.

Graphical Overview

A graphical illustration of the boot and initialization process, including major scheme interactions, can be found below. While this overview may be slightly outdated, it remains informative regarding the overall system initialization.

Boot Process Documentation

For further information, more detailed documentation on the boot process is available.

4o

Last updated