Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

Simple Bootloader to load bin

$
0
0

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:

bits    32section         .text        align   4        dd      0x1BADB002        dd      0x00        dd      - (0x1BADB002+0x00)global startextern kernelstart:        cli        call kernel        hlt

and kernel.c:

kernel(){        char* VideoMemory = (char*)0xb8000;        VideoMemory[0] = 'M';        VideoMemory[2] = 'y';        VideoMemory[4] = '';        VideoMemory[6] = 'O';        VideoMemory[8] = 'S';}

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:

times 510 - ($ - $$) db 0db 55hdb 0AAh

But I don't know how to tell to that bootloader to load that kernel.bin


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>