Assume that you want to start studying the USB driver, where do you start to find the USB code? First, you can try to run the find command: $ find-name in the top-level kernel directory.
Assume that you want to start studying the USB driver, where do you start to 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 all file names containing the string "usb". another way to try is to find a unique string, which can be printk () or the file name in/proc, or any other unique string about the driver that can be 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:
$ Grep-r "USB Universal Host Controller Interface driver ".
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, read the entries in the directory, or find the only 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 the source code itself is another course. you only need to remember that the more you read the source code, the easier you can grasp it, hope you have fun studying the kernel!