ubi.c 16 KB

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