Page 1 of 1
gcc
Posted: Thu Feb 07, 2002 3:51 am
by Whatever5k
Do I have to compile my kernel normally like
gcc -o kernel.bin kernel.c
I heard, that some people use
gcc -ffreestanding -o kernel.bin kernel.c
Does it make a difference and if yes, which?
Re: gcc
Posted: Thu Feb 07, 2002 3:18 pm
by K.J.
Actually, output it as a COFF file like this:
gcc -c kernel.c
You should find a file named kernel.o in the directory where kernel.c was. Now like the kernel.o to a binary with LD like this:
ld --oformat binary kernel.o
You should now find a file name a.out in the directory where kernel.c was. Rename a.out to kernel.bin and there you(should) have it!
K.J.
Re: gcc
Posted: Thu Feb 14, 2002 2:18 am
by jkliff
Hi, I am new to the board. I am just in the process of learning where to begin to code an Operating System (which will, for sure, take a few months more).
Well, I heard about the -ffreestanding option on gcc meaning something like 'generates code to run without an operating system'. I also have seen that ld should link to 0x1000000 (perhaps there's a 0 more or less
) and now I see here something different. What is correct/wrong and why?
Thanks,
John
Re: gcc
Posted: Thu Feb 14, 2002 2:35 am
by The Legend
You need to specify an entry point for your kernel, this is the
option with the 0x10000. Note that it shouldn't be 0x0!!! Some structures are in the memory range in between (64 kb)!