283119d574b9e65511b65fb1981efda43e1394bb
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / build / docs / manual / makedev-syntax.txt
1 // -*- mode:doc; -*-
2 // vim: set syntax=asciidoc:
3
4 [[makedev-syntax]]
5 == Makedev syntax documentation
6
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.
10
11 This syntax is derived from the makedev utility, and more complete
12 documentation can be found in the +package/makedevs/README+ file.
13
14 It takes the form of a space separated list of fields, one file per
15 line; the fields are:
16
17 |===========================================================
18 |name |type |mode |uid |gid |major |minor |start |inc |count
19 |===========================================================
20
21 There are a few non-trivial blocks:
22
23 - +name+ is the path to the file you want to create/modify
24 - +type+ is the type of the file, being one of:
25   * f: a regular file
26   * d: a directory
27   * r: a directory recursively
28   * c: a character device file
29   * b: a block device file
30   * p: a named pipe
31 - +mode+, +uid+ and +gid+ are the usual permissions settings
32 - +major+ and +minor+ are here for device files - set to - for other
33   files
34 - +start+, +inc+ and +count+ are for when you want to create a batch
35   of files, and can be reduced to a loop, beginning at +start+,
36   incrementing its counter by +inc+ until it reaches +count+
37
38 Let's say you want to change the permissions of a given file; using
39 this syntax, you will need to put:
40
41 ----
42 /usr/bin/foobar f 644 0 0 - - - - -
43 ----
44
45 Alternatively, if you want to change owner/permission of a directory
46 recursively, you can put:
47
48 ----
49 /usr/share/myapp r 750 myuser myuser - - - - -
50 ----
51
52 On the other hand, if you want to create the device file +/dev/hda+
53 and the corresponding 15 files for the partitions, you will need for
54 +/dev/hda+:
55
56 ----
57 /dev/hda b 640 0 0 3 0 0 0 -
58 ----
59
60 and then for device files corresponding to the partitions of
61 +/dev/hda+, +/dev/hdaX+, +X+ ranging from 1 to 15:
62
63 ----
64 /dev/hda b 640 0 0 3 1 1 1 15
65 ----
66