This is a simple 16-bit bootloader written in x86 Assembly. It prints a welcome message to the screen using BIOS interrupts.
You need a Linux terminal with the following tools installed:
- Binutils (standard assembler
asand linkerld) - QEMU (to emulate the computer)
To install them on Ubuntu/Debian:
sudo apt update
sudo apt install binutils qemu-system-x86- Assemble the Code Convert the assembly source code (boot.s) into an object file (boot.o).
as boot.s -o boot.o- Link the Binary Use the linker script (boot.ld) to create the raw 512-byte boot sector image (boot.bin).
ld -T boot.ld boot.o -o boot.bin- Verify the Size (Important!) Check that the output file is exactly 512 bytes. If it is not, the BIOS won't load it correctly.
ls -l boot.bin
-rwxrwxr-x ... 512 ... boot.bin- Run in Emulator Boot the operating system using QEMU, treating the binary as a floppy disk image.
qemu-system-x86_64 -fda boot.bin"boot.bin is 32KB?" Check that your boot.ld file contains the /DISCARD/ section to remove hidden ELF metadata that bloats the file size.
"No bootable device?" Make sure you are using the -fda flag in the QEMU command (floppy disk emulation) to tell the emulator where your boot sector is.