How to execute modules loaded by GRUB - ELF?

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
AgentScorpion
Posts: 1
Joined: Sun Oct 14, 2007 10:08 am

How to execute modules loaded by GRUB - ELF?

Post by AgentScorpion »

If you are writing a micro kernel OS, how do you load the modules needed such as drivers and filesystem support and binary execution? Also is there any good tutorials on how to execute binaries in ELF Format?

Currently I have written a OS which has a single TSS, GDT, IDT, ISRs and IRQs, paged memory and a basic kernel heap.

I have written a test ELF executable, which GRUB loads after the kernel. What I would like to know is how do I execute the code? It have got the start and end addresses from the multiboot data. Is there anything else I need to do before I load the hardware drivers?
Fusion OS - Coming Soon...

Well actually just coming...

Possibly...
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Post by AJ »

User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

While I don't know if I recommend this -- I wrote an RDOFF2 loader, instead.

I edited a backend to LCC 3.6 to output nasm assembly, and so was able to use LCC and ldrdf to generate RDOFF2 objects/binaries.

The advantage of this is simplicity -- RDOFF2 objects are pretty simple to link and load. The nasm assembler comes with documentation on the format. I used this, and the source code to rdfdump in order to create my linker/loader code.

I eventually plan on supporting ELF as well, though, at some point, so I sometimes wonder why I didn't just put in the effort to support elf in the first place. However, like I said, the RDOFF2 loader got me up and running real quick.

--Jeff
Post Reply