I working on a monolithic x86 kernel for my university dissertation. I've got the basics done, and am close to starting multitasking, so of course I had to eventually set up a proper cross compiler and tool chain. Using http://wiki.osdev.org/GCC_Cross-Compiler and http://wiki.osdev.org/OS_Specific_Toolchain
I can now compile and link my kernel to an elf binary.
However I'm slightly confused with the os specific toolchain part, I sorted binutils and gcc and built them, however I don't want to use newlib as my c runtime, I want to code this myself. So I ignored the bit about newlib.
Now I compile my basic test prog (I have no api yet, thats coming later, the prog consists of "int main(void){ return 2+3; }") which is fine, however of course when it comes to linking it fails expecting crt0.o.
So as mentioned in the tutorial I created crt0.asm consisting of
Code: Select all
global _start
extern main
_start:
call main
jmp $
Now when i link against this its fine.
My questions are:
1) how can i configure ld to know where my crt0.o and other runtime libraries are by default, i'm currently using --nostdlib and manually specifying crt0.o
2) Is this going to work?
Thanks for any help, it'll be much appreciated.
Wiggles