blob: 0343d19b9c43779e58da850232e817f845d94277 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2
Patrick Williams8e7b46e2023-05-01 14:19:06 -05003.. _device-manager:
4
Andrew Geissler517393d2023-01-13 08:55:19 -06005Selecting a Device Manager
6**************************
7
8The 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
21Using Persistent and Pre-Populated ``/dev``
22===========================================
23
24To use the static method for device population, you need to set the
25:term:`USE_DEVFS` variable to "0"
26as follows::
27
28 USE_DEVFS = "0"
29
30The content of the resulting ``/dev`` directory is defined in a Device
31Table file. The
32:term:`IMAGE_DEVICE_TABLES`
33variable defines the Device Table to use and should be set in the
34machine or distro configuration file. Alternatively, you can set this
35variable in your ``local.conf`` configuration file.
36
37If 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
42The population is handled by the ``makedevs`` utility during image
43creation:
44
45Using ``devtmpfs`` and a Device Manager
46=======================================
47
48To use the dynamic method for device population, you need to use (or be
49sure to set) the :term:`USE_DEVFS`
50variable to "1", which is the default::
51
52 USE_DEVFS = "1"
53
54With this
55setting, the resulting ``/dev`` directory is populated by the kernel
56using ``devtmpfs``. Make sure the corresponding kernel configuration
57variable ``CONFIG_DEVTMPFS`` is set when building you build a Linux
58kernel.
59
60All devices created by ``devtmpfs`` will be owned by ``root`` and have
61permissions ``0600``.
62
63To have more control over the device nodes, you can use a device manager
64like ``udev`` or ``busybox-mdev``. You choose the device manager by
65defining the ``VIRTUAL-RUNTIME_dev_manager`` variable in your machine or
66distro configuration file. Alternatively, you can set this variable in
67your ``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