diff options
author | Micke Prag <micke.prag@telldus.se> | 2014-11-02 11:08:24 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-01-30 18:33:24 +0100 |
commit | 07fa09a9527b7c9f864799c4c1cab86b49f232ce (patch) | |
tree | c51b2a998f1eb9b23f0a0a0f89932544c14733ad | |
parent | 1cbe93cf4e4234629a15cc3038bdb379961ffc2e (diff) | |
download | busybox-w32-07fa09a9527b7c9f864799c4c1cab86b49f232ce.tar.gz busybox-w32-07fa09a9527b7c9f864799c4c1cab86b49f232ce.tar.bz2 busybox-w32-07fa09a9527b7c9f864799c4c1cab86b49f232ce.zip |
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 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) | |||
105 | int mtd_num; | 105 | int mtd_num; |
106 | int dev_num = UBI_DEV_NUM_AUTO; | 106 | int dev_num = UBI_DEV_NUM_AUTO; |
107 | int vol_id = UBI_VOL_NUM_AUTO; | 107 | int vol_id = UBI_VOL_NUM_AUTO; |
108 | int vid_hdr_offset = 0; | ||
108 | char *vol_name; | 109 | char *vol_name; |
109 | unsigned long long size_bytes = size_bytes; /* for compiler */ | 110 | unsigned long long size_bytes = size_bytes; /* for compiler */ |
110 | char *size_bytes_str; | 111 | char *size_bytes_str; |
@@ -133,10 +134,11 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) | |||
133 | #define OPTION_a (1 << 5) | 134 | #define OPTION_a (1 << 5) |
134 | #define OPTION_t (1 << 6) | 135 | #define OPTION_t (1 << 6) |
135 | if (do_mkvol) { | 136 | if (do_mkvol) { |
136 | opt_complementary = "-1:d+:n+:a+"; | 137 | opt_complementary = "-1:d+:n+:a+:O+"; |
137 | opts = getopt32(argv, "md:n:N:s:a:t:", | 138 | opts = getopt32(argv, "md:n:N:s:a:t:O:", |
138 | &dev_num, &vol_id, | 139 | &dev_num, &vol_id, |
139 | &vol_name, &size_bytes_str, &alignment, &type | 140 | &vol_name, &size_bytes_str, &alignment, &type, |
141 | &vid_hdr_offset | ||
140 | ); | 142 | ); |
141 | } else | 143 | } else |
142 | if (do_update) { | 144 | if (do_update) { |
@@ -162,17 +164,19 @@ int ubi_tools_main(int argc UNUSED_PARAM, char **argv) | |||
162 | // bb_error_msg_and_die("%s: not a char device", ubi_ctrl); | 164 | // bb_error_msg_and_die("%s: not a char device", ubi_ctrl); |
163 | 165 | ||
164 | //usage:#define ubiattach_trivial_usage | 166 | //usage:#define ubiattach_trivial_usage |
165 | //usage: "-m MTD_NUM [-d UBI_NUM] UBI_CTRL_DEV" | 167 | //usage: "-m MTD_NUM [-d UBI_NUM] [-O VID_HDR_OFF] UBI_CTRL_DEV" |
166 | //usage:#define ubiattach_full_usage "\n\n" | 168 | //usage:#define ubiattach_full_usage "\n\n" |
167 | //usage: "Attach MTD device to UBI\n" | 169 | //usage: "Attach MTD device to UBI\n" |
168 | //usage: "\n -m MTD_NUM MTD device number to attach" | 170 | //usage: "\n -m MTD_NUM MTD device number to attach" |
169 | //usage: "\n -d UBI_NUM UBI device number to assign" | 171 | //usage: "\n -d UBI_NUM UBI device number to assign" |
172 | //usage: "\n -O VID_HDR_OFF VID header offset" | ||
170 | if (do_attach) { | 173 | if (do_attach) { |
171 | if (!(opts & OPTION_m)) | 174 | if (!(opts & OPTION_m)) |
172 | bb_error_msg_and_die("%s device not specified", "MTD"); | 175 | bb_error_msg_and_die("%s device not specified", "MTD"); |
173 | 176 | ||
174 | attach_req.mtd_num = mtd_num; | 177 | attach_req.mtd_num = mtd_num; |
175 | attach_req.ubi_num = dev_num; | 178 | attach_req.ubi_num = dev_num; |
179 | attach_req.vid_hdr_offset = vid_hdr_offset; | ||
176 | 180 | ||
177 | xioctl(fd, UBI_IOCATT, &attach_req); | 181 | xioctl(fd, UBI_IOCATT, &attach_req); |
178 | } else | 182 | } else |