Search This Blog

Feb 10, 2011

Get Linux BSP compiled files list for IDE

   We are working on Linux BSP. There are tons of source files. We only want to add those files which been compiled into our IDE, like SlickEdit 15.06. We need the dump the file path information from ELF file and generate list file for SlickEdit.


 1. Add CONFIG_DEBUG_INFO in Linux config file.

 $ cd ~/ltib/rpm/BUILD/linux-2.6.35.3/
 $ make menuconfig
 When menu appear enter  "Kernel hacking", select two items
  [*] Kernel debugging
  [*] Compile the kernel with debug info
 Exit and save
 $ make uImage -j4
 And then we get vmlinux with debug information.

2.  Use readelf to dump the files path from vmlinux
 $ readelf -wL vmlinux | grep : > project-file.txt
  Now we have contents like this:
"

include/linux/rcutree.h:
include/linux/thread_info.h:
include/asm-generic/bitops/non-atomic.h:
include/linux/rcutree.h:
init/main.c:
CU: include/asm-generic/int-ll64.h:
CU: init/do_mounts.c:
/root/work/ltib/rpm/BUILD/linux-2.6.35.3/arch/arm/include/asm/current.h:
init/do_mounts.c:
init/do_mounts.h:

"
We replace three symbols with blank.
"/root/work/ltib/rpm/BUILD/linux-2.6.35.3/", "CU: " and ":" and then we get contents below:
"
include/linux/rcutree.h
include/linux/thread_info.h
include/asm-generic/bitops/non-atomic.h
include/linux/rcutree.h
init/main.c
include/asm-generic/int-ll64.h
init/do_mounts.c
arch/arm/include/asm/current.h
init/do_mounts.c
init/do_mounts.h

"
Now we get compiled files list, some of the file are duplicate, however, SlickEdit will handle it, don't worry about it.

3. Open SlickEdit, create new project in " ~/ltib/rpm/BUILD/linux-2.6.35.3/".
  And select "Project->project properties" from menu item, you will see "import" button on right-bottom of the window, click it and select "project-file.txt" as import file. Click OK button and done.
  1500 files were added into SlickEdit project, without this files list, to add all files in Linux BSP, 28000 files need added into SlickEdit project. It will deeply impact parsing speed in IDE.



No comments: