Skip to main content
Jump to: navigation, search

Difference between revisions of "HowTo use the CDT to navigate Linux kernel source"

(New page: I've developed some steps that I've found to get the CDT to work well with the Linux kernel source. If you exclude some of these steps, it may still work to a large degree, but some things...)
 
Line 1: Line 1:
I've developed some steps that I've found to get the CDT to work well with the Linux kernel source. If you exclude some of these steps, it may still work to a large degree, but some things may not work exactly right... for example it may find the wrong include file for a C file.
+
I've developed some steps that I've found to get the CDT to work well with the Linux kernel source. If you exclude some of these steps, it may still work to a large degree, but some things may not work exactly right; for example it may find the wrong include file for a C file.  
  
Anyway, as you do these steps, I think you may understand how they assist the indexer to do a good job for the Linux kernel source.
+
Anyway, as you do these steps, I think you may understand how they assist the indexer to do a good job for the Linux kernel source.  
  
Download and install Eclipse plus the CDT.<br> Configure and build your kernel. This can be done before or after downloading and installing Eclipse.<br> Start up Eclipse.<br> Click '''File'''-&gt;'''New'''-&gt;'''C Project'''<br> Fill in a project name like ''my_kernel''<br> Uncheck the '''Use default location''' box and type in the root directory of your kernel into the '''Location''' box.<br> In the '''Project type:''' pane, click the '''Makefile project''' and select '''Empty Project'''<br> On the right side, select '''Linux GCC'''<br> Click '''Finish'''<br> Eclipse will start indexing the kernel source files, so double click on the little moving "activity" icon in the lower right part of the Eclipse window.<br> Click the square red stop button on the indexer.<br> Right click the top-level project in the '''Project Explorer''' pane on the left, and select '''Properties''' at the bottom.<br> Click the '''Manage Configurations''' at the top right.<br> Select '''Linux GCC''' (if it isn't already) then click '''New...'''<br> Give it a name like ''Linux config'' and a similar description, and click '''OK'''<br> Select your new configuration, and click '''Set Active''' and then '''OK'''<br> Select '''Resource''', and then in the '''Text file encoding''' section, select '''Other''' and '''ISO-8859-1''' in the box, then click '''Apply'''<br> Click on '''Indexer''' and then clear out the '''Files to index up-front''' box.<br> Select '''Use active build configuration''' at the bottom, and click '''Apply'''<br> Click on '''Paths and Symbols'''<br> Select the '''Includes''' tab and then select '''GNU C'''<br> Click '''Add...'''<br> Click '''Workspace...''' then select your project's {{{include}}} directory<br> Do another Add, Workspace and add {{{arch/}}}''architecture''{{{/include}}}, e.g., {{{arch/powerpc/include}}}<br> Click the '''# Symbols''' tab<br> Click '''Add...'''<br> Set the name to {{{__KERNEL__}}}<br> Set the value to {{{1}}} and click '''OK'''<br> Click the '''Source Location''' tab<br> Click the twisty for your project.<br> Select the '''Filter''' item and click '''Edit Filter...'''<br> Click '''Add Multiple...''' and then select all of the {{{arch/*}}} directories in your kernel source that will not be used (i.e. all the ones that are not for the architecture you are using)<br> Click '''OK''' and '''OK''' again to dismiss that dialog.<br> Click '''OK''' on the Properties dialog.<br> Right click on the project again and select '''Index''' then select '''Rebuild'''<br> It will take about 20 minutes or so to complete.<br><br>
+
#Download and install Eclipse plus the CDT.
 +
#Configure and build your kernel. This can be done before or after downloading and installing Eclipse.
 +
#Start up Eclipse.
 +
#Click '''File'''-&gt;'''New'''-&gt;'''C Project'''
 +
#Fill in a project name like ''my_kernel''
 +
#Uncheck the '''Use default location''' box and type in the root directory of your kernel into the '''Location''' box.
 +
#In the '''Project type:''' pane, click the '''Makefile project''' and select '''Empty Project'''
 +
#On the right side, select '''Linux GCC'''
 +
#Click '''Finish'''
 +
#Eclipse will start indexing the kernel source files, so double click on the little moving "activity" icon in the lower right part of the Eclipse window.
 +
#Click the square red stop button on the indexer.
 +
#Right click the top-level project in the '''Project Explorer''' pane on the left, and select '''Properties''' at the bottom.
 +
#Click the '''Manage Configurations''' at the top right.
 +
#Select '''Linux GCC''' (if it isn't already) then click '''New...'''
 +
#Give it a name like ''Linux config'' and a similar description, and click '''OK'''
 +
#Select your new configuration, and click '''Set Active''' and then '''OK'''
 +
#Select '''Resource''', and then in the '''Text file encoding''' section, select '''Other''' and '''ISO-8859-1''' in the box, then click '''Apply'''
 +
#Click on '''Indexer''' and then clear out the '''Files to index up-front''' box.
 +
#Select '''Use active build configuration''' at the bottom, and click '''Apply'''
 +
#Click on '''Paths and Symbols'''
 +
#Select the '''Includes''' tab and then select '''GNU C'''
 +
#Click '''Add...'''
 +
#Click '''Workspace...''' then select your project's include directory
 +
#Do another Add, Workspace and add {{arch/}}''architecture''{{/include}}, e.g., {{arch/powerpc/include}}
 +
#Click the '''# Symbols''' tab
 +
#Click '''Add...'''
 +
#Set the name to {{__KERNEL__}}
 +
#Set the value to {{1}} and click '''OK'''
 +
#Click the '''Source Location''' tab
 +
#Click the twisty for your project.
 +
#Select the '''Filter''' item and click '''Edit Filter...'''
 +
#Click '''Add Multiple...''' and then select all of the arch/* directories in your kernel source that will not be used (i.e. all the ones that are not for the architecture you are using)
 +
#Click '''OK''' and '''OK''' again to dismiss that dialog.
 +
#Click '''OK''' on the Properties dialog.
 +
#Right click on the project again and select '''Index''' then select '''Rebuild'''
 +
#It will take about 20 minutes or so to complete.

Revision as of 19:11, 10 November 2009

I've developed some steps that I've found to get the CDT to work well with the Linux kernel source. If you exclude some of these steps, it may still work to a large degree, but some things may not work exactly right; for example it may find the wrong include file for a C file.

Anyway, as you do these steps, I think you may understand how they assist the indexer to do a good job for the Linux kernel source.

  1. Download and install Eclipse plus the CDT.
  2. Configure and build your kernel. This can be done before or after downloading and installing Eclipse.
  3. Start up Eclipse.
  4. Click File->New->C Project
  5. Fill in a project name like my_kernel
  6. Uncheck the Use default location box and type in the root directory of your kernel into the Location box.
  7. In the Project type: pane, click the Makefile project and select Empty Project
  8. On the right side, select Linux GCC
  9. Click Finish
  10. Eclipse will start indexing the kernel source files, so double click on the little moving "activity" icon in the lower right part of the Eclipse window.
  11. Click the square red stop button on the indexer.
  12. Right click the top-level project in the Project Explorer pane on the left, and select Properties at the bottom.
  13. Click the Manage Configurations at the top right.
  14. Select Linux GCC (if it isn't already) then click New...
  15. Give it a name like Linux config and a similar description, and click OK
  16. Select your new configuration, and click Set Active and then OK
  17. Select Resource, and then in the Text file encoding section, select Other and ISO-8859-1 in the box, then click Apply
  18. Click on Indexer and then clear out the Files to index up-front box.
  19. Select Use active build configuration at the bottom, and click Apply
  20. Click on Paths and Symbols
  21. Select the Includes tab and then select GNU C
  22. Click Add...
  23. Click Workspace... then select your project's include directory
  24. Do another Add, Workspace and add Template:Arch/architectureHowTo use the CDT to navigate Linux kernel source/include, e.g., Template:Arch/powerpc/include
  25. Click the # Symbols tab
  26. Click Add...
  27. Set the name to Template:KERNEL
  28. Set the value to Template:1 and click OK
  29. Click the Source Location tab
  30. Click the twisty for your project.
  31. Select the Filter item and click Edit Filter...
  32. Click Add Multiple... and then select all of the arch/* directories in your kernel source that will not be used (i.e. all the ones that are not for the architecture you are using)
  33. Click OK and OK again to dismiss that dialog.
  34. Click OK on the Properties dialog.
  35. Right click on the project again and select Index then select Rebuild
  36. It will take about 20 minutes or so to complete.

Back to the top