Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Unsorted Block Image commands |
| 3 | * |
| 4 | * Copyright (C) 2008 Samsung Electronics |
| 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
| 6 | * |
Stefan Roese | 2d579e5 | 2009-04-24 20:24:19 +0200 | [diff] [blame] | 7 | * Copyright 2008-2009 Stefan Roese <sr@denx.de>, DENX Software Engineering |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as |
| 11 | * published by the Free Software Foundation. |
| 12 | */ |
| 13 | |
| 14 | #include <common.h> |
| 15 | #include <command.h> |
| 16 | #include <exports.h> |
Simon Glass | 6e29518 | 2015-09-02 17:24:57 -0600 | [diff] [blame] | 17 | #include <memalign.h> |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 18 | #include <nand.h> |
| 19 | #include <onenand_uboot.h> |
| 20 | #include <linux/mtd/mtd.h> |
| 21 | #include <linux/mtd/partitions.h> |
Heiko Schocher | ff94bc4 | 2014-06-24 10:10:04 +0200 | [diff] [blame] | 22 | #include <linux/err.h> |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 23 | #include <ubi_uboot.h> |
Masahiro Yamada | 1221ce4 | 2016-09-21 11:28:55 +0900 | [diff] [blame] | 24 | #include <linux/errno.h> |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 25 | #include <jffs2/load_kernel.h> |
| 26 | |
Joe Hershberger | 147162d | 2013-04-08 10:32:49 +0000 | [diff] [blame] | 27 | #undef ubi_msg |
| 28 | #define ubi_msg(fmt, ...) printf("UBI: " fmt "\n", ##__VA_ARGS__) |
| 29 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 30 | #define DEV_TYPE_NONE 0 |
| 31 | #define DEV_TYPE_NAND 1 |
| 32 | #define DEV_TYPE_ONENAND 2 |
Piotr Ziecik | 25ea652 | 2008-11-17 15:58:00 +0100 | [diff] [blame] | 33 | #define DEV_TYPE_NOR 3 |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 34 | |
| 35 | /* Private own data */ |
| 36 | static struct ubi_device *ubi; |
Stefan Roese | a5c4067 | 2008-11-24 08:31:16 +0100 | [diff] [blame] | 37 | static char buffer[80]; |
Stefan Roese | 2ee951b | 2008-11-27 14:07:09 +0100 | [diff] [blame] | 38 | static int ubi_initialized; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 39 | |
| 40 | struct selected_dev { |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 41 | char part_name[80]; |
Stefan Roese | 2d579e5 | 2009-04-24 20:24:19 +0200 | [diff] [blame] | 42 | int selected; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 43 | int nr; |
| 44 | struct mtd_info *mtd_info; |
| 45 | }; |
| 46 | |
| 47 | static struct selected_dev ubi_dev; |
| 48 | |
Stefan Roese | 2f15cfd | 2010-11-01 17:28:22 +0100 | [diff] [blame] | 49 | #ifdef CONFIG_CMD_UBIFS |
| 50 | int ubifs_is_mounted(void); |
| 51 | void cmd_ubifs_umount(void); |
| 52 | #endif |
| 53 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 54 | static void display_volume_info(struct ubi_device *ubi) |
| 55 | { |
| 56 | int i; |
| 57 | |
| 58 | for (i = 0; i < (ubi->vtbl_slots + 1); i++) { |
| 59 | if (!ubi->volumes[i]) |
| 60 | continue; /* Empty record */ |
| 61 | ubi_dump_vol_info(ubi->volumes[i]); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | static void display_ubi_info(struct ubi_device *ubi) |
| 66 | { |
| 67 | ubi_msg("MTD device name: \"%s\"", ubi->mtd->name); |
| 68 | ubi_msg("MTD device size: %llu MiB", ubi->flash_size >> 20); |
| 69 | ubi_msg("physical eraseblock size: %d bytes (%d KiB)", |
| 70 | ubi->peb_size, ubi->peb_size >> 10); |
| 71 | ubi_msg("logical eraseblock size: %d bytes", ubi->leb_size); |
| 72 | ubi_msg("number of good PEBs: %d", ubi->good_peb_count); |
| 73 | ubi_msg("number of bad PEBs: %d", ubi->bad_peb_count); |
| 74 | ubi_msg("smallest flash I/O unit: %d", ubi->min_io_size); |
| 75 | ubi_msg("VID header offset: %d (aligned %d)", |
| 76 | ubi->vid_hdr_offset, ubi->vid_hdr_aloffset); |
| 77 | ubi_msg("data offset: %d", ubi->leb_start); |
| 78 | ubi_msg("max. allowed volumes: %d", ubi->vtbl_slots); |
| 79 | ubi_msg("wear-leveling threshold: %d", CONFIG_MTD_UBI_WL_THRESHOLD); |
| 80 | ubi_msg("number of internal volumes: %d", UBI_INT_VOL_COUNT); |
| 81 | ubi_msg("number of user volumes: %d", |
| 82 | ubi->vol_count - UBI_INT_VOL_COUNT); |
| 83 | ubi_msg("available PEBs: %d", ubi->avail_pebs); |
| 84 | ubi_msg("total number of reserved PEBs: %d", ubi->rsvd_pebs); |
| 85 | ubi_msg("number of PEBs reserved for bad PEB handling: %d", |
| 86 | ubi->beb_rsvd_pebs); |
| 87 | ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); |
| 88 | } |
| 89 | |
| 90 | static int ubi_info(int layout) |
| 91 | { |
| 92 | if (layout) |
| 93 | display_volume_info(ubi); |
| 94 | else |
| 95 | display_ubi_info(ubi); |
| 96 | |
| 97 | return 0; |
| 98 | } |
| 99 | |
Heiko Schocher | f9f4d80 | 2014-01-25 07:27:11 +0100 | [diff] [blame] | 100 | static int ubi_check_volumename(const struct ubi_volume *vol, char *name) |
| 101 | { |
| 102 | return strcmp(vol->name, name); |
| 103 | } |
| 104 | |
| 105 | static int ubi_check(char *name) |
| 106 | { |
| 107 | int i; |
| 108 | |
| 109 | for (i = 0; i < (ubi->vtbl_slots + 1); i++) { |
| 110 | if (!ubi->volumes[i]) |
| 111 | continue; /* Empty record */ |
| 112 | |
| 113 | if (!ubi_check_volumename(ubi->volumes[i], name)) |
| 114 | return 0; |
| 115 | } |
| 116 | |
Stefan Agner | 6d0f452 | 2015-04-10 11:25:43 +0200 | [diff] [blame] | 117 | return 1; |
Heiko Schocher | f9f4d80 | 2014-01-25 07:27:11 +0100 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 121 | static int verify_mkvol_req(const struct ubi_device *ubi, |
| 122 | const struct ubi_mkvol_req *req) |
| 123 | { |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 124 | int n, err = EINVAL; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 125 | |
| 126 | if (req->bytes < 0 || req->alignment < 0 || req->vol_type < 0 || |
| 127 | req->name_len < 0) |
| 128 | goto bad; |
| 129 | |
| 130 | if ((req->vol_id < 0 || req->vol_id >= ubi->vtbl_slots) && |
| 131 | req->vol_id != UBI_VOL_NUM_AUTO) |
| 132 | goto bad; |
| 133 | |
| 134 | if (req->alignment == 0) |
| 135 | goto bad; |
| 136 | |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 137 | if (req->bytes == 0) { |
| 138 | printf("No space left in UBI device!\n"); |
| 139 | err = ENOMEM; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 140 | goto bad; |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 141 | } |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 142 | |
| 143 | if (req->vol_type != UBI_DYNAMIC_VOLUME && |
| 144 | req->vol_type != UBI_STATIC_VOLUME) |
| 145 | goto bad; |
| 146 | |
| 147 | if (req->alignment > ubi->leb_size) |
| 148 | goto bad; |
| 149 | |
| 150 | n = req->alignment % ubi->min_io_size; |
| 151 | if (req->alignment != 1 && n) |
| 152 | goto bad; |
| 153 | |
| 154 | if (req->name_len > UBI_VOL_NAME_MAX) { |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 155 | printf("Name too long!\n"); |
| 156 | err = ENAMETOOLONG; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 157 | goto bad; |
| 158 | } |
| 159 | |
| 160 | return 0; |
| 161 | bad: |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 162 | return err; |
| 163 | } |
| 164 | |
Ladislav Michl | 0061242 | 2016-09-13 07:14:01 +0200 | [diff] [blame] | 165 | static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id) |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 166 | { |
| 167 | struct ubi_mkvol_req req; |
| 168 | int err; |
| 169 | |
| 170 | if (dynamic) |
| 171 | req.vol_type = UBI_DYNAMIC_VOLUME; |
| 172 | else |
| 173 | req.vol_type = UBI_STATIC_VOLUME; |
| 174 | |
Ladislav Michl | 0061242 | 2016-09-13 07:14:01 +0200 | [diff] [blame] | 175 | req.vol_id = vol_id; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 176 | req.alignment = 1; |
| 177 | req.bytes = size; |
| 178 | |
| 179 | strcpy(req.name, volume); |
| 180 | req.name_len = strlen(volume); |
| 181 | req.name[req.name_len] = '\0'; |
| 182 | req.padding1 = 0; |
| 183 | /* It's duplicated at drivers/mtd/ubi/cdev.c */ |
| 184 | err = verify_mkvol_req(ubi, &req); |
| 185 | if (err) { |
| 186 | printf("verify_mkvol_req failed %d\n", err); |
| 187 | return err; |
| 188 | } |
Paul Burton | dd7185f | 2013-09-04 15:16:58 +0100 | [diff] [blame] | 189 | printf("Creating %s volume %s of size %lld\n", |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 190 | dynamic ? "dynamic" : "static", volume, size); |
| 191 | /* Call real ubi create volume */ |
| 192 | return ubi_create_volume(ubi, &req); |
| 193 | } |
| 194 | |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 195 | static struct ubi_volume *ubi_find_volume(char *volume) |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 196 | { |
Peter Tyser | 3b653fd | 2010-04-04 22:40:50 -0500 | [diff] [blame] | 197 | struct ubi_volume *vol = NULL; |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 198 | int i; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 199 | |
| 200 | for (i = 0; i < ubi->vtbl_slots; i++) { |
| 201 | vol = ubi->volumes[i]; |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 202 | if (vol && !strcmp(vol->name, volume)) |
| 203 | return vol; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 204 | } |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 205 | |
| 206 | printf("Volume %s not found!\n", volume); |
| 207 | return NULL; |
| 208 | } |
| 209 | |
| 210 | static int ubi_remove_vol(char *volume) |
| 211 | { |
| 212 | int err, reserved_pebs, i; |
| 213 | struct ubi_volume *vol; |
| 214 | |
| 215 | vol = ubi_find_volume(volume); |
| 216 | if (vol == NULL) |
| 217 | return ENODEV; |
| 218 | |
| 219 | printf("Remove UBI volume %s (id %d)\n", vol->name, vol->vol_id); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 220 | |
| 221 | if (ubi->ro_mode) { |
| 222 | printf("It's read-only mode\n"); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 223 | err = EROFS; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 224 | goto out_err; |
| 225 | } |
| 226 | |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 227 | err = ubi_change_vtbl_record(ubi, vol->vol_id, NULL); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 228 | if (err) { |
| 229 | printf("Error changing Vol tabel record err=%x\n", err); |
| 230 | goto out_err; |
| 231 | } |
| 232 | reserved_pebs = vol->reserved_pebs; |
| 233 | for (i = 0; i < vol->reserved_pebs; i++) { |
| 234 | err = ubi_eba_unmap_leb(ubi, vol, i); |
| 235 | if (err) |
| 236 | goto out_err; |
| 237 | } |
| 238 | |
| 239 | kfree(vol->eba_tbl); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 240 | ubi->volumes[vol->vol_id]->eba_tbl = NULL; |
| 241 | ubi->volumes[vol->vol_id] = NULL; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 242 | |
| 243 | ubi->rsvd_pebs -= reserved_pebs; |
| 244 | ubi->avail_pebs += reserved_pebs; |
| 245 | i = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs; |
| 246 | if (i > 0) { |
| 247 | i = ubi->avail_pebs >= i ? i : ubi->avail_pebs; |
| 248 | ubi->avail_pebs -= i; |
| 249 | ubi->rsvd_pebs += i; |
| 250 | ubi->beb_rsvd_pebs += i; |
| 251 | if (i > 0) |
| 252 | ubi_msg("reserve more %d PEBs", i); |
| 253 | } |
| 254 | ubi->vol_count -= 1; |
| 255 | |
| 256 | return 0; |
| 257 | out_err: |
Heiko Schocher | 0195a7b | 2015-10-22 06:19:21 +0200 | [diff] [blame] | 258 | ubi_err(ubi, "cannot remove volume %s, error %d", volume, err); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 259 | if (err < 0) |
| 260 | err = -err; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 261 | return err; |
| 262 | } |
| 263 | |
Jeroen Hofstee | 0e350f8 | 2014-06-23 00:22:08 +0200 | [diff] [blame] | 264 | static int ubi_volume_continue_write(char *volume, void *buf, size_t size) |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 265 | { |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 266 | int err = 1; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 267 | struct ubi_volume *vol; |
| 268 | |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 269 | vol = ubi_find_volume(volume); |
| 270 | if (vol == NULL) |
| 271 | return ENODEV; |
| 272 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 273 | err = ubi_more_update_data(ubi, vol, buf, size); |
| 274 | if (err < 0) { |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 275 | printf("Couldnt or partially wrote data\n"); |
| 276 | return -err; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | if (err) { |
| 280 | size = err; |
| 281 | |
| 282 | err = ubi_check_volume(ubi, vol->vol_id); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 283 | if (err < 0) |
| 284 | return -err; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 285 | |
| 286 | if (err) { |
Heiko Schocher | 0195a7b | 2015-10-22 06:19:21 +0200 | [diff] [blame] | 287 | ubi_warn(ubi, "volume %d on UBI device %d is corrupt", |
| 288 | vol->vol_id, ubi->ubi_num); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 289 | vol->corrupted = 1; |
| 290 | } |
| 291 | |
| 292 | vol->checked = 1; |
| 293 | ubi_gluebi_updated(vol); |
| 294 | } |
| 295 | |
| 296 | return 0; |
| 297 | } |
| 298 | |
Paul Burton | cc734f5 | 2013-09-04 15:16:59 +0100 | [diff] [blame] | 299 | int ubi_volume_begin_write(char *volume, void *buf, size_t size, |
| 300 | size_t full_size) |
| 301 | { |
| 302 | int err = 1; |
| 303 | int rsvd_bytes = 0; |
| 304 | struct ubi_volume *vol; |
| 305 | |
| 306 | vol = ubi_find_volume(volume); |
| 307 | if (vol == NULL) |
| 308 | return ENODEV; |
| 309 | |
| 310 | rsvd_bytes = vol->reserved_pebs * (ubi->leb_size - vol->data_pad); |
xypron.glpk@gmx.de | 18f41f2 | 2017-04-15 16:25:25 +0200 | [diff] [blame] | 311 | if (size > rsvd_bytes) { |
Paul Burton | cc734f5 | 2013-09-04 15:16:59 +0100 | [diff] [blame] | 312 | printf("size > volume size! Aborting!\n"); |
| 313 | return EINVAL; |
| 314 | } |
| 315 | |
| 316 | err = ubi_start_update(ubi, vol, full_size); |
| 317 | if (err < 0) { |
| 318 | printf("Cannot start volume update\n"); |
| 319 | return -err; |
| 320 | } |
| 321 | |
| 322 | return ubi_volume_continue_write(volume, buf, size); |
| 323 | } |
| 324 | |
| 325 | int ubi_volume_write(char *volume, void *buf, size_t size) |
| 326 | { |
| 327 | return ubi_volume_begin_write(volume, buf, size, size); |
| 328 | } |
| 329 | |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 330 | int ubi_volume_read(char *volume, char *buf, size_t size) |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 331 | { |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 332 | int err, lnum, off, len, tbuf_size; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 333 | void *tbuf; |
| 334 | unsigned long long tmp; |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 335 | struct ubi_volume *vol; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 336 | loff_t offp = 0; |
Holger Dengler | 985fa93 | 2017-08-30 18:38:52 +0200 | [diff] [blame] | 337 | size_t len_read; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 338 | |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 339 | vol = ubi_find_volume(volume); |
| 340 | if (vol == NULL) |
| 341 | return ENODEV; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 342 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 343 | if (vol->updating) { |
| 344 | printf("updating"); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 345 | return EBUSY; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 346 | } |
| 347 | if (vol->upd_marker) { |
| 348 | printf("damaged volume, update marker is set"); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 349 | return EBADF; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 350 | } |
| 351 | if (offp == vol->used_bytes) |
| 352 | return 0; |
| 353 | |
| 354 | if (size == 0) { |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 355 | printf("No size specified -> Using max size (%lld)\n", vol->used_bytes); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 356 | size = vol->used_bytes; |
| 357 | } |
| 358 | |
Tom Rini | 1341533 | 2018-07-26 11:17:24 -0400 | [diff] [blame] | 359 | printf("Read %zu bytes from volume %s to %p\n", size, volume, buf); |
Stefan Agner | 68c7025 | 2018-06-25 11:19:12 +0200 | [diff] [blame] | 360 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 361 | if (vol->corrupted) |
| 362 | printf("read from corrupted volume %d", vol->vol_id); |
| 363 | if (offp + size > vol->used_bytes) |
Marek Vasut | 2984fd1 | 2011-09-30 12:13:25 +0200 | [diff] [blame] | 364 | size = vol->used_bytes - offp; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 365 | |
| 366 | tbuf_size = vol->usable_leb_size; |
| 367 | if (size < tbuf_size) |
| 368 | tbuf_size = ALIGN(size, ubi->min_io_size); |
Marcel Ziswiler | 4519668 | 2015-08-18 13:06:37 +0200 | [diff] [blame] | 369 | tbuf = malloc_cache_aligned(tbuf_size); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 370 | if (!tbuf) { |
| 371 | printf("NO MEM\n"); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 372 | return ENOMEM; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 373 | } |
| 374 | len = size > tbuf_size ? tbuf_size : size; |
| 375 | |
| 376 | tmp = offp; |
| 377 | off = do_div(tmp, vol->usable_leb_size); |
| 378 | lnum = tmp; |
Holger Dengler | 985fa93 | 2017-08-30 18:38:52 +0200 | [diff] [blame] | 379 | len_read = size; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 380 | do { |
| 381 | if (off + len >= vol->usable_leb_size) |
| 382 | len = vol->usable_leb_size - off; |
| 383 | |
| 384 | err = ubi_eba_read_leb(ubi, vol, lnum, tbuf, off, len, 0); |
| 385 | if (err) { |
| 386 | printf("read err %x\n", err); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 387 | err = -err; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 388 | break; |
| 389 | } |
| 390 | off += len; |
| 391 | if (off == vol->usable_leb_size) { |
| 392 | lnum += 1; |
| 393 | off -= vol->usable_leb_size; |
| 394 | } |
| 395 | |
| 396 | size -= len; |
| 397 | offp += len; |
| 398 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 399 | memcpy(buf, tbuf, len); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 400 | |
| 401 | buf += len; |
| 402 | len = size > tbuf_size ? tbuf_size : size; |
| 403 | } while (size); |
| 404 | |
Holger Dengler | 985fa93 | 2017-08-30 18:38:52 +0200 | [diff] [blame] | 405 | if (!size) |
| 406 | env_set_hex("filesize", len_read); |
| 407 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 408 | free(tbuf); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 409 | return err; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 410 | } |
| 411 | |
Simon Kagstrom | 25c8f40 | 2009-07-07 16:59:46 +0200 | [diff] [blame] | 412 | static int ubi_dev_scan(struct mtd_info *info, char *ubidev, |
| 413 | const char *vid_header_offset) |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 414 | { |
| 415 | struct mtd_device *dev; |
| 416 | struct part_info *part; |
| 417 | struct mtd_partition mtd_part; |
Simon Kagstrom | 25c8f40 | 2009-07-07 16:59:46 +0200 | [diff] [blame] | 418 | char ubi_mtd_param_buffer[80]; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 419 | u8 pnum; |
| 420 | int err; |
| 421 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 422 | if (find_dev_and_part(ubidev, &dev, &pnum, &part) != 0) |
| 423 | return 1; |
| 424 | |
| 425 | sprintf(buffer, "mtd=%d", pnum); |
| 426 | memset(&mtd_part, 0, sizeof(mtd_part)); |
| 427 | mtd_part.name = buffer; |
| 428 | mtd_part.size = part->size; |
| 429 | mtd_part.offset = part->offset; |
| 430 | add_mtd_partitions(info, &mtd_part, 1); |
| 431 | |
Simon Kagstrom | 25c8f40 | 2009-07-07 16:59:46 +0200 | [diff] [blame] | 432 | strcpy(ubi_mtd_param_buffer, buffer); |
| 433 | if (vid_header_offset) |
| 434 | sprintf(ubi_mtd_param_buffer, "mtd=%d,%s", pnum, |
| 435 | vid_header_offset); |
| 436 | err = ubi_mtd_param_parse(ubi_mtd_param_buffer, NULL); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 437 | if (err) { |
| 438 | del_mtd_partitions(info); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 439 | return -err; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | err = ubi_init(); |
| 443 | if (err) { |
| 444 | del_mtd_partitions(info); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 445 | return -err; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 446 | } |
| 447 | |
Stefan Roese | 2ee951b | 2008-11-27 14:07:09 +0100 | [diff] [blame] | 448 | ubi_initialized = 1; |
| 449 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 450 | return 0; |
| 451 | } |
| 452 | |
Heiko Schocher | cddfc97 | 2016-06-07 08:55:40 +0200 | [diff] [blame] | 453 | int ubi_detach(void) |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 454 | { |
Andreas Huber | c203ef5 | 2009-04-02 17:15:34 +0200 | [diff] [blame] | 455 | if (mtdparts_init() != 0) { |
| 456 | printf("Error initializing mtdparts!\n"); |
| 457 | return 1; |
| 458 | } |
| 459 | |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 460 | #ifdef CONFIG_CMD_UBIFS |
| 461 | /* |
| 462 | * Automatically unmount UBIFS partition when user |
| 463 | * changes the UBI device. Otherwise the following |
| 464 | * UBIFS commands will crash. |
| 465 | */ |
| 466 | if (ubifs_is_mounted()) |
| 467 | cmd_ubifs_umount(); |
| 468 | #endif |
| 469 | |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 470 | /* |
| 471 | * Call ubi_exit() before re-initializing the UBI subsystem |
| 472 | */ |
| 473 | if (ubi_initialized) { |
| 474 | ubi_exit(); |
| 475 | del_mtd_partitions(ubi_dev.mtd_info); |
Heiko Schocher | cddfc97 | 2016-06-07 08:55:40 +0200 | [diff] [blame] | 476 | ubi_initialized = 0; |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 477 | } |
| 478 | |
Heiko Schocher | cddfc97 | 2016-06-07 08:55:40 +0200 | [diff] [blame] | 479 | ubi_dev.selected = 0; |
| 480 | return 0; |
| 481 | } |
| 482 | |
| 483 | int ubi_part(char *part_name, const char *vid_header_offset) |
| 484 | { |
| 485 | int err = 0; |
| 486 | char mtd_dev[16]; |
| 487 | struct mtd_device *dev; |
| 488 | struct part_info *part; |
| 489 | u8 pnum; |
| 490 | |
| 491 | ubi_detach(); |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 492 | /* |
| 493 | * Search the mtd device number where this partition |
| 494 | * is located |
| 495 | */ |
| 496 | if (find_dev_and_part(part_name, &dev, &pnum, &part)) { |
| 497 | printf("Partition %s not found!\n", part_name); |
| 498 | return 1; |
| 499 | } |
| 500 | sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num); |
| 501 | ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev); |
| 502 | if (IS_ERR(ubi_dev.mtd_info)) { |
| 503 | printf("Partition %s not found on device %s!\n", part_name, |
| 504 | mtd_dev); |
| 505 | return 1; |
| 506 | } |
| 507 | |
| 508 | ubi_dev.selected = 1; |
| 509 | |
| 510 | strcpy(ubi_dev.part_name, part_name); |
| 511 | err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name, |
| 512 | vid_header_offset); |
| 513 | if (err) { |
| 514 | printf("UBI init error %d\n", err); |
Stefan Roese | 4a94e53 | 2018-06-26 08:12:32 +0200 | [diff] [blame] | 515 | printf("Please check, if the correct MTD partition is used (size big enough?)\n"); |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 516 | ubi_dev.selected = 0; |
| 517 | return err; |
| 518 | } |
| 519 | |
| 520 | ubi = ubi_devices[0]; |
| 521 | |
| 522 | return 0; |
| 523 | } |
| 524 | |
| 525 | static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) |
| 526 | { |
Paul Burton | dd7185f | 2013-09-04 15:16:58 +0100 | [diff] [blame] | 527 | int64_t size = 0; |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 528 | ulong addr = 0; |
| 529 | |
| 530 | if (argc < 2) |
| 531 | return CMD_RET_USAGE; |
| 532 | |
Heiko Schocher | cddfc97 | 2016-06-07 08:55:40 +0200 | [diff] [blame] | 533 | |
| 534 | if (strcmp(argv[1], "detach") == 0) { |
| 535 | if (argc < 2) |
| 536 | return CMD_RET_USAGE; |
| 537 | |
| 538 | return ubi_detach(); |
| 539 | } |
| 540 | |
| 541 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 542 | if (strcmp(argv[1], "part") == 0) { |
Simon Kagstrom | 25c8f40 | 2009-07-07 16:59:46 +0200 | [diff] [blame] | 543 | const char *vid_header_offset = NULL; |
Stefan Roese | 2d579e5 | 2009-04-24 20:24:19 +0200 | [diff] [blame] | 544 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 545 | /* Print current partition */ |
| 546 | if (argc == 2) { |
Stefan Roese | 2d579e5 | 2009-04-24 20:24:19 +0200 | [diff] [blame] | 547 | if (!ubi_dev.selected) { |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 548 | printf("Error, no UBI device/partition selected!\n"); |
| 549 | return 1; |
| 550 | } |
| 551 | |
Stefan Roese | 2d579e5 | 2009-04-24 20:24:19 +0200 | [diff] [blame] | 552 | printf("Device %d: %s, partition %s\n", |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 553 | ubi_dev.nr, ubi_dev.mtd_info->name, ubi_dev.part_name); |
| 554 | return 0; |
| 555 | } |
| 556 | |
Wolfgang Denk | 47e26b1 | 2010-07-17 01:06:04 +0200 | [diff] [blame] | 557 | if (argc < 3) |
Simon Glass | 4c12eeb | 2011-12-10 08:44:01 +0000 | [diff] [blame] | 558 | return CMD_RET_USAGE; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 559 | |
Simon Kagstrom | 25c8f40 | 2009-07-07 16:59:46 +0200 | [diff] [blame] | 560 | if (argc > 3) |
| 561 | vid_header_offset = argv[3]; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 562 | |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 563 | return ubi_part(argv[2], vid_header_offset); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 564 | } |
| 565 | |
Stefan Roese | 2d579e5 | 2009-04-24 20:24:19 +0200 | [diff] [blame] | 566 | if ((strcmp(argv[1], "part") != 0) && (!ubi_dev.selected)) { |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 567 | printf("Error, no UBI device/partition selected!\n"); |
| 568 | return 1; |
| 569 | } |
| 570 | |
| 571 | if (strcmp(argv[1], "info") == 0) { |
| 572 | int layout = 0; |
| 573 | if (argc > 2 && !strncmp(argv[2], "l", 1)) |
| 574 | layout = 1; |
| 575 | return ubi_info(layout); |
| 576 | } |
| 577 | |
Heiko Schocher | f9f4d80 | 2014-01-25 07:27:11 +0100 | [diff] [blame] | 578 | if (strcmp(argv[1], "check") == 0) { |
| 579 | if (argc > 2) |
| 580 | return ubi_check(argv[2]); |
| 581 | |
| 582 | printf("Error, no volume name passed\n"); |
| 583 | return 1; |
| 584 | } |
| 585 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 586 | if (strncmp(argv[1], "create", 6) == 0) { |
| 587 | int dynamic = 1; /* default: dynamic volume */ |
Ladislav Michl | 0061242 | 2016-09-13 07:14:01 +0200 | [diff] [blame] | 588 | int id = UBI_VOL_NUM_AUTO; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 589 | |
| 590 | /* Use maximum available size */ |
| 591 | size = 0; |
| 592 | |
Ladislav Michl | 0061242 | 2016-09-13 07:14:01 +0200 | [diff] [blame] | 593 | /* E.g., create volume size type vol_id */ |
| 594 | if (argc == 6) { |
| 595 | id = simple_strtoull(argv[5], NULL, 16); |
| 596 | argc--; |
| 597 | } |
| 598 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 599 | /* E.g., create volume size type */ |
| 600 | if (argc == 5) { |
| 601 | if (strncmp(argv[4], "s", 1) == 0) |
| 602 | dynamic = 0; |
| 603 | else if (strncmp(argv[4], "d", 1) != 0) { |
| 604 | printf("Incorrect type\n"); |
| 605 | return 1; |
| 606 | } |
| 607 | argc--; |
| 608 | } |
| 609 | /* E.g., create volume size */ |
| 610 | if (argc == 4) { |
Ladislav Michl | f59f07e | 2017-01-19 11:45:35 +0100 | [diff] [blame] | 611 | if (argv[3][0] != '-') |
| 612 | size = simple_strtoull(argv[3], NULL, 16); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 613 | argc--; |
| 614 | } |
| 615 | /* Use maximum available size */ |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 616 | if (!size) { |
Paul Burton | dd7185f | 2013-09-04 15:16:58 +0100 | [diff] [blame] | 617 | size = (int64_t)ubi->avail_pebs * ubi->leb_size; |
| 618 | printf("No size specified -> Using max size (%lld)\n", size); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 619 | } |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 620 | /* E.g., create volume */ |
| 621 | if (argc == 3) |
Ladislav Michl | 0061242 | 2016-09-13 07:14:01 +0200 | [diff] [blame] | 622 | return ubi_create_vol(argv[2], size, dynamic, id); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 623 | } |
| 624 | |
| 625 | if (strncmp(argv[1], "remove", 6) == 0) { |
| 626 | /* E.g., remove volume */ |
| 627 | if (argc == 3) |
| 628 | return ubi_remove_vol(argv[2]); |
| 629 | } |
| 630 | |
| 631 | if (strncmp(argv[1], "write", 5) == 0) { |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 632 | int ret; |
| 633 | |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 634 | if (argc < 5) { |
| 635 | printf("Please see usage\n"); |
| 636 | return 1; |
| 637 | } |
| 638 | |
| 639 | addr = simple_strtoul(argv[2], NULL, 16); |
Stefan Roese | a5c4067 | 2008-11-24 08:31:16 +0100 | [diff] [blame] | 640 | size = simple_strtoul(argv[4], NULL, 16); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 641 | |
Paul Burton | cc734f5 | 2013-09-04 15:16:59 +0100 | [diff] [blame] | 642 | if (strlen(argv[1]) == 10 && |
| 643 | strncmp(argv[1] + 5, ".part", 5) == 0) { |
| 644 | if (argc < 6) { |
| 645 | ret = ubi_volume_continue_write(argv[3], |
| 646 | (void *)addr, size); |
| 647 | } else { |
| 648 | size_t full_size; |
| 649 | full_size = simple_strtoul(argv[5], NULL, 16); |
| 650 | ret = ubi_volume_begin_write(argv[3], |
| 651 | (void *)addr, size, full_size); |
| 652 | } |
| 653 | } else { |
| 654 | ret = ubi_volume_write(argv[3], (void *)addr, size); |
| 655 | } |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 656 | if (!ret) { |
Paul Burton | dd7185f | 2013-09-04 15:16:58 +0100 | [diff] [blame] | 657 | printf("%lld bytes written to volume %s\n", size, |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 658 | argv[3]); |
| 659 | } |
| 660 | |
| 661 | return ret; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 662 | } |
| 663 | |
| 664 | if (strncmp(argv[1], "read", 4) == 0) { |
| 665 | size = 0; |
| 666 | |
| 667 | /* E.g., read volume size */ |
| 668 | if (argc == 5) { |
Stefan Roese | a5c4067 | 2008-11-24 08:31:16 +0100 | [diff] [blame] | 669 | size = simple_strtoul(argv[4], NULL, 16); |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 670 | argc--; |
| 671 | } |
| 672 | |
| 673 | /* E.g., read volume */ |
| 674 | if (argc == 4) { |
| 675 | addr = simple_strtoul(argv[2], NULL, 16); |
| 676 | argc--; |
| 677 | } |
| 678 | |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 679 | if (argc == 3) { |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 680 | return ubi_volume_read(argv[3], (char *)addr, size); |
Joe Hershberger | 7182906 | 2013-04-08 10:32:47 +0000 | [diff] [blame] | 681 | } |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 682 | } |
| 683 | |
| 684 | printf("Please see usage\n"); |
Stefan Roese | 7f5d8a4 | 2011-03-14 14:34:21 +0100 | [diff] [blame] | 685 | return 1; |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 686 | } |
| 687 | |
Frans Meulenbroeks | 388a29d | 2010-07-31 15:01:53 +0200 | [diff] [blame] | 688 | U_BOOT_CMD( |
| 689 | ubi, 6, 1, do_ubi, |
Peter Tyser | 2fb2604 | 2009-01-27 18:03:12 -0600 | [diff] [blame] | 690 | "ubi commands", |
Heiko Schocher | cddfc97 | 2016-06-07 08:55:40 +0200 | [diff] [blame] | 691 | "detach" |
| 692 | " - detach ubi from a mtd partition\n" |
| 693 | "ubi part [part] [offset]\n" |
Simon Kagstrom | 25c8f40 | 2009-07-07 16:59:46 +0200 | [diff] [blame] | 694 | " - Show or set current partition (with optional VID" |
| 695 | " header offset)\n" |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 696 | "ubi info [l[ayout]]" |
| 697 | " - Display volume and ubi layout information\n" |
Heiko Schocher | f9f4d80 | 2014-01-25 07:27:11 +0100 | [diff] [blame] | 698 | "ubi check volumename" |
| 699 | " - check if volumename exists\n" |
Ladislav Michl | f59f07e | 2017-01-19 11:45:35 +0100 | [diff] [blame] | 700 | "ubi create[vol] volume [size] [type] [id]\n" |
| 701 | " - create volume name with size ('-' for maximum" |
| 702 | " available size)\n" |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 703 | "ubi write[vol] address volume size" |
| 704 | " - Write volume from address with size\n" |
Paul Burton | cc734f5 | 2013-09-04 15:16:59 +0100 | [diff] [blame] | 705 | "ubi write.part address volume size [fullsize]\n" |
| 706 | " - Write part of a volume from address\n" |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 707 | "ubi read[vol] address volume [size]" |
| 708 | " - Read volume to address with size\n" |
| 709 | "ubi remove[vol] volume" |
| 710 | " - Remove volume\n" |
| 711 | "[Legends]\n" |
Andrzej Wolski | f6ca3b7 | 2009-07-17 22:26:54 +0200 | [diff] [blame] | 712 | " volume: character name\n" |
| 713 | " size: specified in bytes\n" |
Wolfgang Denk | a89c33d | 2009-05-24 17:06:54 +0200 | [diff] [blame] | 714 | " type: s[tatic] or d[ynamic] (default=dynamic)" |
Kyungmin Park | 694a0b3 | 2008-11-19 11:47:05 +0100 | [diff] [blame] | 715 | ); |