/x86-bootloader

A hobby project to learn how to make a bootloader. Written in C and x86 Assembly

Primary LanguageAssemblyMIT LicenseMIT

x86-bootloader

A hobby project to learn how to make an x86 bootloader in 16-bit real and 32-bit protected mode

Requirements

Make sure the following are installed:

  • qemu -- emulates x86 system virtually
  • nasm -- compile x86 assembly into machine code( since the assembly was written with the Intel syntax )

Usage

  • 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

Notes

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.

References