makedev-syntax.txt 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // -*- mode:doc; -*-
  2. // vim: set syntax=asciidoc:
  3. [[makedev-syntax]]
  4. == Makedev syntax documentation
  5. The makedev syntax is used in several places in Buildroot to
  6. define changes to be made for permissions, or which device files to
  7. create and how to create them, in order to avoid calls to mknod.
  8. This syntax is derived from the makedev utility, and more complete
  9. documentation can be found in the +package/makedevs/README+ file.
  10. It takes the form of a space separated list of fields, one file per
  11. line; the fields are:
  12. |===========================================================
  13. |name |type |mode |uid |gid |major |minor |start |inc |count
  14. |===========================================================
  15. There are a few non-trivial blocks:
  16. - +name+ is the path to the file you want to create/modify
  17. - +type+ is the type of the file, being one of:
  18. * f: a regular file
  19. * d: a directory
  20. * r: a directory recursively
  21. * c: a character device file
  22. * b: a block device file
  23. * p: a named pipe
  24. - +mode+ are the usual permissions settings (only numerical values
  25. are allowed)
  26. - +uid+ and +gid+ are the UID and GID to set on this file; can be
  27. either numerical values or actual names
  28. - +major+ and +minor+ are here for device files, set to +-+ for other
  29. files
  30. - +start+, +inc+ and +count+ are for when you want to create a batch
  31. of files, and can be reduced to a loop, beginning at +start+,
  32. incrementing its counter by +inc+ until it reaches +count+
  33. Let's say you want to change the permissions of a given file; using
  34. this syntax, you will need to write:
  35. ----
  36. /usr/bin/foo f 755 0 0 - - - - -
  37. /usr/bin/bar f 755 root root - - - - -
  38. /data/buz f buz-user buz-group - - - - -
  39. ----
  40. Alternatively, if you want to change owner/permission of a directory
  41. recursively, you can write (to set UID to foo, GID to bar and access
  42. rights to rwxr-x--- for the directory /usr/share/myapp and all files
  43. and directories below it):
  44. ----
  45. /usr/share/myapp r 750 foo bar - - - - -
  46. ----
  47. On the other hand, if you want to create the device file +/dev/hda+
  48. and the corresponding 15 files for the partitions, you will need for
  49. +/dev/hda+:
  50. ----
  51. /dev/hda b 640 root root 3 0 0 0 -
  52. ----
  53. and then for device files corresponding to the partitions of
  54. +/dev/hda+, +/dev/hdaX+, +X+ ranging from 1 to 15:
  55. ----
  56. /dev/hda b 640 root root 3 1 1 1 15
  57. ----