Difference between revisions of "Hammer How to Thumb Drive"

From eLinux.org
Jump to: navigation, search
 
Line 7: Line 7:
 
* USB Storage (usb_storage)
 
* USB Storage (usb_storage)
  
Make sure these are getting loaded if you have them built as modules. You should load modules in the order above to make sure everything happens as it should. I have a 10 second wait (sleep 10) rght after loading usb_storage to give the USB time to settle down.
+
You can add this to your inittab file:
  
configured in your [[Hammer_How_to_build_Kernel|kernel]]. Also be sure to activate the ''Kernel Automounter v4'' and ''Automatic Kernel Module Loading'' so your Thumb Drive will be automatically mounted at bootup.
+
  null::sysinit:/sbin/modprobe scsi_mod
 
+
  null::sysinit:/sbin/modprobe sd_mod
One way to get the USB Thumb Drive recognized and mounted is:
+
  null::sysinit:/bin/sleep 5
 
+
  null::sysinit:/sbin/modprobe usbcore
Add the necessary commands to the '''inittab''' file:
 
* cd buildroot/target/device/Samsung/Hammer/target_skeleton/etc
 
* edit the '''inittab'''.
 
* Add these commands right ''below the jffs2'' line:
 
 
   null::sysinit:/sbin/modprobe usb-storage
 
   null::sysinit:/sbin/modprobe usb-storage
 
   null::sysinit:/bin/sleep 10
 
   null::sysinit:/bin/sleep 10
  
This will load the usb-storage module and wait for it to settle down.
+
The sleeps allow time for each subsystem to settle. Add those lines after the JFFS2 filesystem mount to be sure they get done early in the boot process.
 +
 
 +
Also be sure to activate the ''Kernel Automounter v4'' and ''Automatic Kernel Module Loading'' so your Thumb Drive will be automatically mounted at bootup.
  
 
Now you have to fix up the mount point where you want the Thumb Drive to appear. You can add a new mount point by editing the '''buildroot/target/device/Samsung/Hammer/device_table.txt''' file. If you want to mount your Thumb Drive at /opt (recommended for starters) then add the following line to '''device_table.txt''':
 
Now you have to fix up the mount point where you want the Thumb Drive to appear. You can add a new mount point by editing the '''buildroot/target/device/Samsung/Hammer/device_table.txt''' file. If you want to mount your Thumb Drive at /opt (recommended for starters) then add the following line to '''device_table.txt''':
  
 
  /opt            d      755    0      0      -      -      -      -      -
 
  /opt            d      755    0      0      -      -      -      -      -
 
You'll also need to ensure that /dev/sda, and /dev/sda1 exist in the '''device_table.txt'''. There are entries in there by default that look llke the following:
 
 
# SCSI Devices
 
#/dev/sda b 640 0 0 8 0 0 0 -
 
#/dev/sda b 640 0 0 8 1 1 1 15
 
  
 
You'll want to uncomment the two lines that start in /dev/sda. You'll probably also want to change the 15 at the end of the 2nd line to a more reasonable number like 4. Then it will only create /dev/sda1, /dev/sda2, /dev/sda3, and /dev/sda4.
 
You'll want to uncomment the two lines that start in /dev/sda. You'll probably also want to change the 15 at the end of the 2nd line to a more reasonable number like 4. Then it will only create /dev/sda1, /dev/sda2, /dev/sda3, and /dev/sda4.
Line 37: Line 29:
 
  /dev/sda b 640 0 0 8 0 0 0 -
 
  /dev/sda b 640 0 0 8 0 0 0 -
 
  /dev/sda b 640 0 0 8 1 1 1 4
 
  /dev/sda b 640 0 0 8 1 1 1 4
 
  
 
Now it is time to add the Thumb Drive to your file system. When you build your rootfs, the /opt directory will be created for you with the permissions you set.
 
Now it is time to add the Thumb Drive to your file system. When you build your rootfs, the /opt directory will be created for you with the permissions you set.

Latest revision as of 15:48, 11 July 2008

You can add a USB Thumb Drive to your Hammer pretty easily. There are a few things you have to have in your kernel. Your Thumb Drive will be recognized as a SCSI device, probably /dev/sda1, if it is the only SCSI type device you have. When the usb-storage module loads, it will show which SCSI device you Thumb Drive is. Modular kernels are nice, and it is not difficult to be sure you have the right modules loaded. This how to is based on building everything possibe as modules.

You must have the following built into your kernel or as modules:

  • SCSI support (scsi_mod)
  • SCSI disk (sd_mod) support.
  • USB Core (usbcore)
  • USB Storage (usb_storage)

You can add this to your inittab file:

 null::sysinit:/sbin/modprobe scsi_mod
 null::sysinit:/sbin/modprobe sd_mod
 null::sysinit:/bin/sleep 5
 null::sysinit:/sbin/modprobe usbcore
 null::sysinit:/sbin/modprobe usb-storage
 null::sysinit:/bin/sleep 10

The sleeps allow time for each subsystem to settle. Add those lines after the JFFS2 filesystem mount to be sure they get done early in the boot process.

Also be sure to activate the Kernel Automounter v4 and Automatic Kernel Module Loading so your Thumb Drive will be automatically mounted at bootup.

Now you have to fix up the mount point where you want the Thumb Drive to appear. You can add a new mount point by editing the buildroot/target/device/Samsung/Hammer/device_table.txt file. If you want to mount your Thumb Drive at /opt (recommended for starters) then add the following line to device_table.txt:

/opt            d       755     0       0       -       -       -       -       -

You'll want to uncomment the two lines that start in /dev/sda. You'll probably also want to change the 15 at the end of the 2nd line to a more reasonable number like 4. Then it will only create /dev/sda1, /dev/sda2, /dev/sda3, and /dev/sda4.

# SCSI Devices
/dev/sda	b	640	0	0	8	0	0	0	-
/dev/sda	b	640	0	0	8	1	1	1	4

Now it is time to add the Thumb Drive to your file system. When you build your rootfs, the /opt directory will be created for you with the permissions you set.

Now edit buildroot/target/device/Samsung/Hammer/target_skeleton/etc/fstab file to add your mount point as follows:

/dev/sda1       /opt            ext2    defaults                0       0

This allows the Thumb Drive to be automatically setup and mounted for use.

You can setup your Thumb drive for any mount point you want using this procedure. You can even mount your Thumb Drive as /usr.

NOTE: In order for the changes that you made to /etc/inittab and /etc/fstab to take effect, you'll need to copy them into the project_build_arm/Hammer/root/etc directory.