logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

gensquashfs.1 (9035B)


  1. .TH GENSQUASHFS "1" "March 2021" "generate squashfs images" "User Commands"
  2. .SH NAME
  3. gensquashfs \- generate squashfs images
  4. .SH SYNOPSIS
  5. .B gensquashfs
  6. [\fI\,OPTIONS\/\fR] <squashfs-file>\/\fR
  7. .SH DESCRIPTION
  8. Generate a SquashFS image.
  9. .SH OPTIONS
  10. .TP
  11. \fB\-\-pack\-file\fR, \fB\-F\fR <file>
  12. Use a \fBgen_init_cpio\fR style description file. The file format is specified
  13. below. If \fB\-\-pack\-dir\fR is used, input file paths are relative to the
  14. pack directory, otherwise they are relative to the directory the pack file
  15. is in.
  16. .TP
  17. \fB\-\-pack\-dir\fR, \fB\-D\fR <directory>
  18. If \fB\-\-pack\-file\fR is used, this is the root path relative to which to
  19. read files. If no pack file is specified, pack the contents of the given
  20. directory into a SquashFS image. The directory becomes the root of the file
  21. system.
  22. .TP
  23. \fB\-\-compressor\fR, \fB\-c\fR <name>
  24. Select the compressor to use.
  25. Run \fBgensquashfs \-\-help\fR to get a list of all available compressors
  26. and the default selection.
  27. .TP
  28. \fB\-\-comp\-extra\fR, \fB\-X\fR <options>
  29. A comma separated list of extra options for the selected compressor. Specify
  30. \fBhelp\fR to get a list of available options.
  31. .TP
  32. \fB\-\-num\-jobs\fR, \fB\-j\fR <count>
  33. If libsquashfs was compiled with a built in thread pool based, parallel data
  34. compressor, this option can be used to set the number of compressor
  35. threads. If not set, the default is the number of available CPU cores.
  36. .TP
  37. \fB\-\-queue\-backlog\fR, \fB\-Q\fR <count>
  38. Maximum number of data blocks in the thread worker queue before the packer
  39. starts waiting for the block processors to catch up. Higher values result
  40. in higher memory consumption. Defaults to 10 times the number of workers.
  41. .TP
  42. \fB\-\-block\-size\fR, \fB\-b\fR <size>
  43. Block size to use for Squashfs image.
  44. Defaults to 131072.
  45. .TP
  46. \fB\-\-dev\-block\-size\fR, \fB\-B\fR <size>
  47. Device block size to padd the image to.
  48. Defaults to 4096.
  49. .TP
  50. \fB\-\-keep\-time\fR, \fB\-k\fR
  51. When using \fB\-\-pack\-dir\fR only, use the timestamps from the input files
  52. instead of setting defaults on all input paths. The root inode and the
  53. modification time on the SquashFS image itself will still be set to defaults.
  54. .TP
  55. \fB\-\-one\-file\-system\fR, \fB\-o\fR
  56. When using \fB\-\-pack\-dir\fR only, stay in the local filesystem and do not
  57. cross mount points.
  58. .TP
  59. \fB\-\-defaults\fR, \fB\-d\fR <options>
  60. A comma separated list of default values for
  61. implicitly created directories.
  62. The following values can be set:
  63. .TS
  64. tab(;) allbox;
  65. l l
  66. l l
  67. l l
  68. l l
  69. l l
  70. rd.
  71. \fBOption\fR;\fBDefault\fR
  72. uid=<value>;0
  73. gid=<value>;0
  74. mode=<value>;0755
  75. mtime=<value>;\fB$SOURCE\_DATE\_EPOCH\fR if set, 0 otherwise
  76. .TE
  77. .TP
  78. .TP
  79. \fB\-\-set\-uid\fR, \fB\-u\fR <number>
  80. Force the owners user ID for ALL inodes to this value, no matter what the pack
  81. file or directory entries actually specify.
  82. .TP
  83. \fB\-\-set\-gid\fR, \fB\-g\fR <number>
  84. Force the owners group ID for ALL inodes to this value, no matter what the pack
  85. file or directory entries actually specify.
  86. .TP
  87. \fB\-\-all\-root\fR
  88. A short hand for `\-\-set\-uid 0 \-\-set\-gid 0`.
  89. .TP
  90. \fB\-\-selinux\fR, \fB\-s\fR <file>
  91. If built with SELinux support, use the given SELinux label file to add context
  92. labels to the elements packed into the SquashFS image.
  93. .TP
  94. \fB\-\-exportable\fR, \fB\-e\fR
  95. Generate an export table for NFS support.
  96. .TP
  97. \fB\-\-no\-tail\-packing\fR, \fB\-T\fR
  98. Do not perform tail end packing on files that are larger than the specified
  99. block size.
  100. .TP
  101. \fB\-\-force\fR, \fB\-f\fR
  102. Overwrite the output file if it exists.
  103. .TP
  104. \fB\-\-quiet\fR, \fB\-q\fR
  105. Do not print out progress reports.
  106. .TP
  107. \fB\-\-help\fR, \fB\-h\fR
  108. Print help text and exit.
  109. .TP
  110. \fB\-\-version\fR, \fB\-V\fR
  111. Print version information and exit.
  112. .SH INPUT FILE FORMAT
  113. The input file contains a simple, newline separated list that describe the
  114. files to be included in the squashfs image:
  115. .PP
  116. .in +4n
  117. .nf
  118. # a comment
  119. file <path> <mode> <uid> <gid> [<location>]
  120. dir <path> <mode> <uid> <gid>
  121. nod <path> <mode> <uid> <gid> <dev_type> <maj> <min>
  122. slink <path> <mode> <uid> <gid> <target>
  123. link <path> <dummy> <dummy> <dummy> <target>
  124. pipe <path> <mode> <uid> <gid>
  125. sock <path> <mode> <uid> <gid>
  126. glob <path> <mode|*> <uid|*> <gid|*> [OPTIONS...] <location>
  127. .fi
  128. .in
  129. .TS
  130. tab(;) allbox;
  131. l l
  132. l l
  133. l l
  134. l l
  135. l l
  136. l l
  137. l l
  138. l l
  139. l l
  140. rd.
  141. <path>;T{
  142. Absolute path of the entry in the image. Can be put in quotes
  143. if some components contain spaces.
  144. T}
  145. <location>;T{
  146. Optional location of the input file. Can be specified relative to either the
  147. description file or the pack directory. If omitted, the image path is used
  148. as a relative path.
  149. T}
  150. <target>;Symlink or hardlink target.
  151. <mode>;Mode/permissions of the entry.
  152. <uid>;Numeric user id.
  153. <gid>;Numeric group id.
  154. <dev_type>;Device type (b=block, c=character).
  155. <maj>;Major number of a device special file.
  156. <min>;Minor number of a device special file.
  157. .TE
  158. .SS File Globbing
  159. The \fBglob\fR command requires an \fIinput location\fR which is interpreted
  160. relative to the pack directory (or the input file if no directory was
  161. specified). This location is scanned recursively and the contents are added
  162. to the specified virtual path.
  163. The specified \fImode\fR, \fIuid\fR and \fIgid\fR are applied to all new
  164. entries added by the glob. They can alternatively be set to the special
  165. value \fB*\fR to use the value from the input directory.
  166. In front of the source location, several additional options can be specified to
  167. control the behavior of the glob command:
  168. .TS
  169. tab(;) allbox;
  170. l l
  171. l l
  172. l l
  173. l l
  174. l l
  175. l l
  176. l l
  177. l l
  178. rd.
  179. \fBOption\fR;\fBDescription\fR
  180. \-type;T{
  181. Followed by a single space and a single, lowercase character describing
  182. the inode type to accept. Works similar to the \fB\-type\fR option of the
  183. \fBfind\fR command.
  184. Possible values are \fBb\fR (block devices), \fBc\fR (character devices),
  185. \fBd\fR (directories), \fBp\fR (named pipes), \fBf\fR (regular files),
  186. \fBl\fR (symlinks) and \fBs\fR (sockets).
  187. If \fB\-type\fR is not used, all are accepted. The first use clamps the
  188. selection down to a single type and subsequent uses allow additional
  189. types.
  190. T}
  191. \-xdev;Do not cross mount points during a recursive glob.
  192. \-mount;An alias for \fB\-xdev\fR
  193. \-keeptime;Use the time stamps from the scanned files.
  194. \-nonrecursive;T{
  195. Do not descend into directories.
  196. Even if the type argument does not include directories, it is still possible to
  197. recursively scan a hierarchy. In that case, the scanning will not add \fInew\fR
  198. directory nodes, but still recurse into a directory if a coresponding node
  199. already exist in the virtual filesystem tree.
  200. So a typicall use case might be to first scan only the
  201. directories, and then do several narrower globs to fill them.
  202. T}
  203. \-name <pattern>;T{
  204. Only add entries if their name matches a shell glob pattern.
  205. If the pattern is supposed to contain spaces, it can be wrapped in
  206. quotation marks ("..." or '...').
  207. T}
  208. \-path <pattern>;T{
  209. Only add entries if their full resulting path in the SquashFS image
  210. matches a shell glob pattern. Slashes in the path are only matched
  211. against slashes in the pattern and will never match a wild card
  212. character or a bracket expression containing a slash.
  213. The path is normalized, so it won't have a leading or trailing slash.
  214. T}
  215. .TE
  216. .PP
  217. Any other, unknown string starting with \- will be rejected as unknown option.
  218. If the input path starts with \-, the sequence \-\- can be used to stop
  219. argument parsing, similar to many command line tools.
  220. .SS Example
  221. .PP
  222. .nf
  223. # A simple squashfs image
  224. dir /dev 0755 0 0
  225. nod /dev/console 0600 0 0 c 5 1
  226. dir /root 0700 0 0
  227. dir /sbin 0755 0 0
  228. # Add a file. Input is relative to pack dir or listing path
  229. file /sbin/init 0755 0 0 ../init/sbin/init
  230. # Read from ./bin/bash relative to pack dir or listing path
  231. # /bin is created implicitly with default attributes.
  232. file /bin/bash 0755 0 0
  233. # file name with a space in it and a "special" name
  234. file "/opt/my app/\\"special\\"/data" 0600 0 0
  235. # collect the contents of ./lib and put it under /usr/lib
  236. # mode and uid/gid are explictly set. First we collect the directory tree,
  237. # then all so files, then all symlinks that don't end in ".so"
  238. glob /usr/lib 0755 0 0 -type d ./lib
  239. glob /usr/lib 0755 0 0 -type f -name "*.so.*" ./lib
  240. glob /usr/lib 0777 0 0 -type l -name "*.so.*" ./lib
  241. .fi
  242. .SH ENVIRONMENT
  243. If the command line switch \fB\-\-defaults\fR is not used or no default mtime
  244. is specified, the value of the environment variable \fBSOURCE\_DATE\_EPOCH\fR
  245. is used for all file and filesystem timestamps.
  246. If \fBSOURCE\_DATE\_EPOCH\fR is not set, not a parsable number or it is out of
  247. range, the timestamps default to 0.
  248. Environment variables are only used if no explicit command line switches
  249. are set. Explicit command line switches are always preferred over the
  250. environment variables.
  251. .SH SEE ALSO
  252. rdsquashfs(1), tar2sqfs(1)
  253. .SH AUTHOR
  254. Written by David Oberhollenzer.
  255. .SH COPYRIGHT
  256. Copyright \(co 2019 David Oberhollenzer
  257. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
  258. .br
  259. This is free software: you are free to change and redistribute it.
  260. There is NO WARRANTY, to the extent permitted by law.