Skip to content

mohammadhb/gootloader

Repository files navigation

alt text

Gootloader

Create bootloaders with Go.

Getting Started

Start with creating a Bootloader with your config :

bl := Bootloader{
    Name:     "myBootloader",
    Arch:     1,      // Bootloader Architecture
    ModeBit:  16,     // Bootloader Bit Mode
    Loaddest: 0x7C00, // Destination of loading of bootloader in Memory
}
  

Maybe Print a Message :

message := "Dear BIOS, Load me into ram and give the control flow to me please"
bl.print(message)

Create Your Bootloader :

This generates bl.name.asm file

bl.create();//AKA final file for bootloader

Hello World Example

in main.go file :

package main

import (
	gootloader "github.com/mohammadhb/gootloader"
)

func main() {

	bl := gootloader.Bootloader{
		Name: "MyFirstBootloader",
	}

	bl.Print("Hello World!")
	bl.Create()

}

run go run main.gp

Emulate and Testings the Bootloader

After you create your bootloader using .create() You can use

nasm boot.asm -f bin -o boot.bin && qemu-system-i386 -fda boot.bin

Caution : You must install nasm and qemu in your device to be able to emulate your bootloader (qemu-system-i386 is x86 arch in this example)