Skip to content

Greyrat7490/bloader

Repository files navigation

simple legacy bootloader

procedure

  • enable A20
  • get memory info
    • memory map
    • continuous memory (for BIOSes not supporting memory map)
  • check vbe support
  • get best vbe mode
  • enter protected mode
  • load kernel from FAT16 drive (file named "KERNEL")
  • enter long mode
  • pass important information (in rdi)
  • give control to the kernel (elf64 file)

build

  • $ make / $ make release
    • creates a bootable image without any kernel inside

test it with qemu

  • $ make test
    • creates a bootable image with a test kernel inside (test.asm)
    • test.asm just prints "BLOADER" to the screen

debug with qemu

  • $ make monitor
    • $(qemu) info tlb
      • all valid pages and there frames
    • $(qemu) info mem
      • compact paging tables
    • $(qemu) info registers
      • show all regs and there values
    • $(qemu) x/<num>x <addr>
      • show num words at addr
    • $(qemu) x/<num>i <addr>
      • show num instructions at addr

create log with qemu

  • $ make log
    • log all interrupts (state of all regs)

try it on a real device

  • $ make / $ make release
  • $ sudo dd if=build/bloader.img of=/dev/<YourDevice> (or any other way)
  • put your elf64 kernel into the root directory and call it "KERNEL" (or change name in OPTIONS)
  • reboot and open BIOS
  • make sure legacy boot(CSM) is enabled when using uefi device
  • boot into USB device

About

simple legacy bootloader in assembly x86

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published