diff options
author | Micke Prag | 2014-11-02 11:08:24 +0100 |
---|---|---|
committer | Denys Vlasenko | 2015-01-30 18:33:24 +0100 |
commit | 07fa09a9527b7c9f864799c4c1cab86b49f232ce (patch) | |
tree | c51b2a998f1eb9b23f0a0a0f89932544c14733ad | |
parent | 1cbe93cf4e4234629a15cc3038bdb379961ffc2e (diff) | |
download | busybox-07fa09a9527b7c9f864799c4c1cab86b49f232ce.zip busybox-07fa09a9527b7c9f864799c4c1cab86b49f232ce.tar.gz |
ubiattach: add option -O
Some images do not have the default VID offset. The option -O must
be used to attach such images.
Signed-off-by: Micke Prag <micke.prag@telldus.se>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/ubi_tools.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index 6c09fe5..dd1bda3 100644 --- a/miscutils/ubi_tools.c +++ b/miscutils/ubi_tools.c @@ -105,6 +105,7 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) int mtd_num; int dev_num = UBI_DEV_NUM_AUTO; int vol_id = UBI_VOL_NUM_AUTO; + int vid_hdr_offset = 0; char *vol_name; unsigned long long size_bytes = size_bytes; /* for compiler */ char *size_bytes_str; @@ -133,10 +134,11 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) #define OPTION_a (1 << 5) #define OPTION_t (1 << 6) if (do_mkvol) { - opt_complementary = "-1:d+:n+:a+"; - opts = getopt32(argv, "md:n:N:s:a:t:", + opt_complementary = "-1:d+:n+:a+:O+"; + opts = getopt32(argv, "md:n:N:s:a:t:O:", &dev_num, &vol_id, - &vol_name, &size_bytes_str, &alignment, &type + &vol_name, &size_bytes_str, &alignment, &type, + &vid_hdr_offset ); } else if (do_update) { @@ -162,17 +164,19 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) // bb_error_msg_and_die("%s: not a char device", ubi_ctrl); //usage:#define ubiattach_trivial_usage -//usage: "-m MTD_NUM [-d UBI_NUM] UBI_CTRL_DEV" +//usage: "-m MTD_NUM [-d UBI_NUM] [-O VID_HDR_OFF] UBI_CTRL_DEV" //usage:#define ubiattach_full_usage "\n\n" //usage: "Attach MTD device to UBI\n" //usage: "\n -m MTD_NUM MTD device number to attach" //usage: "\n -d UBI_NUM UBI device number to assign" +//usage: "\n -O VID_HDR_OFF VID header offset" if (do_attach) { if (!(opts & OPTION_m)) bb_error_msg_and_die("%s device not specified", "MTD"); attach_req.mtd_num = mtd_num; attach_req.ubi_num = dev_num; + attach_req.vid_hdr_offset = vid_hdr_offset; xioctl(fd, UBI_IOCATT, &attach_req); } else |