Skip to content

A tiny Os-bootloader created in x_86 assembly with welcome msg with own custom linker script

Notifications You must be signed in to change notification settings

aadityansha06/bootloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Custom OS Bootloader

This is a simple 16-bit bootloader written in x86 Assembly. It prints a welcome message to the screen using BIOS interrupts.

Prerequisites

You need a Linux terminal with the following tools installed:

  • Binutils (standard assembler as and linker ld)
  • QEMU (to emulate the computer)

To install them on Ubuntu/Debian:

sudo apt update
sudo apt install binutils qemu-system-x86

How to Build and Run

Follow these steps to compile the code and start the virtual machine.

  1. Assemble the Code Convert the assembly source code (boot.s) into an object file (boot.o).
as boot.s -o boot.o
  1. 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
  1. 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

Output should look like:

-rwxrwxr-x ... 512 ... boot.bin
  1. Run in Emulator Boot the operating system using QEMU, treating the binary as a floppy disk image.
qemu-system-x86_64 -fda boot.bin

Troubleshooting

"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.

About

A tiny Os-bootloader created in x_86 assembly with welcome msg with own custom linker script

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published