开发者

Linux kernel headers

  • I want to understand, what type of header files are placed u开发者_运维知识库nder "/includes/" in the base directory of the kernel. Are these files intended to be the "public" headers/API's in some sense ? Thereby being, oblivious of the architecture, config switches that have been enabled/disabled etc ?

  • In short, if I want to use some core kernel functionality within my driver, may I safely assume that the functionality I am looking for, would be contained in one of the relevant header files under "/includes" and nowhere else ?

Look forward to some comments.

Thanks..!


I've been looking into this matter a little bit myself recently.

I don't know how related this answer is since it sounds like you are only concerned about understanding the packaging of the kernel source you have on hand. This answer probably only pertains to your second question. Nevertheless here is some stuff I've found about kernel headers.

From what I've found there are two potential locations that end up being referred to as "kernel headers".

The first location is in /usr/src/linux-headers-`version' (at least on my Ubuntu machine). This is where your kernel (source?) is installed as well as the accompanying headers. If you want to build kernel modules then you will need to build against the headers found here.

On the other hand /usr/include/{linux,asm} also contain "kernel headers". You can think of these header files as the userland interface to your kernel. It is the API exported by the kernel so userland programs can make system calls. Your libc will take advantage of this API so it can create functions (in /usr/include) based on which system calls are available.

Here are a couple of documents to back up what I've just said and to clarify things a bit more:

Here is a link about the difference between /usr/src/linux-headers-`version' and /usr/include on RHEL4.

http://www.linuxquestions.org/questions/red-hat-31/rhel4-kernel-devel-headers-packages-missing-directories-697552/

Here is a link about 'exporting' kernel headers: http://www.kernel.org/doc/Documentation/make/headers_install.txt

Finally here is another explanation of what kernel headers are for: http://www.overclockers.com/forums/showthread.php?t=647638

So maybe you knew this already and you just wanted to know how to create a driver using the sources in your kernel package, but at least with this answer you know that its definitely the place to start.


Yes, include contains the standard APIs for use with kernel development.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