From patchwork Tue Sep 13 05:14:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ladislav Michl X-Patchwork-Id: 672152 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3sdbXs07Fwz9sD6 for ; Tue, 20 Sep 2016 18:30:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7001C4B98B; Tue, 20 Sep 2016 10:30:02 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3LoUi06K4sft; Tue, 20 Sep 2016 10:30:02 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1BC194B811; Tue, 20 Sep 2016 10:30:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 686364B811 for ; Tue, 20 Sep 2016 10:29:58 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1GZDkficod25 for ; Tue, 20 Sep 2016 10:29:58 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by theia.denx.de (Postfix) with ESMTP id 324694A039 for ; Tue, 20 Sep 2016 10:29:55 +0200 (CEST) Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23991344AbcITI3yoLU20 (ORCPT ); Tue, 20 Sep 2016 10:29:54 +0200 Resent-Sender: Ladislav Michl Resent-From: Ladislav Michl Resent-Date: Tue, 20 Sep 2016 10:29:47 +0200 Resent-Message-ID: <20160920082947.GA28236@localhost.localdomain> Resent-To: U-Boot Mailing List , Stefan Roese , Kyungmin Park , Scott Wood , Tom Rini Date: Tue, 13 Sep 2016 07:14:01 +0200 From: Ladislav Michl To: U-Boot Mailing List Message-ID: <20160913051401.GA857@localhost.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Cc: Scott Wood , Tom Rini , Stefan Roese , Kyungmin Park Subject: [U-Boot] [PATCH] cmd: ubi: add option to specify volume id X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Signed-off-by: Ladislav Michl diff --git a/cmd/ubi.c b/cmd/ubi.c index 4a92d84..b66bc62 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -162,7 +162,7 @@ bad: return err; } -static int ubi_create_vol(char *volume, int64_t size, int dynamic) +static int ubi_create_vol(char *volume, int64_t size, int dynamic, int vol_id) { struct ubi_mkvol_req req; int err; @@ -172,7 +172,7 @@ static int ubi_create_vol(char *volume, int64_t size, int dynamic) else req.vol_type = UBI_STATIC_VOLUME; - req.vol_id = UBI_VOL_NUM_AUTO; + req.vol_id = vol_id; req.alignment = 1; req.bytes = size; @@ -577,10 +577,17 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) if (strncmp(argv[1], "create", 6) == 0) { int dynamic = 1; /* default: dynamic volume */ + int id = UBI_VOL_NUM_AUTO; /* Use maximum available size */ size = 0; + /* E.g., create volume size type vol_id */ + if (argc == 6) { + id = simple_strtoull(argv[5], NULL, 16); + argc--; + } + /* E.g., create volume size type */ if (argc == 5) { if (strncmp(argv[4], "s", 1) == 0) @@ -603,7 +610,7 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } /* E.g., create volume */ if (argc == 3) - return ubi_create_vol(argv[2], size, dynamic); + return ubi_create_vol(argv[2], size, dynamic, id); } if (strncmp(argv[1], "remove", 6) == 0) { @@ -684,7 +691,7 @@ U_BOOT_CMD( " - Display volume and ubi layout information\n" "ubi check volumename" " - check if volumename exists\n" - "ubi create[vol] volume [size] [type]" + "ubi create[vol] volume [size] [type] [id]" " - create volume name with size\n" "ubi write[vol] address volume size" " - Write volume from address with size\n"