LET’S BUILD AN OS!
Kicking off an Arch Linux install.
© LINUX FROM SCRATCH, ARCH LINUX
IN AN OLD REDDIT THREAD someone once asked, “If you were locked in a room with a PC with no OS, could you write one from scratch?” Among all the joke replies, someone actually answered that question—Kragen Javier Sitaker, who worked for Canonical (the company that publishes Ubuntu) at the time.
Sitaker’s approach took a number of steps to implement the base functionality that’s needed to get an OS up and running, though this hinges on there being a functioning IBM PCcompatible BIOS. He then piggybacked off the bootloader to implement his base features.
On the previous spread we alluded to the BIOS providing base access to devices. This is done via interrupts, and enables the minimal bootloaders to get an OS kernel up and running, and indeed enable the kernel to bootstrap itself into life. Interrupt calls cover everything from writing to the screen (10h), read/ write to storage devices (13h), serial port access (14h), read the keyboard (16h), and access the PCI bus (1Ah).
Using the Intel 8088 ah and al registers, you could print a “!” character to the screen using screen function 0Eh and interrupt call 10h in assembler like so: