hotplug II / mdev discussion and implementation

johnbock

Mitglied
Mitglied seit
2 Mrz 2008
Beiträge
310
Punkte für Reaktionen
0
Punkte
0
Although I'm pleased with the design of the hotplug replacement (hpr), the module separation/scalability and potential configuration is not optimal. While allowing optimal design for block devices, it does support char devices very well. For example, implementing a simple interface for diverse communications devices is not as easy as it may seem. And supplementing hpr for wlan sticks, bluetooth devices and profiles cannot be performed per plugin or freetz-module.

While searching for alternatives I came across busybox's own mdev: an udev replacement. I had to look at a few times at different perspectives to realize it's flexibility. Device configuration and module loading are held simple and easily allow good functional separation while not reducing scalability and flexibility.

In any case, I found a post at uclibc where Natanael Copa was requesting link support in mdev. In this post, he shows his mdev configuration and escorting scripts. In particular I admire how the required modules are loaded. [edit]It does however, have a few short-comings: the largest being mdev scan produces no event environment variables. Using a concept I found in the udev source, it was easily overcome. Big thanks to the guys at udev and kernel;)[/edit]

In order to incorporate the idea of his implementation (self loading modules) we would need to customize the following files
  • /etc/mdev.conf
    Solved in 0.0.2. There is at least one line (mtd creation) that needs to be changed dependent upon the hardware model.
  • /etc/modprobe.conf
    There is at least one line (piglet module option definition) that needs to be changed dependent upon the hardware model.
  • the devices maps in ./root and ./tools
    Most of the static device creation is commented while building the mdev configuration modification. We could probably still tweak the one or the other entry.
  • /etc/init.d/rc.S
    [*]/lib/modules/<kernel version>/modules.dep is already supported

The file /etc/modprobe.conf modification must be mainly hardware version/revision based while all other files are modified per configured module. I believe this maintains optimal granularity between image configuration and build. The entries in this file can also be used correlate modules to hardware with out having to patch the kernel or modules.

This could also allow addons like usbroot to allow the system to bring up the required devices independent of the underlying hardware. There is an example of how one can simplify piglet loading. I used it while analyzing mdev at boot in scan mode.

Additionally, /dev and /dev/pts are mounted in rc.S at boot as the mdev documentation suggests. Subsequently, mdev is executed in scan mode to set up cold-plugged devices. Lastly, announce mdev hotplugging to the kernel.

some problems:
  • mdev should have some kind notification while booting into usbroot or initrd to allow only the required devices to be initialized. a dot file/directory indicating initialization @boot is complete. Each mdev script must voluntarily adhere to this convention
    Code:
    #!/bin/sh
    [ -e /dev/.mdev ] || exit
    ...
    or integrate support directly in mdev.conf
    Code:
    usblp[0-9] root:root 0660 @[ -e /dev/.mdev ] && /lib/mdev/printer
    This is still on my TODO list and will remain there for a while. Device (lp) / service (aura) implementation is more important.
  • may require extensive modifications to the init scripts
    This was not as much as I expected.
  • Even after implementation, the system requires /sbin/makedevs


