Project

General

Profile

Actions

Bug #273

closed

mdev doesn't load usb drivers on boot with 3.10.y RPI kernel

Added by Hammel almost 11 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Immediate
Assignee:
Category:
03 - Linux Kernel
Target version:
Start date:
09 Feb 2014
Due date:
% Done:

100%

Estimated time:
Severity:
01 - Critical

Description

The problem appears to be that usbfs was deprecated in 3.6. So mdev needs a different method of identifying usb devices on boot in order to load their drivers. Without this fix things like BLE (RM #252) can't be added.

I've posted a question about this to the Busybox mailing list.


Files

Makefile (1.56 KB) Makefile Modified nldev makefile for cross compiling test Hammel, 17 Feb 2014 19:23
S10nldev (387 Bytes) S10nldev Sample init script to have nldev run at boot Hammel, 17 Feb 2014 19:23
mdev.conf (4.83 KB) mdev.conf Initial merged PiBox and nldev mdev.conf Hammel, 19 Feb 2014 19:23
S10usbdev (910 Bytes) S10usbdev New S10usbdev init script. Hammel, 23 Feb 2014 17:12
Actions #1

Updated by Hammel almost 11 years ago

  • % Done changed from 0 to 10
No answers of any use on the mailing list. The next step is to look at these:
  1. http://git.r-36.net/nldev/
    1. http://git.r-36.net/nlmon/
    2. http://lists.suckless.org/dev/1204/11576.html (announcement for nldev)
  2. http://git.2f30.org/smdev
    1. https://groups.google.com/forum/#!topic/wmii/o7GksBsfTvQ (discussion of smdev)
  3. http://www.openwall.com/lists/musl/2012/05/22/8 (discussion showing nldev and mdev replacing udev)
  4. http://sta.li/technologies (static linux - part of suckless.org)

It appears it may be useful as a front end to mdev.

Actions #2

Updated by Hammel almost 11 years ago

Cross compiling nldev was easy. See attached modified Makefile. It was run with this command:

make STAGING=$staging CC=arm-unknown-linux-gnueabi-cc PREFIX=`pwd`/install install
where
  • $staging = <Buildroot>/output/staging
Once it's built you apparently do the following:
  1. copy <src>/install/* to pibox:/usr/
  2. copy <src>/mdev/etc/mdev.conf to pibox:/etc/mdev.conf
  3. mkdir pibox:/lib/mdev
  4. copy <src>/mdev/lib/* to pibox:/lib/mdev
  5. Add S10nldev (see attached init script) to pibox:/etc/init.d/ so it runs after mdev is inserted to handle hotplugging

That should be it. This hasn't been tried yet, but it's what I'll be testing next.

If this works then I need to make a Buildroot package for nldev.

Actions #3

Updated by Hammel almost 11 years ago

  • % Done changed from 20 to 30

This works a bit better than mdev by itself. One problem is that nldev is looking for /bin/mdev while Busybox it putting this under /sbin. Making a symlink fixed that.

I tested this with my old mdev.conf but it doesn't work. I tried it with the nldev version of mdev.conf and all the USB device drivers were loaded properly. So I need to merge the mdev.conf so I can get mmc mounted correctly (which my script does but nldev's doesn't).

So the two things to do now:
1. Merge the mdev.conf files
2. Create an nldev package for Buildroot

I'm getting very close to getting to update the kernel to 3.10.x!!

Actions #4

Updated by Hammel almost 11 years ago

  • % Done changed from 30 to 70

Added nldev package to Buildroot 2013.11 build.

Still need to tweak the nldev mdev.conf for PiBox specific needs. This would be a modification to the existing skeleton/etc/mdev.conf.

Actions #5

Updated by Hammel almost 11 years ago

Merged the two mdev.conf's (PiBox and nldev, see attachment) and tested. Most of the system comes up just fine. Certainly the USB wifi is available and the SD card is mounted. But the following two drivers are not loaded:
  1. uvcvideo
  2. videodev
usbhandler.conf specified which driver was loaded (via usbhandler.sh) but the mdev.conf is currently using /lib/mdev/usb (nldev's handler). So I'll need to merge these two scripts:
  1. usbhandler.sh (PiBox)
  2. usb (nldev)

After that, I should be golden with 3.10.y and Buildroot 2013.11.

Actions #6

Updated by Hammel almost 11 years ago

  • Priority changed from High to Immediate
  • Target version changed from 1.0 - Atreides to 0.8.0

Retargeting for 0.8.0.

Actions #7

Updated by Hammel almost 11 years ago

Turns out that nldev + mdev didn't work consistently to load the modules. The former didn't always ensure that event notifications would arrive at mdev. Sometimes I got some of the usb devices, other times I didn't get any. The only drivers that were always loaded were those included in /etc/modules.conf, which were loaded by S00dev's call of /etc/rc.modules.

So I'm punting on this. The alternative is to fall back to a variation on usbhandler.sh, which was being called by mdev in 3.2.x. It's still called by mdev in 3.10.x, but now I'm adding an init script that loads the configuration file (/etc/usbhandler.conf) and loads the output of lsusb into a shell variable. It then uses the latter to find drivers in the former and loads them. This script runs after mdev starts and fails silently if the driver is already loaded.

The new init script is included here, for reference. It's been added to the source tree already.

I just need to do a full kernel and rootfs build to verify this is working properly. Then I can close this issue and be moved permanently to the 3.10.y tree.

Actions #8

Updated by Hammel almost 11 years ago

  • % Done changed from 90 to 80

Ugh. This never ends. So I rebuilt on my desktop instead of the build machine. The desktop picked up 3.10.32. The build machine had 3.10.30. The latter works. The former doesn't. They have the same kernel config. They have the same rootfs. On the 3.10.30 box lsusb works. On 3.10.32 it doesn't. So my little trick of using lsusb fails on the later kernel.

3.10.32 is the latest long term stable kernel for the 3.10.x branch. So I can see why they're tracking it with the Raspberry Pi tree. The previous long term stable release is a 3.4 tree. But that's not good enough for use with BLE (Bluetooth Low Energy). So I have to make the 3.10.x series work.

So I've set the KERNEL_GIT_ID to back up to the 3.10.31 merge and will try again.

Actions #9

Updated by Hammel almost 11 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 80 to 100

The 3.10.y branch works if you use the correct git ID. I found that the last merge with the upstream 3.10.31 branch at kernel.org works correctly with lsusb, allowing the new S10usbdev init script to properly load usb drivers.

Changes pushed upstream.

So now PiBox is rev'd to the 3.10.y branch, which is what the fbtft driver is mainlained with and which will allow use of BLE support.

This issue can be closed.

Actions

Also available in: Atom PDF