HowTo use the CDT to navigate Linux kernel source
来源:互联网 发布:java自己设计流程引擎 编辑:程序博客网 时间:2024/05/16 17:58
HowTo use the CDT to navigate Linux kernel source
转自:http://wiki.eclipse.org/HowTo_use_the_CDT_to_navigate_Linux_kernel_source
Here are 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.
Disclaimer: these steps were developed for Eclipse 3.5.1 + CDT 6.0.0.
- Download and install Eclipse plus the CDT.
- Configure and build your kernel to define CONFIG_* and generate autoconf.h. This can be done before or after downloading and installing Eclipse.
- Ensure that you have the right kernel source (e.g. make sure you are on the right git branch). If you check out another branch later, that's ok, but you will need to re-index the source, and that takes about 20 minutes.
- Start up Eclipse.
- Click File->New->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 Advanced settings... and a Properties dialog will pop up.
- Select Resource on the left, and then in the Text file encoding section, select Other and ISO-8859-1 in the box, then click Apply
- Select C/C++ Build on the left.
- Click on Discovery Options
- At the bottom of the screen where it says Compiler invocation arguments, insert "-include include/generated/autoconf.h" at the beginning of that line. Also insert any other compiler options you may need that are not the default, such as "-m64" (Note: for older kernels [pre-2.6.36?], the location of autoconf.h is include/linux/autoconf.h)
- You may also need to change the compiler command from gcc to whatever compiler you are using (e.g. you are using a cross compiler).
- Open the C/C++ General selection on the left.
- Click on Indexer
- Checkmark the Enable project specific setttings box.
- Uncheck Index source files not included in the build
- Clear out the Files to index up-front box.
- Click on Paths and Symbols on the left.
- Select the Includes tab and then select GNU C
- Click Add...
- Click Workspace... then select your kernel'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.
- Click Finish on the C Project dialog.
- Right click on the project and select Index then select Rebuild
- It will take about 20 minutes or so to complete.
Note 1: If you change any of your CONFIG_* settings, in order for Eclipse to recognize those changes, you must do a "build" from within Eclipse. Note, this does not mean to re-build the index; this means to build the kernel, by having Eclipse invoke make (this is normally bound to the Ctrl-B key in Eclipse). Only after a build operation, will Eclipse regenerate the compilation #defines it uses when analyzing the source during indexing and editing.
Note 2: The background color of "Quick Context View" will be dark if the Ambiance theme in Ubuntu is selected.
- HowTo use the CDT to navigate Linux kernel source
- HowTo use the CDT to navigate Linux kernel source
- The Linux Kernel HOWTO
- The Linux Kernel HOWTO
- HOWTO Change the Linux Kernel Start Address
- Howto: Build Linux Kernel Module Against Installed Kernel w/o Full Kernel Source Tree
- Howto: Build Linux Kernel Module Against Installed Kernel w/o Full Kernel Source Tree
- Linux Kernel HOWTO 中译版
- Linux Kernel---some source on the internet.
- Browse the Linux Kernel Source with LXR
- Browse the Linux Kernel Source with LXR
- CONFIG_AEABI: Use the ARM EABI to compile the kernel
- HOWTO do Linux kernel development
- HOWTO do Linux kernel development
- How to use the HTML source for debugging issues
- The Linux Sound HOWTO
- The Linux Bootdisk HOWTO
- The Linux GCC HOWTO
- oracle普通表 临时表 awr统计分析
- setTag()/getTag()
- android用intent调用google地图
- typeof在linux中妙用
- Linux内核学习之链表
- HowTo use the CDT to navigate Linux kernel source
- 网络协议栈4:bind()函数
- 这小学课本插图 你能记得多少
- sax
- JavaScript自定义日期格式化函数
- Android 4.0新特性(中文)
- android学习笔记27:星级评分条
- 下雪了,可我却开心不起来
- NVIC寄存器组