device-manager.rst 2.4 KB

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