aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/ubiattach.c
diff options
context:
space:
mode:
Diffstat (limited to 'ubi-utils/ubiattach.c')
-rw-r--r--ubi-utils/ubiattach.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/ubi-utils/ubiattach.c b/ubi-utils/ubiattach.c
index 09f85af..e758dab 100644
--- a/ubi-utils/ubiattach.c
+++ b/ubi-utils/ubiattach.c
@@ -42,6 +42,8 @@ struct args {
const char *node;
const char *dev;
int max_beb_per1024;
+ bool disable_fm;
+ bool need_resv_pool;
};
static struct args args = {
@@ -51,6 +53,8 @@ static struct args args = {
.node = NULL,
.dev = NULL,
.max_beb_per1024 = 0,
+ .disable_fm = false,
+ .need_resv_pool = false,
};
static const char doc[] = PROGRAM_NAME " version " VERSION
@@ -67,6 +71,11 @@ static const char optionsstr[] =
"-b, --max-beb-per1024 maximum expected bad block number per 1024 eraseblock.\n"
" The default value is correct for most NAND devices.\n"
" Allowed range is 0-768, 0 means the default kernel value.\n"
+"-f, --disable-fastmap don't create new fastmap and do full scanning (existed\n"
+" fastmap will be destroyed) for the given ubi device.\n"
+"-r, --reserve-pool Slow down the frequency of updating fastmap by reserving\n"
+" pebs for filling pool/wl_pool, which can prolong flash\n"
+" service life.\n"
"-h, --help print help message\n"
"-V, --version print program version";
@@ -74,7 +83,7 @@ static const char usage[] =
"Usage: " PROGRAM_NAME " [<UBI control device node file name>]\n"
"\t[-m <MTD device number>] [-d <UBI device number>] [-p <path to device>]\n"
"\t[--mtdn=<MTD device number>] [--devn=<UBI device number>]\n"
-"\t[--dev-path=<path to device>]\n"
+"\t[--dev-path=<path to device>] [-f] [--disable-fastmap] [-r] [--reserve-pool]\n"
"\t[--max-beb-per1024=<maximum bad block number per 1024 blocks>]\n"
"UBI control device defaults to " DEFAULT_CTRL_DEV " if not supplied.\n"
"Example 1: " PROGRAM_NAME " -p /dev/mtd0 - attach /dev/mtd0 to UBI\n"
@@ -93,6 +102,8 @@ static const struct option long_options[] = {
{ .name = "mtdn", .has_arg = 1, .flag = NULL, .val = 'm' },
{ .name = "vid-hdr-offset", .has_arg = 1, .flag = NULL, .val = 'O' },
{ .name = "max-beb-per1024", .has_arg = 1, .flag = NULL, .val = 'b' },
+ { .name = "disable-fastmap", .has_arg = 0, .flag = NULL, .val = 'f' },
+ { .name = "reserve-pool", .has_arg = 0, .flag = NULL, .val = 'r' },
{ .name = "help", .has_arg = 0, .flag = NULL, .val = 'h' },
{ .name = "version", .has_arg = 0, .flag = NULL, .val = 'V' },
{ NULL, 0, NULL, 0},
@@ -103,7 +114,7 @@ static int parse_opt(int argc, char * const argv[])
while (1) {
int key, error = 0;
- key = getopt_long(argc, argv, "p:m:d:O:b:hV", long_options, NULL);
+ key = getopt_long(argc, argv, "p:m:d:O:b:frhV", long_options, NULL);
if (key == -1)
break;
@@ -143,6 +154,14 @@ static int parse_opt(int argc, char * const argv[])
break;
+ case 'f':
+ args.disable_fm = true;
+ break;
+
+ case 'r':
+ args.need_resv_pool = true;
+ break;
+
case 'h':
printf("%s\n\n", doc);
printf("%s\n\n", usage);
@@ -213,6 +232,8 @@ int main(int argc, char * const argv[])
req.vid_hdr_offset = args.vidoffs;
req.mtd_dev_node = args.dev;
req.max_beb_per1024 = args.max_beb_per1024;
+ req.disable_fm = args.disable_fm;
+ req.need_resv_pool = args.need_resv_pool;
err = ubi_attach(libubi, args.node, &req);
if (err < 0) {