View previous topic :: View next topic |
Author |
Message |
TJNII l33t
Joined: 09 Nov 2003 Posts: 637 Location: for(;;);
|
Posted: Wed Sep 08, 2004 6:38 am Post subject: HOWTO: Set up a USB key drive |
|
|
So in my forum travels it hit me that there isn't a HowTo to set up all the nice USB drive Gizmos, and I know how to do it. So here goes:
First off, I'm going to treat all kernel related sections as kernel modules. This way we don't have to reboot and we can see the fruits of our labors immediatly. Secondly, I'm going to assume you have no USB stuff working. Thirdly, I'm assuming you're running a 2.6 kernel. As far as I know this should work for the 2.4 kernels, but the menuconfig paths will be way off.
There are 3 modules you need for this to work:
1) The driver for your hub hardware
2) The scsi driver module
3) The USB storage module
4) The FAT filesystem driver
1- The hub driver
There are 3 different drivers for USB hubs: UHCI, OHCI, and EHCI. You can figure out which one you need through the lspci command. This tells all the hardware connected to the PCI bus. It should display something like this:
Code: |
0000:00:00.0 Host bridge: Intel Corp. 82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface (rev 03)
0000:00:02.0 VGA compatible controller: Intel Corp. 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 03)
0000:00:1d.0 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 02)
0000:00:1d.1 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 02)
0000:00:1d.2 USB Controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 02)
0000:00:1e.0 PCI bridge: Intel Corp. 82801 PCI Bridge (rev 82)
0000:00:1f.0 ISA bridge: Intel Corp. 82801DB/DBL (ICH4/ICH4-L) LPC Bridge (rev 02)
0000:00:1f.1 IDE interface: Intel Corp. 82801DB/DBL (ICH4/ICH4-L) UltraATA-100 IDE Controller (rev 02)
0000:00:1f.3 SMBus: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 02)
0000:00:1f.5 Multimedia audio controller: Intel Corp. 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 02)
|
Note that I have 3 UHCI controllers, so I use the UHCI module. All the modules are in the menuconfig tree under
Code: | Device Drivers --> USB Support |
So, select the module for your hardware, save the config changes, and let's see if it worked.
a) Compile the modules
b) modprobe the module (uhci_hcd ohci_hcd or ehci_hcd)
c) lsmod to see if it loaded
d) plug in your toy and see if the connection is noticed (I find dmesg the best for this)
If it is, you're ready to go onto the next section. Otherwise, consult the forums.
2) Scsi driver
Linux currently recignizes USB drives as scsi devices. As such, we need the driver for it. The module is stashed away under
Code: | Device Drivers --> SCSI Device Support |
And you want to select
-> SCSI device support (scsi_mod)
-> legacy /proc/scsi/ support
-> SCSI disk support (sd_mod)
We won't insert them now, let's stick around in menuconfig until after the next section.
3) USB storage
This is the module that makes it all come together. It's under the same menu as the hub drivers. So, select USB Mass Storage support as a module (usb_storage). It should open a slew of options for drive types. Select the device types to be supported.
4) FAT filesystem
Currently basic USB flash drives use thre FAT filesystem. Archaic, but well supported across platforms. Let's make sure you can read it. Goto:
Code: | File Systems --> DOS/FAT/NT Filesystems |
You want:
-> DOS FAT fs support (fat)
-> MSDOS fs support (msdos)
Okay, now all the kernel modules should be ready. Save the config options, exit the menuconfig, compile, and let's try it!
a) Disconnect the drive, if you haven't already.
b) Modprobe scsi_mod, sd_mod, fat, msdos, and usb_storage in that order.
c) Do a lsmod, make sure they loaded.
d) Plug in the drive
e) check out dmesg. It should show the device detected, and connected as a scsi devide (probably /dev/sda1 if you have IDE HDs)
If all that went as planned, you should be able to mount the device in your filesystem tree and use it! I like /mnt/Keydrive. However, the computer will get mad and yell at you if you try to do this as a regular user. Let's fix this. The easiest way is through the fstab. You can use the existing entries in fstab as a template. I added the following line to my fstab:
Code: | /dev/sda1 /mnt/KeyDrive auto noauto,user 0 0 |
Sections:
/dev/sda1: The device to mount
/mnt/Keydrive: The mount point
auto: Filesystem type
noauto,user: Don't auto mount the media, and allow users to mount it
0 0: Dump/Pass values
Now your users should be able to read to, write from, mount and unmount flash drives!
Hope that helps! _________________ Maintaining documentation on upgrades is apparently not within the power of Gentoo
Beware when you emerge -u world! |
|
Back to top |
|
|
koroumel Guru
Joined: 17 Jun 2004 Posts: 339 Location: Athens, Greece
|
|
Back to top |
|
|
TJNII l33t
Joined: 09 Nov 2003 Posts: 637 Location: for(;;);
|
|
Back to top |
|
|
ian! Bodhisattva
Joined: 25 Feb 2003 Posts: 3829 Location: Essen, Germany
|
Posted: Wed Sep 08, 2004 9:54 am Post subject: |
|
|
Moved to dups. _________________ "To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|