cmd_ubi.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711
  1. /*
  2. * Unsorted Block Image commands
  3. *
  4. * Copyright (C) 2008 Samsung Electronics
  5. * Kyungmin Park <kyungmin.park@samsung.com>
  6. *
  7. * Copyright 2008-2009 Stefan Roese <sr@denx.de>, DENX Software Engineering
  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. #include <common.h>
  14. #include <command.h>
  15. #include <exports.h>
  16. #include <nand.h>
  17. #include <onenand_uboot.h>
  18. #include <linux/mtd/mtd.h>
  19. #include <linux/mtd/partitions.h>
  20. #include <ubi_uboot.h>
  21. #include <asm/errno.h>
  22. #include <jffs2/load_kernel.h>
  23. #undef ubi_msg
  24. #define ubi_msg(fmt, ...) printf("UBI: " fmt "\n", ##__VA_ARGS__)
  25. #define DEV_TYPE_NONE 0
  26. #define DEV_TYPE_NAND 1
  27. #define DEV_TYPE_ONENAND 2
  28. #define DEV_TYPE_NOR 3
  29. /* Private own data */
  30. static struct ubi_device *ubi;
  31. static char buffer[80];
  32. static int ubi_initialized;
  33. struct selected_dev {
  34. char part_name[80];
  35. int selected;
  36. int nr;
  37. struct mtd_info *mtd_info;
  38. };
  39. static struct selected_dev ubi_dev;
  40. #ifdef CONFIG_CMD_UBIFS
  41. int ubifs_is_mounted(void);
  42. void cmd_ubifs_umount(void);
  43. #endif
  44. static void ubi_dump_vol_info(const struct ubi_volume *vol)
  45. {
  46. ubi_msg("volume information dump:");
  47. ubi_msg("vol_id %d", vol->vol_id);
  48. ubi_msg("reserved_pebs %d", vol->reserved_pebs);
  49. ubi_msg("alignment %d", vol->alignment);
  50. ubi_msg("data_pad %d", vol->data_pad);
  51. ubi_msg("vol_type %d", vol->vol_type);
  52. ubi_msg("name_len %d", vol->name_len);
  53. ubi_msg("usable_leb_size %d", vol->usable_leb_size);
  54. ubi_msg("used_ebs %d", vol->used_ebs);
  55. ubi_msg("used_bytes %lld", vol->used_bytes);
  56. ubi_msg("last_eb_bytes %d", vol->last_eb_bytes);
  57. ubi_msg("corrupted %d", vol->corrupted);
  58. ubi_msg("upd_marker %d", vol->upd_marker);
  59. if (vol->name_len <= UBI_VOL_NAME_MAX &&
  60. strnlen(vol->name, vol->name_len + 1) == vol->name_len) {
  61. ubi_msg("name %s", vol->name);
  62. } else {
  63. ubi_msg("the 1st 5 characters of the name: %c%c%c%c%c",
  64. vol->name[0], vol->name[1], vol->name[2],
  65. vol->name[3], vol->name[4]);
  66. }
  67. printf("\n");
  68. }
  69. static void display_volume_info(struct ubi_device *ubi)
  70. {
  71. int i;
  72. for (i = 0; i < (ubi->vtbl_slots + 1); i++) {
  73. if (!ubi->volumes[i])
  74. continue; /* Empty record */
  75. ubi_dump_vol_info(ubi->volumes[i]);
  76. }
  77. }
  78. static void display_ubi_info(struct ubi_device *ubi)
  79. {
  80. ubi_msg("MTD device name: \"%s\"", ubi->mtd->name);
  81. ubi_msg("MTD device size: %llu MiB", ubi->flash_size >> 20);
  82. ubi_msg("physical eraseblock size: %d bytes (%d KiB)",
  83. ubi->peb_size, ubi->peb_size >> 10);
  84. ubi_msg("logical eraseblock size: %d bytes", ubi->leb_size);
  85. ubi_msg("number of good PEBs: %d", ubi->good_peb_count);
  86. ubi_msg("number of bad PEBs: %d", ubi->bad_peb_count);
  87. ubi_msg("smallest flash I/O unit: %d", ubi->min_io_size);
  88. ubi_msg("VID header offset: %d (aligned %d)",
  89. ubi->vid_hdr_offset, ubi->vid_hdr_aloffset);
  90. ubi_msg("data offset: %d", ubi->leb_start);
  91. ubi_msg("max. allowed volumes: %d", ubi->vtbl_slots);
  92. ubi_msg("wear-leveling threshold: %d", CONFIG_MTD_UBI_WL_THRESHOLD);
  93. ubi_msg("number of internal volumes: %d", UBI_INT_VOL_COUNT);
  94. ubi_msg("number of user volumes: %d",
  95. ubi->vol_count - UBI_INT_VOL_COUNT);
  96. ubi_msg("available PEBs: %d", ubi->avail_pebs);
  97. ubi_msg("total number of reserved PEBs: %d", ubi->rsvd_pebs);
  98. ubi_msg("number of PEBs reserved for bad PEB handling: %d",
  99. ubi->beb_rsvd_pebs);
  100. ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec);
  101. }
  102. static int ubi_info(int layout)
  103. {
  104. if (layout)
  105. display_volume_info(ubi);
  106. else
  107. display_ubi_info(ubi);
  108. return 0;
  109. }
  110. static int ubi_check_volumename(const struct ubi_volume *vol, char *name)
  111. {
  112. return strcmp(vol->name, name);
  113. }
  114. static int ubi_check(char *name)
  115. {
  116. int i;
  117. for (i = 0; i < (ubi->vtbl_slots + 1); i++) {
  118. if (!ubi->volumes[i])
  119. continue; /* Empty record */
  120. if (!ubi_check_volumename(ubi->volumes[i], name))
  121. return 0;
  122. }
  123. return -EEXIST;
  124. }
  125. static int verify_mkvol_req(const struct ubi_device *ubi,
  126. const struct ubi_mkvol_req *req)
  127. {
  128. int n, err = EINVAL;
  129. if (req->bytes < 0 || req->alignment < 0 || req->vol_type < 0 ||
  130. req->name_len < 0)
  131. goto bad;
  132. if ((req->vol_id < 0 || req->vol_id >= ubi->vtbl_slots) &&
  133. req->vol_id != UBI_VOL_NUM_AUTO)
  134. goto bad;
  135. if (req->alignment == 0)
  136. goto bad;
  137. if (req->bytes == 0) {
  138. printf("No space left in UBI device!\n");
  139. err = ENOMEM;
  140. goto bad;
  141. }
  142. if (req->vol_type != UBI_DYNAMIC_VOLUME &&
  143. req->vol_type != UBI_STATIC_VOLUME)
  144. goto bad;
  145. if (req->alignment > ubi->leb_size)
  146. goto bad;
  147. n = req->alignment % ubi->min_io_size;
  148. if (req->alignment != 1 && n)
  149. goto bad;
  150. if (req->name_len > UBI_VOL_NAME_MAX) {
  151. printf("Name too long!\n");
  152. err = ENAMETOOLONG;
  153. goto bad;
  154. }
  155. return 0;
  156. bad:
  157. return err;
  158. }
  159. static int ubi_create_vol(char *volume, int64_t size, int dynamic)
  160. {
  161. struct ubi_mkvol_req req;
  162. int err;
  163. if (dynamic)
  164. req.vol_type = UBI_DYNAMIC_VOLUME;
  165. else
  166. req.vol_type = UBI_STATIC_VOLUME;
  167. req.vol_id = UBI_VOL_NUM_AUTO;
  168. req.alignment = 1;
  169. req.bytes = size;
  170. strcpy(req.name, volume);
  171. req.name_len = strlen(volume);
  172. req.name[req.name_len] = '\0';
  173. req.padding1 = 0;
  174. /* It's duplicated at drivers/mtd/ubi/cdev.c */
  175. err = verify_mkvol_req(ubi, &req);
  176. if (err) {
  177. printf("verify_mkvol_req failed %d\n", err);
  178. return err;
  179. }
  180. printf("Creating %s volume %s of size %lld\n",
  181. dynamic ? "dynamic" : "static", volume, size);
  182. /* Call real ubi create volume */
  183. return ubi_create_volume(ubi, &req);
  184. }
  185. static struct ubi_volume *ubi_find_volume(char *volume)
  186. {
  187. struct ubi_volume *vol = NULL;
  188. int i;
  189. for (i = 0; i < ubi->vtbl_slots; i++) {
  190. vol = ubi->volumes[i];
  191. if (vol && !strcmp(vol->name, volume))
  192. return vol;
  193. }
  194. printf("Volume %s not found!\n", volume);
  195. return NULL;
  196. }
  197. static int ubi_remove_vol(char *volume)
  198. {
  199. int err, reserved_pebs, i;
  200. struct ubi_volume *vol;
  201. vol = ubi_find_volume(volume);
  202. if (vol == NULL)
  203. return ENODEV;
  204. printf("Remove UBI volume %s (id %d)\n", vol->name, vol->vol_id);
  205. if (ubi->ro_mode) {
  206. printf("It's read-only mode\n");
  207. err = EROFS;
  208. goto out_err;
  209. }
  210. err = ubi_change_vtbl_record(ubi, vol->vol_id, NULL);
  211. if (err) {
  212. printf("Error changing Vol tabel record err=%x\n", err);
  213. goto out_err;
  214. }
  215. reserved_pebs = vol->reserved_pebs;
  216. for (i = 0; i < vol->reserved_pebs; i++) {
  217. err = ubi_eba_unmap_leb(ubi, vol, i);
  218. if (err)
  219. goto out_err;
  220. }
  221. kfree(vol->eba_tbl);
  222. ubi->volumes[vol->vol_id]->eba_tbl = NULL;
  223. ubi->volumes[vol->vol_id] = NULL;
  224. ubi->rsvd_pebs -= reserved_pebs;
  225. ubi->avail_pebs += reserved_pebs;
  226. i = ubi->beb_rsvd_level - ubi->beb_rsvd_pebs;
  227. if (i > 0) {
  228. i = ubi->avail_pebs >= i ? i : ubi->avail_pebs;
  229. ubi->avail_pebs -= i;
  230. ubi->rsvd_pebs += i;
  231. ubi->beb_rsvd_pebs += i;
  232. if (i > 0)
  233. ubi_msg("reserve more %d PEBs", i);
  234. }
  235. ubi->vol_count -= 1;
  236. return 0;
  237. out_err:
  238. ubi_err("cannot remove volume %s, error %d", volume, err);
  239. if (err < 0)
  240. err = -err;
  241. return err;
  242. }
  243. static int ubi_volume_continue_write(char *volume, void *buf, size_t size)
  244. {
  245. int err = 1;
  246. struct ubi_volume *vol;
  247. vol = ubi_find_volume(volume);
  248. if (vol == NULL)
  249. return ENODEV;
  250. err = ubi_more_update_data(ubi, vol, buf, size);
  251. if (err < 0) {
  252. printf("Couldnt or partially wrote data\n");
  253. return -err;
  254. }
  255. if (err) {
  256. size = err;
  257. err = ubi_check_volume(ubi, vol->vol_id);
  258. if (err < 0)
  259. return -err;
  260. if (err) {
  261. ubi_warn("volume %d on UBI device %d is corrupted",
  262. vol->vol_id, ubi->ubi_num);
  263. vol->corrupted = 1;
  264. }
  265. vol->checked = 1;
  266. ubi_gluebi_updated(vol);
  267. }
  268. return 0;
  269. }
  270. int ubi_volume_begin_write(char *volume, void *buf, size_t size,
  271. size_t full_size)
  272. {
  273. int err = 1;
  274. int rsvd_bytes = 0;
  275. struct ubi_volume *vol;
  276. vol = ubi_find_volume(volume);
  277. if (vol == NULL)
  278. return ENODEV;
  279. rsvd_bytes = vol->reserved_pebs * (ubi->leb_size - vol->data_pad);
  280. if (size < 0 || size > rsvd_bytes) {
  281. printf("size > volume size! Aborting!\n");
  282. return EINVAL;
  283. }
  284. err = ubi_start_update(ubi, vol, full_size);
  285. if (err < 0) {
  286. printf("Cannot start volume update\n");
  287. return -err;
  288. }
  289. return ubi_volume_continue_write(volume, buf, size);
  290. }
  291. int ubi_volume_write(char *volume, void *buf, size_t size)
  292. {
  293. return ubi_volume_begin_write(volume, buf, size, size);
  294. }
  295. int ubi_volume_read(char *volume, char *buf, size_t size)
  296. {
  297. int err, lnum, off, len, tbuf_size;
  298. void *tbuf;
  299. unsigned long long tmp;
  300. struct ubi_volume *vol;
  301. loff_t offp = 0;
  302. vol = ubi_find_volume(volume);
  303. if (vol == NULL)
  304. return ENODEV;
  305. if (vol->updating) {
  306. printf("updating");
  307. return EBUSY;
  308. }
  309. if (vol->upd_marker) {
  310. printf("damaged volume, update marker is set");
  311. return EBADF;
  312. }
  313. if (offp == vol->used_bytes)
  314. return 0;
  315. if (size == 0) {
  316. printf("No size specified -> Using max size (%lld)\n", vol->used_bytes);
  317. size = vol->used_bytes;
  318. }
  319. if (vol->corrupted)
  320. printf("read from corrupted volume %d", vol->vol_id);
  321. if (offp + size > vol->used_bytes)
  322. size = vol->used_bytes - offp;
  323. tbuf_size = vol->usable_leb_size;
  324. if (size < tbuf_size)
  325. tbuf_size = ALIGN(size, ubi->min_io_size);
  326. tbuf = malloc(tbuf_size);
  327. if (!tbuf) {
  328. printf("NO MEM\n");
  329. return ENOMEM;
  330. }
  331. len = size > tbuf_size ? tbuf_size : size;
  332. tmp = offp;
  333. off = do_div(tmp, vol->usable_leb_size);
  334. lnum = tmp;
  335. do {
  336. if (off + len >= vol->usable_leb_size)
  337. len = vol->usable_leb_size - off;
  338. err = ubi_eba_read_leb(ubi, vol, lnum, tbuf, off, len, 0);
  339. if (err) {
  340. printf("read err %x\n", err);
  341. err = -err;
  342. break;
  343. }
  344. off += len;
  345. if (off == vol->usable_leb_size) {
  346. lnum += 1;
  347. off -= vol->usable_leb_size;
  348. }
  349. size -= len;
  350. offp += len;
  351. memcpy(buf, tbuf, len);
  352. buf += len;
  353. len = size > tbuf_size ? tbuf_size : size;
  354. } while (size);
  355. free(tbuf);
  356. return err;
  357. }
  358. static int ubi_dev_scan(struct mtd_info *info, char *ubidev,
  359. const char *vid_header_offset)
  360. {
  361. struct mtd_device *dev;
  362. struct part_info *part;
  363. struct mtd_partition mtd_part;
  364. char ubi_mtd_param_buffer[80];
  365. u8 pnum;
  366. int err;
  367. if (find_dev_and_part(ubidev, &dev, &pnum, &part) != 0)
  368. return 1;
  369. sprintf(buffer, "mtd=%d", pnum);
  370. memset(&mtd_part, 0, sizeof(mtd_part));
  371. mtd_part.name = buffer;
  372. mtd_part.size = part->size;
  373. mtd_part.offset = part->offset;
  374. add_mtd_partitions(info, &mtd_part, 1);
  375. strcpy(ubi_mtd_param_buffer, buffer);
  376. if (vid_header_offset)
  377. sprintf(ubi_mtd_param_buffer, "mtd=%d,%s", pnum,
  378. vid_header_offset);
  379. err = ubi_mtd_param_parse(ubi_mtd_param_buffer, NULL);
  380. if (err) {
  381. del_mtd_partitions(info);
  382. return -err;
  383. }
  384. err = ubi_init();
  385. if (err) {
  386. del_mtd_partitions(info);
  387. return -err;
  388. }
  389. ubi_initialized = 1;
  390. return 0;
  391. }
  392. int ubi_part(char *part_name, const char *vid_header_offset)
  393. {
  394. int err = 0;
  395. char mtd_dev[16];
  396. struct mtd_device *dev;
  397. struct part_info *part;
  398. u8 pnum;
  399. if (mtdparts_init() != 0) {
  400. printf("Error initializing mtdparts!\n");
  401. return 1;
  402. }
  403. #ifdef CONFIG_CMD_UBIFS
  404. /*
  405. * Automatically unmount UBIFS partition when user
  406. * changes the UBI device. Otherwise the following
  407. * UBIFS commands will crash.
  408. */
  409. if (ubifs_is_mounted())
  410. cmd_ubifs_umount();
  411. #endif
  412. /* todo: get dev number for NAND... */
  413. ubi_dev.nr = 0;
  414. /*
  415. * Call ubi_exit() before re-initializing the UBI subsystem
  416. */
  417. if (ubi_initialized) {
  418. ubi_exit();
  419. del_mtd_partitions(ubi_dev.mtd_info);
  420. }
  421. /*
  422. * Search the mtd device number where this partition
  423. * is located
  424. */
  425. if (find_dev_and_part(part_name, &dev, &pnum, &part)) {
  426. printf("Partition %s not found!\n", part_name);
  427. return 1;
  428. }
  429. sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(dev->id->type), dev->id->num);
  430. ubi_dev.mtd_info = get_mtd_device_nm(mtd_dev);
  431. if (IS_ERR(ubi_dev.mtd_info)) {
  432. printf("Partition %s not found on device %s!\n", part_name,
  433. mtd_dev);
  434. return 1;
  435. }
  436. ubi_dev.selected = 1;
  437. strcpy(ubi_dev.part_name, part_name);
  438. err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name,
  439. vid_header_offset);
  440. if (err) {
  441. printf("UBI init error %d\n", err);
  442. ubi_dev.selected = 0;
  443. return err;
  444. }
  445. ubi = ubi_devices[0];
  446. return 0;
  447. }
  448. static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
  449. {
  450. int64_t size = 0;
  451. ulong addr = 0;
  452. if (argc < 2)
  453. return CMD_RET_USAGE;
  454. if (strcmp(argv[1], "part") == 0) {
  455. const char *vid_header_offset = NULL;
  456. /* Print current partition */
  457. if (argc == 2) {
  458. if (!ubi_dev.selected) {
  459. printf("Error, no UBI device/partition selected!\n");
  460. return 1;
  461. }
  462. printf("Device %d: %s, partition %s\n",
  463. ubi_dev.nr, ubi_dev.mtd_info->name, ubi_dev.part_name);
  464. return 0;
  465. }
  466. if (argc < 3)
  467. return CMD_RET_USAGE;
  468. if (argc > 3)
  469. vid_header_offset = argv[3];
  470. return ubi_part(argv[2], vid_header_offset);
  471. }
  472. if ((strcmp(argv[1], "part") != 0) && (!ubi_dev.selected)) {
  473. printf("Error, no UBI device/partition selected!\n");
  474. return 1;
  475. }
  476. if (strcmp(argv[1], "info") == 0) {
  477. int layout = 0;
  478. if (argc > 2 && !strncmp(argv[2], "l", 1))
  479. layout = 1;
  480. return ubi_info(layout);
  481. }
  482. if (strcmp(argv[1], "check") == 0) {
  483. if (argc > 2)
  484. return ubi_check(argv[2]);
  485. printf("Error, no volume name passed\n");
  486. return 1;
  487. }
  488. if (strncmp(argv[1], "create", 6) == 0) {
  489. int dynamic = 1; /* default: dynamic volume */
  490. /* Use maximum available size */
  491. size = 0;
  492. /* E.g., create volume size type */
  493. if (argc == 5) {
  494. if (strncmp(argv[4], "s", 1) == 0)
  495. dynamic = 0;
  496. else if (strncmp(argv[4], "d", 1) != 0) {
  497. printf("Incorrect type\n");
  498. return 1;
  499. }
  500. argc--;
  501. }
  502. /* E.g., create volume size */
  503. if (argc == 4) {
  504. size = simple_strtoull(argv[3], NULL, 16);
  505. argc--;
  506. }
  507. /* Use maximum available size */
  508. if (!size) {
  509. size = (int64_t)ubi->avail_pebs * ubi->leb_size;
  510. printf("No size specified -> Using max size (%lld)\n", size);
  511. }
  512. /* E.g., create volume */
  513. if (argc == 3)
  514. return ubi_create_vol(argv[2], size, dynamic);
  515. }
  516. if (strncmp(argv[1], "remove", 6) == 0) {
  517. /* E.g., remove volume */
  518. if (argc == 3)
  519. return ubi_remove_vol(argv[2]);
  520. }
  521. if (strncmp(argv[1], "write", 5) == 0) {
  522. int ret;
  523. if (argc < 5) {
  524. printf("Please see usage\n");
  525. return 1;
  526. }
  527. addr = simple_strtoul(argv[2], NULL, 16);
  528. size = simple_strtoul(argv[4], NULL, 16);
  529. if (strlen(argv[1]) == 10 &&
  530. strncmp(argv[1] + 5, ".part", 5) == 0) {
  531. if (argc < 6) {
  532. ret = ubi_volume_continue_write(argv[3],
  533. (void *)addr, size);
  534. } else {
  535. size_t full_size;
  536. full_size = simple_strtoul(argv[5], NULL, 16);
  537. ret = ubi_volume_begin_write(argv[3],
  538. (void *)addr, size, full_size);
  539. }
  540. } else {
  541. ret = ubi_volume_write(argv[3], (void *)addr, size);
  542. }
  543. if (!ret) {
  544. printf("%lld bytes written to volume %s\n", size,
  545. argv[3]);
  546. }
  547. return ret;
  548. }
  549. if (strncmp(argv[1], "read", 4) == 0) {
  550. size = 0;
  551. /* E.g., read volume size */
  552. if (argc == 5) {
  553. size = simple_strtoul(argv[4], NULL, 16);
  554. argc--;
  555. }
  556. /* E.g., read volume */
  557. if (argc == 4) {
  558. addr = simple_strtoul(argv[2], NULL, 16);
  559. argc--;
  560. }
  561. if (argc == 3) {
  562. printf("Read %lld bytes from volume %s to %lx\n", size,
  563. argv[3], addr);
  564. return ubi_volume_read(argv[3], (char *)addr, size);
  565. }
  566. }
  567. printf("Please see usage\n");
  568. return 1;
  569. }
  570. U_BOOT_CMD(
  571. ubi, 6, 1, do_ubi,
  572. "ubi commands",
  573. "part [part] [offset]\n"
  574. " - Show or set current partition (with optional VID"
  575. " header offset)\n"
  576. "ubi info [l[ayout]]"
  577. " - Display volume and ubi layout information\n"
  578. "ubi check volumename"
  579. " - check if volumename exists\n"
  580. "ubi create[vol] volume [size] [type]"
  581. " - create volume name with size\n"
  582. "ubi write[vol] address volume size"
  583. " - Write volume from address with size\n"
  584. "ubi write.part address volume size [fullsize]\n"
  585. " - Write part of a volume from address\n"
  586. "ubi read[vol] address volume [size]"
  587. " - Read volume to address with size\n"
  588. "ubi remove[vol] volume"
  589. " - Remove volume\n"
  590. "[Legends]\n"
  591. " volume: character name\n"
  592. " size: specified in bytes\n"
  593. " type: s[tatic] or d[ynamic] (default=dynamic)"
  594. );