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