simonkagstrom (simonkagstrom) wrote,

An illustrated guide to indexing the linux kernel in eclipse

I posted earlier about indexing the linux kernel in eclipse. After Jakob Engblom and a few people at work started following this, I realised it's probably a bit unclear. This post is just a condensed form of the earlier one but with helpful pictures! So, follow these steps to index the linux kernel with Eclipse Ganymede:
  • First download the autoconf-to-eclipse.py script and place somewhere in your path

  • Create a new project of the type C project and select Makefile project/Other toolchain. Uncheck the Use default location checkbox, then enter the path to the kernel source:

    eclipse-new

  • Click next and select Advanced options

  • Select the C/C++ Build tab and uncheck Automated discovery of paths and symbols:

    uncheck-automate-discovery

  • Select the C/C++ General tab and select no indexer

    no-indexer


  • Remove the default includes from all languages and add kernel includes so that you have something like this:

    all-includes

    When adding includes, select Add to all languages and select a workspace path:

    add-kernel-include

  • Select the Symbols tab and add the __KERNEL__ symbol:

    symbols

    Again, add to all languages:

    add-symbol

  • Press OK to return to the main eclipse window

  • Exclude non-needed architectures and includes by selecting paths in the project window, right clicking and selecting Exclude from build...:

    exclude-from-build

    Do the same for unneeded includes

  • Run autoconf-to-eclipse.py in the kernel directory, updating the eclipse project files:

    run-autoconf-to-eclipse

  • Refresh the project in the project window and enter the project properties again. Enable the indexer:

    enable-indexer

  • Press OK

Eclipse will now index the kernel and after this you should be set to go. Indexing will obviously take some time, but it's saved between sessions so you can safely exit eclipse.
Comments for this post were disabled by the author