aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/tar2sqfs.18
-rw-r--r--tar/tar2sqfs.c24
2 files changed, 29 insertions, 3 deletions
diff --git a/doc/tar2sqfs.1 b/doc/tar2sqfs.1
index 39e62f4..61c6b47 100644
--- a/doc/tar2sqfs.1
+++ b/doc/tar2sqfs.1
@@ -23,6 +23,14 @@ and the default selection.
A comma seperated list of extra options for the selected compressor. Specify
\fBhelp\fR to get a list of available options.
.TP
+\fB\-\-block\-size\fR, \fB\-b\fR <size>
+Block size to use for Squashfs image.
+Defaults to 131072.
+.TP
+\fB\-\-dev\-block\-size\fR, \fB\-B\fR <size>
+Device block size to padd the image to.
+Defaults to 4096.
+.TP
\fB\-\-defaults\fR, \fB\-d\fR <options>
A comma seperated list of default values for
implicitly created directories.
diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c
index 8592fcb..8c55ea3 100644
--- a/tar/tar2sqfs.c
+++ b/tar/tar2sqfs.c
@@ -20,15 +20,17 @@
static struct option long_opts[] = {
{ "compressor", required_argument, NULL, 'c' },
- { "comp-extra", required_argument, NULL, 'X' },
+ { "block-size", required_argument, NULL, 'b' },
+ { "dev-block-size", required_argument, NULL, 'B' },
{ "defaults", required_argument, NULL, 'd' },
+ { "comp-extra", required_argument, NULL, 'X' },
{ "force", no_argument, NULL, 'f' },
{ "quiet", no_argument, NULL, 'q' },
{ "help", no_argument, NULL, 'h' },
{ "version", no_argument, NULL, 'V' },
};
-static const char *short_opts = "c:X:d:fqhV";
+static const char *short_opts = "c:b:B:d:X:fqhV";
static const char *usagestr =
"Usage: tar2sqfs [OPTIONS...] <sqfsfile>\n"
@@ -43,6 +45,10 @@ static const char *usagestr =
" --comp-extra, -X <options> A comma seperated list of extra options for\n"
" the selected compressor. Specify 'help' to\n"
" get a list of available options.\n"
+" --block-size, -b <size> Block size to use for Squashfs image.\n"
+" Defaults to %u.\n"
+" --dev-block-size, -B <size> Device block size to padd the image to.\n"
+" Defaults to %u.\n"
" --defaults, -d <options> A comma seperated list of default values for\n"
" implicitly created directories.\n"
"\n"
@@ -86,6 +92,17 @@ static void process_args(int argc, char **argv)
break;
switch (i) {
+ case 'b':
+ block_size = strtol(optarg, NULL, 0);
+ break;
+ case 'B':
+ devblksize = strtol(optarg, NULL, 0);
+ if (devblksize < 1024) {
+ fputs("Device block size must be at "
+ "least 1024\n", stderr);
+ exit(EXIT_FAILURE);
+ }
+ break;
case 'c':
have_compressor = true;
@@ -114,7 +131,8 @@ static void process_args(int argc, char **argv)
quiet = true;
break;
case 'h':
- fputs(usagestr, stdout);
+ printf(help_string, SQFS_DEFAULT_BLOCK_SIZE,
+ SQFS_DEVBLK_SIZE);
compressor_print_available();
exit(EXIT_SUCCESS);
case 'V':