Kernel device driver order

  • Dear Support-Team,


    there seems to be a difference in the order device drivers are executed in kernel between V2.0 and V2.1.


    I'm using a special USB device that will be installed as /dev/ttyACM0. There is a special driver that will be executed as udev rule to create a virtual network device connected with this /dev/ttyACM0.
    In kernel V2.0 this was working very good.


    In kernel V2.1 this is working but there seems to be a timing problem:


    The USB device is plugged in while booting. The kernel seems detecting this device before starting the udev (/etc/init.d/S20udev). This causes the kernel to wait for some minutes.


    Output during boot:



    Thanks for any hint.

  • What I found out until now:


    If I change the /etc/init.d/S10udev script lines

    Code
    1. udevadm trigger --type=subsystems --action=add
    2. udevadm trigger --type=devices --action=add
    3. udevadm settle --timeout=30 || echo "udevadm settle failed"


    to

    Code
    1. udevadm trigger


    it's working without the delay. The kernel debug messages below still will be displayed with the same delay but do not halt kernel execution.

    Code
    1. udevd[882]: worker [884] /devices/platform/fsl-ehci.1/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0 is taking a long time
    2. udevd[882]: worker [884] /devices/platform/fsl-ehci.1/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0 timeout; kill it
    3. udevd[882]: seq 940 '/devices/platform/fsl-ehci.1/usb2/2-1/2-1.2/2-1.2:1.0/tty/ttyACM0' killed
    4. udevd[882]: worker [884] terminated by signal 9 (Killed)


    I'm not happy with these errors/warnings even if it's working.
    Any hints ?

  • The USB device is plugged in while booting. The kernel seems detecting this device before starting the udev (/etc/init.d/S20udev).


    I think this is normal. Usually all devices are activated while the kernel is booting and before the init from the rootfs is started, which in turn starts udev. So having the device started before udev is available is rather common. This is why udev is populating the /dev directory with all devices that are already existing as a first step.


    The question is why adding this device does take so long. Here I have an idea. Please look for the line


    null::sysinit:/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug


    in file /etc/inittab. Remove this line, for example by commenting it with a '#' at the beginning of this line. Then try again. Does this work?


    If yes, here is the explanation:
    mdev is something similar to udev, but a smaller implementation provided by busybox. The line above will set busybox's mdev to be used as hotplug program instead of udevd. Therefore later when S10udev is executed, udevadm waits for the confirmation that the devices are created. But as mdev is used instead of udevd, it will not talk to udevadm and therefore udevadm waits indefinitely.


    I believe this line is wrong. On fsimx6 we are using udev and should never use anything of mdev. So this line should be removed.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • Do you need a special driver for this device? Is this driver available at this time? Or do you load the driver as a module by hand later?

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • First of all did you check that the mdev-line in /etc/inittab is really switched off? It is *not* sufficient to modify the file in buildroot's output/target/etc directory. The final_script that is run at the end of the build process right before the filesystem images are created, does copy the file from board/f+s/common/etc to it every time again, overwriting any modifications in output/target/etc/inittab. So if you change it, change it directly on the board, at least for a quick test. If you need to change this file permanently, change it in board/f+s/common/etc or modify the final_script to copy your own file instead.


    Regarding the module, is the driver loaded automatically by a udev rule? Or do you need to load it by hand? If you need to load it by hand, just create your own start script to do this and add it to /etc/init.d. Just use a filename beginning with S0n... where n is a digit. Then this will be started before S10udev. Such a script gets called with the argument "start" or "stop". This should oviously start the driver (load the module with modprobe) or stop the driver (unload the driver with modprobe -r). If you also add argument "restart", then you can call it by hand to restart the driver. Simply stop it and start it again in this case. You can have a look at the other scripts for how this can be done.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.