USB support in Linux

Hi to all,

I am using a CS-9302 board and I want to use a USB stick whith it. (specifically a SunDisk Cruzer 512 Mb). However, it seems that my kernel (2.6.20.4) doesn’t have USB support because when I am trying to mount it I get the following message:

mount: Mounting /dev/sda1 on mnt failed: No such device or address

from the kernel boot process I noticed the following messages which are regarding to USB drivers:

ep93xx-usb ep93xx-usb: EP93xx OHCI

ep93xx-usb ep93xx-usb: new USB bus registered, assigned bus number 1

ep93xx-usb ep93xx-usb: irq 56, io mem 0x80020000

usb usb1: configuration #1 chosen from 1 choice

hub 1-0:1.0: USB hub found

hub 1-0:1.0: 3 ports detected

usbcore: registered new interface driver hiddev

usbcore: registered new interface driver usbhid

drivers/usb/input/hid-core.c: v2.6:USB HID core driver

drivers/usb/net/rtl8150.c: rtl8150 based usb-ethernet driver v0.6.2 (2004/08/27)



usbcore: registered new interface driver rtl8150

usbcore: registered new interface driver usbserial

drivers/usb/serial/usb-serial.c: USB Serial Driver core

drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303

usbcore: registered new interface driver pl2303

drivers/usb/serial/pl2303.c: Prolific PL2303 USB to serial adaptor driver

What should I do to have USB support? Could I do some changes into kernel configuration settings to fix that?

Thank you in advance for your time.

Did you load the modules usb-storage and sd_mod?

First of all thank you for your reply!

In menuconfig I am choosing all “USB Mass Storage support” devices to be built-in the kernel so I assumed that there will be no need to load any module regarding usb suppport.

Could you please help me out a little bit on how to load these modules on the kernel? Where are located anyway in the source?

In BusyBox I don’t have support of the insmod command in order to load the module. Could I follow a different procedure in order to load them?

Again, thanks a lot!

You also need the SCSI subsystem including the SCSI disk driver (sd_mod).

Did you include those as well?

What does dmesg say after you’ve plugged in that stick?

You also need the SCSI subsystem including the SCSI disk driver (sd_mod).

Did you include those as well?

I am choosing “SCSI device support”, “SCSI targert support” and “SCSI generic support” to be built-in the kernel from menuconfig.

I can’t find anyware in the source where the modules “sd_mod” and “usb-storage” that you mentioned are. How can I built this modules in the kernel Image file that I am creating and finally load on the board?

What does dmesg say after you’ve plugged in that stick?

I am getting the following message:
~ # usb 1-3: new full speed USB device using ep93xx-usb and address 2
usb 1-3: not running at top speed; connect to a high speed hub
usb 1-3: Product: U3 Cruzer Micro
usb 1-3: Manufacturer: SanDisk Corporation
usb 1-3: SerialNumber: 0000051019072283
usb 1-3: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices

~ # scsi 0:0:0:0: Direct-Access     SanDisk  U3 Cruzer Micro  2.15 PQ: 0 ANSI: 2

Thank you!

limp:
I am choosing “SCSI device support”, “SCSI targert support” and “SCSI generic support” to be built-in the kernel from menuconfig.

You don’t need “SCSI target support” and “SCSI generic support” for this to work.

You need “SCSI disk support”

I can’t find anyware in the source where the modules “sd_mod” and “usb-storage” that you mentioned are.

sd_mod is “SCSI disk support”

usb-storage is “USB Mass Storage support”

I will try to re-build the kernel with “SCSI disk support” and “USB Mass Storage support” selected to be built-in and I will let you know for the results.

I really apreciate your help!

I have dove the changes in menuconfig and I re-built the kernel.

The compilation has been compilted successfully, however, I can’t find the kernel Images.

Here are the messages from the end of the build procedure indicating that arch/arm/boot/zImage file has been created successfully:

  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  GZIP    arch/arm/boot/compressed/piggy.gz
  AS      arch/arm/boot/compressed/piggy.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  Building modules, stage 2.
  MODPOST 15 modules

Also, Linux can see the zImage file with “ls” command:

limp@limp-laptop:~/limp_project/My_Kernel/linux-2.6.20.4$ ls -l arch/arm/boot/zImage
-rwxr-xr-x 1 limp limp 1794320 2008-07-21 13:32 arch/arm/boot/zImage

BUT, when I am going to linux-2.6.20.4/arch/arm/boot/ folder, zImage is not there!!!

BUT, when I am going to linux-2.6.20.4/arch/arm/boot/ folder, zImage is not there!!!

OK, I got finally the zImage file after lots of tries (I don’t know why I had the above problem) and I load it to the board.

Now, when I am plugin in my USB I am getting the below message:

