[Buildroot] package/hotplug

Michael S. Zick minimod at morethan.org
Thu Aug 19 18:59:18 UTC 2010


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
> 
> 




More information about the buildroot mailing list