compiling my c program/kernel

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
Zalzer

compiling my c program/kernel

Post by Zalzer »

Hey can anybody help me

I have written a small program/kernel in c and want the bootloader to load it.
But when I compile it with gcc it turns into a *.exe file and the bootloader only loads *.com files

So my question is
How do I compile my c program/kernel into a *.com file?
or
How do I make the bootloader load an *.exe file
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:compiling my c program/kernel

Post by Pype.Clicker »

there's nothing like .COM out of DJGPP (or any other 32 bits linker) as .COM is per se a 16 bits format (or rather lack of format :p )

however, by selecting "binary" as output format (look at your linker's options, but i think -oformat binary should do the trick), you can have a flat binary ready-to-run-if-loaded-at-address-X 32 bit image.

also note that .EXE files usually include some stub code that will either enter pmode using DPMI services or perform windows-specific initializations, thus they must be forgotten at this point ... (though COFF .o may be translated into something loadable)
Zalzer

Re:compiling my c program/kernel

Post by Zalzer »

Thanks

I'll try as soon as I get some spare time
I'm all new to osdev, so if this work then I'll have a bootloader theres able to boot a program writting in c

What should I do next then, I know that I have to make a console, and I think, I'm not sure, I know how to do that, but how do I make it load/start up a program on the disk?
I'll write it in c
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:compiling my c program/kernel

Post by Solar »

Zalzer wrote: I'm all new to osdev...

What should I do next then...?
.:QuickLinkz:. <-- read this before you post !
Every good solution is obvious once you've found it.
Post Reply