Reputation: 487
I have a driver loaded as part of boot using some initcall level (say late_initcall). As part of the module init, it registers with udev to create the device node auto-ma(t|g)ically. Problem is how can module know whether the udev daemon is running at that point in the boot process. If it is not, user-space will not be able to use the device file rendering the driver and device useless.
Thanks.
Upvotes: 1
Views: 327
Reputation: 2720
Firstly udev
is just one mechanism for creating device nodes. Your code should be creating a device in the kernel device model, and then something will create a device node in /dev
for your device. On an embedded system that may just be a simple shell script.
As far as timing goes, if your device is created early in boot then udev and the kernel will handle replaying the creation event once udev is up and running. This happens via udev scanning /sys
and writing "add"
to the uevent
file of each device. That tells the kernel to send the creation event, which udev receives via netlink (or it could use uevent_helper
).
Also even without udev your device will appear somewhere in /sys
where you can query its major and minor number and create the device node manually.
Upvotes: 3