summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2016-09-27 10:47:37 -0400
committerTom Rini <trini@konsulko.com>2016-09-27 10:47:37 -0400
commite120c848bac77cfcc88183541c2e966e625a7840 (patch)
tree240d57bd7de234742908be8efbd951140c77e43c /cmd
parent6828e602b722d1137d17ca0d25a451c7743c2770 (diff)
parent0061242236e4dbef97e3fbfd8a18e626c2b70726 (diff)
Merge branch 'master' of git://git.denx.de/u-boot-ubi
Diffstat (limited to 'cmd')
-rw-r--r--cmd/ubi.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/ubi.c b/cmd/ubi.c
index b726f3f3bb..7d0d7e7a80 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -162,7 +162,7 @@ bad:
return err;
}
-static int ubi_create_vol(char *volume, int64_t size, int dynamic)
+static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id)
{
struct ubi_mkvol_req req;
int err;
@@ -172,7 +172,7 @@ static int ubi_create_vol(char *volume, int64_t size, int dynamic)
else
req.vol_type = UBI_STATIC_VOLUME;
- req.vol_id = UBI_VOL_NUM_AUTO;
+ req.vol_id = vol_id;
req.alignment = 1;
req.bytes = size;
@@ -577,10 +577,17 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (strncmp(argv[1], "create", 6) == 0) {
int dynamic = 1; /* default: dynamic volume */
+ int id = UBI_VOL_NUM_AUTO;
/* Use maximum available size */
size = 0;
+ /* E.g., create volume size type vol_id */
+ if (argc == 6) {
+ id = simple_strtoull(argv[5], NULL, 16);
+ argc--;
+ }
+
/* E.g., create volume size type */
if (argc == 5) {
if (strncmp(argv[4], "s", 1) == 0)
@@ -603,7 +610,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
/* E.g., create volume */
if (argc == 3)
- return ubi_create_vol(argv[2], size, dynamic);
+ return ubi_create_vol(argv[2], size, dynamic, id);
}
if (strncmp(argv[1], "remove", 6) == 0) {
@@ -684,7 +691,7 @@ U_BOOT_CMD(
" - Display volume and ubi layout information\n"
"ubi check volumename"
" - check if volumename exists\n"
- "ubi create[vol] volume [size] [type]"
+ "ubi create[vol] volume [size] [type] [id]"
" - create volume name with size\n"
"ubi write[vol] address volume size"
" - Write volume from address with size\n"