From patchwork Tue Jul 28 09:51:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337708 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=PkYsHutH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBlm0BrGz9sSd for ; Tue, 28 Jul 2020 19:51:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7B83823BC; Tue, 28 Jul 2020 11:51:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="PkYsHutH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3AC34823BF; Tue, 28 Jul 2020 11:51:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6CECA822B6 for ; Tue, 28 Jul 2020 11:51:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9nfbR000653; Tue, 28 Jul 2020 11:51:36 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=ZZXvu9q/fs9XcNqta2nZUoLSSOCpTJeVdG22x9glAWk=; b=PkYsHutHdl0XFfFgqznCf11ytl7nxByrXLHFRkq6RGvVKVN/jFYEQUuxuC/3sftc+c4W fw6g5TMts2IKZy0a7desptaEfHyGt7bq57COb28KGWBEIeZNp0nF8C4DZNnqseh4j76X jBZL4lMrWJMEubnRvzP/0X5GjG0QnKeb3IH9eTW8NdRAcl/3FdI43mEipl3pgApdcP+K R2puC9l2tNMQp3VBns8DcCKrqI9YCKXR9O1jJ7ecO1nLYwMaCAmpl0I8IHqIFSbVgOMZ mJezvhNXMrPRRtXabdh+xIw8PZPgz7dIFutBFefZZ9l1nnYWxLBOsd5PpO+pjfaU6nC5 4Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gagv5hs8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:36 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B6047100034; Tue, 28 Jul 2020 11:51:35 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A8A092A70DA; Tue, 28 Jul 2020 11:51:35 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:35 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 01/14] env: add absolute path at CONFIG_ENV_EXT4_FILE Date: Tue, 28 Jul 2020 11:51:14 +0200 Message-ID: <20200728095128.2363-2-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG5NODE2.st.com (10.75.127.14) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the absolute path to the default value of CONFIG_ENV_EXT4_FILE = "/uboot.env". This patch avoid the error : Saving Environment to EXT4... File System is consistent Please supply Absolute path Reviewed-by: Tom Rini Signed-off-by: Patrick Delaunay --- For information, it is the value used today by all the boards: dragonboard820c_defconfig:29:CONFIG_ENV_EXT4_FILE="/uboot.env" hikey960_defconfig:25:CONFIG_ENV_EXT4_FILE="/uboot.env" stm32mp15_basic_defconfig:64:CONFIG_ENV_EXT4_FILE="/uboot.env" stm32mp15_trusted_defconfig:50:CONFIG_ENV_EXT4_FILE="/uboot.env" (no changes since v1) env/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/Kconfig b/env/Kconfig index 5784136674..445e1ad341 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -473,7 +473,7 @@ config ENV_EXT4_DEVICE_AND_PART config ENV_EXT4_FILE string "Name of the EXT4 file to use for the environment" depends on ENV_IS_IN_EXT4 - default "uboot.env" + default "/uboot.env" help It's a string of the EXT4 file name. This file use to store the environment (explicit path to the file) From patchwork Tue Jul 28 09:51:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337711 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=mhpL0jiX; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBmN2tRKz9sSd for ; Tue, 28 Jul 2020 19:52:20 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C5EB3823C7; Tue, 28 Jul 2020 11:51:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="mhpL0jiX"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 36C70823B9; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id CF6E5823B9 for ; Tue, 28 Jul 2020 11:51:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9l7WJ024973; Tue, 28 Jul 2020 11:51:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=vcyJxcvUhx9F06us5xSHsbJA9ExCjb2l9dTHsanc3E0=; b=mhpL0jiXPlxDLqUtvr+ntOmokg5SAZj++CWzmXyWFZyv8CpsHYAFgjSWuk0H6AJLf8K4 tKpu1wKqes3n3ugl16mn7GGP50684u53tzPDmvd0n83VL/GJC05YfGrSEMSlZ0Q42kED 24peq3s8l41U1Y6cTI3c1oFL6JNhA7Z0HJmeEhTCTNjtXGcpCb9tDj9ku+CJHMBf2UG6 FFOE5ok3bpL7U4HLZGgDtgFP6mApKPUQPb3cErfsWERHz4NqruCYDPY5TkI4TYvRC8NW douVGCquRZ0TNmQIWn62E9T7ZNDFtIqHIEvutn64ut90PaghJLXZKg580l1M1hi33Mn8 OQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32g9v9dsa3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:37 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8789710002A; Tue, 28 Jul 2020 11:51:36 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7D75A2A70DA; Tue, 28 Jul 2020 11:51:36 +0200 (CEST) Received: from localhost (10.75.127.49) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:35 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 02/14] env: ext4: set gd->env_valid Date: Tue, 28 Jul 2020 11:51:15 +0200 Message-ID: <20200728095128.2363-3-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG2NODE1.st.com (10.75.127.4) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add a missing initialization of gd->env_valid in env_ext4_load as it is already done in some other env device. Set gd->env_valid = ENV_VALID in env_ext4_save() and env_ext4_load(). This patch allows to have a correct information in 'env info' command. Reviewed-by: Tom Rini Signed-off-by: Patrick Delaunay --- (no changes since v1) env/ext4.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/env/ext4.c b/env/ext4.c index 8e90bb71b7..ac9f126bec 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -32,6 +32,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + __weak const char *env_ext4_get_intf(void) { return (const char *)CONFIG_ENV_EXT4_INTERFACE; @@ -79,6 +81,7 @@ static int env_ext4_save(void) CONFIG_ENV_EXT4_FILE, ifname, dev, part); return 1; } + gd->env_valid = ENV_VALID; puts("done\n"); return 0; @@ -124,7 +127,11 @@ static int env_ext4_load(void) goto err_env_relocate; } - return env_import(buf, 1); + err = env_import(buf, 1); + if (!err) + gd->env_valid = ENV_VALID; + + return err; err_env_relocate: env_set_default(NULL, 0); From patchwork Tue Jul 28 09:51:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337710 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=b3TVK60L; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBm92wlsz9sT6 for ; Tue, 28 Jul 2020 19:52:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CA511823C1; Tue, 28 Jul 2020 11:51:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="b3TVK60L"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 07DA5823C5; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id C1A06823AB for ; Tue, 28 Jul 2020 11:51:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9oKSC005778; Tue, 28 Jul 2020 11:51:37 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=+JOeJFDTo+286nhqbquJtxFALrznyx9uP6BIISYEzoc=; b=b3TVK60LYSkeZ7QJwUu7nioOugMjykFNcazUGryfv/rkS11BTx3/nRUcwzjX/OnT4bV4 84Tl0XAZ7hV+T/sqtdTRYOgaDFsBhUZmZE2KszbS9jF4xbOW6mUwT9nhuR7CeqysGaEP HQjnSIGPwSUT5lqlM8b9XxJDAFwJSUYh29wO2e4rBA/yIU96b8JzsJeGfGXvvXsIqpjL VcNn85ZihduO6AP5lWaw1lrXF1EGsGlBpe3lPT1lEjZ1uweozxRFaSp9hctxsVhoYgKJ l65pcvEZnNIHPMUzLiwxTwXiPfo/ctGsWCtY3Otf/Y/Gv7Zt6nJCWn8xwTOnqjobmNbs ww== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32ga71wkgn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:37 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 53ACD100034; Tue, 28 Jul 2020 11:51:37 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 498DA2A70DA; Tue, 28 Jul 2020 11:51:37 +0200 (CEST) Received: from localhost (10.75.127.49) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:36 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 03/14] env: sf: avoid space in backend name Date: Tue, 28 Jul 2020 11:51:16 +0200 Message-ID: <20200728095128.2363-4-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG8NODE3.st.com (10.75.127.24) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Remove space in ENV backend name for SPI Flash (SF) to avoid issue with env select command. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - new env/sf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/sf.c b/env/sf.c index 3e524f2947..a059561cb0 100644 --- a/env/sf.c +++ b/env/sf.c @@ -305,7 +305,7 @@ static int env_sf_init(void) U_BOOT_ENV_LOCATION(sf) = { .location = ENVL_SPI_FLASH, - ENV_NAME("SPI Flash") + ENV_NAME("SPIFlash") .load = env_sf_load, .save = CONFIG_IS_ENABLED(SAVEENV) ? ENV_SAVE_PTR(env_sf_save) : NULL, #if defined(INITENV) && (CONFIG_ENV_ADDR != 0x0) From patchwork Tue Jul 28 09:51:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337709 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=FSHbp0ns; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBly4lmcz9sSd for ; Tue, 28 Jul 2020 19:51:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 931A1823CA; Tue, 28 Jul 2020 11:51:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="FSHbp0ns"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7C02823BC; Tue, 28 Jul 2020 11:51:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3D338823B1 for ; Tue, 28 Jul 2020 11:51:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9ngN1000659; Tue, 28 Jul 2020 11:51:38 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=dFeX2e6+sXkGdy4+8IApJgWq98hcDb6Q7pE3F1wJ2do=; b=FSHbp0nsomxrzptVjf7rvxKqM+t5toEhs4IaEXW9XM+SpnGyluIILKkymMAFvrvDiRLx Q4es3dTJZtopvytO3/lOrXC6HDmORErJio4teWJN4fjEKCt2O7lWOKBiuz5QyP5Gc8XD /Zoo/E6agcTSRTsiTWt30lG4c38hzqYy7oqPVWg0icv5SH+kIgkBkmk0mlFUr+GN3hDe c0Vnt2+zwnO2ioOYoQKZgbsXbCKSry8pDaFGLHCfDU36nCRkqwyVRw4j+cXfdVzeiUBS +IAagw2Zdc4sv6WNoJ94y9pHkbbAvsId5e7kxYJ4z/+o7b5uNwKCTpvCq23Eh1JcsTmH qw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gagv5hsc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:38 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2392210002A; Tue, 28 Jul 2020 11:51:38 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 180B32A70DA; Tue, 28 Jul 2020 11:51:38 +0200 (CEST) Received: from localhost (10.75.127.48) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:37 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 04/14] env: correctly handle env_load_prio Date: Tue, 28 Jul 2020 11:51:17 +0200 Message-ID: <20200728095128.2363-5-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG7NODE2.st.com (10.75.127.20) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Only update gd->env_load_prio in generic function env_load() and no more in the weak function env_get_location() which is called in many place (for example in env_driver_lookup, even for ENVOP_SAVE operation). This patch is a preliminary step to use env_driver_lookup()/ env_get_location() in new function env_select() without updating gd->env_load_prio. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - new env/env.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/env/env.c b/env/env.c index 2e64346438..bcc68c6bce 100644 --- a/env/env.c +++ b/env/env.c @@ -131,8 +131,6 @@ __weak enum env_location env_get_location(enum env_operation op, int prio) if (prio >= ARRAY_SIZE(env_locations)) return ENVL_UNKNOWN; - gd->env_load_prio = prio; - return env_locations[prio]; } @@ -204,6 +202,8 @@ int env_load(void) ret = drv->load(); if (!ret) { printf("OK\n"); + gd->env_load_prio = prio; + return 0; } else if (ret == -ENOMSG) { /* Handle "bad CRC" case */ @@ -227,7 +227,8 @@ int env_load(void) debug("Selecting environment with bad CRC\n"); else best_prio = 0; - env_get_location(ENVOP_LOAD, best_prio); + + gd->env_load_prio = best_prio; return -ENODEV; } From patchwork Tue Jul 28 09:51:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337715 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=XN7wJ1SH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBms0Y8Hz9sSd for ; Tue, 28 Jul 2020 19:52:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5319B823D7; Tue, 28 Jul 2020 11:51:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="XN7wJ1SH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF696823C3; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 56032823BA for ; Tue, 28 Jul 2020 11:51:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9nh3V000662; Tue, 28 Jul 2020 11:51:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=c2EW0DcG85PrnpWpXOypq0ARi0qitezqSmaW747I800=; b=XN7wJ1SHSRY3bTIzl741BXnHk9j1/gYyjcjLjf1SFTMMzvluOyu9/oAxRs3FahCJu8D6 45wc1w1sznRNdgtkfbsq9uO2qcOlzfvEVQoF/BICzikbXKuDkQ+ZFvKpNYFhcddX3ttT SV8IIrW2m1gw0cBaH8rAQww3+02T6XsJGWqKuvT8+agrA6ZaJzd/R9lITMdxiTJ4vOAu JsctIlQP6/EUebTJp0uIHA/DyhrNcZI0xhSa9ZpuCTEwfLH3KDLz5z5aI6N069jGZj3N FQYsYKP/dGdZdqmQaM/PWmvFC/vLGNhnhRKiTkafQuZKr0CY9lk8/Q5bYRdBGUa6m3jT lA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gagv5hsf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:39 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id ECC0710002A; Tue, 28 Jul 2020 11:51:38 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E2D4B2A70DA; Tue, 28 Jul 2020 11:51:38 +0200 (CEST) Received: from localhost (10.75.127.48) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:38 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 05/14] env: nowhere: add .load ops Date: Tue, 28 Jul 2020 11:51:18 +0200 Message-ID: <20200728095128.2363-6-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG6NODE1.st.com (10.75.127.16) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the ops .load for nowhere ENV backend to load the default environment. This ops is needed for the command 'env load' Signed-off-by: Patrick Delaunay --- Changes in v4: - don't use env_import in SPL to avoid to increase its size as it is only required for 'env load' command Changes in v3: - new: add load ops in nowhere env/nowhere.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/env/nowhere.c b/env/nowhere.c index f5b0a17652..d33fdf27d0 100644 --- a/env/nowhere.c +++ b/env/nowhere.c @@ -27,8 +27,25 @@ static int env_nowhere_init(void) return 0; } +static int env_nowhere_load(void) +{ + /* + * for SPL, set env_valid = ENV_INVALID is enougth as env_get_char() + * return the default env if env_get is used + * and SPL don't used env_import to reduce its size + * For U-Boot proper, import the default environment to allow reload. + */ + if (!IS_ENABLED(CONFIG_SPL_BUILD)) + env_set_default(NULL, 0); + + gd->env_valid = ENV_INVALID; + + return 0; +} + U_BOOT_ENV_LOCATION(nowhere) = { .location = ENVL_NOWHERE, .init = env_nowhere_init, + .load = env_nowhere_load, ENV_NAME("nowhere") }; From patchwork Tue Jul 28 09:51:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337712 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=p3/p6oSs; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBmc75RVz9sT6 for ; Tue, 28 Jul 2020 19:52:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CF687823D2; Tue, 28 Jul 2020 11:51:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="p3/p6oSs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5520F823C2; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DEB2E823BD for ; Tue, 28 Jul 2020 11:51:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9nfbT000653; Tue, 28 Jul 2020 11:51:40 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=QpYWtFV4MY1c5eT/b6Y9LF9icp6xptP1F46BOcdhOW0=; b=p3/p6oSs6c+4S0PtJZuDwv6Mm/ZALw+Ze7zUVuOYvUNmUpjkX5KSk70tXzpO47gtf2NU QEzTXLcJRP54Tr/KRXaYijVFPfLjIEj+UUaj7/vjlwpncaM9pSGMpXERlS3yH4yt7gk0 /ZAY7xM7wsVRkuC1A6kIKQTbs3blsMtuehBTQNnFXOdYfsM6oGACYKzD32bvt6DyUlD0 MJXbxws8YndyhIHFR1WrH3kgNtNS0GanIExRu3VLJQ2QjpdAOJwLHX/PD8FXhdn7EgMK lQ976xTWenisjr68NgKL402/vDsWzpkJFW02RQTTydgyWq/0CplL1xRqeIA2z0/hiTMy +Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gagv5hsk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:40 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B6763100034; Tue, 28 Jul 2020 11:51:39 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id AC41B2A70DA; Tue, 28 Jul 2020 11:51:39 +0200 (CEST) Received: from localhost (10.75.127.49) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:39 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 06/14] env: the ops driver load becomes mandatory in struct env_driver Date: Tue, 28 Jul 2020 11:51:19 +0200 Message-ID: <20200728095128.2363-7-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG5NODE2.st.com (10.75.127.14) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The ops driver load becomes mandatory in struct env_drive, change the comment for this ops and remove unnecessary test. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - new: load operation becomes mandatory env/env.c | 3 --- include/env_internal.h | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/env/env.c b/env/env.c index bcc68c6bce..5cf5bd238f 100644 --- a/env/env.c +++ b/env/env.c @@ -187,9 +187,6 @@ int env_load(void) for (prio = 0; (drv = env_driver_lookup(ENVOP_LOAD, prio)); prio++) { int ret; - if (!drv->load) - continue; - if (!env_has_inited(drv->location)) continue; diff --git a/include/env_internal.h b/include/env_internal.h index 66550434c3..795941daee 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -154,8 +154,7 @@ struct env_driver { /** * load() - Load the environment from storage * - * This method is optional. If not provided, no environment will be - * loaded. + * This method is required for loading environment * * @return 0 if OK, -ve on error */ From patchwork Tue Jul 28 09:51:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337720 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=WM7TAHVD; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBnp3mbjz9sSd for ; Tue, 28 Jul 2020 19:53:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A963A823EB; Tue, 28 Jul 2020 11:52:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="WM7TAHVD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C85DA823B9; Tue, 28 Jul 2020 11:51:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E5635823B9 for ; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9oIXS005719; Tue, 28 Jul 2020 11:51:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=lC7E40jvhWrNL35QN4nr58/vdpMOdT/T5qDUdW69tME=; b=WM7TAHVDPOZnXfUQ60cEa9zCmif4AOC+2Wf/W7v7HvjZAbRXfnemX2D6kL/D6CkvnQLx WqpV1JCb/zxqQykibi7Cuc2W9wXePy9LpaBFCr97wFLU+ZWCVJEHa5ImUnwXMP9YsGkT 61DbE5j0Tr7vTMkTbpcvNs6pBXV+JbtF/4KZZm1PJPQIROh+Ylbn17oBXipy0hGNLgCQ 4r757JlVCQCx18dFGZrYEc/lGKkW8hOxfUozv2XzUr4W58bZPHw+46t45soCWsKVqflE XtojFpxcn8m/kX4usc8G+HdgisVU4pkT81g9fHgH1ICQsY0NAt+MIBIMwWJEcOA+fQbL jg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32ga71wkgx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:41 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9F113100034; Tue, 28 Jul 2020 11:51:40 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8FF722A70DA; Tue, 28 Jul 2020 11:51:40 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:39 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , AKASHI Takahiro , Heinrich Schuchardt , Joe Hershberger , Joel Johnson , Miquel Raynal , Patrice Chotard , Ramon Fried , Sam Protsenko , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 07/14] cmd: env: add env load command Date: Tue, 28 Jul 2020 11:51:20 +0200 Message-ID: <20200728095128.2363-8-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG6NODE3.st.com (10.75.127.18) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the new command env load to load the environment from the current location gd->env_load_prio. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - new: add 'env load' command cmd/Kconfig | 6 ++++++ cmd/nvedit.c | 14 ++++++++++++++ env/env.c | 28 ++++++++++++++++++++++++++++ include/env.h | 7 +++++++ 4 files changed, 55 insertions(+) diff --git a/cmd/Kconfig b/cmd/Kconfig index e2b0a4fbc0..4aec6fe844 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -604,6 +604,12 @@ config CMD_NVEDIT_INFO [-q] : quiet output The result of multiple evaluations will be combined with AND. +config CMD_NVEDIT_LOAD + bool "env load" + help + Load all environment variables from the compiled-in persistent + storage. + endmenu menu "Memory commands" diff --git a/cmd/nvedit.c b/cmd/nvedit.c index acd9f82667..f730e2e754 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -794,6 +794,14 @@ U_BOOT_CMD( ); #endif #endif + +#if defined(CONFIG_CMD_NVEDIT_LOAD) +static int do_env_load(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + return env_reload() ? 1 : 0; +} +#endif #endif /* CONFIG_SPL_BUILD */ int env_match(uchar *s1, int i2) @@ -1346,6 +1354,9 @@ static struct cmd_tbl cmd_env_sub[] = { #endif #if defined(CONFIG_CMD_NVEDIT_INFO) U_BOOT_CMD_MKENT(info, 3, 0, do_env_info, "", ""), +#endif +#if defined(CONFIG_CMD_NVEDIT_LOAD) + U_BOOT_CMD_MKENT(load, 1, 0, do_env_load, "", ""), #endif U_BOOT_CMD_MKENT(print, CONFIG_SYS_MAXARGS, 1, do_env_print, "", ""), #if defined(CONFIG_CMD_RUN) @@ -1442,6 +1453,9 @@ static char env_help_text[] = "env erase - erase environment\n" #endif #endif +#if defined(CONFIG_CMD_NVEDIT_LOAD) + "env load - load environment\n" +#endif #if defined(CONFIG_CMD_NVEDIT_EFI) "env set -e [-nv][-bs][-rt][-at][-a][-i addr,size][-v] name [arg ...]\n" " - set UEFI variable; unset if '-i' or 'arg' not specified\n" diff --git a/env/env.c b/env/env.c index 5cf5bd238f..785a2b8552 100644 --- a/env/env.c +++ b/env/env.c @@ -230,6 +230,34 @@ int env_load(void) return -ENODEV; } +int env_reload(void) +{ + struct env_driver *drv; + + drv = env_driver_lookup(ENVOP_LOAD, gd->env_load_prio); + if (drv) { + int ret; + + printf("Loading Environment from %s... ", drv->name); + + if (!env_has_inited(drv->location)) { + printf("not initialized\n"); + return -ENODEV; + } + + ret = drv->load(); + if (ret) + printf("Failed (%d)\n", ret); + else + printf("OK\n"); + + if (!ret) + return 0; + } + + return -ENODEV; +} + int env_save(void) { struct env_driver *drv; diff --git a/include/env.h b/include/env.h index d6c2d751d6..68e0f4fa56 100644 --- a/include/env.h +++ b/include/env.h @@ -265,6 +265,13 @@ int env_set_default_vars(int nvars, char *const vars[], int flags); */ int env_load(void); +/** + * env_reload() - Re-Load the environment from current storage + * + * @return 0 if OK, -ve on error + */ +int env_reload(void); + /** * env_save() - Save the environment to storage * From patchwork Tue Jul 28 09:51:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337719 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=it0/u3Ve; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBnb3wmTz9sSd for ; Tue, 28 Jul 2020 19:53:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 13323823E1; Tue, 28 Jul 2020 11:52:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="it0/u3Ve"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19B2A823C7; Tue, 28 Jul 2020 11:51:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E9B33823BD for ; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9oIXT005719; Tue, 28 Jul 2020 11:51:41 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=/FYUYyFGb9q/L+ABDpNTi2SHaHlUVIdDVRDTm3x3D+Y=; b=it0/u3VeIll7/OCuDe+WF3Xqnvm3l55p4jcBbltx2LIuJ7eXGxirIeZkQBQ8MuCHPPoX yPsd/DMFqTlYLirWPciiZZCnxy7GjrhGU6RwUToT1SSxeD3mi5dBIzZOWkamfYCQcf+G mWxD5Ijs+YQECFgyIgmo4HUOiNDU9/LTgyIhqSXU1hYoh+BlFBREEK52XbjrFnxFw+hf JLTDuaQ3iQ8/IUEL3PI/Jp6sw6HNXSBA44INwX41EtATDVkjs+cjQHxzZBzzHLOXP9kM 5mRMOGtaZ5cI1oYA+D8tazzUZ7UqGjV7sjpIMiHqLgYR1RHCHWjFt9wKKLg/tEcXSKl3 wQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32ga71wkh1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:41 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7FCE110002A; Tue, 28 Jul 2020 11:51:41 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6E4352A70DA; Tue, 28 Jul 2020 11:51:41 +0200 (CEST) Received: from localhost (10.75.127.48) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:40 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , AKASHI Takahiro , Heinrich Schuchardt , Joe Hershberger , Joel Johnson , Miquel Raynal , Patrice Chotard , Ramon Fried , Sam Protsenko , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 08/14] cmd: env: add env select command Date: Tue, 28 Jul 2020 11:51:21 +0200 Message-ID: <20200728095128.2363-9-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG8NODE1.st.com (10.75.127.22) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the new command 'env select' to force the persistent storage of environment, saved in gd->env_load_prio. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - new: add 'env select' command cmd/Kconfig | 5 +++++ cmd/nvedit.c | 15 +++++++++++++++ env/env.c | 42 ++++++++++++++++++++++++++++++++++++++++++ include/env.h | 8 +++++++- 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index 4aec6fe844..5208687df4 100644 --- a/cmd/Kconfig +++ b/cmd/Kconfig @@ -610,6 +610,11 @@ config CMD_NVEDIT_LOAD Load all environment variables from the compiled-in persistent storage. +config CMD_NVEDIT_SELECT + bool "env select" + help + Select the compiled-in persistent storage of environment variables. + endmenu menu "Memory commands" diff --git a/cmd/nvedit.c b/cmd/nvedit.c index f730e2e754..d188c6aa6b 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -802,6 +802,15 @@ static int do_env_load(struct cmd_tbl *cmdtp, int flag, int argc, return env_reload() ? 1 : 0; } #endif + +#if defined(CONFIG_CMD_NVEDIT_SELECT) +static int do_env_select(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + return env_select(argv[1]) ? 1 : 0; +} +#endif + #endif /* CONFIG_SPL_BUILD */ int env_match(uchar *s1, int i2) @@ -1367,6 +1376,9 @@ static struct cmd_tbl cmd_env_sub[] = { #if defined(CONFIG_CMD_ERASEENV) U_BOOT_CMD_MKENT(erase, 1, 0, do_env_erase, "", ""), #endif +#endif +#if defined(CONFIG_CMD_NVEDIT_SELECT) + U_BOOT_CMD_MKENT(select, 2, 0, do_env_select, "", ""), #endif U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 0, do_env_set, "", ""), #if defined(CONFIG_CMD_ENV_EXISTS) @@ -1456,6 +1468,9 @@ static char env_help_text[] = #if defined(CONFIG_CMD_NVEDIT_LOAD) "env load - load environment\n" #endif +#if defined(CONFIG_CMD_NVEDIT_SELECT) + "env select [target] - select environment target\n" +#endif #if defined(CONFIG_CMD_NVEDIT_EFI) "env set -e [-nv][-bs][-rt][-at][-a][-i addr,size][-v] name [arg ...]\n" " - set UEFI variable; unset if '-i' or 'arg' not specified\n" diff --git a/env/env.c b/env/env.c index 785a2b8552..2af2fae23c 100644 --- a/env/env.c +++ b/env/env.c @@ -344,3 +344,45 @@ int env_init(void) return ret; } + +int env_select(const char *name) +{ + struct env_driver *drv; + const int n_ents = ll_entry_count(struct env_driver, env_driver); + struct env_driver *entry; + int prio; + bool found = false; + + printf("Select Environment on %s: ", name); + + /* search ENV driver by name */ + drv = ll_entry_start(struct env_driver, env_driver); + for (entry = drv; entry != drv + n_ents; entry++) { + if (!strcmp(entry->name, name)) { + found = true; + break; + } + } + + if (!found) { + printf("driver not found\n"); + return -ENODEV; + } + + /* search priority by driver */ + for (prio = 0; (drv = env_driver_lookup(ENVOP_INIT, prio)); prio++) { + if (entry->location == env_get_location(ENVOP_LOAD, prio)) { + /* when priority change, reset the ENV flags */ + if (gd->env_load_prio != prio) { + gd->env_load_prio = prio; + gd->env_valid = ENV_INVALID; + gd->flags &= ~GD_FLG_ENV_DEFAULT; + } + printf("OK\n"); + return 0; + } + } + printf("priority not found\n"); + + return -ENODEV; +} diff --git a/include/env.h b/include/env.h index 68e0f4fa56..665857f032 100644 --- a/include/env.h +++ b/include/env.h @@ -286,6 +286,13 @@ int env_save(void); */ int env_erase(void); +/** + * env_select() - Select the environment storage + * + * @return 0 if OK, -ve on error + */ +int env_select(const char *name); + /** * env_import() - Import from a binary representation into hash table * @@ -349,5 +356,4 @@ int env_get_char(int index); * This is used for those unfortunate archs with crappy toolchains */ void env_reloc(void); - #endif From patchwork Tue Jul 28 09:51:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337718 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=lWZdC9+g; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBnM2XRrz9sSd for ; Tue, 28 Jul 2020 19:53:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D3029823DC; Tue, 28 Jul 2020 11:52:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="lWZdC9+g"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 10096823AB; Tue, 28 Jul 2020 11:51:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 256A4823AB for ; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9m55m020744; Tue, 28 Jul 2020 11:51:42 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=Ls19rC8OrzMfMp0B5YA04zfToQCHS5TJ2xN3LNksvvc=; b=lWZdC9+gC3QdLUA8F655fY5Bf06FOpR70UFzs1CUYMa0ECGsxok2P3GF0JNMNCwu+vgZ sFDghKQRSb5jYJNqpRbPkwq3E9hCR9AkuRPjGpItOuCt+IqxfI6qjLqZ134qIlZCbu49 bq/ppiSJnPhsQ837fuKNDiUPYwp6tuQtuw5XI7C82BrAY+jGPSFDaVNk1Uk6yzQFlVjf SMALt3xmSYVkt1x5oxtpOT1QTsMvm/0xSUhjc6TnIL8S3KW2iazMKDqzSt7E+mDVGwtj At6zAqWm/yr59B4fRgwvs3g0lDiWgRErueaPGngxzPDd9mkBguQ828C/dPoY37M+g2nF Tg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gbmg5dxw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:42 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 4479910002A; Tue, 28 Jul 2020 11:51:42 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3A61D2A70DA; Tue, 28 Jul 2020 11:51:42 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:41 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Mario Six , U-Boot STM32 Subject: [PATCH v4 09/14] configs: sandbox: activate env in ext4 support Date: Tue, 28 Jul 2020 11:51:22 +0200 Message-ID: <20200728095128.2363-10-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG1NODE2.st.com (10.75.127.2) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Activate ENV in EXT4 support in sandbox. The sandbox behavior don't change; the default environment with the nowhere backend (CONFIG_ENV_IS_NOWHERE)is still used: the weak function env_get_location() return ENVL_NOWHERE for priority 0. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - change env_get_location to avoid gd->env_load_prio modification board/sandbox/sandbox.c | 15 +++++++++++++++ configs/sandbox64_defconfig | 4 ++++ configs/sandbox_defconfig | 4 ++++ configs/sandbox_flattree_defconfig | 4 ++++ configs/sandbox_spl_defconfig | 4 ++++ 5 files changed, 31 insertions(+) diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index c1317a8ca3..937ce28411 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -44,6 +45,20 @@ unsigned long timer_read_counter(void) } #endif +/* specific order for sandbox: nowhere is the first value, used by default */ +static enum env_location env_locations[] = { + ENVL_NOWHERE, + ENVL_EXT4, +}; + +enum env_location env_get_location(enum env_operation op, int prio) +{ + if (prio >= ARRAY_SIZE(env_locations)) + return ENVL_UNKNOWN; + + return env_locations[prio]; +} + int dram_init(void) { gd->ram_size = CONFIG_SYS_SDRAM_SIZE; diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 5794d1d159..66bf794f7f 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -83,6 +83,10 @@ CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox64" +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_REGMAP=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 4110497841..a01711cbaf 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -93,6 +93,10 @@ CONFIG_OF_CONTROL=y CONFIG_OF_LIVE=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox" +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_REGMAP=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index bea27f68bb..eef7e182f1 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -66,6 +66,10 @@ CONFIG_AMIGA_PARTITION=y CONFIG_OF_CONTROL=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox" +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_REGMAP=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index ffb6a6f710..1c3d9a1eae 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -81,6 +81,10 @@ CONFIG_SPL_OF_CONTROL=y CONFIG_OF_HOSTFILE=y CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_SPL_OF_PLATDATA=y +CONFIG_ENV_IS_NOWHERE=y +CONFIG_ENV_IS_IN_EXT4=y +CONFIG_ENV_EXT4_INTERFACE="host" +CONFIG_ENV_EXT4_DEVICE_AND_PART="0:0" CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y CONFIG_SPL_DM=y From patchwork Tue Jul 28 09:51:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337722 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=fOENBtg6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBpB1v6cz9sTC for ; Tue, 28 Jul 2020 19:53:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2E9B3823EF; Tue, 28 Jul 2020 11:52:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="fOENBtg6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD078823C7; Tue, 28 Jul 2020 11:51:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 89E5F823C5 for ; Tue, 28 Jul 2020 11:51:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9m59Z020731; Tue, 28 Jul 2020 11:51:43 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=2l8PZQZVTDNpEpD9hz1AGRKVxCcnQ96j395zFyn7NuQ=; b=fOENBtg6bk/34hwRgRWPTDo82o0YBI+l1S5cV3P5XGTUSU4zZrFMDnGsW+78EcjmyUpu 6egl+heUfxb6An+qwmBOrYru9TVp8bdX60mtilebNBXQ3i9rnSZc78HPz6qxVmC28rgk NzgVEbRbv+pT7rHXY1HW3DgXdVBFqLnSTqhQUeWG41FAib5L/Ch/HOvWiO3MDoIhl3ub T7d35KdXblTFyGpznk8sRFvTmRR3zdxVkBxJjv8Ci9wzKV84X2THPvRX9KZyU7si10bq /SIp/hD0SqaAW4FWoBWIaw8t5TegkZ2VYGpP4osKkiZrREdnTiI/7NgpRNnpn2JZ8wv+ kg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gbmg5dy1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:43 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 2530E100034; Tue, 28 Jul 2020 11:51:43 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 18B6C2A70DB; Tue, 28 Jul 2020 11:51:43 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:42 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Mario Six , U-Boot STM32 Subject: [PATCH v4 10/14] configs: sandbox: activate command env select and env load Date: Tue, 28 Jul 2020 11:51:23 +0200 Message-ID: <20200728095128.2363-11-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add support of environment location with the new env command: 'env select' and 'env load' The ENV backend is selected by priority order - 0 = "nowhere" (default at boot) - 1 = "EXT4" To test EXT4 env support, this backend is selected by name: > env select EXT4 Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - replace specific sandbox command by generic command 'env select' and 'env load' - change title "sandbox: support the change of env location" Changes in v2: - change cmd_tbl_t to struct cmd_tbl configs/sandbox64_defconfig | 2 ++ configs/sandbox_defconfig | 2 ++ configs/sandbox_flattree_defconfig | 2 ++ configs/sandbox_spl_defconfig | 2 ++ 4 files changed, 8 insertions(+) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 66bf794f7f..d19c6dfba9 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -31,6 +31,8 @@ CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index a01711cbaf..04efc9b50b 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -35,6 +35,8 @@ CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index eef7e182f1..60d065b8c5 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -25,6 +25,8 @@ CONFIG_CMD_BOOTEFI_HELLO=y CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 1c3d9a1eae..40605626e5 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -35,6 +35,8 @@ CONFIG_CMD_GREPENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_INFO=y +CONFIG_CMD_NVEDIT_LOAD=y +CONFIG_CMD_NVEDIT_SELECT=y CONFIG_LOOPW=y CONFIG_CMD_MD5SUM=y CONFIG_CMD_MEMINFO=y From patchwork Tue Jul 28 09:51:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337724 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=IKdY+u15; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBpM3vh4z9sT6 for ; Tue, 28 Jul 2020 19:54:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5AC0C823F4; Tue, 28 Jul 2020 11:52:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="IKdY+u15"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 118DA823C8; Tue, 28 Jul 2020 11:51:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 11749823C1 for ; Tue, 28 Jul 2020 11:51:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9l8d0024986; Tue, 28 Jul 2020 11:51:44 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=VWHsjYZt3SzzR9qStAM+yKeaPzOniTByjidfUxLUrPw=; b=IKdY+u15zjP6/RH519I93FfDWWLDb6G7v7bG5eVQLbzf8hliwxCez+JC6523K4D3C1ba iGd5DpKtwESyZdxe64hDsSLpfM61zRz3R2iXM4uJzKEe4Ipb6BZJ2hUn8hS/Ec34iYIt ViIr51KISfc9n/cFSefYj5j7J2PNmQKaAXSGPqO94ZjTPQPzjir/6T9mEzu21GDGi09U l80PYaPJ8kMsNFFF+b3nbrXs8FQonRR4qW+Fz3M5BPJ64BlbzjtQEmRmL23y5WgJKwgW bJd8HaeVZtMfxdABfLmN1kk5rnfS63Q8yaEVG45Z52olZyJ5NsnKJ5tQHOApiazYlKG7 Og== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32g9v9dsb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:44 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E243610002A; Tue, 28 Jul 2020 11:51:43 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D587F2A70DB; Tue, 28 Jul 2020 11:51:43 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:43 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Stephen Warren , U-Boot STM32 Subject: [PATCH v4 11/14] test: environment in ext4 Date: Tue, 28 Jul 2020 11:51:24 +0200 Message-ID: <20200728095128.2363-12-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG7NODE2.st.com (10.75.127.20) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add basic test to persistent environment in ext4: save and load in host ext4 file 'uboot.env'. On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - replace specific sandbox command by generic command 'env select' and 'env load' - update after Stephen Warren comments test/py/tests/test_env.py | 97 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 96 insertions(+), 1 deletion(-) diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py index a64aaa9bc5..70913c8d9a 100644 --- a/test/py/tests/test_env.py +++ b/test/py/tests/test_env.py @@ -4,6 +4,10 @@ # Test operation of shell commands relating to environment variables. +import os +import os.path +from subprocess import call, check_call, CalledProcessError + import pytest import u_boot_utils @@ -374,7 +378,6 @@ def test_env_info(state_test_env): @pytest.mark.buildconfigspec('cmd_nvedit_info') @pytest.mark.buildconfigspec('cmd_echo') def test_env_info_sandbox(state_test_env): - """Test 'env info' command result with several options on sandbox with a known ENV configuration: ready & default & persistent """ @@ -399,3 +402,95 @@ def test_env_info_sandbox(state_test_env): response = c.run_command('env info -d -p -q') response = c.run_command('echo $?') assert response == "1" + +def mk_env_ext4(state_test_env): + + """Create a empty ext4 file system volume.""" + c = state_test_env.u_boot_console + filename = 'env.ext4.img' + persistent = c.config.persistent_data_dir + '/' + filename + fs_img = c.config.result_dir + '/' + filename + + if os.path.exists(persistent): + c.log.action('Disk image file ' + persistent + ' already exists') + else: + try: + u_boot_utils.run_and_log(c, 'dd if=/dev/zero of=%s bs=1M count=16' % persistent) + u_boot_utils.run_and_log(c, 'mkfs.ext4 -O ^metadata_csum %s' % persistent) + except CalledProcessError: + call('rm -f %s' % persistent, shell=True) + raise + + u_boot_utils.run_and_log(c, ['cp', '-f', persistent, fs_img]) + return fs_img + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_echo') +@pytest.mark.buildconfigspec('cmd_nvedit_info') +@pytest.mark.buildconfigspec('cmd_nvedit_load') +@pytest.mark.buildconfigspec('cmd_nvedit_select') +@pytest.mark.buildconfigspec('env_is_in_ext4') +def test_env_ext4(state_test_env): + + """Test ENV in EXT4 on sandbox.""" + c = state_test_env.u_boot_console + fs_img = '' + try: + fs_img = mk_env_ext4(state_test_env) + + c.run_command('host bind 0 %s' % fs_img) + + response = c.run_command('ext4ls host 0:0') + assert 'uboot.env' not in response + + # force env location: EXT4 (prio 1 in sandbox) + response = c.run_command('env select EXT4') + assert 'Select Environment on EXT4: OK' in response + + response = c.run_command('env save') + assert 'Saving Environment to EXT4' in response + + response = c.run_command('env load') + assert 'Loading Environment from EXT4... OK' in response + + response = c.run_command('ext4ls host 0:0') + assert '8192 uboot.env' in response + + response = c.run_command('env info') + assert 'env_valid = valid' in response + assert 'env_ready = true' in response + assert 'env_use_default = false' in response + + response = c.run_command('env info -p -d') + assert 'Environment was loaded from persistent storage' in response + assert 'Environment can be persisted' in response + + response = c.run_command('env info -d -q') + assert response == "" + response = c.run_command('echo $?') + assert response == "1" + + response = c.run_command('env info -p -q') + assert response == "" + response = c.run_command('echo $?') + assert response == "0" + + # restore env location: NOWHERE (prio 0 in sandbox) + response = c.run_command('env select nowhere') + assert 'Select Environment on nowhere: OK' in response + + response = c.run_command('env load') + assert 'Loading Environment from nowhere... OK' in response + + response = c.run_command('env info') + assert 'env_valid = invalid' in response + assert 'env_ready = true' in response + assert 'env_use_default = true' in response + + response = c.run_command('env info -p -d') + assert 'Default environment is used' in response + assert 'Environment cannot be persisted' in response + + finally: + if fs_img: + call('rm -f %s' % fs_img, shell=True) From patchwork Tue Jul 28 09:51:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337721 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=iEPsJpUA; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBp10ydXz9sT6 for ; Tue, 28 Jul 2020 19:53:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A27A3823C3; Tue, 28 Jul 2020 11:52:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="iEPsJpUA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA06B823C9; Tue, 28 Jul 2020 11:51:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1889F822B6 for ; Tue, 28 Jul 2020 11:51:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9oNFa005913; Tue, 28 Jul 2020 11:51:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=P0w0rXNgnmDfwIYljnX646tRCaDd//h41GAQgi9X8UM=; b=iEPsJpUAXuB4X+K/zBAW3iynYUWDjyPqc4k9298PQOgPejTDi+g3j2knh1p4dbWtAp3G t0VouB3Ht+2zBZ9ZaNsnCtRbN4/Elw0CMVdPPjPqlPV5zYup7Ii/tKnTzD5cy4m6Y2Gn 6K8n9gbzlrX/queKFoo6f8Zp/o8okezqPzeEoNfyI/3eY1Wo9Gqfuf2HZGfgr+SeDwjH 2+3fW5eZdhKTF8O0MReG6ulm+UcSFBd1BoqqDlz1239tYztvbq5R2WcOqtpzLxv+qU07 AWWVGFiOEgL97fQiwQziIIjpfnikoktOl5hIN17j5P+g/QeWr5Fi2Tv25uffSvzOJ36J 0w== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32ga71wkh8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:45 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id AD0E4100034; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A0D9E2A70DB; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:44 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 12/14] env: ext4: introduce new function env_ext4_save_buffer Date: Tue, 28 Jul 2020 11:51:25 +0200 Message-ID: <20200728095128.2363-13-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Split the function env_ext4_save to prepare the erase support. Signed-off-by: Patrick Delaunay --- (no changes since v1) env/ext4.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/env/ext4.c b/env/ext4.c index ac9f126bec..0a10a5e050 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -44,9 +44,8 @@ __weak const char *env_ext4_get_dev_part(void) return (const char *)CONFIG_ENV_EXT4_DEVICE_AND_PART; } -static int env_ext4_save(void) +static int env_ext4_save_buffer(env_t *env_new) { - env_t env_new; struct blk_desc *dev_desc = NULL; struct disk_partition info; int dev, part; @@ -54,10 +53,6 @@ static int env_ext4_save(void) const char *ifname = env_ext4_get_intf(); const char *dev_and_part = env_ext4_get_dev_part(); - err = env_export(&env_new); - if (err) - return err; - part = blk_get_device_part_str(ifname, dev_and_part, &dev_desc, &info, 1); if (part < 0) @@ -72,7 +67,7 @@ static int env_ext4_save(void) return 1; } - err = ext4fs_write(CONFIG_ENV_EXT4_FILE, (void *)&env_new, + err = ext4fs_write(CONFIG_ENV_EXT4_FILE, (void *)env_new, sizeof(env_t), FILETYPE_REG); ext4fs_close(); @@ -81,9 +76,26 @@ static int env_ext4_save(void) CONFIG_ENV_EXT4_FILE, ifname, dev, part); return 1; } - gd->env_valid = ENV_VALID; + return 0; +} + +static int env_ext4_save(void) +{ + env_t env_new; + int err; + + err = env_export(&env_new); + if (err) + return err; + + err = env_ext4_save_buffer(&env_new); + if (err) + return err; + + gd->env_valid = ENV_VALID; puts("done\n"); + return 0; } From patchwork Tue Jul 28 09:51:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337725 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=1jEICzQT; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBpZ2PDrz9sT6 for ; Tue, 28 Jul 2020 19:54:14 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 43DAC823F9; Tue, 28 Jul 2020 11:52:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="1jEICzQT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA94C823C1; Tue, 28 Jul 2020 11:51:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AEB8A823C3 for ; Tue, 28 Jul 2020 11:51:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046668.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9oNFb005913; Tue, 28 Jul 2020 11:51:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=grVASiqTslVmoyvNE7cUQ69Jk1KSCDpDlkRlnomTjII=; b=1jEICzQTx6yPnRFVVnFzL7RdcOiSdJ20bGazVXWYbW30gAySOMmDqYi8+B9lV2DBPFCP NjRQSy72xkELTizgURi/jBFyaK1ByL2CoGNlouzIMtEQT4x+jQ1+wqSZidtnIwtCyr8i utIIjbHbqmSXlMFyXTV5+sDiZnAJAel30JDtqMX9N513FTH0R8ozLc2TOE6xcZG2Z8KS ZwcNAUpbwl8vKHy23qGrVjvtOnYbaPiUUN2m32FPI5xKpv3EMnMWuVNJQjwVKchZcHgq 4WXJhniuKaOX0UBYJShlkm/iJTxHcfbvRCbQPOD+xZPj32pT0dnw0nzP7i/xwSnXBqH3 GQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32ga71wkha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:45 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 8091310002A; Tue, 28 Jul 2020 11:51:45 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 76C672A70DA; Tue, 28 Jul 2020 11:51:45 +0200 (CEST) Received: from localhost (10.75.127.49) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:44 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 13/14] env: ext4: add support of command env erase Date: Tue, 28 Jul 2020 11:51:26 +0200 Message-ID: <20200728095128.2363-14-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG4NODE3.st.com (10.75.127.12) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add support of opts erase for env in ext4, this opts is used by command 'env erase'. This command only fill the env file (CONFIG_ENV_EXT4_FILE) with 0, the CRC and the saved environment becomes invalid. Signed-off-by: Patrick Delaunay --- (no changes since v2) Changes in v2: - use CONFIG_IS_ENABLED to set .erase (same as .save) env/ext4.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/env/ext4.c b/env/ext4.c index 0a10a5e050..cc36504154 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -99,6 +99,23 @@ static int env_ext4_save(void) return 0; } +static int env_ext4_erase(void) +{ + env_t env_new; + int err; + + memset(&env_new, 0, sizeof(env_t)); + + err = env_ext4_save_buffer(&env_new); + if (err) + return err; + + gd->env_valid = ENV_INVALID; + puts("done\n"); + + return 0; +} + static int env_ext4_load(void) { ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); @@ -156,4 +173,6 @@ U_BOOT_ENV_LOCATION(ext4) = { ENV_NAME("EXT4") .load = env_ext4_load, .save = ENV_SAVE_PTR(env_ext4_save), + .erase = CONFIG_IS_ENABLED(CMD_ERASEENV) ? env_ext4_erase : + NULL, }; From patchwork Tue Jul 28 09:51:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337726 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=eFvj5r7r; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBpm2VRgz9sSd for ; Tue, 28 Jul 2020 19:54:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC0EC82400; Tue, 28 Jul 2020 11:52:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="eFvj5r7r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 86B02823C1; Tue, 28 Jul 2020 11:51:53 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 50712823CC for ; Tue, 28 Jul 2020 11:51:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9nfbY000653; Tue, 28 Jul 2020 11:51:46 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=9WTrP52d1AY/RnoCcFCrjuuqkqWx7r4C9fvr8FFoti8=; b=eFvj5r7ruEnYSalib2smLM2UJfpdd+sQ9J0pD+f/k+vQBCHJS8TxSpJbBOXwfA/+jUrX X5dqwySFr3I5pHPyryffs+JDkwruF/rD+KL6qrFdC/m+0On0QFG9lUMZjD8phK9qUo0/ v8Eu+WjINBPEfpdY463IiUiNoHdpor6iOnlmfHJXb3X3jNbTIx4+7lWR24rS4LG0kShQ RaGturH1GWs44mpN/dDT50p3JV2YG3+tyCUFHfHi9GNVlYDyGStLMpMC3gREzGY5TH9g iC7OhkDRadiWZNPeP2SG0YiPmIj/HTRgaCzq/AQrEUG6c8hIyvhu6r1eh+9UXoyNHXI9 mQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gagv5ht9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:46 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 55CD210002A; Tue, 28 Jul 2020 11:51:46 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4AB652A70DA; Tue, 28 Jul 2020 11:51:46 +0200 (CEST) Received: from localhost (10.75.127.51) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:45 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Mario Six , Stephen Warren , U-Boot STM32 Subject: [PATCH v4 14/14] test: sandbox: add test for erase command Date: Tue, 28 Jul 2020 11:51:27 +0200 Message-ID: <20200728095128.2363-15-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.51] X-ClientProxiedBy: SFHDAG4NODE1.st.com (10.75.127.10) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add test for the erase command tested on ENV in EXT4. Signed-off-by: Patrick Delaunay --- (no changes since v3) Changes in v3: - replace sandbox command by generic command 'env load' in test_env configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + test/py/tests/test_env.py | 16 ++++++++++++++++ 5 files changed, 20 insertions(+) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index d19c6dfba9..d4cef46e13 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -27,6 +27,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 04efc9b50b..90aac2d69b 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_ABOOTIMG=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_EFI=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 60d065b8c5..195ce57d81 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -24,6 +24,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_NVEDIT_INFO=y CONFIG_CMD_NVEDIT_LOAD=y CONFIG_CMD_NVEDIT_SELECT=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 40605626e5..fe7b182b89 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -32,6 +32,7 @@ CONFIG_CMD_BOOTEFI_HELLO=y # CONFIG_CMD_ELF is not set CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y +CONFIG_CMD_ERASEENV=y CONFIG_CMD_ENV_CALLBACK=y CONFIG_CMD_ENV_FLAGS=y CONFIG_CMD_NVEDIT_INFO=y diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py index 70913c8d9a..86ec1b36d3 100644 --- a/test/py/tests/test_env.py +++ b/test/py/tests/test_env.py @@ -475,6 +475,22 @@ def test_env_ext4(state_test_env): response = c.run_command('echo $?') assert response == "0" + response = c.run_command('env erase') + assert 'OK' in response + + response = c.run_command('env load') + assert 'Loading Environment from EXT4... ' in response + assert 'bad CRC, using default environment' in response + + response = c.run_command('env info') + assert 'env_valid = invalid' in response + assert 'env_ready = true' in response + assert 'env_use_default = true' in response + + response = c.run_command('env info -p -d') + assert 'Default environment is used' in response + assert 'Environment can be persisted' in response + # restore env location: NOWHERE (prio 0 in sandbox) response = c.run_command('env select nowhere') assert 'Select Environment on nowhere: OK' in response