Skip to content

Booting — GRUB images, modules, kernel_main

Equinox OS boots via GRUB multiboot as a plain 32-bit kernel — no UEFI stub, no bootloader of its own. Disks installed with Qfs -install-boot are made bootable in the same way.

Two boot paths

1. Live ISO (make run)

src/boot/grub.cfg template → grub-mkrescue → dist/equinox.iso. One .cfg entry boots kernel.elf with a module line per asset.

2. Installed disk (Qfs -install-boot hdX)

The same chain, embedded:

  • boot.img — the 512-byte boot image (from grub-mkimage);
  • core.img — the GRUB core with an early.cfg prefix, written at LBA 1 of the disk (the region before the FAT32 partition at LBA 2048 stays reserved for it);
  • /boot/grub/grub.cfg — generated by walking the volume and listing .mrp .c .wad .ruf .elf .h files;
  • MBR rewritten with the VBR's BPB.

So a disk produced by the installer is self-contained: GRUB → kernel → modules → shell, with no ISO.

What GRUB hands over

  1. Video mode request: 1360×768×32 via VBE, VGA text fallback.
  2. kernel.elf (multiboot) — kernel_main(mb_magic, mb_info) receives the MEMMAP and the module list.
  3. One module per userland asset, staged at 0x2800000 (12 MB) by boot/start.asm:
  4. flat .c files → RAMFS /test;
  5. nested trees → /equinox/tools, /equinox/libc;
  6. .mrp/.wad → placed by their dist/ path;
  7. the kernel-min.elf module is re-registered as /boot/kernel.elf via a cmdline trick.

kernel_main subsystem order

FPU+SSE → idt_init → timer_init(100) → mouse_init
→ vesa (force 1360x768x32) → paging_set_ram_top(mb_info->mem_upper)
→ paging_init → tss_init → init_display
→ fs_init (RAMFS; panic if no root)
→ pci_init → fat32_boot_init (blk_init: ata_init, ahci_init)
→ mrp_bootloader_load_modules(mb_info)
→ syscall_init/sys_init
→ net_init (nic_load_pref via system.ecf → net_nic_init)
→ httpd → shell_entry

Order matters: pci_init and blk_init must precede net_init because NIC selection reads system.ecf off the mounted volume, and the E1000 driver needs PCI enumeration.

Early-boot config

/equinox/conf/system.ecf is parsed after the first FAT32 mount so that [net] driver, dependencies.bash and eggkg.* are live before the shell starts. See SYSTEM_ECF.md.

Serial mirror

Boot log and the shell are mirrored to COM1; launch with -serial file:serial.log to capture them — every QEMU regression script asserts against that stream.

Hand-rolling the boot disk

Qfs -list-disk
Qfs -t hde -format fat32
mount hde
copy dist/equinox /mnt/equinox
set -w /mnt/equinox/conf/system.ecf
Qfs -install-boot hde

Full walkthroughs: INSTALL.md, QFS.md.