"Come out and try again sooner or later ."
Basically, Linux
Each directory in the kernel has a makefile
. Makefile
And kconfig
Just like a map of a city, a map leads us to know a city, while makefile
And kconfig
So that we can understand the structure under this directory. Drivers/USB/storage/
Makefile under the Directory
The content is as follows:
Lfg1:/usr/src/linux-2.6.22/Drivers/USB/storage #
Cat makefile
#
# Makefile for the USB mass storage device drivers.
#
#15 Aug 2000, Christoph Hellwig
<Hch@infradead.org>
# Rewritten to use lists instead of IF-statements.
#
Extra_cflags: =-idrivers/SCSI
OBJ-$ (config_usb_storage) + = usb-storage.o
USB-storage-obj-$ (config_usb_storage_debug) + = Debug. o
USB-storage-obj-$ (config_usb_storage_usbat) + = shuttle_usbat.o
USB-storage-obj-$ (config_usb_storage_sddr09) + = sddr09.o
USB-storage-obj-$ (config_usb_storage_sddr55) + = sddr55.o
USB-storage-obj-$ (config_usb_storage_freecom) + = freecom. o
USB-storage-obj-$ (config_usb_storage_dpcm) + = DPCM. o
USB-storage-obj-$ (config_usb_storage_isd200) + = isd200.o
USB-storage-obj-$ (config_usb_storage_datafab) + = datafab. o
USB-storage-obj-$ (config_usb_storage_jumpshot) + = jumpshot. o
USB-storage-obj-$ (config_usb_storage_alauda) + = Alauda. o
USB-storage-obj-$ (config_usb_storage_onetouch) + = onetouch. o
USB-storage-obj-$ (config_usb_storage_karma) + = karma. o
USB-storage-objs: = scsiglue. O protocol. O transport. o usb. O/
Initializers. o $ (USB-storage-obj-y)
Ifneq ($ (config_usb_libusual ),)
OBJ-$ (config_usb) + =
Libusual. o
Endif
While kconfig
File is actually the config
Option, kconfig
The file is too long to be pasted. However, by reading kconfig
File, except config_usb_storage
This compilation option is what we really need, and other options can be ignored. For example
, Kconfig
There is such a section in the file,
Config usb_storage_datafab
Bool "datafab compact flash
Reader support (experimental )"
Depends on usb_storage &&
Experimental
Help
Support for certain
Datafab compactflash readers.
Datafab has a web page
At
>.
Obviously, this option has nothing to do with us. First, this is specifically for datafab.
The company's products, followed by compactflash Reader
Is a type of Flash
Device, but this is obviously not u
Disk because of drivers/USB/storage
The code in this directory is for a type of device, not a specific device. This type of device is USB
Mass Storage
Device. For this type of devices, there are special documents and spec
Describes the communication or physical power-on characteristics of such devices.
Disks are only one of them. The communication protocol used by such devices is called bulk-only transport.
Protocol. For example, for config_usb_storage_sddr55
This option, kconfig
There is a corresponding section in the file,
Config usb_storage_sddr55
Bool "SanDisk SDDR-55
Smartmedia support (experimental )"
Depends on usb_storage &&
Experimental
Help
Say y here to include
Additional code to support the SanDisk SDDR-55
Smartmedia reader in
USB Mass Storage driver.
Apparently, this is SanDisk.
And is for Sm
Card, This is not u
Disk. In fact, it is easy to determine that only config_usb_storage
This option requires a real concern, and its corresponding module is called USB-storage
, Makefile
In the last few lines also said:
USB-storage-objs: =
Scsiglue. O protocol. O transport. o usb. O/
Initializers. o $ (USB-storage-obj-y)
This means that the only file we need to pay attention to is scsiglue. C.
, Protocol. c
, Transport. c
, USB. c
, Initializers. c
And. h with the same name.
Header file. Use WC-l again
The command counts these files and finds that the total length is only 3654
Rows, 15455 more than the first
There were a lot fewer lines, and confidence increased at that time.
However, you must note that config_usb_storage_debug
This compilation option is not required, but if you really want to modify or debug USB-storage
So it is necessary to open this option, because it will be responsible for printing some debugging information and will see its role in the source code later.
*****************************
From Linux, I am USB.
I am USB in Linux
Link: China-Pub
Dangdang
, Excellence
Linux
Core cultivation path: excellence
Dangdang
,
China-Pub