gensquashfs - generate squashfs images
gensquashfs [OPTIONS] <squashfs-file>
Generate a SquashFS image.
- --pack-file, -F
<file>
- Use a gen_init_cpio style description file. The file format is
specified below. If --pack-dir is used, input file paths are
relative to the pack directory, otherwise they are relative to the
directory the pack file is in.
- --pack-dir,
-D <directory>
- If --pack-file is used, this is the root path relative to which to
read files. If no pack file is specified, pack the contents of the given
directory into a SquashFS image. The directory becomes the root of the
file system.
- --compressor,
-c <name>
- Select the compressor to use. Run gensquashfs --help to get a list
of all available compressors and the default selection.
- --comp-extra, -X
<options>
- A comma separated list of extra options for the selected compressor.
Specify help to get a list of available options.
- --num-jobs, -j
<count>
- If libsquashfs was compiled with a built in thread pool based, parallel
data compressor, this option can be used to set the number of compressor
threads. If not set, the default is the number of available CPU
cores.
- --queue-backlog,
-Q <count>
- Maximum number of data blocks in the thread worker queue before the packer
starts waiting for the block processors to catch up. Higher values result
in higher memory consumption. Defaults to 10 times the number of
workers.
- --block-size,
-b <size>
- Block size to use for Squashfs image. Defaults to 131072.
- --dev-block-size,
-B <size>
- Device block size to padd the image to. Defaults to 4096.
- --keep-time,
-k
- When using --pack-dir only, use the timestamps from the input files
instead of setting defaults on all input paths. The root inode and the
modification time on the SquashFS image itself will still be set to
defaults.
- --one-file-system,
-o
- When using --pack-dir only, stay in the local filesystem and do not
cross mount points.
- --defaults,
-d <options>
- A comma separated list of default values for implicitly created
directories. The following values can be set:
Option |
Default |
uid=<value> |
0 |
gid=<value> |
0 |
mode=<value> |
0755 |
mtime=<value> |
$SOURCE_DATE_EPOCH if set, 0 otherwise |
- --set-uid, -u
<number>
- Force the owners user ID for ALL inodes to this value, no matter what the
pack file or directory entries actually specify.
- --set-gid, -g
<number>
- Force the owners group ID for ALL inodes to this value, no matter what the
pack file or directory entries actually specify.
- --all-root
- A short hand for `--set-uid 0 --set-gid 0`.
- --selinux,
-s <file>
- If built with SELinux support, use the given SELinux label file to add
context labels to the elements packed into the SquashFS image.
- --exportable,
-e
- Generate an export table for NFS support.
- --no-tail-packing,
-T
- Do not perform tail end packing on files that are larger than the
specified block size.
- --force,
-f
- Overwrite the output file if it exists.
- --quiet,
-q
- Do not print out progress reports.
- --help,
-h
- Print help text and exit.
- --version,
-V
- Print version information and exit.
The input file contains a simple, newline separated list that
describe the files to be included in the squashfs image:
# a comment
file <path> <mode> <uid> <gid> [<location>]
dir <path> <mode> <uid> <gid>
nod <path> <mode> <uid> <gid> <dev_type> <maj> <min>
slink <path> <mode> <uid> <gid> <target>
link <path> <dummy> <dummy> <dummy> <target>
pipe <path> <mode> <uid> <gid>
sock <path> <mode> <uid> <gid>
<path> |
Absolute path of the entry in the image. Can be put in quotes if some
components contain spaces. |
<location> |
Optional location of the input file. Can be specified relative to either
the description file or the pack directory. If omitted, the image path is
used as a relative path. |
<target> |
Symlink or hardlink target. |
<mode> |
Mode/permissions of the entry. |
<uid> |
Numeric user id. |
<gid> |
Numeric group id. |
<dev_type> |
Device type (b=block, c=character). |
<maj> |
Major number of a device special file. |
<min> |
Minor number of a device special file. |
Example:
# A simple squashfs image
dir /dev 0755 0 0
nod /dev/console 0600 0 0 c 5 1
dir /root 0700 0 0
dir /sbin 0755 0 0
# Add a file. Input is relative to pack dir or listing path
file /sbin/init 0755 0 0 ../init/sbin/init
# Read from ./bin/bash relative to pack dir or listing path
# /bin is created implicitly with default attributes.
file /bin/bash 0755 0 0
# file name with a space in it and a "special" name
file "/opt/my app/\"special\"/data" 0600 0 0
If the command line switch --defaults is not used or no
default mtime is specified, the value of the environment variable
SOURCE_DATE_EPOCH is used for all file and filesystem timestamps.
If SOURCE_DATE_EPOCH is not set, not a parsable number or
it is out of range, the timestamps default to 0.
Environment variables are only used if no explicit command line
switches are set. Explicit command line switches are always preferred over
the environment variables.
Written by David Oberhollenzer.
Copyright © 2019 David Oberhollenzer License GPLv3+: GNU
GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.