On Sunday, 12 January 2025 at 11:11:44 Marko Hoyer <mhoyer.oss-devel@xxxxxxxxxx> wrote: > > Am 12.01.25 um 02:03 schrieb Rob Landley: > > On 1/11/25 12:57, Bird, Tim wrote: > >> Hey Rob, This is a great review of /dev, /sys and the different > >> ways that /dev gets populated. > > > > Feel free to link stuff from wikis or some such. The newest of those > > documents was written in 2007. > > > >> For a lot of embedded Linux devices, the only bus where > >> new items can show up dynamically is USB. > > SDCARD readers connected via MMC are common in automtove head units as > well ... > > > > > > Yup, /sys/bus/usb/devices is in there too and when a driver binds to > > them, they wind up in /sys/block and such as well. (you USED to have > > to seprately mount a usbfs under /sys but they finally acknowledged > > that was silly about 5 years ago, hence > > https://askubuntu.com/questions/1218321/if-usbfs-has-been-deprecated-then-why-is-sys-bus-usb-drivers-usbfs-directory-p) > > > > When a driver DOESN'T automatically bind to them it gets a bit > > complicated, and one of the things mdev can be configured to do is act > > as a firmware loader! Which is just... Ahem, there are YEARS of poor > > design decisions the kernel guys made, where they ignored a mechanism > > they already had an implemented something more complicated. The > > mechanism whereby the kernel opens a firmware file and read it > > directly out of the filesystem instead of calling a hotplug helper > > was... I'm just going to gloss over that. > > WIFI & Bluetooth devices often use this firmware mechanism. And yes I > agree, it looks a bit ** ugly** seeing the kernel loading a firmware > file from /lib/firmware searching it in the root file system w/o > knowing the state of it during boot ... For WIFI and bluetooth I do not > see a big issue here since I'd prevent putting such features on a > critical chain by system design in any way since bringing them up and > (re)connecting external devices is time consuming by nature. Nothing you > shall need to wait for ... > The whole "try to access the rootfs during boot" domain is an area worth investigating, as it *should* be simple to track the actual init state and directly skip the accesses that aren't going to succeed. I recently stumbled for example on the Ethernet PHY core trying to load modules during init [1], but the firmware loading is another of such examples. > To summarize from my point of view: > > * It's worth talking a bit about the effect of udev and about alternatives > > * "mdev" is surely worth being named as an potential option besides > "selective triggering" and "static setup and moving triggers back in time" > > * I wouldn't regard mknode as an real alternative in todays system > Another approach that in my opinion is worth mentioning is: no udev/mdev at all. In a couple of embedded products with a very limited scope I simply decided to use devtmpfs + manual insmod + a simple bash script for USB automounting registered as hotplug handler. Very few dependencies, no boot time parsing of configuration files. It took a bit to configure the init sequence, but the result was/is very satisfying. > * In addition I can imagine is "modules loading" vs. "compiling in > drivers" something which is worth mentioning > > * Once I've access to the wiki, I can try to put these ideas into an > initial structure filled up w/ info we discussed in this thread > > Marko > > > [1] https://lore.kernel.org/netdev/SJ0PR18MB5216A8D227B2B3651DB9AC0DDB152@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/ --- Regards, Francesco