From patchwork Thu Sep 12 14:41:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Roese X-Patchwork-Id: 1161651 X-Patchwork-Delegate: hs@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46ThLN2sqBz9s00 for ; Fri, 13 Sep 2019 00:42:04 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B5397C21EC8; Thu, 12 Sep 2019 14:41:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 089CEC21E7E; Thu, 12 Sep 2019 14:41:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 45B4CC21DB5; Thu, 12 Sep 2019 14:41:09 +0000 (UTC) Received: from mx1.mailbox.org (mx1.mailbox.org [80.241.60.212]) by lists.denx.de (Postfix) with ESMTPS id AB668C21DB5 for ; Thu, 12 Sep 2019 14:41:07 +0000 (UTC) Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 97B234DE05; Thu, 12 Sep 2019 16:41:07 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter04.heinlein-hosting.de (spamfilter04.heinlein-hosting.de [80.241.56.122]) (amavisd-new, port 10030) with ESMTP id swQ7o64eHk97; Thu, 12 Sep 2019 16:41:04 +0200 (CEST) From: Stefan Roese To: u-boot@lists.denx.de Date: Thu, 12 Sep 2019 16:41:03 +0200 Message-Id: <20190912144103.17261-3-sr@denx.de> In-Reply-To: <20190912144103.17261-1-sr@denx.de> References: <20190912144103.17261-1-sr@denx.de> MIME-Version: 1.0 Cc: Boris Brezillon , Quentin Schulz Subject: [U-Boot] [PATCH 3/3] ubi: Add "skipcheck" command to set/clear this bit in the UBI volume hdr X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" U-Boot now supports the "skip_check" flag to optionally skip the CRC check at open time. Currently its only possible to set this bit upon UBI volume creation. But it might be very useful to also set this bit on already installed systems (e.g. field upgrade) to make also use of the boot-time decrease on those systems. This patch now adds a new "ubi" command "ubi skipcheck" to set or clear this bit in the UBI volume header: => ubi skipcheck rootfs0 on Setting skip_check on volume rootfs0 BTW: This saves approx. 10 seconds Linux bootup time on a MT7688 based target with 128MiB of SPI NAND. Signed-off-by: Stefan Roese Cc: Quentin Schulz Cc: Boris Brezillon Cc: Heiko Schocher Reviewed-by: Heiko Schocher --- cmd/ubi.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cmd/ubi.c b/cmd/ubi.c index c857f07d93..42b5641b32 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -419,6 +419,30 @@ static int ubi_dev_scan(struct mtd_info *info, const char *vid_header_offset) return 0; } +static int ubi_set_skip_check(char *volume, bool skip_check) +{ + struct ubi_vtbl_record vtbl_rec; + struct ubi_volume *vol; + + vol = ubi_find_volume(volume); + if (vol == NULL) + return ENODEV; + + printf("%sing skip_check on volume %s\n", + skip_check ? "Sett" : "Clear", volume); + + vtbl_rec = ubi->vtbl[vol->vol_id]; + if (skip_check) { + vtbl_rec.flags |= UBI_VTBL_SKIP_CRC_CHECK_FLG; + vol->skip_check = 1; + } else { + vtbl_rec.flags &= ~UBI_VTBL_SKIP_CRC_CHECK_FLG; + vol->skip_check = 0; + } + + return ubi_change_vtbl_record(ubi, vol->vol_id, &vtbl_rec); +} + static int ubi_detach(void) { #ifdef CONFIG_CMD_UBIFS @@ -578,6 +602,14 @@ static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return ubi_remove_vol(argv[2]); } + if (strncmp(argv[1], "skipcheck", 9) == 0) { + /* E.g., change skip_check flag */ + if (argc == 4) { + skipcheck = strncmp(argv[3], "on", 2) == 0; + return ubi_set_skip_check(argv[2], skipcheck); + } + } + if (strncmp(argv[1], "write", 5) == 0) { int ret; @@ -658,6 +690,8 @@ U_BOOT_CMD( " - Read volume to address with size\n" "ubi remove[vol] volume" " - Remove volume\n" + "ubi skipcheck volume on/off" + " - Set or clear skip_check flag in volume header\n" "[Legends]\n" " volume: character name\n" " size: specified in bytes\n"