b797a23e77
This updates packages/utils/mtd-utils and includes all patches from tools/mtd-utils, so the two may eventually be merged. I also added 150-fix_ubi-utils_static.patch which is a hack needed to include libcrc32.o in the static binaries. Having them static makes sense as only ubiformat is required on the target. [juhosg: - add build-time dependency on util-linux - allow to specify dependency for each subpackage - update ubifs optional lzo patch - add more patches] Signed-off-by: Daniel Golle <dgolle@allnet.de> git-svn-id: svn://svn.openwrt.org/openwrt/packages@31913 3c298f89-4303-0410-b956-a3cf2f4a3e73
62 lines
2.2 KiB
Diff
62 lines
2.2 KiB
Diff
--- a/mkfs.ubifs/mkfs.ubifs.c
|
|
+++ b/mkfs.ubifs/mkfs.ubifs.c
|
|
@@ -110,6 +110,7 @@ static int out_fd;
|
|
static int out_ubi;
|
|
static int squash_owner;
|
|
static int squash_rino_perm = -1;
|
|
+static int overwrite_volume;
|
|
|
|
/* The 'head' (position) which nodes are written */
|
|
static int head_lnum;
|
|
@@ -132,7 +133,7 @@ static struct inum_mapping **hash_table;
|
|
/* Inode creation sequence number */
|
|
static unsigned long long creat_sqnum;
|
|
|
|
-static const char *optstring = "d:r:m:o:D:h?vVe:c:g:f:Fp:k:x:X:j:R:l:j:UQq";
|
|
+static const char *optstring = "d:r:m:o:OD:h?vVe:c:g:f:Fp:k:x:X:j:R:l:j:UQq";
|
|
|
|
static const struct option longopts[] = {
|
|
{"root", 1, NULL, 'r'},
|
|
@@ -140,6 +141,7 @@ static const struct option longopts[] =
|
|
{"leb-size", 1, NULL, 'e'},
|
|
{"max-leb-cnt", 1, NULL, 'c'},
|
|
{"output", 1, NULL, 'o'},
|
|
+ {"overwrite", 0, NULL, 'O'},
|
|
{"devtable", 1, NULL, 'D'},
|
|
{"help", 0, NULL, 'h'},
|
|
{"verbose", 0, NULL, 'v'},
|
|
@@ -176,6 +178,7 @@ static const char *helptext =
|
|
"-e, --leb-size=SIZE logical erase block size\n"
|
|
"-c, --max-leb-cnt=COUNT maximum logical erase block count\n"
|
|
"-o, --output=FILE output to FILE\n"
|
|
+"-O, --overwrite force overwriting of the existing volume\n"
|
|
"-j, --jrn-size=SIZE journal size\n"
|
|
"-R, --reserved=SIZE how much space should be reserved for the super-user\n"
|
|
"-x, --compr=TYPE compression type - \"lzo\", \"favor_lzo\", \"zlib\" or\n"
|
|
@@ -594,6 +597,9 @@ static int get_options(int argc, char**a
|
|
case 'o':
|
|
output = strdup(optarg);
|
|
break;
|
|
+ case 'O':
|
|
+ overwrite_volume = 1;
|
|
+ break;
|
|
case 'D':
|
|
tbl_file = optarg;
|
|
if (stat(tbl_file, &st) < 0)
|
|
@@ -2180,8 +2186,13 @@ static int open_target(void)
|
|
if (ubi_set_property(out_fd, UBI_PROP_DIRECT_WRITE, 1))
|
|
return sys_err_msg("ubi_set_property failed");
|
|
|
|
- if (check_volume_empty())
|
|
- return err_msg("UBI volume is not empty");
|
|
+ if (check_volume_empty()) {
|
|
+ if (overwrite_volume)
|
|
+ if (verbose)
|
|
+ printf("Warning: overwriting existing data\n");
|
|
+ else
|
|
+ return err_msg("UBI volume is not empty");
|
|
+ }
|
|
} else {
|
|
out_fd = open(output, O_CREAT | O_RDWR | O_TRUNC,
|
|
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
|