xref: /OK3568_Linux_fs/buildroot/docs/manual/customize-device-permission-tables.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun// -*- mode:doc; -*-
2*4882a593Smuzhiyun// vim: set syntax=asciidoc:
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun[[customize-device-permission]]
5*4882a593Smuzhiyun==== Setting file permissions and ownership and adding custom devices nodes
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunSometimes it is needed to set specific permissions or ownership on files
8*4882a593Smuzhiyunor device nodes. For example, certain files may need to be owned by
9*4882a593Smuzhiyunroot. Since the post-build scripts are not run as root, you cannot do
10*4882a593Smuzhiyunsuch changes from there unless you use an explicit fakeroot from the
11*4882a593Smuzhiyunpost-build script.
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunInstead, Buildroot provides support for so-called _permission tables_.
14*4882a593SmuzhiyunTo use this feature, set config option +BR2_ROOTFS_DEVICE_TABLE+ to a
15*4882a593Smuzhiyunspace-separated list of permission tables, regular text files following
16*4882a593Smuzhiyunthe xref:makedev-syntax[makedev syntax].
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunIf you are using a static device table (i.e. not using +devtmpfs+,
19*4882a593Smuzhiyun+mdev+, or +(e)udev+) then you can add device nodes using the same
20*4882a593Smuzhiyunsyntax, in so-called _device tables_. To use this feature, set config
21*4882a593Smuzhiyunoption +BR2_ROOTFS_STATIC_DEVICE_TABLE+ to a space-separated list of
22*4882a593Smuzhiyundevice tables.
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunAs shown in xref:customize-dir-structure[], the recommended location for
25*4882a593Smuzhiyunsuch files is +board/<company>/<boardname>/+.
26*4882a593Smuzhiyun
27*4882a593SmuzhiyunIt should be noted that if the specific permissions or device nodes are
28*4882a593Smuzhiyunrelated to a specific application, you should set variables
29*4882a593Smuzhiyun+FOO_PERMISSIONS+ and +FOO_DEVICES+ in the package's +.mk+ file instead
30*4882a593Smuzhiyun(see xref:generic-package-reference[]).
31