Find the specific code in the kernel-general Linux technology-Linux programming and kernel information. The following is a detailed description. Assume that you want to start studying the USB driver. Where can I find the USB code?
First, you can try to run the find command in the top-level kernel directory:
$ Find.-name \ * usb \*
This command prints out all file names containing the string "usb.
Another way to try is to find a unique string. The only string can be the output of printk (), the file name in/proc, or any other unique string about the driver found in the source code. For example, the message printed by USB is:
USB Universal Host Controller Interface driver v2.2
So we can try to use recursive grep to find the part of the printk that does not include the version number:
Another way to try to find the USB source code is to view/proc. If you enter find/proc-name usb, you may find a directory named/proc/bus/usb. Reading the entries in that directory may find the unique string used for the grep command.
If all other methods fail, you can try to enter each directory and list the files, or view the ls-lR output. You may see the relevant file name. However, this should be the final method. You can try it again only after running different find and grep commands multiple times.
After finding the source code you are interested in, you can start to read it. Reading and understanding source code is another course. You only need to remember that the more you read the source code, the easier it is to grasp it. Hope you have fun studying the kernel!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.