How to compile my kernel

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
Whatever5k

How to compile my kernel

Post by Whatever5k »

Hi,
ok, I have my kernel.c and some headerfiles in my own include directory... .
Do I only need to compile my kernel.c or also the headerfiles? And how do I manage, that the #include directory is not /usr/include?
K.J.

Re: How to compile my kernel

Post by K.J. »

Well, if you includes are in the same directory as your kernel.c then simply include them like this(notice the quotes):

#include "whatever.h"

That will make the compiler look for the includes in the directory that your kernel.c is in.

Do I only need to compile my kernel.c or also the headerfiles?

Both. If you just say:

gcc kernel.c
or more likly:
gcc -c kernel.c
(then link kernel.o to a flat binary)

The includes should be automaticly compiled into kernel.o so they should stay when you link kernel.o

K.J.
Post Reply