mdev doesn't load usb drivers on boot with 3.10.y RPI kernel
|Status:||Closed||Start date:||09 Feb 2014|
|Category:||03 - Linux Kernel|
|Severity:||01 - Critical|
RM #273: Add missing helper scripts. Only copy over mdev.conf if one doesn't already exist. Added mdevdebug.sh to tree.
RM #273: Add init script to load USB drivers on boot. Turn off debugging by default in blockhandler.sh.
#1 Updated by Hammel about 4 years ago
- % Done changed from 0 to 10
- https://groups.google.com/forum/#!topic/wmii/o7GksBsfTvQ (discussion of smdev)
- http://www.openwall.com/lists/musl/2012/05/22/8 (discussion showing nldev and mdev replacing udev)
- http://sta.li/technologies (static linux - part of suckless.org)
It appears it may be useful as a front end to mdev.
#2 Updated by Hammel about 4 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 installwhere
- $staging = <Buildroot>/output/staging
- copy <src>/install/* to pibox:/usr/
- copy <src>/mdev/etc/mdev.conf to pibox:/etc/mdev.conf
- mkdir pibox:/lib/mdev
- copy <src>/mdev/lib/* to pibox:/lib/mdev
- 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.
#3 Updated by Hammel about 4 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!!
#5 Updated by Hammel about 4 years ago
- File mdev.conf added
- % Done changed from 70 to 80
- usbhandler.sh (PiBox)
- usb (nldev)
After that, I should be golden with 3.10.y and Buildroot 2013.11.
#7 Updated by Hammel about 4 years ago
- File S10usbdev added
- % Done changed from 80 to 90
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.
#8 Updated by Hammel about 4 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.
#9 Updated by Hammel about 4 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.