I am USB in Linux, I am a USB flash drive (2) Makefile

Source: Internet
Author: User
Come out and try again later. Basically, each directory in the Linux kernel has a Makefile. Makefile and Kconfig are just like a map of a city. a map shows us a city, while Makefile and Kconfig let us know what is under this directory...

"Come out and try again sooner or later ."

Basically, there is a Makefile under each directory in the Linux kernel. Makefile and Kconfig are like a map of a city. a map leads us to know a city, while Makefile and Kconfig let us know the structure under this directory. The Makefile content under the drivers/usb/storage/directory 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

# 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

The Kconfig file explains the preceding Config options. if the Kconfig file is long, it will not be pasted. However, by looking at the Kconfig file, we can know that, except for the CONFIG_USB_STORAGE compilation option, we really need it, other options can be ignored. For example, there is such a section in the Kconfig file about CONFIG_USB_STORAGE_DATAFAB,

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 .

Obviously, this option has nothing to do with us. first, this is specifically for Datafab products, and second, CompactFlash reader is a flash device, but this is obviously not a U disk, because the code in the drivers/usb/storage directory is for a type of devices, not a specific device, such devices are USB Mass Storage devices. For this type of equipment, there are special documents to introduce, there is a corresponding spec to describe the communication or physical power-on characteristics of this type of equipment specifications, U disk is only one of them, the communication protocol used by this device is called the Bulk-Only Transport protocol. For example, for the CONFIG_USB_STORAGE_SDDR55 option, the Kconfig file also has a corresponding section,

Config USB_STORAGE_SDDR55
Bool & quot; SanDisk SDDR-55 SmartMedia support (EXPERIMENTAL) & quot )"
Depends on USB_STORAGE & EXPERIMENTAL
Help
Say Y here to include additional code to support the Sandisk SDDR-55
SmartMedia reader in the USB Mass Storage driver.

Obviously, this is a SanDisk product and it is targeted at SM cards. this is not a USB disk, so I ignore it. In fact, it is easy to determine that only the CONFIG_USB_STORAGE option is really concerned, and its corresponding module is usb-storage. the last few lines in Makefile also said:

Usb-storage-objs: = scsiglue. o protocol. o transport. o usb. o/
Initializers. o $ (usb-storage-obj-y)

This means that the files we only need to pay attention to are scsiglue. c, protocol. c, transport. c, usb. c, initializers. c, and. h header files with the same name. Using the wc-l command again to count these files, we found that the total length is only 3654 lines, much less than the first 15455 lines, and confidence multiplied.

However, it should be noted that the CONFIG_USB_STORAGE_DEBUG compilation option is not required, but if you really want to modify or debug the usb-storage code by yourself, it is necessary to open this option, because it will print some debugging information, it will be seen in the source code in the future.

 

*****************************

From Linux, I am USB.

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.