I am a U disk in Linux (1) xiaocheng story

Source: Internet
Author: User

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.

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.