Kernel Design

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
Chris (Yet Again...)

Kernel Design

Post 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++??
Tim

Re: Kernel Design

Post 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).
K.J.

Re: Kernel Design

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