Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Getting mcd to run on a minimal system: (8 Items)
   
Getting mcd to run on a minimal system  
I'm trying to get mcd to auto-detect when a USB memory stick is inserted.  My boot image is small and does not use the 
diskboot program and its associated syinit script.  I'm booting from a compact flash card that installs as /dev/hd0 and 
/dev/hd0t77.  I can plug in a USB stick and it shows up as /dev/hd1 and /dev/hd1t6.  I tried to configure devb-umass to 
have it show up as the expected /dev/umass*, but this is poorly documented and I couldn't get it to work.  So I tried to
 trick mcd into mounting it as /fs/us0 with the following configuration:

mcd.conf:
vvvvvvvvvvvvvvvvvvv
[/dev/hd*]
Callout		= PATH_MEDIA_PROCMGR
Argument	= /proc/mount
Priority	= 11,10
Start Rule	= MOUNT
Stop Rule	= UNMOUNT

[MOUNT]
Callout		= MOUNT_FSYS
Argument	= /etc/mcd.mnt

[UNMOUNT]
Callout		= UNMOUNT_FSYS

[/dev/cd*]
Callout		= CD_MEDIA_IOBLK
Argument	= 1000,2000
Priority	= 11,9
Start Rule  = MOUNT
Stop Rule   = UNMOUNT

[/fs/cd*]
Callout		= PATH_MEDIA_PROCMGR
Argument	= /proc/mount
Priority	= 11,10
Start Rule	= INSERTED
Stop Rule	= EJECTED

[/fs/usb*]
Callout		= PATH_MEDIA_PROCMGR
Argument	= /proc/mount
Priority	= 11,10
Start Rule	= INSERTED
Stop Rule	= EJECTED

[/fs/pfs*]
Callout		= PATH_MEDIA_PROCMGR
Argument	= /proc/mount
Priority	= 11,10
Start Rule	= INSERTED
Stop Rule	= EJECTED

[INSERTED]

[EJECTED]

[AVAILABLE]
^^^^^^^^^^^^^
mcd.mnt:
vvvvvvvvvvvvvvvv
#----------------------------------------------------------------------
# Device						Mountpt		Type	Options
#----------------------------------------------------------------------
/dev/cd[0-9]					/fs/cd%#	udf		normv
/dev/hd[1-9]					/			enum
/dev/hd[1-9]t1[124]			/fs/usb%0	dos		normv,fsi=use
/dev/hd[1-9]t1[124].[0-9]	/fs/usb%0	dos		normv,fsi=use
/dev/hd[1-9]t[146]			/fs/usb%0	dos		normv,fsi=use
/dev/hd[1-9]t[146].[0-9]		/fs/usb%0	dos		normv,fsi=use
/dev/hd[1-9]t7[789]			/fs/usb%0	qnx4	normv
/dev/hd[1-9]t17[789]			/fs/usb%0	qnx6	normv,sync=optional
/dev/hd[1-9]t7				/fs/usb%0	nt		normv,ro
/dev/hd[1-9]t175				/fs/usb%0	mac		normv,ro
/dev/hd[1-9]					/fs/usb%0	dos		normv,fsi=use
^^^^^^^^^^^^^^^

This doesn't work and I don't see any errors in slogger.  If I insert the stick and manually mount the device it shows 
up:

# mount -t dos /dev/hd1t6 /fs/usb0

When I unplug the stick, /fs/usb0 and the devices disappear correctly.

Is what I am doing incorrect?  Is there a better way?  I've attached my build file as generated by the IDE.

Rob Murrell
Attachment: Text advantechboot.mkifs 4.37 KB
Re: Getting mcd to run on a minimal system  
I should add that I'm developing under QNX version 6.5.0.
Re: Getting mcd to run on a minimal system  
If you beat your head against a coconut long enough something is bound to crack.  I found out how to rename the umass 
devices buried in the bowels of the enum-devices config files:

devb-umass cam pnp disk name=umass cdrom name=umasscd &

This is not documented.  But I still can't get mcd to recognize these devices and mount them.
Re: Getting mcd to run on a minimal system  
>>> I can plug in a USB stick and it shows up as /dev/hd1 and /dev/hd1t6.  

One thing that is going on here is that, when a usbstick is present AT BOOT, it shows up as above, say /dev/hd1.

If instead, you boot WITHOUT the usbstick in place, and then insert it after boot, it will be /dev/umass0.

In other words, "mcd" is not used if the usbstick is present when the system boots.  It is only used LATER when the usb 
stack reports a new device has been detected.  [I don't believe it should work two different ways, but it does...]  So 
changing mcd.conf will never affect the device name - if usbstick is present at system boot.

BTW - I gave up trying to get mcd to work from a minimal ifs.  There must be some undocumented magic somewhere...

Dennis

 
Re: Getting mcd to run on a minimal system  
> >>> I can plug in a USB stick and it shows up as /dev/hd1 and /dev/hd1t6.  

Well, I think you could miss "blk auto=none" .

We have a working mcd configuration with followinh devb-umass options:

"devb-umass cam pnp,quit,verbose blk cache=1m,vnode=384,auto=none,delwri=2:2,rmvto=none,noatime disk name=umass"

-Michael
Re: Getting mcd to run on a minimal system  
OK people, here is the final part to getting mcd to work.  I added the following to the boot script:

mount /dev/hd0t77 /

Apparently, mcd doesn't like the virtual file system the boot image creates.  It wants a real file system to recognize 
removable devices.

Michael, thanks for the devb-umass command options.  I'll want to decompose them to figure out exactly what they mean 
but will likely use them because that's what everyone else does.

Dennis, the peculiar name differences appears to be an artifact of the enum-devices program, which I am not using.  With
 this configuration, the USB stick always shows up as /fs/usb0 even if it is present during booting.
Re: Getting mcd to run on a minimal system  
Thanks.  I was going by your original post -  "I can plug in a USB stick and it shows up as /dev/hd1 and /dev/hd1t6"

When I was trying mcd, I was booting a simple ifs from usbstick - so no remount of / to hd0 occured. 

Iin this case the usbstick is not mounted - even though you boot from it via the bios.
 
I ended up writing code to  find the mass storage device using "usb" binary, parsing values for vid, did, busno, devno 
and issuing a mount the  boot device directly.
Re: Getting mcd to run for files found in a directory  
In my mcd config file I have the following:

-------------------------------
[/dev/umass*]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = MOUNT
Stop Rule   = UNMOUNT

[MOUNT]
Callout     = MOUNT_FSYS
Argument    = /etc/mcd.mnt

[UNMOUNT]
Callout     = UNMOUNT_FSYS

[/fs/usb*]
Callout     = PATH_MEDIA_PROCMGR
Argument    = /proc/mount
Priority    = 11,10
Start Rule  = FIRMWARE_IFS

[/var/spool/uploads/*]
Callout     = PATH_MEDIA_SCAN
Argument    = 1000  
Start Rule  = FIRMWARE_IFS

[FIRMWARE_IFS]
Callout     = FNAME_PATTERN
Argument    = *.IFS,*.ifs
-------------------------------

There is a section that I am telling it if ifs found in that directory, call FIRMWARE_IFS. But why I cannot capture it 
at all?

Basically when I run
# cat /dev/mcd/FIRMWARE_IFS

and creating a sample ifs file:
echo "ers" > /var/spool/uploads/ds.ifs


FIRMWARE_IFS is not triggered!! Why?