Page 1 of 1

Kernel Design

Posted: Wed Feb 20, 2002 3:46 pm
by Chris (Yet Again...)
I am writing my kerel in ASM, and have different fils for video, the console, etc... I dont know how to compile all these files in to one. Can i just use an include call like you cn in C++??

Re: Kernel Design

Posted: Thu Feb 21, 2002 3:08 am
by Tim
You could do, but the long-term solution is to use a linker.

1) Assemble each .ASM file to .OBJ or .O files
2) Compile each .C file to .OBJ or .O files
3) Use your linker to link all the .OBJs or .Os into one executable

A good linker will let you link to either flat binary (i.e. just raw code and data) or to some format (such a ELF or PE).

Re: Kernel Design

Posted: Thu Feb 21, 2002 5:50 am
by K.J.
Tim's right. If you're using NASM compile each file like this:

nasm -f coff yourfile.asm

Then link all of the files toget with LD like this:

ld  --oformat binary yourfile.o yourfile2.o -o yourkernel.bin

K.J.