How to link a simple OS with gcc

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
mj

How to link a simple OS with gcc

Post 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!
Guest

RE:How to link a simple OS with gcc

Post 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
Guest

RE:How to link a simple OS with gcc

Post 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
Post Reply