SP5RFD
SP5RFD

Reputation: 861

Configuring Eclipse for Linux Kernel module development

I'm trying to configure Eclipse for developing Linux Kernel Modules under Ubuntu. So far I've added to Properties > Paths and Symbols > Includes > GNU C headers from directory /usr/src/'uname -r'/include but it doesn't remove all the Syntax error from my code.

After that, my code looks like this:

code after headers added to path

What else should I do to develop Kernel modules with pleasure?

Upvotes: 5

Views: 16522

Answers (2)

benf
benf

Reputation: 1005

If you are building an Out-of-Tree kernel module, follow the steps in the CDT wiki (linked in @pjenney58's response).

The key difference is at Step 30 (Source Location->expand your project name).

  1. Instead of adding a filter to your own source folder, choose "Link Folder..." to add the kernel source.
  2. Check 'Link to folder in the file system' and select the path to your kernel source.
  3. Click Ok, then follow the instructions for adding the filter (steps 31 & 32 in the wiki) but do it on the kernel source instead of your module folder.

In my project that took care of almost all the indexer markers complaining about syntax errors.

Upvotes: 1

pjenney58
pjenney58

Reputation: 316

If you're interested, those orange squigglies are actually indexer markers. Turn them off by going to window/preferences/general/editors/text editors/annotations, select c/c++indexer markers and uncheck 'text as'.

Also, this was posted on the Eclipse wiki: http://wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source

Upvotes: 4

Related Questions