2 // vim: set syntax=asciidoc:
5 == Makedev syntax documentation
7 The makedev syntax is used in several places in Buildroot to
8 define changes to be made for permissions, or which device files to
9 create and how to create them, in order to avoid calls to mknod.
11 This syntax is derived from the makedev utility, and more complete
12 documentation can be found in the +package/makedevs/README+ file.
14 It takes the form of a space separated list of fields, one file per
17 |===========================================================
18 |name |type |mode |uid |gid |major |minor |start |inc |count
19 |===========================================================
21 There are a few non-trivial blocks:
23 - +name+ is the path to the file you want to create/modify
24 - +type+ is the type of the file, being one of:
27 * r: a directory recursively
28 * c: a character device file
29 * b: a block device file
31 - +mode+ are the usual permissions settings (only numerical values
33 - +uid+ and +gid+ are the UID and GID to set on this file; can be
34 either numerical values or actual names
35 - +major+ and +minor+ are here for device files, set to +-+ for other
37 - +start+, +inc+ and +count+ are for when you want to create a batch
38 of files, and can be reduced to a loop, beginning at +start+,
39 incrementing its counter by +inc+ until it reaches +count+
41 Let's say you want to change the permissions of a given file; using
42 this syntax, you will need to write:
45 /usr/bin/foo f 755 0 0 - - - - -
46 /usr/bin/bar f 755 root root - - - - -
47 /data/buz f 644 buz-user buz-group - - - - -
50 Alternatively, if you want to change owner/permission of a directory
51 recursively, you can write (to set UID to foo, GID to bar and access
52 rights to rwxr-x--- for the directory /usr/share/myapp and all files
53 and directories below it):
56 /usr/share/myapp r 750 foo bar - - - - -
59 On the other hand, if you want to create the device file +/dev/hda+
60 and the corresponding 15 files for the partitions, you will need for
64 /dev/hda b 640 root root 3 0 0 0 -
67 and then for device files corresponding to the partitions of
68 +/dev/hda+, +/dev/hdaX+, +X+ ranging from 1 to 15:
71 /dev/hda b 640 root root 3 1 1 1 15
74 Extended attributes are supported if
75 +BR2_ROOTFS_DEVICE_TABLE_SUPPORTS_EXTENDED_ATTRIBUTES+ is enabled.
76 This is done by adding a line starting with +|xattr+ after
77 the line describing the file. Right now, only capability
78 is supported as extended attribute.
80 |=====================
81 | \|xattr | capability
82 |=====================
84 - +|xattr+ is a "flag" that indicate an extended attribute
85 - +capability+ is a capability to add to the previous file
87 If you want to add the capability cap_sys_admin to the binary foo,
91 /usr/bin/foo f 755 root root - - - - -
92 |xattr cap_sys_admin+eip
95 You can add several capabilities to a file by using several +|xattr+ lines.
96 If you want to add the capability cap_sys_admin and cap_net_admin to the
97 binary foo, you will write :
100 /usr/bin/foo f 755 root root - - - - -
101 |xattr cap_sys_admin+eip
102 |xattr cap_net_admin+eip