From patchwork Tue Jun 16 07:40:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310090 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=QVOvCLNG; 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 49mKt127kXz9sSt for ; Tue, 16 Jun 2020 17:42:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2B8CB81ED7; Tue, 16 Jun 2020 09:41:36 +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="QVOvCLNG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6950181ECD; Tue, 16 Jun 2020 09:41:16 +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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 5678E81EAA for ; Tue, 16 Jun 2020 09:40:54 +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 05G7e7l0028817; Tue, 16 Jun 2020 09:40:52 +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=edqOSd8/G/p4S3zF96jlp+NTwDFo8MuEcvzFZHJDHDo=; b=QVOvCLNGSW7+rPNn9ZvwpXawdQdhuMmaOuSdHfjOR+KGBKpJ5aqRhmVoaKPJR5S5si57 8JXfwrVoUXZiNiSOXsicb1EDKqBjeCicHg26OmelhmWyJun5AGhZZx2dDWzX9ZfEsAni Tv0Q6Rb9HAfBdgMPaetRxEcIzArZ7ErMvysAOdnQJAJbqyQ0+dFUi5FlcHcf3HUhBn06 7kVRt/uXuepasgZqnvAHpF5ZqjRnwwdLUigM2jIoGg35G5kAktOkYKSS7PrFgpIjWD0m TdP9tCxQrs3x4jdl+UHCHAcr5sEW9A/lXxSv4gRly7x5AoIkdXq1PbxAPa5tkt8SQWYz tw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31mnph5mqj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:52 +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 82AE3100034; Tue, 16 Jun 2020 09:40:51 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 76E792AEF8D; Tue, 16 Jun 2020 09:40:51 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:51 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v2 1/9] env: add absolute path at CONFIG_ENV_EXT4_FILE Date: Tue, 16 Jun 2020 09:40:40 +0200 Message-ID: <20200616074048.7898-2-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG3NODE1.st.com (10.75.127.7) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 Signed-off-by: Patrick Delaunay Reviewed-by: Tom Rini --- 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 ca7fef682b..9dad1cf8c1 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -469,7 +469,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 Jun 16 07:40:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310095 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=Y9wnFquN; 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 49mKw22CpBz9s1x for ; Tue, 16 Jun 2020 17:44:18 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E27CB81EF7; Tue, 16 Jun 2020 09:41:54 +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="Y9wnFquN"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5F4981ED0; Tue, 16 Jun 2020 09:41:24 +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 [62.209.51.94]) (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 A868B81EB2 for ; Tue, 16 Jun 2020 09:40:56 +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 05G7cuYj026908; Tue, 16 Jun 2020 09:40:52 +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=v/woQdszPxLVTxB/js2GFZ0XB/oZVRDaONJWqrcmwus=; b=Y9wnFquNJ+D8B81bghnNY41KiSUAngzYcLrrortdKmlbVqK4NxEzCPgj/Tzh+akueQ6n T9eooVhyg3Qtimxrg9SCHqfPCOCZSZSeGbecB33IMll107mTqB4lJzS6j9mMtqi/8AMh Mx9aYPOrpWAroj6y6zmUIixs4k4Zg2s/retODj5rQUcQEvqpOw4DVjVII7OVe5Wdm9KI 48DqJt/s7qsDvkSvsM0iG/8XhzLJGSR1zcD9hm3mrMP9wRJpYOFN8gVKvlLrYJBiT+Vb KyN7Zr0n8/JcVQ+LqYE9sISVzKl+VcIOV2MGvUAJfzV9I6TumXk60LGI2vVkP5JMOpM/ hw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31mmjvwtj0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:52 +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 3BFC4100038; Tue, 16 Jun 2020 09:40:52 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 32D682AEF93; Tue, 16 Jun 2020 09:40:52 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:51 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v2 2/9] env: ext4: set gd->env_valid Date: Tue, 16 Jun 2020 09:40:41 +0200 Message-ID: <20200616074048.7898-3-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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. Signed-off-by: Patrick Delaunay Reviewed-by: Tom Rini --- (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 Jun 16 07:40:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310084 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=KUcNmOBH; 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 49mKrq73mQz9sRN for ; Tue, 16 Jun 2020 17:41:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3764281EAF; Tue, 16 Jun 2020 09:41:12 +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="KUcNmOBH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4297B81EBE; Tue, 16 Jun 2020 09:41:09 +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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 B52C281EBD for ; Tue, 16 Jun 2020 09:40: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=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 05G7e1sa007229; Tue, 16 Jun 2020 09:40:53 +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=S1hC6wgG9ILlHJ+Tcm8sO7/A0kUVtDqPQPcoSixr9X8=; b=KUcNmOBHxWNo8/6x+RQkTpMqST4P8b85aY4s1JWTftweOnBWv4KrjjCwAE/i9QJzk78r SmXNz6cBhsHbjnjgdOy8+1cIvrVsqnOpwPPEeZgBmhTrUJfI5g8dRwuFgzt0zbjmfY1K 2FzHbkM8wy5DNAUj7c/nlcVLOIpZOo72gJKulMAFacOZwKzbHogqZms50VtqClz+ceGU rmdH1seHH9liWVh+BG10e0zD0oytWL61N5D8HI8y9nAr+CTqeHNZe83DDJbT196rjkii GdgVtwlWMnRbzLM+CQfOg3Nm+jYO1oj6QckGeR9BlzDRwc6H2LNmTIkRFUYyKscFN2nx Xw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31mkx95x25-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:53 +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 DF85B10002A; Tue, 16 Jun 2020 09:40:52 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id D66012AEF93; Tue, 16 Jun 2020 09:40:52 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:52 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v2 3/9] env: correctly handle result in env_init Date: Tue, 16 Jun 2020 09:40:42 +0200 Message-ID: <20200616074048.7898-4-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Don't return error with ret=-ENOENT when the optional ops drv->init is absent but only if env_driver_lookup doesn't found driver. This patch correct an issue for the code if (!env_init()) env_load() When only ext4 is supported (CONFIG_ENV_IS_IN_EXT4), as the backend env/ext4.c doesn't define an ops .init Signed-off-by: Patrick Delaunay --- (no changes since v1) env/env.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index dcc25c030b..819c88f729 100644 --- a/env/env.c +++ b/env/env.c @@ -295,7 +295,10 @@ int env_init(void) int prio; for (prio = 0; (drv = env_driver_lookup(ENVOP_INIT, prio)); prio++) { - if (!drv->init || !(ret = drv->init())) + ret = 0; + if (drv->init) + ret = drv->init(); + if (!ret) env_set_inited(drv->location); debug("%s: Environment %s init done (ret=%d)\n", __func__, From patchwork Tue Jun 16 07:40:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310092 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=d70iPudo; 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 49mKts6bc3z9sSS for ; Tue, 16 Jun 2020 17:43:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A915E81ED0; Tue, 16 Jun 2020 09:41:43 +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="d70iPudo"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DCFE081ED0; Tue, 16 Jun 2020 09:41:17 +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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 B038081EB0 for ; Tue, 16 Jun 2020 09:40: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=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 05G7e3al007401; Tue, 16 Jun 2020 09:40:54 +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=xCtxeV7yJX84+MQRSAaT37WzdKA6bGfD0uPJNGNi2bg=; b=d70iPudoBUIcSi7Zr0RNfJzE1AO6A/k0Jhhhe6ff/x28I/aQuJ4LgCYyE4B5ljYgfrLT 4YT+YpgUYW/zN5IrjO3f0CDPU0HjfePEtklxp59g3I/nVsUEOLKEAlXqmvh75tPpR8LT 5YqqsV27t6+cpo89xhDgNMw2Nm+oL3e1L4foz9Irk50aLYuV+x1XYuLwhFB5jzxYZgXI HCv5jYeyxFBj9kVSp7hMOFq+ckc3yuOR3Sz7RW4uF7ZKGa73YCVO/O4X7aHFDfdb9Axe tfBfeac19jUHhNUwo6yhZVpwCtlkFLh4/RWqRZ3rk9lB9SQu3hlSuNkNRvD79ag4w8tl 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 31mkx95x26-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:54 +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 B289E10002A; Tue, 16 Jun 2020 09:40:53 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A867C2AEF93; Tue, 16 Jun 2020 09:40:53 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:53 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Mario Six , Simon Glass , U-Boot STM32 Subject: [PATCH v2 4/9] sandbox: activate env in ext4 support Date: Tue, 16 Jun 2020 09:40:43 +0200 Message-ID: <20200616074048.7898-5-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean The default environment is still used with "ENVL_NOWHERE" indicated by the weak function env_get_location() and activated by CONFIG_ENV_IS_NOWHERE. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- (no changes since v1) board/sandbox/sandbox.c | 12 ++++++++++++ configs/sandbox64_defconfig | 4 ++++ configs/sandbox_defconfig | 4 ++++ configs/sandbox_flattree_defconfig | 4 ++++ configs/sandbox_spl_defconfig | 4 ++++ 5 files changed, 28 insertions(+) diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 1372003018..9cb5fe5c75 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,17 @@ unsigned long timer_read_counter(void) } #endif +enum env_location env_get_location(enum env_operation op, int prio) +{ + /* only one location supported */ + if (prio != 0) + return ENVL_UNKNOWN; + + gd->env_load_prio = 0; + + return ENVL_NOWHERE; +} + int dram_init(void) { gd->ram_size = CONFIG_SYS_SDRAM_SIZE; diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index a2410b3368..b70272c0b0 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -81,6 +81,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 0c9e0b9f1f..715f5dc39d 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -90,6 +90,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 bc4819f998..ce806270bd 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -64,6 +64,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 64f2ed5102..ea11c9bded 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -80,6 +80,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 Jun 16 07:40:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310093 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=gMZBMC9A; 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 49mKvM4cqNz9sTD for ; Tue, 16 Jun 2020 17:43:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0565281EE2; Tue, 16 Jun 2020 09:41:47 +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="gMZBMC9A"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 19E4181EC0; Tue, 16 Jun 2020 09:41:19 +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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 A861081EB4 for ; Tue, 16 Jun 2020 09:40:58 +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 05G7e7l2028817; Tue, 16 Jun 2020 09:40:55 +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=trDbTbr+tpg5eY91k0ud508mdbsi2D7D3/7TyxwdArc=; b=gMZBMC9A8EsxT6rLpVFts7BtWCRFJYBjb7/CAPp8JYI5gixKIVK6MSu/xRIKTHDF0nxv xVBOKnrUugcN82iBYYMjiwBHk4To98Rkj9SA2aw6T5v466h6lNWLXSHZe+aAYWqQT2CR jukVJ/pIcB/vUCOfe6dE2zgfedNxUWWbNaS4y2cI9oH7DIz7x1pCSDusGO6kWtbWtZLR 7VedypeyIDbsYmI5/wPh9LGmAwev0Km1r9KuvVdpOf+6QqdrFHc3efVqAE34P1P5VHcR 0t5aY2GANt4v2SWlrx3jq/4XTFnHJqBtX0awLjbHbnK8MTzB637hiiLpQ12Qy9O87YPB nw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31mnph5mqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:55 +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 6365D100038; Tue, 16 Jun 2020 09:40:54 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 592A42AEF93; Tue, 16 Jun 2020 09:40:54 +0200 (CEST) Received: from localhost (10.75.127.45) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:54 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Mario Six , Simon Glass , U-Boot STM32 Subject: [PATCH v2 5/9] sandbox: support the change of env location Date: Tue, 16 Jun 2020 09:40:44 +0200 Message-ID: <20200616074048.7898-6-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG1NODE3.st.com (10.75.127.3) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Add support of environment location with a new sandbox command 'env_loc'. When the user change the environment location with the command 'env_loc ' the env is reinitialized and saved; the GD_FLG_ENV_DEFAULT flag is also updated. When the user set the same env location, the environment is re-loaded. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass --- Changes in v2: - change cmd_tbl_t to struct cmd_tbl board/sandbox/sandbox.c | 42 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 9cb5fe5c75..bd99141fa8 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -4,6 +4,7 @@ */ #include +#include #include #include #include @@ -21,6 +22,9 @@ */ gd_t *gd; +/* env location: current location used during test */ +static enum env_location sandbox_env_location = ENVL_NOWHERE; + /* Add a simple GPIO device */ U_BOOT_DEVICE(gpio_sandbox) = { .name = "gpio_sandbox", @@ -53,9 +57,45 @@ enum env_location env_get_location(enum env_operation op, int prio) gd->env_load_prio = 0; - return ENVL_NOWHERE; + return sandbox_env_location; } +static int do_env_loc(struct cmd_tbl *cmdtp, int flag, int argc, + char * const argv[]) +{ + enum env_location loc; + + if (argc < 2) + return CMD_RET_USAGE; + + loc = (enum env_location)simple_strtoul(argv[1], NULL, 10); + if (loc >= ENVL_COUNT) + return CMD_RET_FAILURE; + + if (sandbox_env_location != loc) { + sandbox_env_location = loc; + if (loc == ENVL_NOWHERE) { + gd->flags |= GD_FLG_ENV_DEFAULT; + gd->env_valid = ENV_VALID; + } else { + if (gd->flags & GD_FLG_ENV_DEFAULT) { + gd->flags &= ~GD_FLG_ENV_DEFAULT; + if (!env_init()) + env_save(); + } + } + } else { + if (!env_init()) + env_load(); + } + + return CMD_RET_SUCCESS; +} + +U_BOOT_CMD(env_loc, 2, 1, do_env_loc, + "set the environment location", "[loc]" +); + int dram_init(void) { gd->ram_size = CONFIG_SYS_SDRAM_SIZE; From patchwork Tue Jun 16 07:40:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310091 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=OIY2Zcp4; 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 49mKtR2z3Qz9s1x for ; Tue, 16 Jun 2020 17:42:55 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A7E8A81E82; Tue, 16 Jun 2020 09:41: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=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="OIY2Zcp4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7F6DC81EC5; Tue, 16 Jun 2020 09:41:18 +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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 2666381E82 for ; Tue, 16 Jun 2020 09:40:56 +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 05G7e33F007394; Tue, 16 Jun 2020 09:40:55 +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=hoEkkRWgfDEoELkq3rOGZ+1n//KQz/F2hVFrbw8TZLU=; b=OIY2Zcp4WLCWZ4iNhidhyFWqx+pIFzIBh7r82Szj0nawweRTIRlAlDV7K7We+VGyCqIP aZyQfSr/gr6Z9FxKqAWOI3Fl6rlC77F7szUTP+29KXJ/nkjYYvMqT+jwew1Bitp42D4Y UauZ0PSJsymK7RERtulERHHI4e56h994tXTaey1uoMAh5qAOCnx8Ud2kJLtaaD1tTw/d bBIKbHpcb10YuAUdHMtbFWiHp3PiX8bzc3de85nACqtIf1cOzytd3ItriKfI8NlJXtP3 +rzGtZF1Pn418CSPBifC/MUA0wUQGXK49CmgbgJmVKAIqlnOY/70FzVv/K96oLGUT2lo 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 31mkx95x2a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:55 +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 115EE10002A; Tue, 16 Jun 2020 09:40:55 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 085CE2AEF93; Tue, 16 Jun 2020 09:40:55 +0200 (CEST) Received: from localhost (10.75.127.46) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:54 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Stephen Warren , U-Boot STM32 Subject: [PATCH v2 6/9] test: environment in ext4 Date: Tue, 16 Jun 2020 09:40:45 +0200 Message-ID: <20200616074048.7898-7-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG7NODE3.st.com (10.75.127.21) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 v1) test/py/tests/test_env.py | 87 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py index cbdb41031c..6f1d94b953 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 + import pytest import u_boot_utils @@ -380,3 +384,86 @@ def test_env_info_quiet(state_test_env): assert response == "" response = c.run_command('echo $?') assert response == "1" + +def mk_env_ext4(state_test_env): + c = state_test_env.u_boot_console + + """Create a empty ext4 file system volume. + """ + 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: + check_call('rm -f %s' % persistent, shell=True) + check_call('dd if=/dev/zero of=%s bs=1M count=16' + % persistent, shell=True) + check_call('mkfs.ext4 -O ^metadata_csum %s' % persistent, shell=True) + except CalledProcessError: + call('rm -f %s' % persistent, shell=True) + raise + + call('cp -f %s %s' % (persistent, fs_img), shell=True) + return fs_img + +@pytest.mark.boardspec('sandbox') +@pytest.mark.buildconfigspec('cmd_nvedit_info') +@pytest.mark.buildconfigspec('cmd_echo') +@pytest.mark.buildconfigspec('env_is_in_ext4') +def test_env_ext4(state_test_env): + + c = state_test_env.u_boot_console + + 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 + + """ env location: ENVL_EXT4 (2) + """ + response = c.run_command('env_loc 2') + assert 'Saving Environment to EXT4' in response + + response = c.run_command('env_loc 2') + 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: ENVL_NOWHERE (12) + """ + c.run_command('env_loc 12') + + response = c.run_command('env info') + assert 'env_valid = valid' 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 + + call('rm -f %s' % fs_img, shell=True) From patchwork Tue Jun 16 07:40:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310097 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=UJvt8kxu; 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 49mKwQ0CtBz9sRN for ; Tue, 16 Jun 2020 17:44:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B0AE681F00; Tue, 16 Jun 2020 09:41:58 +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="UJvt8kxu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 956BB81EC0; Tue, 16 Jun 2020 09:41:25 +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 [62.209.51.94]) (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 C0BE581EB3 for ; Tue, 16 Jun 2020 09:40: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=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 05G7ctMG026893; Tue, 16 Jun 2020 09:40:56 +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=V4PV2XlPFMIrfTHGzsKQcpW33DwRXTfGD/94XPw8FHU=; b=UJvt8kxulaVu/G0HXL9xReoArVXRcRwvamwYEIdBrMXM40FSmvOOC9tCmuyyKk2QePlZ lX31aLAb7ZWwFPiNm1Ov5sIrKnkoztrHexjf5TzkydXZO7+9MPCpV0pWFWuPxLywwFjt tRYrSTw22vGE6vD+PFRTwe5Q3FJhXas1eJGkHECRwJywOm/rdfhmKfiFdESFiA6q9Yh2 8+k9OorG6lcYlHCTbPsxSVu1z8AseJR9vSLtQOXODIAuLV4VgZj/q/hMPupA1H/7NiSk KM9+uQnLpwxw72n0aqF+sh5HVatZQ2WJ/NSu34nXVdxiOG37u4/7EtkY6VUGA0ON4c39 5Q== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31mmjvwtj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:56 +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 C5C3F100034; Tue, 16 Jun 2020 09:40:55 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id BC30F2AEF93; Tue, 16 Jun 2020 09:40:55 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:55 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v2 7/9] env: ext4: introduce new function env_ext4_save_buffer Date: Tue, 16 Jun 2020 09:40:46 +0200 Message-ID: <20200616074048.7898-8-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG2NODE2.st.com (10.75.127.5) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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..027a721b69 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 Jun 16 07:40:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310094 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=l6T2f59w; 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 49mKvf13QDz9sSS for ; Tue, 16 Jun 2020 17:43:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E281681EE8; Tue, 16 Jun 2020 09:41:50 +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="l6T2f59w"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C809881EB4; Tue, 16 Jun 2020 09:41:19 +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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 D449E81EBB for ; Tue, 16 Jun 2020 09:40:58 +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 05G7e7v0028803; Tue, 16 Jun 2020 09:40:57 +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=T1NoD+hMRpAWoMGRu6q5H4AbgS2dmwlKZMsggdTYuwg=; b=l6T2f59wgrtb1f6P7BPtB1wXwS1wduO3w/VyKuPKqmGrOJ7zYduNMUgXXvpIrWa5/Vah YE8CyQer7eoAXR4v21fuj9di7IpUjuq+7/JVjvA694uoxGxcBG57vtcUNZwJ13GGa9FR ZQB9D7ZwDmiwjbfp/uCoc6srvbaOmLzmd5f+p4WcQDS/qZ4qkKoE037uS7bhbeFn40Z9 8zgcY+BoxalBWBZCT0HuvY9qkFoFzNdtoBlwuvsaaqUUBhywaQpbcHo11+FzZXI8lg4O uui2jEnB2qEO6gCTfKfL5v+ZL/z07bE8Q3DJ9f5zpDquqosI9gk622HwBB0NFbpAKqe1 NQ== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31mnph5mqx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:57 +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 738E210002A; Tue, 16 Jun 2020 09:40:56 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6AA2C2AEF93; Tue, 16 Jun 2020 09:40:56 +0200 (CEST) Received: from localhost (10.75.127.45) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:56 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v2 8/9] env: ext4: add support of command env erase Date: Tue, 16 Jun 2020 09:40:47 +0200 Message-ID: <20200616074048.7898-9-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG1NODE1.st.com (10.75.127.1) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 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 --- 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 027a721b69..7a104c1615 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 Jun 16 07:40:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1310098 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=SKHHG2JT; 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 49mKwp4lgLz9s1x for ; Tue, 16 Jun 2020 17:44:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0A08881EEF; Tue, 16 Jun 2020 09:42:05 +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="SKHHG2JT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1013281EC0; Tue, 16 Jun 2020 09:41:27 +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,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, 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 93FAE81EBC for ; Tue, 16 Jun 2020 09:41:00 +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 05G7e27D007333; Tue, 16 Jun 2020 09:40:57 +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=Vc3ghUXyZMAB8TYkFy3EF0WY5Hli2ca6cgS3+AiK3oY=; b=SKHHG2JTk6zcLfrs+mqacInFT4zqvFnbBXeAJWJ7SxXQfj3lclHDfPggEFlTyTM37G9+ cc576LUiTXpTk9bQmi2DTtyUpy1DbAuNJbJEvjyqxmspDWhSem1cSnb5AjgJnzz8B/lR ynKteb7M2740nqCzMgX36PrtrJfGT87LjkzK/2auFMckgQgINX1U5zcBSlBzuqyCCmXe gl+I+eUQ+99dsv1rk6+kZhgU7pq/3J1dCKIJTt/LMkgXy+2H7FBciHy1N0ILpD28BWgr 3lqExJWJpMqjjy3wztW7xVNxoAzA7ckg2PjeVmQrecaLL9inNFaud/aUwOP0tc0Hua+A oA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 31mkx95x2f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 16 Jun 2020 09:40:57 +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 3BA39100038; Tue, 16 Jun 2020 09:40:57 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 312972AEF93; Tue, 16 Jun 2020 09:40:57 +0200 (CEST) Received: from localhost (10.75.127.47) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 16 Jun 2020 09:40:56 +0200 From: Patrick Delaunay To: CC: Patrick Delaunay , Mario Six , Simon Glass , Stephen Warren , U-Boot STM32 Subject: [PATCH v2 9/9] test: sandbox: add test for erase command Date: Tue, 16 Jun 2020 09:40:48 +0200 Message-ID: <20200616074048.7898-10-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200616074048.7898-1-patrick.delaunay@st.com> References: <20200616074048.7898-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] X-ClientProxiedBy: SFHDAG1NODE1.st.com (10.75.127.1) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.687 definitions=2020-06-16_02:2020-06-15, 2020-06-16 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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.2 at phobos.denx.de X-Virus-Status: Clean Add test for the erase command tested on ENV in EXT4. Signed-off-by: Patrick Delaunay Reviewed-by: Simon Glass Acked-by: Stephen Warren --- (no changes since v1) 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 b70272c0b0..3913b6392e 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 715f5dc39d..c59e20579d 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 ce806270bd..99b750b4f8 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_LOOPW=y CONFIG_CMD_MD5SUM=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index ea11c9bded..52e7625bd7 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 6f1d94b953..a71b4c2571 100644 --- a/test/py/tests/test_env.py +++ b/test/py/tests/test_env.py @@ -453,6 +453,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_loc 2') + 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: ENVL_NOWHERE (12) """ c.run_command('env_loc 12')