<< to CrossControl homepage

Support & Service Center

Change name of autostart script for iMX5 units (cc-auto.sh)

Printer-friendly versionPrinter-friendly versionPDF versionPDF version

This information is only valid for iMX5 units (VC/VA)


To be able to autostart scripts from an inserted USB-stick, we currently use the script name ‘cc-auto.sh’. If there is a script with this name on the root-folder of the USB, it will start executing its contents.

Why we use this particular script name, depends on the content of the file ‘/sbin/hotplug’.

In Linux there is a kernel parameter, /proc/sys/kernel/hotplug which normally contains the pathname ‘/sbin/hotplug’. That parameter gives the name a program which the kernel may invoke at various times.

The USB subsystem currently invokes /sbin/hotplug when USB devices are added or removed from system. This invocation is currently done by the kernel in our Linux units.

If you want to rename the script that will be autostarted, when present on an USB-stick, you need to edit (with ‘nano’ or ‘vi’) the following file: /sbin/hotplug

Exchange the name ‘cc-auto.sh’ to the name of your choice.

mount_usb()
{
   DEV=$1
   SLOT=$2
   mount -t auto $DEV $SLOT –osync
   if ( test $? -eq 0 ) ; then
      debug_mesg mounted $DEV to $SLOT
      if [ -f $SLOT/cc-auto.sh ] ; then
         debug_mesg executing autorun-script
         /bin/sh $SLOT/cc-auto.sh
      fi
   fi
}

There could also be a need to extinguish the possibility to autorun scripts from an inserted USB and in that case you need to remove (or comment out) the line:

/bin/sh $SLOT/cc-auto.sh

as shown in the script example above.


Link to more Linux USB information



Environment and Versions: 
CCP VA/VC
Category: