aboutsummaryrefslogtreecommitdiff
path: root/cmd/sqfs.c
diff options
context:
space:
mode:
authorJoao Marcos Costa <joaomarcos.costa@bootlin.com>2020-07-30 15:33:48 +0200
committerTom Rini <trini@konsulko.com>2020-08-07 22:31:32 -0400
commitbba604b65e58f8e540ee60b57b9f9c78dcc83f04 (patch)
tree7267e88915a81a8d30ab11b18c965262f1f9b7f4 /cmd/sqfs.c
parentc51006130370b48b7eb5a93ada745385aa27f6bf (diff)
downloadu-boot-bba604b65e58f8e540ee60b57b9f9c78dcc83f04.zip
u-boot-bba604b65e58f8e540ee60b57b9f9c78dcc83f04.tar.gz
u-boot-bba604b65e58f8e540ee60b57b9f9c78dcc83f04.tar.bz2
fs/squashfs: add filesystem commands
Add 'ls' and 'load' commands. Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
Diffstat (limited to 'cmd/sqfs.c')
-rw-r--r--cmd/sqfs.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/cmd/sqfs.c b/cmd/sqfs.c
new file mode 100644
index 0000000..107038c
--- /dev/null
+++ b/cmd/sqfs.c
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2020 Bootlin
+ *
+ * Author: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
+ *
+ * squashfs.c: implements SquashFS related commands
+ */
+
+#include <command.h>
+#include <fs.h>
+#include <squashfs.h>
+
+static int do_sqfs_ls(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SQUASHFS);
+}
+
+U_BOOT_CMD(sqfsls, 4, 1, do_sqfs_ls,
+ "List files in directory. Default: root (/).",
+ "<interface> [<dev[:part]>] [directory]\n"
+ " - list files from 'dev' on 'interface' in 'directory'\n"
+);
+
+static int do_sqfs_load(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
+{
+ return do_load(cmdtp, flag, argc, argv, FS_TYPE_SQUASHFS);
+}
+
+U_BOOT_CMD(sqfsload, 7, 0, do_sqfs_load,
+ "load binary file from a SquashFS filesystem",
+ "<interface> [<dev[:part]> [<addr> [<filename> [bytes [pos]]]]]\n"
+ " - Load binary file 'filename' from 'dev' on 'interface'\n"
+ " to address 'addr' from SquashFS filesystem.\n"
+ " 'pos' gives the file position to start loading from.\n"
+ " If 'pos' is omitted, 0 is used. 'pos' requires 'bytes'.\n"
+ " 'bytes' gives the size to load. If 'bytes' is 0 or omitted,\n"
+ " the load stops on end of file.\n"
+ " If either 'pos' or 'bytes' are not aligned to\n"
+ " ARCH_DMA_MINALIGN then a misaligned buffer warning will\n"
+ " be printed and performance will suffer for the load."
+);