From: Micke Prag Date: Sun, 2 Nov 2014 10:08:24 +0000 (+0100) Subject: ubiattach: add option -O X-Git-Tag: 1_24_0~211 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=07fa09a9527b7c9f864799c4c1cab86b49f232ce;p=oweals%2Fbusybox.git 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 Signed-off-by: Denys Vlasenko --- diff --git a/miscutils/ubi_tools.c b/miscutils/ubi_tools.c index 6c09fe534..dd1bda300 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