In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What are the specific Linux kernel development tools, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
To develop embedded Linux products, it is often necessary to tailor and customize the kernel to meet the functional and performance requirements of embedded products. This article introduces several tools and methods for reading Linux kernel source code.
The "Linux kernel development" mentioned here only refers to the kernel and driver related development work in the embedded Linux product development, which is very different from the kernel development of the kernel development team led by Linux.
As the saying goes, "if you want to do a good job, you must sharpen its tools first." in the face of hundreds of megabytes of Linux kernel code, you have to read, view, or search for the code. Most developers who come into contact with Linux kernel code for the first time have the feeling that they don't know how to start. Several source code reading and indexing tools are recommended below to provide some convenience for subsequent kernel development.
1 、 Source Insight
Source Insight is a very popular source code reading and editing tool under the Windows platform. Many Linux developers are still used to editing the source code under Windows, or even viewing and editing the Linux kernel source code, which is still done in Source Insight.
Description: Source Insight is a copyright software that needs to solve the copyright problem on its own.
After installing the Source Insight software, create a new project, name it and specify the location where the data is stored, as shown in figure 1.1.
Figure 1.1 New Project
Figure 1.2 Project Settings
Click the OK button to enter the project settings interface, as shown in figure 1.2.
Then add the source code. After browsing and selecting the Linux kernel source folder, click the "Add Tree" button to add all the files of the kernel source tree to the project, as shown in figure 1.3.
Figure 1.3 adding kernel source code
Once added, you can read and edit the source code in Source Insight, as shown in figure 1.4.
Figure 1.4 read the source code in Source Insight
2 、 Eclipse
Eclipse is a cross-platform IDE that can run on both the Windows platform and Linux. Many developers who are accustomed to graphical interface operation are accustomed to using Eclipse to view and edit Linux source code under Linux.
If you are only looking at the Linux kernel source code in Eclipse, you do not need to install the cross compiler in advance, otherwise you must install the cross compiler in advance.
Create a kernel source project. Click the Filekeeper Newspeak Project to start creating the project, and select create C project in the project creation interface, as shown in figure 1.5.
Click Next, fill in the project name in the Project name field of the C Project interface, remove the check box "Use default locaTIon", and click Browse to set LocaTIon to the Linux kernel source directory, as shown in figure 1.6. If you do not compile the kernel in Eclipse, you can use Linux GCC, otherwise use the installed Cross GCC.
Figure 1.6 Import Linux kernel source code
Then click Finish to complete the import of the Linux kernel source code, and the code can be read and edited in Eclipse, as shown in figure 1.7.
Figure 1.7 browsing kernel source code in Eclipse
To trace the source code in Eclipse, simply select a function, variable or macro definition and press F3. More operations can be found in Navigate.
3 、 vim+ctags+cscope
Vi/Vim is a text editor that can efficiently implement code editing in Vim. But the function of Vim is not only a text editor. With the cooperation of ctags and cscope, Vim can achieve the source code editing and reading function comparable to the graphic IDE environment, which is even more convenient than the graphic IDE to some extent.
The installation of Vi/Vim is no longer described. If you are not working on a remote server through remote login, but on a local desktop system, you can also use gvim to start the Vi editor.
L Taglist
Taglist is a source browsing plug-in for Vim and is available from the http://www.vim.org website. After downloading to the compressed package, extract it locally, and then copy the plugin directory in the extracted directory to the ~ / .vim directory. If there is no .vim directory under the user's home directory, you can establish such a directory.
L Ctags
Ctags is a software used to generate tags files. You can download the source code to compile and install it. Under Ubuntu, you can install it through apt-get:
$sudo apt-get install exuberant-ctags
L source code reading and tracking
Enter the directory where the source code is to be viewed, and first generate the tags file:
$ctags-R
The execution time depends on the amount of source code. After execution, you can see a tags file in the current directory. The more the source code, the longer the execution time, and the larger the resulting tags file.
Note: if the source code is modified, the line number of the code has changed and the tags file needs to be regenerated.
(1) View the definition of function, etc. Open a C file with Vi/Vim. To know where a function, variable, structure, or macro definition is defined, first move the cursor over the function (variable, structure, or macro definition), and then press CTRL+]. After viewing, press CTRL+o to return to the original location.
(2) View the list of file functions. After opening the C file, enter: TlistToggle (Vi/Vim 's command input supports completion) in the command state of Vi/Vim, and the function list sidebar will appear on the left side of Vi/Vim, as shown in figure 1.8. Press CTRL+ww (twice w) to switch in the list and code view interval.
Figure 1.8 Vi/Vim 's function list sidebar
If you are on the local desktop, open the C file with Gvim, which is closer to the IDE integrated environment. Double-click the function with the mouse to jump to the function definition, CTRL+ right mouse button can be reversed to the original location. More practical features need to be experienced in practice.
4 、 LXR
LXR, which stands for Linux Cross Referencer, is a popular tool for viewing Linux source code, and of course it is not limited to viewing Linux source code. The download address of LXR is: http://lxr.sourceforge.net. With reference to the installation instructions of the website, it is easy to build a local LXR on this machine for source code viewing.
If you do not want to build a local LXR, you can directly visit the LXR website that has been built. Two websites are recommended: one is the Linux source code provided by the open source Chinese website to read http://lxr.oss.org.cn online, and the other is the http://lxr.free-electrons.com website. The former is faster, but provides fewer versions of the Linux kernel, while the latter provides more versions. The website provides source code reading, keyword search and free text search functions. The snapshots of the two web pages are shown in figures 1.9 and 1.10, respectively.
Figure 1.9 Snapshot of lxr.oss.org.cn web pages
Figure 1.10 Snapshot of lxr.free-electrons.com web page
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.