In this story, kernel code 2.6.10 is used. in the Linux kernel code directory, all the Code related to the device driver is under the drivers/directory. In this directory, we can use the LS command to see many subdirectories.
Localhost:/usr/src/linux-2.6.10/drivers # ls
Kconfig atm cdrom eisa ide Macintosh message net parport s390 TC W1
Makefile base char FC4 ieee1394 mca misc nubus PCI sbus telephony Zorro
Acorn block cpufreq firmware input md mmc oprofile PCMCIA SCSI USB
ACPI Bluetooth Dio I2C ISDN media MTD parisc PNP serial video
The USB directory contains the drivers of all USB devices, and the USB directory contains its own subdirectories. Go in and have a look,
Localhost:/usr/src/linux-2.6.10/drivers # cd USB/
Locahost:/usr/src/linux-2.6.10/Drivers/USB # ls
Kconfig makefile readme ATM class core gadget host image input media MISC net Serial Storage usb-skeleton.c
Note that each directory contains a kconfig file and a makefile. This is very important and will be introduced later.
Our story is based on the drivers/USB/storage directory. in fact, the code here clearly shows how the USB flash drive we frequently access is working and how it is driven. however, the winter and winter in this directory do not live in a paradise. They are always closely related to the world outside. you can continue to see,
Localhost:/usr/src/linux-2.6.10/Drivers/USB # CD storage/
Localhost:/usr/src/linux-2.6.10/Drivers/USB/storage # ls
Kconfig Debug. c freecom. c isd200.c protocol. c sddr09.c shuttle_usbat.c unusual_devs.h
Makefile Debug. h freecom. h isd200.h protocol. h sddr09.h shuttle_usbat.h USB. c
Datafab. c DPCM. c initializers. c jumpshot. c scsiglue. c sddr55.c transport. c USB. h
Datafab. h DPCM. h initializers. h jumpshot. h scsiglue. h sddr55.h transport. h
At first glance, I was shocked. I used the 'wc-L * 'command to count the number of lines 12076. I was dizzy...
However, maybe, life is always full of ups and downs.
After carefully reading makefile and kconfig, the mood is much better.