I am writing a kernel module where I need to access sk_buff variables. But when I write

#include <linux/skbuff.h>

Netbeans says it can't locate that header file.

1 Answer 1


That header is purposely not installed in /usr/include/linux even if you have the kernel headers installed. This is because the things defined in that header are not part of the kernel's stable ABI; the kernel developers are allowed to change anything in that header between any two releases, so you must reference the headers specific to the kernel version you want the driver to link to.

For 2.6+ kernels, it is easier to get the right behavior through use of the standard kernel driver Makefile scheme than through attempts to arm-twist Netbeans. The 2.6+ driver build system does a lot of things for you, more than you will get from an "easy to use" IDE like Netbeans.

Maybe you can get the best of both worlds. Some IDEs let you use it as a glorified editor, but delegate building to an external make tool.

If you absolutely had to do everything within Netbeans, you could do it pretty much the same way we had to build drivers for 2.4 and earlier kernels. Basically, you end up referencing header file directories within the kernel source code itself. In GNU Makefile speak, you'd have something like this:

KERNPATH=/usr/src/kernels/$(shell uname -r)

Doing the same in Netbeans will probably be anywhere from difficult to impossible:

  1. Netbeans probably doesn't have a way to run a shell command (uname -r) from within the IDE as part of the build process and use its output to substitute into a variable used within the rest of the build.

  2. The kernel source path varies by Linux distro. With Makefiles you can just write a shell script to discover local details like this dymamically, but I doubt you can do that with Netbeans. The path above is correct for one Red Hat type system I happened to have checked while writing this answer. I then checked an Ubuntu system and found the same files in /usr/src/linux-headers-$(uname -r)/include instead. The were no standards for this until the new 2.6 kernel driver build system was developed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.