A hobby project to learn how to make an x86
bootloader in 16
-bit real and 32
-bit protected mode
Make sure the following are installed:
qemu
-- emulates x86 system virtuallynasm
-- compile x86 assembly into machine code( since the assembly was written with theIntel
syntax )
-
You can compile all the bootloaders without a kernel with this:
./compile.sh
-
In order to use them as boot devices from a
floppy
disk, you can run them like so:qemu-system-x86_64 -fda real-mode-bootloader # it is in 16-bit real mode qemu-system-x86_64 -fda protected-mode-bootloader # it is in 32-bit protected mode
-
In order to compile the bootloader with a kernel, you need to have a gcc cross-compiler of target
i686-elf
installed. You can compile the bootloader with the kernel like so:./kernel-compile.sh
In case you don't have that cross-compiler installed, you can use check this to install it or use my bash script here to do all the heavy lifting for you.
-
In order to run the bootloader with the kernel, you can run it like so:
qemu-system-x86_64 -fda kernel.bin
This project is a work in progress. I am still learning about the x86
architecture and how to write bootloaders. I will be updating this project as I learn more about the x86
architecture and how to write bootloaders. But it ain't easy, so I will be updating this project slowly.