Simple Bootloader to load bin
Posted: Sat Sep 22, 2018 2:58 pm
I am new to things like OS dev, but I would like to ask you if there is any simple bootloader or tutorial how to load bin file (which contains custom OS).
I read lot of tutorials about bootloaders, but mostly they end with Hello World and doesn't say how to load some bin file.
I have kernel.bin which contains:
kernel.asm:
and kernel.c:
It uses grub as bootloader and kernel.bin is saved in /boot/ directory, but I would like to create custom bootloader which loads that kernel.bin
I know that if I create custom bootloader I can use only first 510 bytes, because 511th and 512th byte contains magic number for booting.
I know that I have to use:
But I don't know how to tell to that bootloader to load that kernel.bin
I read lot of tutorials about bootloaders, but mostly they end with Hello World and doesn't say how to load some bin file.
I have kernel.bin which contains:
kernel.asm:
Code: Select all
bits 32
section .text
align 4
dd 0x1BADB002
dd 0x00
dd - (0x1BADB002+0x00)
global start
extern kernel
start:
cli
call kernel
hlt
Code: Select all
kernel()
{
char* VideoMemory = (char*)0xb8000;
VideoMemory[0] = 'M';
VideoMemory[2] = 'y';
VideoMemory[4] = ' ';
VideoMemory[6] = 'O';
VideoMemory[8] = 'S';
}
I know that if I create custom bootloader I can use only first 510 bytes, because 511th and 512th byte contains magic number for booting.
I know that I have to use:
Code: Select all
times 510 - ($ - $$) db 0
db 55h
db 0AAh