A lightweight, minimal bare-metal bootloader written in x86 Assembly, running on real hardware or in QEMU inside Docker.
This project provides a fully isolated Docker environment for assembling and running a bootloader without requiring an OS.
No OS Required – Runs directly on hardware.
Minimal Setup – No dependencies needed on the host machine.
Fully Dockerized – NASM (for assembly) and QEMU (for execution) included in the container.
USB Bootable – Can be flashed to a USB drive and booted on real hardware.
baremetal-bootloader/
├── src/ # Source files
│ ├── bootloader.asm # Core bootloader (loads kernel and modules)
│ ├── core.asm # Core functionalities (prompt, input, output)
│ ├── commands/ # Separate folder for commands
│ │ ├── echo.asm # "echo" command
│ │ ├── clear.asm # "clear" command
│ │ ├── help.asm # "help" command
├── bin/ # Compiled output
│ ├── bootloader.bin
├── scripts/ # Build & run scripts
│ ├── build.sh
│ ├── run.sh
│ ├── entrypoint.sh
├── Dockerfile # Minimal Docker setup
└── README.md # Project documentation
Make sure you have Docker installed. If not, install it from:
🔗 Docker Install Guide
git clone https://github.com/javabrown/baremetal-bootloader.git
cd baremetal-bootloaderchmod +x run_docker.sh scripts/*.sh./run_docker.shWhat this does:
- Deletes any existing Docker image.
- Builds a fresh Docker image.
- Runs the container with NASM and QEMU pre-installed.
Inside Docker, run:
/app/scripts/build.shOutput:
Compiling Bootloader...
Bootloader compiled successfully! File saved in bin/bootloader.bin
Inside Docker, run:
/app/scripts/run.shExpected Output in QEMU:
Hello, World from Bare-Metal Bootloader!
If you want to boot this on real hardware:
sudo dd if=bin/bootloader.bin of=/dev/sdX bs=512 count=1(Replace /dev/sdX with your actual USB drive path.)
- Restart your computer
- Enter BIOS/UEFI (Press F2, F12, DEL, ESC, depending on the manufacturer)
- Set the USB drive as the first boot device
- Save and exit
💡 If successful, you will see the message on your screen!
Would you like to:
- Handle keyboard input in the bootloader?
- Load a kernel after boot?
- Port this to ARM for mobile devices?
Getting "stat /app/build.sh: no such file or directory" error?
Make sure the scripts are mounted inside Docker:
-v $(pwd)/scripts:/app/scriptsEnsure the scripts have execution permissions:
chmod +x scripts/*.shFeel free to fork this repo, submit PRs, or ask questions in the Issues section!
Follow for more projects: https://github.com/javabrown
This project is open-source under the MIT License.