diff options
Diffstat (limited to 'ubi-utils')
-rw-r--r-- | ubi-utils/Makemodule.am | 4 | ||||
-rw-r--r-- | ubi-utils/mtdinfo.c | 6 | ||||
-rw-r--r-- | ubi-utils/ubiattach.c | 15 | ||||
-rw-r--r-- | ubi-utils/ubinize.c | 4 | ||||
-rw-r--r-- | ubi-utils/ubirsvol.c | 2 |
5 files changed, 20 insertions, 11 deletions
diff --git a/ubi-utils/Makemodule.am b/ubi-utils/Makemodule.am index 7183ec3..66c0238 100644 --- a/ubi-utils/Makemodule.am +++ b/ubi-utils/Makemodule.am @@ -40,16 +40,14 @@ ubirsvol_LDADD = libmtd.a libubi.a ubiblock_SOURCES = ubi-utils/ubiblock.c ubiblock_LDADD = libmtd.a libubi.a -if WITH_GETRANDOM ubihealthd_SOURCES = ubi-utils/ubihealthd.c ubihealthd_LDADD = libmtd.a libubi.a -endif sbin_PROGRAMS += \ ubiupdatevol ubimkvol ubirmvol ubicrc32 ubinfo ubiattach \ ubidetach ubinize ubiformat ubirename mtdinfo ubirsvol ubiblock ubiscan -if WITH_GETRANDOM +if WITH_UBIHEALTHD sbin_PROGRAMS += ubihealthd endif diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c index 7dff0de..61ce7bc 100644 --- a/ubi-utils/mtdinfo.c +++ b/ubi-utils/mtdinfo.c @@ -185,7 +185,7 @@ static void print_ubi_info(const struct mtd_info *mtd_info, static void print_region_map(const struct mtd_dev_info *mtd, int fd, const region_info_t *reginfo) { - unsigned long start; + unsigned long long start; int i, width; int ret_locked, errno_locked, ret_bad, errno_bad; @@ -203,8 +203,8 @@ static void print_region_map(const struct mtd_dev_info *mtd, int fd, ret_locked = ret_bad = errno_locked = errno_bad = 0; for (i = 0; i < reginfo->numblocks; ++i) { - start = reginfo->offset + i * reginfo->erasesize; - printf(" %*i: %08lx ", width, i, start); + start = reginfo->offset + (unsigned long long)i * reginfo->erasesize; + printf(" %*i: %08llx ", width, i, start); if (ret_locked != -1) { ret_locked = mtd_is_locked(mtd, fd, i); diff --git a/ubi-utils/ubiattach.c b/ubi-utils/ubiattach.c index 527a735..e758dab 100644 --- a/ubi-utils/ubiattach.c +++ b/ubi-utils/ubiattach.c @@ -43,6 +43,7 @@ struct args { const char *dev; int max_beb_per1024; bool disable_fm; + bool need_resv_pool; }; static struct args args = { @@ -53,6 +54,7 @@ static struct args args = { .dev = NULL, .max_beb_per1024 = 0, .disable_fm = false, + .need_resv_pool = false, }; static const char doc[] = PROGRAM_NAME " version " VERSION @@ -71,6 +73,9 @@ static const char optionsstr[] = " 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"; @@ -78,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>] [-f] [--disable-fastmap]\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" @@ -98,6 +103,7 @@ static const struct option long_options[] = { { .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}, @@ -108,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:fhV", long_options, NULL); + key = getopt_long(argc, argv, "p:m:d:O:b:frhV", long_options, NULL); if (key == -1) break; @@ -152,6 +158,10 @@ static int parse_opt(int argc, char * const argv[]) 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); @@ -223,6 +233,7 @@ int main(int argc, char * const argv[]) 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) { diff --git a/ubi-utils/ubinize.c b/ubi-utils/ubinize.c index ac8c1e5..9c950b1 100644 --- a/ubi-utils/ubinize.c +++ b/ubi-utils/ubinize.c @@ -375,8 +375,8 @@ static int read_section(const struct ubigen_info *ui, const char *sname, vi->alignment = iniparser_getint(args.dict, buf, -1); if (vi->alignment == -1) vi->alignment = 1; - else if (vi->id < 0) - return errmsg("negative volume alignment %d in section \"%s\"", + else if (vi->alignment <= 0) + return errmsg("not positive volume alignment %d in section \"%s\"", vi->alignment, sname); verbose(args.verbose, "volume alignment: %d", vi->alignment); diff --git a/ubi-utils/ubirsvol.c b/ubi-utils/ubirsvol.c index 0854abc..73d2f68 100644 --- a/ubi-utils/ubirsvol.c +++ b/ubi-utils/ubirsvol.c @@ -231,7 +231,7 @@ int main(int argc, char * const argv[]) } if (args.lebs != -1) - args.bytes = vol_info.leb_size * args.lebs; + args.bytes = (long long)vol_info.leb_size * args.lebs; err = ubi_rsvol(libubi, args.node, args.vol_id, args.bytes); if (err) { |