Message ID | 1464152832-11200-3-git-send-email-hs@denx.de |
---|---|
State | Superseded |
Delegated to: | Tom Rini |
Headers | show |
On 05/25/2016 12:07 AM, Heiko Schocher wrote: > @@ -661,7 +675,9 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) > U_BOOT_CMD( > ubi, 6, 1, do_ubi, > "ubi commands", > - "part [part] [offset]\n" > + "dettach" "detach", here and elsewhere. > + " - detach ubi from a mtd partition\n" Like that. :-) -Scott P.S. When CCing me, please use oss@buserror.net so that my responses don't have to go through moderation.
Hello Scott, Am 25.05.2016 um 07:47 schrieb Scott Wood: > On 05/25/2016 12:07 AM, Heiko Schocher wrote: >> @@ -661,7 +675,9 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) >> U_BOOT_CMD( >> ubi, 6, 1, do_ubi, >> "ubi commands", >> - "part [part] [offset]\n" >> + "dettach" > > "detach", here and elsewhere. > >> + " - detach ubi from a mtd partition\n" > > Like that. :-) Thanks! Fixed. > P.S. When CCing me, please use oss@buserror.net so that my responses > don't have to go through moderation. Huh... I used the address in u-boot:/doc/git-mailrc ... changed. bye, Heiko
On 05/25/2016 01:28 AM, Heiko Schocher wrote: > Hello Scott, > > Am 25.05.2016 um 07:47 schrieb Scott Wood: >> On 05/25/2016 12:07 AM, Heiko Schocher wrote: >>> @@ -661,7 +675,9 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) >>> U_BOOT_CMD( >>> ubi, 6, 1, do_ubi, >>> "ubi commands", >>> - "part [part] [offset]\n" >>> + "dettach" >> >> "detach", here and elsewhere. >> >>> + " - detach ubi from a mtd partition\n" >> >> Like that. :-) > > Thanks! Fixed. > >> P.S. When CCing me, please use oss@buserror.net so that my responses >> don't have to go through moderation. > > Huh... I used the address in u-boot:/doc/git-mailrc ... > changed. I changed it in MAINTAINERS... didn't realize there was another place I needed to change it. I'll send a patch to update that. -Scott
diff --git a/cmd/ubi.c b/cmd/ubi.c index 753a4db..bf5da42 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -443,14 +443,8 @@ static int ubi_dev_scan(struct mtd_info *info, char *ubidev, return 0; } -int ubi_part(char *part_name, const char *vid_header_offset) +int ubi_dettach(void) { - int err = 0; - char mtd_dev[16]; - struct mtd_device *dev; - struct part_info *part; - u8 pnum; - if (mtdparts_init() != 0) { printf("Error initializing mtdparts!\n"); return 1; @@ -466,17 +460,28 @@ int ubi_part(char *part_name, const char *vid_header_offset) cmd_ubifs_umount(); #endif - /* todo: get dev number for NAND... */ - ubi_dev.nr = 0; - /* * Call ubi_exit() before re-initializing the UBI subsystem */ if (ubi_initialized) { ubi_exit(); del_mtd_partitions(ubi_dev.mtd_info); + ubi_initialized = 0; } + ubi_dev.selected = 0; + return 0; +} + +int ubi_part(char *part_name, const char *vid_header_offset) +{ + int err = 0; + char mtd_dev[16]; + struct mtd_device *dev; + struct part_info *part; + u8 pnum; + + ubi_dettach(); /* * Search the mtd device number where this partition * is located @@ -517,6 +522,15 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (argc < 2) return CMD_RET_USAGE; + + if (strcmp(argv[1], "dettach") == 0) { + if (argc < 2) + return CMD_RET_USAGE; + + return ubi_dettach(); + } + + if (strcmp(argv[1], "part") == 0) { const char *vid_header_offset = NULL; @@ -661,7 +675,9 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) U_BOOT_CMD( ubi, 6, 1, do_ubi, "ubi commands", - "part [part] [offset]\n" + "dettach" + " - detach ubi from a mtd partition\n" + "ubi part [part] [offset]\n" " - Show or set current partition (with optional VID" " header offset)\n" "ubi info [l[ayout]]"
simple detachs ubi fram the mtd partition. Signed-off-by: Heiko Schocher <hs@denx.de> --- cmd/ubi.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-)