~ # usb 1-3: new full speed USB device using ep93xx-usb and address 2
usb 1-3: not running at top speed; connect to a high speed hub
usb 1-3: configuration #1 chosen from 1 choice
scsi0 : SCSI emulation for USB Mass Storage devices
scsi 0:0:0:0: Direct-Access     SanDisk  U3 Cruzer Micro  2.15 PQ: 0 ANSI: 2
SCSI device sda: 990865 512-byte hdwr sectors (507 MB)
sda: Write Protect is off
sda: assuming drive cache: write through
SCSI device sda: 990865 512-byte hdwr sectors (507 MB)
sda: Write Protect is off
sda: assuming drive cache: write through
 sda:<7>usb-storage: queuecommand called
 sda1
sd 0:0:0:0: Attached scsi removable disk sda

and my dmesg is the following:

R 188 Stat 0x0              
usb-storage: scsi cmd done, result=0x0                                      
usb-storage: *** thread sleeping.                                 
sda: Write Protect is off                         
sda: Mode Sense: 03 00 00 00                            
sda: assuming drive cache: write through                                        
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Command TEST_UNIT_READY (6 bytes)                                              
usb-storage:  00 00 00 00 00 00                               
usb-storage: Bulk Command S 0x43425355 T 0x5 L 0 F 0 Trg 0 LUN 0 CL 6                                                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes                                                      
usb-storage: Status code 0; transferred 31/31                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk command transfer result=0                                           
usb-storage: Attempting to get CSW...                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes                                                      
usb-storage: Status code 0; tr                            
usb-storage: -- transfer complete                                 
usb-storage: Bulk status result = 0                                   
usb-storage: Bulk Status S 0x53425355 T 0x5 R 0 Stat 0x0                                                        
usb-storage: scsi cmd done, result=0x0                                      
usb-storage: *** thread sleeping.                                 
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Command ALLOW_MEDIUM_REMOVAL (6 bytes)                                                   
usb-storage:  1e 00 00 00 01 00                               
usb-storage: Bulk Command S 0x43425355 T 0x6 L 0 F 0 Trg 0 LUN 0 CL 6                                                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes                                                      
usb-storage: Status code 0; transferred 31                                        
usb-storage: -- transfer complete                                 
usb-storage: Bulk command transfer result=0                                           
usb-storage: Attempting to get CSW...                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes                                                      
usb-storage: Status code 0; transferred 13/13                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk status result = 0                                   
usb-storage: Bulk Status S 0x53425355 T 0x6 R 0 Stat 0x1                                                        
usb-storage: -- transport indicates command failure                                                   
usb-storage: Issuing auto-REQUEST_SENSE                                       
usb-storage: Bulk Command S 0x43425355 T 0x7 L 18 F 128 Trg 0 LUN 0 CL 6                                                                        
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes                                                      
usb-storage: Status code 0; transferred 31/31                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk command transfer result=0                                           
usb-storage: usb_stor_bulk_transfer_buf: xfer 18 bytes                                                      
usb-storage: Status code 0; transferred 18/18                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk data transfer result 0x0                                          
usb-storage: Attempting to get CSW...                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes                                                      
usb-storage: Status code 0; transferred 13/13                                             
usb-storage: -- transf                    
usb-storage: Bulk status result = 0                                   
usb-storage: Bulk Status S 0x53425355 T 0x7 R 0 Stat 0x0                                                        
usb-storage: -- Result from auto-sense is 0                                           
usb-storage: -- code: 0x70, key: 0x5, ASC: 0x24, ASCQ: 0x0                                                          
usb-storage: (Unknown Key): (unknown ASC/ASCQ)                                              
usb-storage: scsi cmd done, result=0x2                                      
usb-storage: *** thread sleeping.                                 
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Command TEST_UNIT_READY (6 bytes)                                              
usb-storage:  00 00 00 00 00 00                               
usb-storage: Bulk Command S 0x43425355 T 0x8 L 0 F 0 Trg                                                      
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes                                                      
usb-storage: Status code 0; transferred 31/31                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk command transfer result=0                                           
usb-storage: Attempting to get CSW...                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes                                                      
usb-storage: Status code 0; transferred 13/13                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk status result = 0                                   
usb-storage: Bulk Status S 0x53425355 T 0x8 R 0 Stat 0x0                                                        
usb-storage: scsi cmd done, result=0x0                                      
usb-storage: *** thread sleeping.                                 
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Command READ_CAPACITY (10 bytes)                                             
usb-storage:  25 00 00 00 00 00 00 00 00 00                                           
usb-storage: Bulk Command S 0x43425355 T 0x9 L 8 F 128 Trg 0 LUN 0 CL 10                                                                        
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes                                                      
usb-storage: Status code 0; transferred 31/31                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk command transfer result=0                                           
usb-storage: usb_stor_bulk_transfer_sglist: xfer 8 bytes, 1 entries                                                                   
usb-storage: Status code 0; transferred                                        
usb-storage: -- transfer complete                                 
usb-storage: Bulk data transfer result 0x0                                          
usb-storage: Attempting to get CSW...                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes                                                      
usb-storage: Status code 0; transferred 13/13                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk status result = 0                                   
usb-storage: Bulk Status S 0x53425355 T 0x9 R 0 Stat 0x0                                                        
usb-storage: scsi cmd done, result=0x0                                      
usb-storage: *** thread sleeping.                                 
SCSI device sda: 990865 512-byte hdwr sectors (507 MB)                                                      
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Command MODE_SENSE (6 bytes)                                         
usb-storage:  1a 00 3f 00 c0 00                               
usb-storage: Bulk Command S 0x43425355 T 0xa L 192 F 128 Trg 0 LUN 0 CL 6                                                                         
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes                                                      
usb-storage: Status code 0; transferred 31/31                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk command transfer result=0                                           
usb-storage: usb_stor_bulk_transfer_sglist: xfer 192 bytes, 1 entries                                                                     
usb-storage: Status code -121; transferred 4/192                                                
usb-storage: -- short read transfer                                   
usb-storage: Bulk data transfer result 0x1                                          
usb-storage: Attempting to get CSW...                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes                                                      
usb-storage: Status code 0; transferred 13/13                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk status result = 0                                   
usb-storage: Bulk Status S 0x53425355 T 0xa R 188 Stat 0x0                                                          
usb-storage: scsi cmd done, result=0x0                                      
usb-storage: *** thread sleeping.                                 
sda: Write Protect is off                         
sda: Mode Sense: 03 00 00 00                            
sda: assuming drive cache: write through                                        
 sda:<7>usb-storage: queuecommand call                                     
