* [Buildroot] package/hotplug @ 2010-08-19 0:43 H Hartley Sweeten 2010-08-19 9:26 ` Will Newton 0 siblings, 1 reply; 7+ messages in thread From: H Hartley Sweeten @ 2010-08-19 0:43 UTC (permalink / raw) To: buildroot Hello all, I am trying to get USB memory stick hotplugging to work on my busybox system. I would like to be able to attach a memory stick and have the system auto mount the drive. I assumed that I would need to enable hotplug package to do this but it is normally disabled by BR2_PACKAGE_BUSYBOX_SHOW_OTHERS. I have looked thru the busybox configuration and can't find anything that would replace the hotplug app. Did I overlook something? Regards, Hartley ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] package/hotplug 2010-08-19 0:43 [Buildroot] package/hotplug H Hartley Sweeten @ 2010-08-19 9:26 ` Will Newton 2010-08-19 17:10 ` H Hartley Sweeten 0 siblings, 1 reply; 7+ messages in thread From: Will Newton @ 2010-08-19 9:26 UTC (permalink / raw) To: buildroot On Thu, Aug 19, 2010 at 1:43 AM, H Hartley Sweeten <hartleys@visionengravers.com> wrote: > Hello all, > > I am trying to get USB memory stick hotplugging to work on my busybox system. ?I > would like to be able to attach a memory stick and have the system auto mount the > drive. > > I assumed that I would need to enable hotplug package to do this but it is normally > disabled by BR2_PACKAGE_BUSYBOX_SHOW_OTHERS. ?I have looked thru the busybox > configuration and can't find anything that would replace the hotplug app. ?Did I > overlook something? mdev from busybox should do what you need. You'll need a line like this in your inittab: ::sysinit:/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug It's not as flexible as udev, but should do what you need. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] package/hotplug 2010-08-19 9:26 ` Will Newton @ 2010-08-19 17:10 ` H Hartley Sweeten 2010-08-19 17:58 ` Will Newton 0 siblings, 1 reply; 7+ messages in thread From: H Hartley Sweeten @ 2010-08-19 17:10 UTC (permalink / raw) To: buildroot On Thursday, August 19, 2010 2:26 AM, Will Newton wrote: > On Thu, Aug 19, 2010 at 1:43 AM, H Hartley Sweeten wrote: >> Hello all, >> >> I am trying to get USB memory stick hotplugging to work on my busybox >> system. ?I would like to be able to attach a memory stick and have the >> system auto mount the drive. >> >> I assumed that I would need to enable hotplug package to do this but >> it is normally disabled by BR2_PACKAGE_BUSYBOX_SHOW_OTHERS. ?I have >> looked thru the busybox configuration and can't find anything that >> would replace the hotplug app. ?Did I overlook something? > > mdev from busybox should do what you need. You'll need a line like > this in your inittab: > > ::sysinit:/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug > > It's not as flexible as udev, but should do what you need. Hello Will, thanks for the reply. I have already tried 'echo /sbin/mdev > /proc/sys/kernel/hotplug' from a command line. When I insert the USB memory stick it is detected but not mounted (same result without the command above). I just tried adding the line above to my inittab and I get the same result. usb 2-1.4: new high speed USB device using fsl-ehci and address 4 usb 2-1.4: configuration #1 chosen from 1 choice scsi0 : SCSI emulation for USB Mass Storage devices scsi 0:0:0:0: Direct-Access USB Flash Disk 4.00 PQ: 0 ANSI: 2 sd 0:0:0:0: [sda] 499071 2048-byte logical blocks: (1.02 GB/974 MiB) sd 0:0:0:0: [sda] Write Protect is off sd 0:0:0:0: [sda] Assuming drive cache: write through sd 0:0:0:0: [sda] 499071 2048-byte logical blocks: (1.02 GB/974 MiB) sd 0:0:0:0: [sda] Assuming drive cache: write through sda: sd 0:0:0:0: [sda] 499071 2048-byte logical blocks: (1.02 GB/974 MiB) sd 0:0:0:0: [sda] Assuming drive cache: write through sd 0:0:0:0: [sda] Attached SCSI removable disk My buildroot setup is pretty much a generic arm config. This config uses the device table from target/generic/device_table.txt so the /dev/sda nodes actually exist even before the USB memory stick is connected. I assume mdev would create them if then were not there. I can mount the drive manually: # cat /proc/partitions | grep sda 8 0 998142 sda # ls /mnt # mount -t vfat /dev/sda /mnt # ls /mnt test_file.txt # mount | grep sda /dev/sda on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,errors=remount-ro) But, how to I get mdev to mount the drive after it's detected? Regards, Hartley ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] package/hotplug 2010-08-19 17:10 ` H Hartley Sweeten @ 2010-08-19 17:58 ` Will Newton 2010-08-19 18:38 ` H Hartley Sweeten 0 siblings, 1 reply; 7+ messages in thread From: Will Newton @ 2010-08-19 17:58 UTC (permalink / raw) To: buildroot On Thu, Aug 19, 2010 at 6:10 PM, H Hartley Sweeten <hartleys@visionengravers.com> wrote: > I have already tried 'echo /sbin/mdev > /proc/sys/kernel/hotplug' from > a command line. ?When I insert the USB memory stick it is detected but > not mounted (same result without the command above). > > I just tried adding the line above to my inittab and I get the same > result. > > usb 2-1.4: new high speed USB device using fsl-ehci and address 4 > usb 2-1.4: configuration #1 chosen from 1 choice > scsi0 : SCSI emulation for USB Mass Storage devices > scsi 0:0:0:0: Direct-Access ? ? USB ? ? ?Flash Disk ? ? ? 4.00 PQ: 0 ANSI: 2 > sd 0:0:0:0: [sda] 499071 2048-byte logical blocks: (1.02 GB/974 MiB) > sd 0:0:0:0: [sda] Write Protect is off > sd 0:0:0:0: [sda] Assuming drive cache: write through > sd 0:0:0:0: [sda] 499071 2048-byte logical blocks: (1.02 GB/974 MiB) > sd 0:0:0:0: [sda] Assuming drive cache: write through > ?sda: > sd 0:0:0:0: [sda] 499071 2048-byte logical blocks: (1.02 GB/974 MiB) > sd 0:0:0:0: [sda] Assuming drive cache: write through > sd 0:0:0:0: [sda] Attached SCSI removable disk > > My buildroot setup is pretty much a generic arm config. ?This config > uses the device table from target/generic/device_table.txt so the > /dev/sda nodes actually exist even before the USB memory stick is > connected. ?I assume mdev would create them if then were not there. > > I can mount the drive manually: > > # cat /proc/partitions ?| grep sda > ? 8 ? ? ? ?0 ? ? 998142 sda > # ls /mnt > # mount -t vfat /dev/sda /mnt > # ls /mnt > test_file.txt > # mount | grep sda > /dev/sda on /mnt type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,errors=remount-ro) > > But, how to I get mdev to mount the drive after it's detected? it may be possible with the mdev config file. It seems to only be documented in the source: http://git.busybox.net/busybox/tree/util-linux/mdev.c See the section that mentions executing a command. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] package/hotplug 2010-08-19 17:58 ` Will Newton @ 2010-08-19 18:38 ` H Hartley Sweeten 2010-08-19 18:59 ` Michael S. Zick 0 siblings, 1 reply; 7+ messages in thread From: H Hartley Sweeten @ 2010-08-19 18:38 UTC (permalink / raw) To: buildroot On Thursday, August 19, 2010 10:58 AM, Will Newton wrote: > On Thu, Aug 19, 2010 at 6:10 PM, H Hartley Sweeten wrote: >> But, how to I get mdev to mount the drive after it's detected? > > it may be possible with the mdev config file. It seems to only be > documented in the source: > > http://git.busybox.net/busybox/tree/util-linux/mdev.c > > See the section that mentions executing a command. I figured it had something to do with the mdev.conf file. I did some grep'ing and found the KwikByte target handles this with a custom '/sbin/automount.script' that is called by mdev. I have modified my setup and it appears to be working. When I plug in the USB drive it is now detected and mounted. The only issue I have now is when the drive is removed. mdev does call the script to unmount the drive but I get two kernel errors: usb 2-1.4: USB disconnect, address 4 FAT: bread failed in fat_clusters_flush FAT: bread failed in fat_clusters_flush I think these are generated because the drive is actually not present when umount tries to unmount it. I'm using the -f option (force unmount) but that doesn't seem to prevent the error. Thanks for the help, Hartley ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] package/hotplug 2010-08-19 18:38 ` H Hartley Sweeten @ 2010-08-19 18:59 ` Michael S. Zick 2010-08-25 5:35 ` Mitch Davis 0 siblings, 1 reply; 7+ messages in thread From: Michael S. Zick @ 2010-08-19 18:59 UTC (permalink / raw) To: buildroot On Thu August 19 2010, H Hartley Sweeten wrote: > On Thursday, August 19, 2010 10:58 AM, Will Newton wrote: > > On Thu, Aug 19, 2010 at 6:10 PM, H Hartley Sweeten wrote: > >> But, how to I get mdev to mount the drive after it's detected? > > > > it may be possible with the mdev config file. It seems to only be > > documented in the source: > > > > http://git.busybox.net/busybox/tree/util-linux/mdev.c > > > > See the section that mentions executing a command. > > I figured it had something to do with the mdev.conf file. I did > some grep'ing and found the KwikByte target handles this with a > custom '/sbin/automount.script' that is called by mdev. > > I have modified my setup and it appears to be working. When I plug > in the USB drive it is now detected and mounted. The only issue I > have now is when the drive is removed. mdev does call the script > to unmount the drive but I get two kernel errors: > > usb 2-1.4: USB disconnect, address 4 > FAT: bread failed in fat_clusters_flush > FAT: bread failed in fat_clusters_flush > > I think these are generated because the drive is actually not present > when umount tries to unmount it. I'm using the -f option (force unmount) > but that doesn't seem to prevent the error. > It can't, the drive isn't there to write to once you remove it. Add a "safely unmount" thingy to whatever interface your device has, call a: mount -o remount device_name script. Note there is no option specified after the "remount" - not a typo here. That will make the kernel flush its VFS buffers for that device. Mike > Thanks for the help, > Hartley > _______________________________________________ > buildroot mailing list > buildroot at busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [Buildroot] package/hotplug 2010-08-19 18:59 ` Michael S. Zick @ 2010-08-25 5:35 ` Mitch Davis 0 siblings, 0 replies; 7+ messages in thread From: Mitch Davis @ 2010-08-25 5:35 UTC (permalink / raw) To: buildroot Hartley, On Fri, Aug 20, 2010 at 4:59 AM, Michael S. Zick <minimod@morethan.org> wrote: > On Thu August 19 2010, H Hartley Sweeten wrote: >> On Thursday, August 19, 2010 10:58 AM, Will Newton wrote: >> > On Thu, Aug 19, 2010 at 6:10 PM, H Hartley Sweeten wrote: >> >> But, how to I get mdev to mount the drive after it's detected? >> > >> > it may be possible with the mdev config file. It seems to only be >> > documented in the source: >> > >> > http://git.busybox.net/busybox/tree/util-linux/mdev.c >> > >> > See the section that mentions executing a command. >> >> I figured it had something to do with the mdev.conf file. ?I did >> some grep'ing and found the KwikByte target handles this with a >> custom '/sbin/automount.script' that is called by mdev. >> >> I have modified my setup and it appears to be working. ?When I plug >> in the USB drive it is now detected and mounted. ?The only issue I >> have now is when the drive is removed. ?mdev does call the script >> to unmount the drive but I get two kernel errors: >> >> usb 2-1.4: USB disconnect, address 4 >> FAT: bread failed in fat_clusters_flush >> FAT: bread failed in fat_clusters_flush >> >> I think these are generated because the drive is actually not present >> when umount tries to unmount it. ?I'm using the -f option (force unmount) >> but that doesn't seem to prevent the error. > > It can't, the drive isn't there to write to once you remove it. > > Add a "safely unmount" thingy to whatever interface your device has, > call a: > mount -o remount device_name > script. > Note there is no option specified after the "remount" - not a typo here. > That will make the kernel flush its VFS buffers for that device. If you don't need to write to the device, you could also use "mount -o ro" to make it read-only. Then you won't get the message. If it happens that you need to write, you can temporarily call "mount -o remount,rw", do your op, then "mount -o remount,ro". Alternatively (and this is a little bit gross), if you don't want the kernel to do any mounting, you may be able to hack "mtools" to use it as a library: http://www.gnu.org/software/mtools/ Then the kernel wouldn't care if the device was pulled unexpectedly. Mitch. ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-08-25 5:35 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-08-19 0:43 [Buildroot] package/hotplug H Hartley Sweeten 2010-08-19 9:26 ` Will Newton 2010-08-19 17:10 ` H Hartley Sweeten 2010-08-19 17:58 ` Will Newton 2010-08-19 18:38 ` H Hartley Sweeten 2010-08-19 18:59 ` Michael S. Zick 2010-08-25 5:35 ` Mitch Davis
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox