Create bootloaders with Go.
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
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
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)