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