summaryrefslogtreecommitdiffstats
path: root/commands/ubi.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-03-01 11:52:26 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2013-07-23 16:32:18 +0200
commit675ef4770f1c896b8a24e89699b501c90f1847d9 (patch)
treebe6a8ab0aed42c427047282cb1e646866eb40546 /commands/ubi.c
parentf483f66e6d65e1898a4ecbd7c69a797673608779 (diff)
downloadbarebox-675ef4770f1c896b8a24e89699b501c90f1847d9.tar.gz
barebox-675ef4770f1c896b8a24e89699b501c90f1847d9.tar.xz
UBI: Add ubidetach command
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/ubi.c')
-rw-r--r--commands/ubi.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/commands/ubi.c b/commands/ubi.c
index 73483948b7..854ea83258 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -92,6 +92,32 @@ BAREBOX_CMD_START(ubiattach)
BAREBOX_CMD_HELP(cmd_ubiattach_help)
BAREBOX_CMD_END
+static int do_ubidetach(int argc, char *argv[])
+{
+ int ubi_num, ret;
+
+ if (argc != 2)
+ return COMMAND_ERROR_USAGE;
+
+ ubi_num = simple_strtoul(argv[1], NULL, 0);
+ ret = ubi_detach_mtd_dev(ubi_num, 1);
+
+ if (ret)
+ printf("failed to detach: %s\n", strerror(-ret));
+
+ return ret;
+}
+
+static const __maybe_unused char cmd_ubidetach_help[] =
+"Usage: ubidetach <ubinum>\n"
+"Detach <ubinum> from ubi\n";
+
+BAREBOX_CMD_START(ubidetach)
+ .cmd = do_ubidetach,
+ .usage = "detach an ubi dev",
+ BAREBOX_CMD_HELP(cmd_ubidetach_help)
+BAREBOX_CMD_END
+
static int do_ubirmvol(int argc, char *argv[])
{
struct ubi_mkvol_req req;