GabrielRRussell / BootK

Multistage Bootloader for x86 based systems

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BootK

The premier x86 Bootloader for KoiOS!

A rectangular minimalist art piece, with a drawing of a yellow bouquet of pink flowers to the left. Above it is the text 'BootK', with a green circle reaching around the bouquet of flowers. The background is a green and white gradient.


Prerequisites

You'll need the following utilities installed:

  • NASM - Assembler
  • sfdisk - Scripting disk image partitions
  • mkfs - Formatting various filesystems
  • e2tools - EXT2 Disk Image Operations
  • qemu-system-x86_64 (or any other 32/64bit x86 VM of your choice)
  • gdb - Debugging the boot loader

Building

As long as you have the above utilities installed, edit the makefile to fit what your needs. You do NOT need root permissions to build the disk image, since this build script does not take advantage of loop devices, or mount the disk images. It uses entirely userspace tools to do so, as long as you have the proper prerequisites installed. Most of these should be included on your Distro, but I'm running on a Debian based OS. The only tools I had to install using my package manager were NASM, e2tools, and qemu.

Use make to build a bootable disk image.
Use make test to make and boot the image in a VM.
Use make debug to open the image in a VM, and connect GDB to it in ASM layout.
Use make clean to remove non-source files in the directory.


Other Info

BootK is a 2 Stage Loader by default. Building the image will generate a 128MB disk image, that is formatted as GPT. BootK currently works only on BIOS machines, but will eventually include UEFI. BootK does not support MBR formatted disks. There will be two required partitions:

  1. RAW, 4KB - This is used to store the first stage for BIOS machines. GUID: 0x0000FEED
  2. FAT32, 128MB - This is the ESP for UEFI machines, and stores a config file for BootK.

The RAW partition is for BIOS systems to load the first stage of BootK, and must not be modified. It has no filesystem. The FAT32 partition is the EFI System Partition, and stores a configuration file that is loaded by BootK, and it will also eventually store the EFI executable used to load the OS on UEFI based systems. On BIOS machines, the Bootsector will load the raw executable from the first partition, and run it at 0x8000. The RAW partition must be recorded in the first 4 sectors of the partition entry table, for technical reasons.

BootK is not quite yet ready for booting other Operating Systems. It will be in the future though, so keep an eye out!

Credits and Thanks

Software, Code, Documentation:

About

Multistage Bootloader for x86 based systems

License:MIT License


Languages

Language:Assembly 90.0%Language:Makefile 10.0%