How to exucute an elf kernel from a bootloader

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
marcthe12
Posts: 2
Joined: Sun Nov 08, 2015 6:36 pm

How to exucute an elf kernel from a bootloader

Post by marcthe12 »

Hi! I am a beginner and I have made a boot loader return in flat binary and planning to execute the kernel. I have written the code for loading up files and entered protected mode. I planning to write a kernel ini686-elf. So after the kernel is loader in memory, how to run the code.

I have been using the following tutorial http://www.brokenthorn.com/Resources/OSDevIndex.html in order making the boot loader.
User avatar
BASICFreak
Member
Member
Posts: 284
Joined: Fri Jan 16, 2009 8:34 pm
Location: Louisiana, USA

Re: How to exucute an elf kernel from a bootloader

Post by BASICFreak »

Hello, so the steps are:

Process ELF Header - Get Entry Point and Program Header Information

Process each Program Header - Copy each section to there respected location, and clear any allocated memory not located in the ELF.

Switch Modes

Jump to ELF Entry Point.


Grab a copy of the ELF Spec - if I'm not mistaken you should only have to worry about sections 1-3 and 2-2 (until you get into SOs or Relocs)



B!
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
Sortie wrote:
  • Don't play the role of an operating systems developer, be one.
  • Be truly afraid of undefined [behavior].
  • Your operating system should be itself, not fight what it is.
Post Reply