Page 1 of 1

How to link a simple OS with gcc

Posted: Tue Nov 20, 2001 12:00 am
by mj
I have written a simple OS, a boot strap, and a kernel
file(kernel.s), and a main.c C file.

I compile and link the kernel.s and main.c with gcc, I
want the ouput file to be a bin, and I will put the bin
file at 0x100000 in the memory, how can I link the two
files(how can I write the link script)?

How can I jump to the entry point of the bin file, I know
there is a header structure at the front of the bin file.

Any help will be great appreciated!

RE:How to link a simple OS with gcc

Posted: Tue Nov 20, 2001 12:00 am
by Guest
>I compile and link the kernel.s and main.c with gcc, I
>want the ouput file to be a bin, and I will put the bin
>file at 0x100000 in the memory, how can I link the two
>files(how can I write the link script)?

gcc -c -o kernel.o kernel.s
gcc -c -o main.o main.c
ld -Ttext 0x100000 --oformat binary -o kernel.bin kernel.o main.o

RE:How to link a simple OS with gcc

Posted: Tue Nov 20, 2001 12:00 am
by Guest
>How can I jump to the entry point of the bin file, I know
>there is a header structure at the front of the bin file.

There's no header structure for a bin file