device-manager.rst 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. .. _device-manager:
  3. Selecting a Device Manager
  4. **************************
  5. The Yocto Project provides multiple ways to manage the device manager
  6. (``/dev``):
  7. - Persistent and Pre-Populated ``/dev``: For this case, the ``/dev``
  8. directory is persistent and the required device nodes are created
  9. during the build.
  10. - Use ``devtmpfs`` with a Device Manager: For this case, the ``/dev``
  11. directory is provided by the kernel as an in-memory file system and
  12. is automatically populated by the kernel at runtime. Additional
  13. configuration of device nodes is done in user space by a device
  14. manager like ``udev`` or ``busybox-mdev``.
  15. Using Persistent and Pre-Populated ``/dev``
  16. ===========================================
  17. To use the static method for device population, you need to set the
  18. :term:`USE_DEVFS` variable to "0"
  19. as follows::
  20. USE_DEVFS = "0"
  21. The content of the resulting ``/dev`` directory is defined in a Device
  22. Table file. The
  23. :term:`IMAGE_DEVICE_TABLES`
  24. variable defines the Device Table to use and should be set in the
  25. machine or distro configuration file. Alternatively, you can set this
  26. variable in your ``local.conf`` configuration file.
  27. If you do not define the :term:`IMAGE_DEVICE_TABLES` variable, the default
  28. ``device_table-minimal.txt`` is used::
  29. IMAGE_DEVICE_TABLES = "device_table-mymachine.txt"
  30. The population is handled by the ``makedevs`` utility during image
  31. creation:
  32. Using ``devtmpfs`` and a Device Manager
  33. =======================================
  34. To use the dynamic method for device population, you need to use (or be
  35. sure to set) the :term:`USE_DEVFS`
  36. variable to "1", which is the default::
  37. USE_DEVFS = "1"
  38. With this
  39. setting, the resulting ``/dev`` directory is populated by the kernel
  40. using ``devtmpfs``. Make sure the corresponding kernel configuration
  41. variable ``CONFIG_DEVTMPFS`` is set when building you build a Linux
  42. kernel.
  43. All devices created by ``devtmpfs`` will be owned by ``root`` and have
  44. permissions ``0600``.
  45. To have more control over the device nodes, you can use a device manager like
  46. ``udev`` or ``busybox-mdev``. You choose the device manager by defining the
  47. :term:`VIRTUAL-RUNTIME_dev_manager <VIRTUAL-RUNTIME>` variable in your machine
  48. or distro configuration file. Alternatively, you can set this variable in
  49. your ``local.conf`` configuration file::
  50. VIRTUAL-RUNTIME_dev_manager = "udev"
  51. # Some alternative values
  52. # VIRTUAL-RUNTIME_dev_manager = "busybox-mdev"
  53. # VIRTUAL-RUNTIME_dev_manager = "systemd"