ubi.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  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. printf("Rename UBI volume %s to %s\n", oldname, newname);
  225. if (ubi->ro_mode) {
  226. printf("%s: ubi device is in read-only mode\n", __func__);
  227. return EROFS;
  228. }
  229. rename.new_name_len = strlen(newname);
  230. strcpy(rename.new_name, newname);
  231. rename.remove = 0;
  232. desc.vol = vol;
  233. desc.mode = 0;
  234. rename.desc = &desc;
  235. INIT_LIST_HEAD(&rename.list);
  236. INIT_LIST_HEAD(&list);
  237. list_add(&rename.list, &list);
  238. return ubi_rename_volumes(ubi, &list);
  239. }
  240. static int ubi_volume_continue_write(char *volume, void *buf, size_t size)
  241. {
  242. int err = 1;
  243. struct ubi_volume *vol;
  244. vol = ubi_find_volume(volume);
  245. if (vol == NULL)
  246. return ENODEV;
  247. err = ubi_more_update_data(ubi, vol, buf, size);
  248. if (err < 0) {
  249. printf("Couldnt or partially wrote data\n");
  250. return -err;
  251. }
  252. if (err) {
  253. size = err;
  254. err = ubi_check_volume(ubi, vol->vol_id);
  255. if (err < 0)
  256. return -err;
  257. if (err) {
  258. ubi_warn(ubi, "volume %d on UBI device %d is corrupt",
  259. vol->vol_id, ubi->ubi_num);
  260. vol->corrupted = 1;
  261. }
  262. vol->checked = 1;
  263. ubi_gluebi_updated(vol);
  264. }
  265. return 0;
  266. }
  267. int ubi_volume_begin_write(char *volume, void *buf, size_t size,
  268. size_t full_size)
  269. {
  270. int err = 1;
  271. int rsvd_bytes = 0;
  272. struct ubi_volume *vol;
  273. vol = ubi_find_volume(volume);
  274. if (vol == NULL)
  275. return ENODEV;
  276. rsvd_bytes = vol->reserved_pebs * (ubi->leb_size - vol->data_pad);
  277. if (size > rsvd_bytes) {
  278. printf("size > volume size! Aborting!\n");
  279. return EINVAL;
  280. }
  281. err = ubi_start_update(ubi, vol, full_size);
  282. if (err < 0) {
  283. printf("Cannot start volume update\n");
  284. return -err;
  285. }
  286. return ubi_volume_continue_write(volume, buf, size);
  287. }
  288. int ubi_volume_write(char *volume, void *buf, size_t size)
  289. {
  290. return ubi_volume_begin_write(volume, buf, size, size);
  291. }
  292. int ubi_volume_read(char *volume, char *buf, size_t size)
  293. {
  294. int err, lnum, off, len, tbuf_size;
  295. void *tbuf;
  296. unsigned long long tmp;
  297. struct ubi_volume *vol;
  298. loff_t offp = 0;
  299. size_t len_read;
  300. vol = ubi_find_volume(volume);
  301. if (vol == NULL)
  302. return ENODEV;
  303. if (vol->updating) {
  304. printf("updating");
  305. return EBUSY;
  306. }
  307. if (vol->upd_marker) {
  308. printf("damaged volume, update marker is set");
  309. return EBADF;
  310. }
  311. if (offp == vol->used_bytes)
  312. return 0;
  313. if (size == 0) {
  314. printf("No size specified -> Using max size (%lld)\n", vol->used_bytes);
  315. size = vol->used_bytes;
  316. }
  317. printf("Read %zu bytes from volume %s to %p\n", size, volume, buf);
  318. if (vol->corrupted)
  319. printf("read from corrupted volume %d", vol->vol_id);
  320. if (offp + size > vol->used_bytes)
  321. size = vol->used_bytes - offp;
  322. tbuf_size = vol->usable_leb_size;
  323. if (size < tbuf_size)
  324. tbuf_size = ALIGN(size, ubi->min_io_size);
  325. tbuf = malloc_cache_aligned(tbuf_size);
  326. if (!tbuf) {
  327. printf("NO MEM\n");
  328. return ENOMEM;
  329. }
  330. len = size > tbuf_size ? tbuf_size : size;
  331. tmp = offp;
  332. off = do_div(tmp, vol->usable_leb_size);
  333. lnum = tmp;
  334. len_read = size;
  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. if (!size)
  356. env_set_hex("filesize", len_read);
  357. free(tbuf);
  358. return err;
  359. }
  360. static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset)
  361. {
  362. char ubi_mtd_param_buffer[80];
  363. int err;
  364. if (!vid_header_offset)
  365. sprintf(ubi_mtd_param_buffer, "%s", info->name);
  366. else
  367. sprintf(ubi_mtd_param_buffer, "%s,%s", info->name,
  368. vid_header_offset);
  369. err = ubi_mtd_param_parse(ubi_mtd_param_buffer, NULL);
  370. if (err)
  371. return -err;
  372. err = ubi_init();
  373. if (err)
  374. return -err;
  375. return 0;
  376. }
  377. static int ubi_set_skip_check(char *volume, bool skip_check)
  378. {
  379. struct ubi_vtbl_record vtbl_rec;
  380. struct ubi_volume *vol;
  381. vol = ubi_find_volume(volume);
  382. if (!vol)
  383. return ENODEV;
  384. printf("%sing skip_check on volume %s\n",
  385. skip_check ? "Sett" : "Clear", volume);
  386. vtbl_rec = ubi->vtbl[vol->vol_id];
  387. if (skip_check) {
  388. vtbl_rec.flags |= UBI_VTBL_SKIP_CRC_CHECK_FLG;
  389. vol->skip_check = 1;
  390. } else {
  391. vtbl_rec.flags &= ~UBI_VTBL_SKIP_CRC_CHECK_FLG;
  392. vol->skip_check = 0;
  393. }
  394. return ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec);
  395. }
  396. static int ubi_detach(void)
  397. {
  398. #ifdef CONFIG_CMD_UBIFS
  399. /*
  400. * Automatically unmount UBIFS partition when user
  401. * changes the UBI device. Otherwise the following
  402. * UBIFS commands will crash.
  403. */
  404. if (ubifs_is_mounted())
  405. cmd_ubifs_umount();
  406. #endif
  407. /*
  408. * Call ubi_exit() before re-initializing the UBI subsystem
  409. */
  410. if (ubi)
  411. ubi_exit();
  412. ubi = NULL;
  413. return 0;
  414. }
  415. int ubi_part(char *part_name, const char *vid_header_offset)
  416. {
  417. struct mtd_info *mtd;
  418. int err = 0;
  419. ubi_detach();
  420. mtd_probe_devices();
  421. mtd = get_mtd_device_nm(part_name);
  422. if (IS_ERR(mtd)) {
  423. printf("Partition %s not found!\n", part_name);
  424. return 1;
  425. }
  426. put_mtd_device(mtd);
  427. err = ubi_dev_scan(mtd, vid_header_offset);
  428. if (err) {
  429. printf("UBI init error %d\n", err);
  430. printf("Please check, if the correct MTD partition is used (size big enough?)\n");
  431. return err;
  432. }
  433. ubi = ubi_devices[0];
  434. return 0;
  435. }
  436. static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
  437. {
  438. int64_t size = 0;
  439. ulong addr = 0;
  440. bool skipcheck = false;
  441. if (argc < 2)
  442. return CMD_RET_USAGE;
  443. if (strcmp(argv[1], "detach") == 0)
  444. return ubi_detach();
  445. if (strcmp(argv[1], "part") == 0) {
  446. const char *vid_header_offset = NULL;
  447. /* Print current partition */
  448. if (argc == 2) {
  449. if (!ubi) {
  450. printf("Error, no UBI device selected!\n");
  451. return 1;
  452. }
  453. printf("Device %d: %s, MTD partition %s\n",
  454. ubi->ubi_num, ubi->ubi_name, ubi->mtd->name);
  455. return 0;
  456. }
  457. if (argc < 3)
  458. return CMD_RET_USAGE;
  459. if (argc > 3)
  460. vid_header_offset = argv[3];
  461. return ubi_part(argv[2], vid_header_offset);
  462. }
  463. if ((strcmp(argv[1], "part") != 0) && !ubi) {
  464. printf("Error, no UBI device selected!\n");
  465. return 1;
  466. }
  467. if (strcmp(argv[1], "info") == 0) {
  468. int layout = 0;
  469. if (argc > 2 && !strncmp(argv[2], "l", 1))
  470. layout = 1;
  471. return ubi_info(layout);
  472. }
  473. if (strcmp(argv[1], "check") == 0) {
  474. if (argc > 2)
  475. return ubi_check(argv[2]);
  476. printf("Error, no volume name passed\n");
  477. return 1;
  478. }
  479. if (strncmp(argv[1], "create", 6) == 0) {
  480. int dynamic = 1; /* default: dynamic volume */
  481. int id = UBI_VOL_NUM_AUTO;
  482. /* Use maximum available size */
  483. size = 0;
  484. /* E.g., create volume with "skipcheck" bit set */
  485. if (argc == 7) {
  486. skipcheck = strncmp(argv[6], "--skipcheck", 11) == 0;
  487. argc--;
  488. }
  489. /* E.g., create volume size type vol_id */
  490. if (argc == 6) {
  491. id = simple_strtoull(argv[5], NULL, 16);
  492. argc--;
  493. }
  494. /* E.g., create volume size type */
  495. if (argc == 5) {
  496. if (strncmp(argv[4], "s", 1) == 0)
  497. dynamic = 0;
  498. else if (strncmp(argv[4], "d", 1) != 0) {
  499. printf("Incorrect type\n");
  500. return 1;
  501. }
  502. argc--;
  503. }
  504. /* E.g., create volume size */
  505. if (argc == 4) {
  506. if (argv[3][0] != '-')
  507. size = simple_strtoull(argv[3], NULL, 16);
  508. argc--;
  509. }
  510. /* Use maximum available size */
  511. if (!size) {
  512. size = (int64_t)ubi->avail_pebs * ubi->leb_size;
  513. printf("No size specified -> Using max size (%lld)\n", size);
  514. }
  515. /* E.g., create volume */
  516. if (argc == 3) {
  517. return ubi_create_vol(argv[2], size, dynamic, id,
  518. skipcheck);
  519. }
  520. }
  521. if (strncmp(argv[1], "remove", 6) == 0) {
  522. /* E.g., remove volume */
  523. if (argc == 3)
  524. return ubi_remove_vol(argv[2]);
  525. }
  526. if (IS_ENABLED(CONFIG_CMD_UBI_RENAME) && !strncmp(argv[1], "rename", 6))
  527. return ubi_rename_vol(argv[2], argv[3]);
  528. if (strncmp(argv[1], "skipcheck", 9) == 0) {
  529. /* E.g., change skip_check flag */
  530. if (argc == 4) {
  531. skipcheck = strncmp(argv[3], "on", 2) == 0;
  532. return ubi_set_skip_check(argv[2], skipcheck);
  533. }
  534. }
  535. if (strncmp(argv[1], "write", 5) == 0) {
  536. int ret;
  537. if (argc < 5) {
  538. printf("Please see usage\n");
  539. return 1;
  540. }
  541. addr = simple_strtoul(argv[2], NULL, 16);
  542. size = simple_strtoul(argv[4], NULL, 16);
  543. if (strlen(argv[1]) == 10 &&
  544. strncmp(argv[1] + 5, ".part", 5) == 0) {
  545. if (argc < 6) {
  546. ret = ubi_volume_continue_write(argv[3],
  547. (void *)addr, size);
  548. } else {
  549. size_t full_size;
  550. full_size = simple_strtoul(argv[5], NULL, 16);
  551. ret = ubi_volume_begin_write(argv[3],
  552. (void *)addr, size, full_size);
  553. }
  554. } else {
  555. ret = ubi_volume_write(argv[3], (void *)addr, size);
  556. }
  557. if (!ret) {
  558. printf("%lld bytes written to volume %s\n", size,
  559. argv[3]);
  560. }
  561. return ret;
  562. }
  563. if (strncmp(argv[1], "read", 4) == 0) {
  564. size = 0;
  565. /* E.g., read volume size */
  566. if (argc == 5) {
  567. size = simple_strtoul(argv[4], NULL, 16);
  568. argc--;
  569. }
  570. /* E.g., read volume */
  571. if (argc == 4) {
  572. addr = simple_strtoul(argv[2], NULL, 16);
  573. argc--;
  574. }
  575. if (argc == 3) {
  576. return ubi_volume_read(argv[3], (char *)addr, size);
  577. }
  578. }
  579. printf("Please see usage\n");
  580. return 1;
  581. }
  582. U_BOOT_CMD(
  583. ubi, 7, 1, do_ubi,
  584. "ubi commands",
  585. "detach"
  586. " - detach ubi from a mtd partition\n"
  587. "ubi part [part] [offset]\n"
  588. " - Show or set current partition (with optional VID"
  589. " header offset)\n"
  590. "ubi info [l[ayout]]"
  591. " - Display volume and ubi layout information\n"
  592. "ubi check volumename"
  593. " - check if volumename exists\n"
  594. "ubi create[vol] volume [size] [type] [id] [--skipcheck]\n"
  595. " - create volume name with size ('-' for maximum"
  596. " available size)\n"
  597. "ubi write[vol] address volume size"
  598. " - Write volume from address with size\n"
  599. "ubi write.part address volume size [fullsize]\n"
  600. " - Write part of a volume from address\n"
  601. "ubi read[vol] address volume [size]"
  602. " - Read volume to address with size\n"
  603. "ubi remove[vol] volume"
  604. " - Remove volume\n"
  605. #if IS_ENABLED(CONFIG_CMD_UBI_RENAME)
  606. "ubi rename oldname newname\n"
  607. #endif
  608. "ubi skipcheck volume on/off - Set or clear skip_check flag in volume header\n"
  609. "[Legends]\n"
  610. " volume: character name\n"
  611. " size: specified in bytes\n"
  612. " type: s[tatic] or d[ynamic] (default=dynamic)"
  613. );