At the moment the following devices are explicitly supported
  • HDs and memory keys (disk, partition, swap, vfat, ext2, ext3 with fsck)
    The naming convention has been altered to allow as many devices as the kernel does. swaps haven't been tested yet.
  • bluetooth dongles with bluez-util mod
  • hid (keyboard, mouse) are recognized but have no module support
  • stick n surf usb wlan sticks and possibly mini fon (don't have one to test)

WARNING
The attached patches and tar file are included only for review purposes or for the extremely brave or immensely stupid. If you don't know how the box boots or how hotplug works you should not include the package in an image to be installed. The current implementation is intended for only the 7270 and has been tested with the freetz trunk at 2365


Version 0.0.2 - 02.Jul.2008
- harmonized mtd char double-up node creation (hardware independent)

Version 0.0.3 - 10.Jul.2008
- register/unregister mountpoint with tam (telephone answering machine), no automatic activation

Version 0.0.4 - 13.Jul.2008
- change mdev scan behavior for ohio kernels
---- scan additionally for modalias files
---- scan entire sysfs w/o following symlinks
---- workaround for missing uevent files on ohio kernels required for scanning
- correct mdev remove event behavior (remove evtl. node aliases)
- include busybox patch for Config.4mb_26 configurations

Version 0.0.5 - Not released


Version 0.6.1 - 10.Sep.2008
  • updated busybox patches to 1.11.2
  • updated freetz patches to 2524
  • updated e2fsprogs patches (e2fsprogs.mk)
  • tam hotplug session fixes
  • new build accounts for hardware differences (modprobe piglet) part one
Version 0.6.2 - 11.Sep.2008 [your mileage may vary]
  • adjusted patching to freetz r2531
  • eleminated e2fsprogs and busybox configuration patches (in freetz trunk)
  • mdev patches for tailoring scan behavior (primarily required for ohio kernels)
  • mdev configuration build uses new bb conf in freetz trunk
  • acquiescing hardware part two: after running /lib/mdev/misc/bitfile piglet can be loaded using 'modprobe avm_piglet'
  • load usbhost (usbahcicore, musb_hdrc) modules hardware independently: modprobe avm_usb_host
* these are used for both 2.6.19 and 2.6.13 kernels and have been thoroughly tested on the 7270
 

Anhänge

  • mdev-0.6.2_busybox-mdev-scan.tar.bz2
    2.1 KB · Aufrufe: 13
  • mdev-0.6.2_freetz-2531.patch.bz2
    215 Bytes · Aufrufe: 13
  • mdev-package-0.6.2.tar.bz2
    18.8 KB · Aufrufe: 15
Zuletzt bearbeitet:
geht das jetzt oder nicht? Was ist zu tun?
 
The reference implementation @mdev 0.0.1 is still partly awkward:
  • The changes required to the mount subsystem for integration from hpr are a bit spotty. mount/umounting and avm interface should be reworked.
  • mtd support in the file /etc/mdev.conf and subsequent call could be less hardware dependent. i.e. Call the script @mtd0 recognition, find the max. mtd device and double up as required. All mtd devices should be present at scan time. Implemented, tested -> 0.0.2.
  • Implement aura/usbip support in /lib/mdev/interface which is linked to /etc/hotplug.
  • Add the ability to eject HDs/keys in the freetz status page. The problem with the avm page is that neither individual partitions nor disks can be separately selected.
  • Perhaps add a wish/todo list in the mdev package directory.
  • Patch /etc/modprobe.conf dependent to hardware.
  • There are many other things to do, but I don't want to list them yet...
 
Zuletzt bearbeitet:
Version 0.0.2 released.
 
Kann mir jemand sagen für was das "hotplug" gut ist.
Bitte auf "deutsch" wenns geht;)
 
Kann mir jemand sagen für was das "hotplug" gut ist.
Bitte auf "deutsch" wenns geht;)

Ich versuchs mal...

Diese Implementation soll stabiler und flexibler als die originale sein. Sie benutzt z.B. keinerlei Locking und laesst das System (Kernel) arbeiten wie es soll. Zusaetzlich, laesst diese Implementation eine unbegrenzte Anzahl von USB-Geraeten zu. Hoefentlich ist sie dann auch etwas verstaendlicher.

Wie ich die Sache verstehe, ist hierdurch auch die moeglichkeit gegeben den Tickets 2, 135, 159, 142 und 194 zuloesen und eine moegliche Loesung fuer 177 und 141 vereinfachen.
 
Muss ich eigentlich alle 5 patches installieren oder nur das letzte mdev 0.02 ?
 
Muss ich eigentlich alle 5 patches installieren oder nur das letzte mdev 0.02 ?

I see only 3 patches... You must install the patches and unpack the tar.bz2 all in the freetz co directory.

In any case, as you can see in the warning the package is not at stage for everyone to use. If something goes wrong you will have to use the recover-image from avm to reanimate your box. If you cannot boot with use of the ttyS0, don't install the mdev configuration.

If you feel you can handle it; go ahead... Don't come back crying, I've warned you;)
 
7170

When I would try to patch the patches in order to prepare them for the 7170, what would be need to be changed? MTD dev nodes? What more?

Is recovery from errors within the mdev/hotplug configuration possible with make recover or could such errors likely brick the device?

Anyway, this improvement of the firmware seems to be a good thing :)
 
