udev is responsible for populating /dev. It adds and removes device nodes to /dev dynamically based on rules/configs/scripts under /lib/udev and /etc/udev/.
If I have a CDROM device node /dev/sr0 I can add a symlink /dev/cdrom by adding a rule like:
SUBSYSTEM=="block", KERNEL=="sr0", SYMLINK+="cdrom", GROUP="cdrom"
I understand how symlinks are created in udev. But who (or "which rule") created /dev/sr0 (or another non symlink device node) in the first place?
Best Answer
The default device, based on the kernel name (
sr0
in this case) is always created automatically as a real device file, so no rule is needed for that.Additional synonyms are then created by writing rules which specify symlinks to be added which point at the real file.