usb-storage: *** thread awakened.                                 
usb-storage: Command READ_10 (10 bytes)                                       
usb-storage:  28 00 00 00 00 00 00 00 08 00                                           
usb-storage: Bulk Command S 0x43425355 T 0xb L 4096 F 128 Trg 0 LUN 0 CL 10                                                                           
usb-storage: usb_stor_bulk_transfer_buf: xfer 31 bytes                                                      
usb-storage: Status code 0; transferred 31/31                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk command transfer result=0                                           
usb-storage: usb_stor_bulk_transfer_sglist: xfer 4096 bytes, 1 entries                                                                      
usb-storage: Status code 0; transferred 4096/4096                                                 
usb-storage: -- transfe                      
usb-storage: Bulk data transfer result 0x0                                          
usb-storage: Attempting to get CSW...                                     
usb-storage: usb_stor_bulk_transfer_buf: xfer 13 bytes                                                      
usb-storage: Status code 0; transferred 13/13                                             
usb-storage: -- transfer complete                                 
usb-storage: Bulk status result = 0                                   
usb-storage: Bulk Status S 0x53425355 T 0xb R 0 Stat 0x0                                                        
usb-storage: scsi cmd done, result=0x0                                      
usb-storage: *** thread sleeping.                                 
 sda1     
sd 0:0:0:0: Attached scsi removable disk sda                                            
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Bad ta                 
usb-storage: scsi cmd done, result=0x40000                                          
usb-storage: *** thread sleeping.                                 
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Bad target number (2:0)                                    
usb-storage: scsi cmd done, result=0x40000                                          
usb-storage: *** thread sleeping.                                 
usb-storage: queuecommand called                                
usb-storage: *** thread awakened.                                 
usb-storage: Bad target number (3:0)                                    
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (4:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (5:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (6:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Bad target number (7:0)
usb-storage: scsi cmd done, result=0x40000
usb-storage: *** thread sleeping.
usb-storage: device scan complete

When I am trying to mount it I get the following message:

~ # mount /dev/sda1 mnt
UDF-fs: No partition found (1)
mount: Mounting /dev/sda1 on mnt failed: Invalid argument

I have also tried with sda instead of sda1 without success.

Any help?

limp:
When I am trying to mount it I get the following message:

~ # mount /dev/sda1 mnt

UDF-fs: No partition found (1)
mount: Mounting /dev/sda1 on mnt failed: Invalid argument

Has the drive been partitioned?

Is “mnt” a directory under the directory that you’re invoking mount from?

limp:
I have also tried with sda instead of sda1 without success.

Any help?

Has the unpartitioned drive been formatted with a filesystem which the kernel you’ve built supports?

limp:

R 188 Stat 0x0              

usb-storage: scsi cmd done, result=0x0
usb-storage: *** thread sleeping.
sda: Write Protect is off
sda: Mode Sense: 03 00 00 00
sda: assuming drive cache: write through
usb-storage: queuecommand called
usb-storage: *** thread awakened.
usb-storage: Command TEST_UNIT_READY (6 bytes)
usb-storage: 00 00 00 00 00 00
usb-storage: Bulk Command S 0x43425355 T 0x5 L 0 F 0 Trg 0 LUN 0 CL 6

Wow, you’ve compiled in A LOT of debug messages…

When I am trying to mount it I get the following message:

UDF-fs: No partition found (1)

For some reason it is trying to use the UDF file system. Try to mount with -t vfat or -t ntfs or whatever you use on that stick.

I have also tried with sda instead of sda1 without success.

/dev/sda1 is correct. The message that says which partitions are available is in that big dmesg output.

Problem solved!

lou:
Has the unpartitioned drive been formatted with a filesystem which the kernel you’ve built supports?

My USB stick has FAT filesystem but my kernel didn’t have support for FAT filesystems. When I added this, everything worked fine and now I am able to mount and use my USB stick!

I want to thank you all for your help. It was really appreciated!