When I would try to patch the patches in order to prepare them for the 7170, what would be need to be changed? MTD dev nodes? What more?
The entire usb hotplug runs off the endpoint events. I'm not sure if the 2.6.13 kernel produce those. Log onto your box and take a look at /sys/class/usb_endpoint. If the 7170 has the directory and there are endpoints listed from within, the package should work. Otherwise, I can only guess you don't need to change anything. BTW, 0.0.2 levies the differences with the mtds between the boxes.

Is recovery from errors within the mdev/hotplug configuration possible with make recover or could such errors likely brick the device?
No, no. I don't mess with the boot sectors in flash. I've done a few naughty things with box and have always been able to reanimate it using make recover.
 
Wäre super wenn das auch auf OpenWrt laufen würde. Dort ist die aktuelle hotplug implementation grausam.
 
Wäre super wenn das auch auf OpenWrt laufen würde. Dort ist die aktuelle hotplug implementation grausam.

The mdev configuration should would on any recent kernel. There are only a few minor Fritz/Freetz specifics. But, I'd rather get this baby going in Freetz and then talk about other stuff. Unless of course we combine our resources;)
 
Log onto your box and take a look at /sys/class/usb_endpoint. If the 7170 has the directory and there are endpoints listed from within, the package should work.
Pechato, the usb_endpoint directory isn't available.

Code:
/var/mod/root # find /sys -name usb*
/sys/module/usb_storage
/sys/module/usbahcicore
/sys/module/usbcore
/sys/module/usbcore/parameters/usbfs_snoop
/sys/class/usb
/sys/class/usb_host
/sys/class/usb_host/usb1
/sys/bus/usb
/sys/bus/usb/drivers/usb-storage
/sys/bus/usb/drivers/usb
/sys/bus/usb/drivers/usb/usb1
/sys/bus/usb/drivers/usbfs
/sys/bus/usb/devices/usb1
/sys/devices/ahci-hcd/usb1
 
Hallo,

habe die 3 patch Dateien installiert und die mdev-0.0.3 version.

Mein USB2Com Adapter funktioniert, aber mein USB Stick wird im AVM Webinterface nicht mehr angezeigt..

Hat jemand eine Idee ?
 
aber mein USB Stick wird im AVM Webinterface nicht mehr angezeigt..

Hat jemand eine Idee ?

The current mdev configuration releases are for testing/review purposes only. And on this note I want to say thank you for being the first (other than myself) for testing it on the 7270.

After manually ensuring the stick is not mounted, detach your memory key and reboot the box. When the box is again up, reattach you key and post all of syslog.
 
Habe die Box neugestartet ( ohne Stick).
Dann Stick eingesteckt ---> wurde eingebunden und im AVM Interface sichtbar.
Danach USB Stick abgezogen und HUB angesteckt , USB2COM angesteckt und Stick angesteckt ( Stick wurde nicht eingebunden)

Code:
<14>Jul 13 21:05:19 eventadd[1082]: EVENT(131): USB-GerÃ&curren;t 002, Klasse 'storage', angesteckt

<14>Jul 13 21:05:27 eventadd[1174]: EVENT(140): Partition unter uStor00 eingebunden

<91>Jul 13 21:05:27 ftpd[1185]: control bind: Address already in use

<11>Jul 13 21:05:37 tr069starter[1187]: tr069starter: /var/media/ftp/uStor00/tr069start.config not found - exit

<14>Jul 13 21:07:05 eventadd[1271]: EVENT(132): USB-GerÃ&curren;t 002 abgezogen

<14>Jul 13 21:07:05 eventadd[1286]: EVENT(141): uStor00 entfernt

<14>Jul 13 21:07:14 eventadd[1379]: EVENT(131): USB-GerÃ&curren;t 003, Klasse 'hub', angesteckt

<14>Jul 13 21:07:35 eventadd[1414]: EVENT(130): USB-GerÃ&curren;t 004 angesteckt

<14>Jul 13 21:08:19 eventadd[1449]: EVENT(131): USB-GerÃ&curren;t 005, Klasse 'storage', angesteckt
 

Zurzeit aktive Besucher

Statistik des Forums

Themen
246,159
Beiträge
2,247,074
Mitglieder
373,678
Neuestes Mitglied
brainkennedy
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.