From: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 2/5] fs/squashfs: add filesystem commands
Date: Tue, 21 Jul 2020 11:22:56 +0200 [thread overview]
Message-ID: <20200721092259.26916-3-joaomarcos.costa@bootlin.com> (raw)
In-Reply-To: <20200721092259.26916-1-joaomarcos.costa@bootlin.com>
Add 'ls' and 'load' commands.
Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
---
Changes in v3:
- No changes since v2.
Changes in v2:
- Add info. to MAINTAINERS
- Add 'static' keyword to do_sqfs_*(). These functions' prototypes
are no longer needed in include/fs.h.
- Change commit message.
MAINTAINERS | 1 +
cmd/Kconfig | 6 ++++++
cmd/Makefile | 1 +
cmd/sqfs.c | 42 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 50 insertions(+)
create mode 100644 cmd/sqfs.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 198fe2b89e..9a5f330148 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -949,6 +949,7 @@ M: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
S: Maintained
F: fs/squashfs/
F: include/sqfs.h
+F: cmd/sqfs.c
TDA19988 HDMI ENCODER
M: Liviu Dudau <liviu.dudau@foss.arm.com>
diff --git a/cmd/Kconfig b/cmd/Kconfig
index bfe6c163dc..c8f3d34b88 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -2059,6 +2059,12 @@ config CMD_FAT
help
Support for the FAT fs
+config CMD_SQUASHFS
+ bool "SquashFS command support"
+ select FS_SQUASHFS
+ help
+ Enables SquashFS filesystem commands (e.g. load, ls).
+
config CMD_FS_GENERIC
bool "filesystem commands"
help
diff --git a/cmd/Makefile b/cmd/Makefile
index 7952138dc2..ef2da1c928 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -62,6 +62,7 @@ obj-$(CONFIG_CMD_EXT4) += ext4.o
obj-$(CONFIG_CMD_EXT2) += ext2.o
obj-$(CONFIG_CMD_FAT) += fat.o
obj-$(CONFIG_CMD_FDT) += fdt.o
+obj-$(CONFIG_CMD_SQUASHFS) += sqfs.o
obj-$(CONFIG_CMD_FLASH) += flash.o
obj-$(CONFIG_CMD_FPGA) += fpga.o
obj-$(CONFIG_CMD_FPGAD) += fpgad.o
diff --git a/cmd/sqfs.c b/cmd/sqfs.c
new file mode 100644
index 0000000000..107038c4cf
--- /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."
+);
--
2.17.1
next prev parent reply other threads:[~2020-07-21 9:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 9:22 [PATCH v3 0/5] Add support for the SquashFS filesystem Joao Marcos Costa
2020-07-21 9:22 ` [PATCH v3 1/5] fs/squashfs: new filesystem Joao Marcos Costa
2020-07-21 9:22 ` Joao Marcos Costa [this message]
2020-07-21 9:22 ` [PATCH v3 3/5] include/u-boot, lib/zlib: add sources for zlib decompression Joao Marcos Costa
2020-07-29 15:27 ` Tom Rini
2020-07-29 16:00 ` Joao Marcos Costa
2020-07-29 16:54 ` Tom Rini
2020-07-30 12:10 ` Joao Marcos Costa
2020-07-30 12:17 ` Tom Rini
2020-07-30 13:27 ` Joao Marcos Costa
2020-07-21 9:22 ` [PATCH v3 4/5] fs/squashfs: add support " Joao Marcos Costa
2020-07-21 9:22 ` [PATCH v3 5/5] fs/fs.c: add symbolic link case to fs_ls_generic() Joao Marcos Costa
2020-07-29 12:54 ` [PATCH v3 0/5] Add support for the SquashFS filesystem Joao Marcos Costa
2020-07-29 15:21 ` Tom Rini
2020-07-29 16:02 ` Joao Marcos Costa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200721092259.26916-3-joaomarcos.costa@bootlin.com \
--to=joaomarcos.costa@bootlin.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.