Assume that you want to start studying the USB driver. Where can I find the USB code?
First, you can try to runfindCommand:
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 beprintk()Or/procOr 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 findprintkExcluding the version:
$ grep -r "USB Universal Host Controller Interface driver" .
|
Another way to try to find the USB source code is to view/proc. If you enterfind /proc -name usb, You may find/proc/bus/usbDirectory. 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 viewls -lR. 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!