简体   繁体   English

配置Eclipse for Linux内核模块开发

[英]Configuring Eclipse for Linux Kernel module development

I'm trying to configure Eclipse for developing Linux Kernel Modules under Ubuntu. 我正在尝试配置Eclipse以在Ubuntu下开发Linux内核模块。 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. 到目前为止,我已添加到目录/usr/src/'uname -r'/include Properties > Paths and Symbols > Includes > GNU C头,但它不会从我的代码中删除所有Syntax error

After that, my code looks like this: 之后,我的代码如下所示:

标题添加到路径后的代码

What else should I do to develop Kernel modules with pleasure? 我还应该做些什么来愉快地开发内核模块?

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'. 通过转到窗口/首选项/常规/编辑器/文本编辑器/注释,选择c / c ++索引器标记并取消选中“text as”来关闭它们。

Also, this was posted on the Eclipse wiki: http://wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source 此外,它发布在Eclipse维基上: http//wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source

If you are building an Out-of-Tree kernel module, follow the steps in the CDT wiki (linked in @pjenney58's response). 如果要构建Out-of-Tree内核模块,请按照CDT wiki中的步骤进行操作(链接在@ pjenney58的响应中)。

The key difference is at Step 30 ( Source Location ->expand your project name). 关键区别在于步骤30( 源位置 - >扩展您的项目名称)。

  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. 单击“确定”,然后按照说明添加过滤器(wiki中的步骤31和32),但是在内核源代码而不是模块文件夹上执行此操作。

In my project that took care of almost all the indexer markers complaining about syntax errors. 在我的项目中,几乎所有的索引器标记都在抱怨语法错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM