This project focuses on understanding how bootloaders work. It includes various stages and components to load an operating system.
Warning
This project is a work in progress and is not yet complete. It is not recommended for production use.
- OS Loader: Loads the operating system (Unix family).
- GUI: Graphical user interface.
- Config: Configuration files and settings.
Currently, there is no installation process available.
nasm(Netwide Assembler)ld(GNU Linker)gcc(GNU Compiler Collection)make(GNU Make)clang(LLVM Compiler)qemu(for running the bootloader)
To build the bootloader, run the following command:
makeThis will generate the bootloader binary in the build directory.
To build the ELF file for debugging, run:
make debugTO run the bootloader in QEMU, run:
make run DEBUG=falseTO run the bootloader in QEMU with debugging enabled, run:
make run DEBUG=trueTo clean the build directory, run:
make cleanClick to expand
- Place the code in MBR (first sector of the disk)
- Setup 16-bit segment registers and stack
- Print startup message
- Enable and confirm enabled A20 line
- Load GDTR
- Setup GDT
- Enable 32-bit Protected Mode
- Call second stage C code
- Support GNU Multiboot
- Check presence of PCI, CPUID, MSRs
- Inform BIOS of target processor mode
- Get memory map from BIOS
- Locate kernel in filesystem
- Allocate memory to load kernel image
- Load kernel image into buffer
- Enable graphics mode
- Check kernel image ELF headers
- Allocate and map memory for kernel segments
- Setup COM serial output port
- Setup IDT
- Disable PIC
- Check presence of CPU features (NX, SMEP, x87, PCID, global pages, TCE, WP, MMX, SSE, SYSCALL), and enable them
- Assign a PAT to write combining
- Setup FS/GS base
- Load IDTR
- Enable APIC and setup using information in ACPI tables
- Setup TSS
Contributions are welcome! Please fork the repository and submit a pull request.