Page 1 of 1

compiling my c program/kernel

Posted: Mon Aug 25, 2003 5:35 am
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

Re:compiling my c program/kernel

Posted: Mon Aug 25, 2003 6:54 am
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)

Re:compiling my c program/kernel

Posted: Tue Aug 26, 2003 12:03 am
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

Re:compiling my c program/kernel

Posted: Tue Aug 26, 2003 12:21 am
by Solar
Zalzer wrote: I'm all new to osdev...

What should I do next then...?
.:QuickLinkz:. <-- read this before you post !