From patchwork Wed Feb 12 18:44:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237007 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=0QEzm6+O; 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 48HpVV2wd8z9s1x for ; Thu, 13 Feb 2020 05:45:22 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3F6688124F; Wed, 12 Feb 2020 19:45:18 +0100 (CET) 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="0QEzm6+O"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6551381253; Wed, 12 Feb 2020 19:45:16 +0100 (CET) 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 1698181244 for ; Wed, 12 Feb 2020 19:45:13 +0100 (CET) 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 01CIg6Yv021881; Wed, 12 Feb 2020 19:45:12 +0100 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=OiwrFh3/S2/hRMVHTzd8/kh4L3RtkxzxgBHJkkhEzTY=; b=0QEzm6+OFfLKia/Flz6HqbAVpAvw+2FJS0+hq5TqKR4zX19m7zvlLYt+etCAE0OLaa/F 6u/xHLEgV8B6f8QXGgWv8Qaq7OW1G43hdo0R9QJkHxyssPkolKlpXoh9o43wWzU3b7a/ faui45/ldyLNWNI7LK3t0Fk4cgO/x9sTy5DNpv3T6NLQyyI2rBBBBlZwxQ117JK7e4Iy aBGUOo3ciZOABHFdp8+3uMFjTlZP9cwdDyh9FBI9VVuvR4QKkFyPBO41xujXlZtbr9t2 YGptDwA9orp0yTk7bEx3mdqyiWbcvarvpEuli7TCTSBgOTuAdQ/OLlWDUx4AyfHE8e0k Lg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1uvdqv1t-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:12 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6AEDF10003D; Wed, 12 Feb 2020 19:45:04 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 62F6B2C60B1; Wed, 12 Feb 2020 19:45:04 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:03 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [RESEND PATCH 01/10] env: add absolute path at CONFIG_ENV_EXT4_FILE Date: Wed, 12 Feb 2020 19:44:52 +0100 Message-ID: <20200212184501.5911-2-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-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.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 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 --- 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_optee_defconfig:51:CONFIG_ENV_EXT4_FILE="/uboot.env" stm32mp15_trusted_defconfig:50:CONFIG_ENV_EXT4_FILE="/uboot.env" env/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/Kconfig b/env/Kconfig index 0d6f559b39..8059749701 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -467,7 +467,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 Wed Feb 12 18:44:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237012 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=of62diUv; 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 48HpWV54cwz9s1x for ; Thu, 13 Feb 2020 05:46:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5C3D881273; Wed, 12 Feb 2020 19:45:28 +0100 (CET) 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="of62diUv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4E86981257; Wed, 12 Feb 2020 19:45:20 +0100 (CET) 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 1CE818123A for ; Wed, 12 Feb 2020 19:45:15 +0100 (CET) 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 01CIgifm017922; Wed, 12 Feb 2020 19:45:13 +0100 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=Eau3pLj/S13wvwqTjRgoQ0QUxIGH4WX+a5RizJiIf2g=; b=of62diUvXr1IFWfg2ZZ1mNN5EVYYOQ3OG6PWtxoa0H9Vv9fRL8oxPrleN7m5K6qIk1Pl DXqbDYLtkuf9YdDWqBlqB5DbaEZzFVC7rG/w9M1rPmW2fMO3LEs/OU68lBISewotUh8L Kyc3+88andsnRoavL5lN4G/oSmbTfpCYBDvbmNee9NxBWtRxaWHoO1BhDNWAtCTRyfle hO+ufJTZ3a695c+6yiMYYatWpBBG478A7/nsFKO7jsQSef678iq0Asai7Pv8MbIpOHV7 vJoNl8juQoxnEp1CP3idRX3/01nBQntYT4INROKbcrFoDkptXG8RjEP11Cq9fwHRQ8Gj 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 2y1ufhgc8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:13 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 84FC710003E; Wed, 12 Feb 2020 19:45:05 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7D2302C60B1; Wed, 12 Feb 2020 19:45:05 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:04 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [RESEND PATCH 02/10] env: ext4: set gd->env_valid Date: Wed, 12 Feb 2020 19:44:53 +0100 Message-ID: <20200212184501.5911-3-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG8NODE2.st.com (10.75.127.23) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 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 --- env/ext4.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/env/ext4.c b/env/ext4.c index 1f6b1b5bd8..e3bbf4a4e0 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -31,6 +31,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; @@ -125,7 +128,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 Wed Feb 12 18:44:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237017 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=dQZ0rOwf; 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 48HpXT738xz9s1x for ; Thu, 13 Feb 2020 05:47:05 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6EAA081289; Wed, 12 Feb 2020 19:45:38 +0100 (CET) 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="dQZ0rOwf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DBF7081244; Wed, 12 Feb 2020 19:45:23 +0100 (CET) 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 26A4E81242 for ; Wed, 12 Feb 2020 19:45:15 +0100 (CET) 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 01CIgmr6006915; Wed, 12 Feb 2020 19:45:13 +0100 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=cim5RCor7m9WLRk7j2NFtE/aFBSp+BFFNE7/+z/yRa0=; b=dQZ0rOwfFKUiBWTe0GV12q/IWnjAlWEoRSGHFDpoVRPwIElDnXDWfcbNazDeA5tERTJe KyjjNbLnGB/h3Rbr0Ta9Ka6GCeKeh6a452g9yTNX3dV6eu08GNEVAzk2HEgWgNiLG/Sz A0OgeioPm9K6cIEC6SlD0ws53q0wquuXV+De7j+6K5qlRAtrLEReZQexUsQ+kdpaPaCW PymAP4gPdvu2s1b4EETW2DhzSgjU2kIJm1q02G/fpyRFt493ujwLnb9YPdgfFcEnH32L YInWFtvZ6alY2+Uj5s2DgRB6skHIgCMc2ywBtFwT2n6D7Yd+7Sa2RCd2+vykEUQbDuQu Yg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1urhg7ps-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:13 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 458C0100040; Wed, 12 Feb 2020 19:45:06 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 3D3962C60B1; Wed, 12 Feb 2020 19:45:06 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:05 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [RESEND PATCH 03/10] env: correctly handle result in env_init Date: Wed, 12 Feb 2020 19:44:54 +0100 Message-ID: <20200212184501.5911-4-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] 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.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 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 don'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 --- env/env.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/env/env.c b/env/env.c index 9237bb9c74..e4df1715e4 100644 --- a/env/env.c +++ b/env/env.c @@ -292,7 +292,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 Wed Feb 12 18:44:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237011 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=n93YE0io; 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 48HpWH0kckz9s1x for ; Thu, 13 Feb 2020 05:46:03 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8ED8D81266; Wed, 12 Feb 2020 19:45:27 +0100 (CET) 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="n93YE0io"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0961D81263; Wed, 12 Feb 2020 19:45:20 +0100 (CET) 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 7D8EB81245 for ; Wed, 12 Feb 2020 19:45:15 +0100 (CET) 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 01CIg6Yw021881; Wed, 12 Feb 2020 19:45:13 +0100 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=mOa3ahmlChe1QUYJY9Arw5xK8S6n8XkryXANfGc9gME=; b=n93YE0io000BnAKpGCX8p6OsQZcR4Lbl4TBh6L6vq3F4KajTxtwDBXSHsgKvDKhltnkm +seCYQb+ew8aGFkkEstfBk31egNfRL1txWu1VYr0XUcF7wbPO8HbuNaDGBH4/7Gbz/ZP dN03DWQkp+PdpAzyBhNll679oWhF1yhxk/dwI0vrc4zDjPGMZQsbWcxdEmCPvK+xUOuK fohV2I+2LeMPU6Z/88kVfwXXN9ipi7DOhXt5iHvAaMT4iZHarRHL59sk4oOZAbYL2q1j x5IhzxZbykHQhJ4Ipdzk1B1va4wqu7g6CG0uFcbGt4vJtOXzTCayYElhS7wVlrxRPuix RA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1uvdqv1u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:13 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 56E46100042; Wed, 12 Feb 2020 19:45:07 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 4DBF52C60B1; Wed, 12 Feb 2020 19:45:07 +0100 (CET) Received: from localhost (10.75.127.44) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 12 Feb 2020 19:45:06 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Mario Six , Simon Glass , U-Boot STM32 Subject: [RESEND PATCH 04/10] sandbox: activate env in ext4 support Date: Wed, 12 Feb 2020 19:44:55 +0100 Message-ID: <20200212184501.5911-5-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG5NODE1.st.com (10.75.127.13) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 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 --- 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 0c3d245dff..01f356be31 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 cdcb0acbdc..6172259924 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -75,6 +75,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_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 33a103edab..28a6211189 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -84,6 +84,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_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 2bfbb66453..1324aaca37 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -59,6 +59,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_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 3bf27c974a..eadcdb9f43 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -76,6 +76,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_SYS_RELOC_GD_ENV_ADDR=y CONFIG_NETCONSOLE=y CONFIG_IP_DEFRAG=y From patchwork Wed Feb 12 18:44:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237015 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=TJNLQCrB; 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 48HpX70wCGz9s1x for ; Thu, 13 Feb 2020 05:46:47 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5B1DE8127E; Wed, 12 Feb 2020 19:45:36 +0100 (CET) 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="TJNLQCrB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A49F81244; Wed, 12 Feb 2020 19:45:22 +0100 (CET) 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 8E1BC81244 for ; Wed, 12 Feb 2020 19:45:16 +0100 (CET) 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 01CIgh8d024159; Wed, 12 Feb 2020 19:45:14 +0100 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=m9tQbcUtZCc3Cgtg0UGOMGA/Fchaq528VqoXWzxpVOU=; b=TJNLQCrBcmX+H4nC54OahQ9UUjNBNJiS23RfqCI/80dSPcXqdEKot3iz2L+qPprsYMBc qVrgoYsbC6mQ8zrz6JgZBdpolShZN4wT1eYo/Ig3+vT0/hV4/6KMUvJ/0Jiw1MydGuZ7 cNnpHBLSdjuaRdG2/io3vhBu+Phn/Pe2sZrUAxQdUbM8ygqDljRUQa62JCoPKHJWdUDV H+45Bc/OOkW+YafJzQ3LicR4M6SPNAYkid6ShXzZ4IPpGexozr0vf9r/gOLJKm2I0LXm X7rvbKzY5AreJXi6bOqMIs+rPlrMbSfuGP6imZMtLrIxdVzjheYYTmKuDkHMFgvv6Vnx Ug== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1uda04cf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:14 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E5042100044; Wed, 12 Feb 2020 19:45:07 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id DCC462C60B1; Wed, 12 Feb 2020 19:45:07 +0100 (CET) Received: from localhost (10.75.127.44) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Wed, 12 Feb 2020 19:45:07 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Mario Six , Simon Glass , U-Boot STM32 Subject: [RESEND PATCH 05/10] sandbox: support the change of env location Date: Wed, 12 Feb 2020 19:44:56 +0100 Message-ID: <20200212184501.5911-6-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.44] X-ClientProxiedBy: SFHDAG7NODE1.st.com (10.75.127.19) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 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 --- board/sandbox/sandbox.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/board/sandbox/sandbox.c b/board/sandbox/sandbox.c index 01f356be31..023a71d5f0 100644 --- a/board/sandbox/sandbox.c +++ b/board/sandbox/sandbox.c @@ -21,6 +21,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 +56,44 @@ 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(cmd_tbl_t *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 Wed Feb 12 18:44:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237009 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=qCXuj6mR; 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 48HpVv4YkPz9s1x for ; Thu, 13 Feb 2020 05:45:43 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 490C681244; Wed, 12 Feb 2020 19:45:25 +0100 (CET) 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="qCXuj6mR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 109098125E; Wed, 12 Feb 2020 19:45:19 +0100 (CET) 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 7074E81236 for ; Wed, 12 Feb 2020 19:45:14 +0100 (CET) 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 01CIgf4Z023880; Wed, 12 Feb 2020 19:45:14 +0100 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=HAX7akF+EwBPK3DsIb46V9XzXI20N0NyBhEt5aaI8UY=; b=qCXuj6mR2pEVYEgdlO2YcQQzBmim4zONwLB4NAlFaFme7GKIWUUOYXLL3QETMNnucrmd ksxfrE6xyYIyBFOGHFDxOYu9BLbz9Vz/j0JKLg493zb4O1HjC3PJZ/dH1/9ISk3KXCmI vSUN6tf7VOBEHNXAYawZpQNOz2+Ido2tgeKH85/ssFwNLTacNwdvG+qp+9FIlFrcyvW+ Xz+ZzuZC9uoC877NlGg0jxJkffeR4Isr9bmBV0vWGqkKWy9mpnlJJCmSWbFwz6ZAV9op dCWgZDD/xe75h5RSVt5JxiAHpqXm3W3nhLWQhQhI/Nad0JOP9792ZDBbuGh9GDnsiJ/d hA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1uda04ce-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:14 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id A7225100045; Wed, 12 Feb 2020 19:45:08 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9F4BC2C60B1; Wed, 12 Feb 2020 19:45:08 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:07 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Stephen Warren , U-Boot STM32 Subject: [RESEND PATCH 06/10] test: environment in ext4 Date: Wed, 12 Feb 2020 19:44:57 +0100 Message-ID: <20200212184501.5911-7-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG4NODE2.st.com (10.75.127.11) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 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 a empty EXT4 file system is created in persistent data dir: env.ext4.img. Signed-off-by: Patrick Delaunay --- 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..d35ad888a7 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 Wed Feb 12 18:44:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237013 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=WiNm2oob; 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 48HpWj3gQMz9s1x for ; Thu, 13 Feb 2020 05:46:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 25B9281279; Wed, 12 Feb 2020 19:45:29 +0100 (CET) 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="WiNm2oob"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B96881257; Wed, 12 Feb 2020 19:45:21 +0100 (CET) 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 876FB81249 for ; Wed, 12 Feb 2020 19:45:15 +0100 (CET) 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 01CIgmZj006928; Wed, 12 Feb 2020 19:45:14 +0100 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=sRgTt+DNzZN4jbjX6YFukilKONIqSquaLUztZ68fCSY=; b=WiNm2oobZYM8pvu82Gv4KHzzkYLugXeZpLguq+JCG9znP7AGGiwH8FIleG+U12E8gIwI oV4MAUAUx8Os9CnySnylKr61pwsG/zJS3S9+qSv3Re0+Cc8T4DYjt9nwlU+lBqJuFTr0 uhRDITRLIv+n3ByKTljlUFwFtUBhgmWBMyKcAzqSk8iozChdZUGt5v56XF2clH4N6EfQ s3m/yHwi/3/lB5nmvcXTMwfd9Xdi65nToLIvjaXtC5bqPRz8lrg/ksW/2BF+DzJq+/AD 3FpMB89qvnAiEDK/BAz56/IjhNkNskpdqOIEhxtZ63eqnvdCZDdtodkV2/kvLH5P/Kmv 8g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1urhg7pt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:14 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 661B4100048; Wed, 12 Feb 2020 19:45:09 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 5E5332C60B1; Wed, 12 Feb 2020 19:45:09 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:08 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [RESEND PATCH 07/10] env: ext4: fix possible compilation issue Date: Wed, 12 Feb 2020 19:44:58 +0100 Message-ID: <20200212184501.5911-8-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG6NODE2.st.com (10.75.127.17) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 at phobos.denx.de X-Virus-Status: Clean Fix possible compilation issue in env ext4 support when CONFIG_CMD_SAVEENV is not activated. Signed-off-by: Patrick Delaunay --- env/ext4.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/env/ext4.c b/env/ext4.c index e3bbf4a4e0..aa77261649 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -144,5 +144,7 @@ U_BOOT_ENV_LOCATION(ext4) = { .location = ENVL_EXT4, ENV_NAME("EXT4") .load = env_ext4_load, +#ifdef CONFIG_CMD_SAVEENV .save = env_save_ptr(env_ext4_save), +#endif }; From patchwork Wed Feb 12 18:44:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237010 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=mgZPEPnf; 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 48HpW51Tcyz9s3x for ; Thu, 13 Feb 2020 05:45:53 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 989D28125A; Wed, 12 Feb 2020 19:45:26 +0100 (CET) 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="mgZPEPnf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 587DA81258; Wed, 12 Feb 2020 19:45:19 +0100 (CET) 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 3A6D28123E for ; Wed, 12 Feb 2020 19:45:15 +0100 (CET) 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 01CIg6Yx021881; Wed, 12 Feb 2020 19:45:14 +0100 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=+jtj3CmL0QgqRvRjC8/K9G0x5M7BSfr3Zac8Pe5cKVM=; b=mgZPEPnfP91vHF68N9cBHeC2KiEzqGZDCJ2MemclD1jECSyGbxK+vHSoYuxWDCqxSRLZ 1zmqY0cUSxa/y32m6AfsnFozTpiamolVTxgJ0W75r7TWcB5PATYNqykVljA9OgByZcq3 YTbQL5lXyekTOkkkaNKmc/0NTTMSj7iKf/kDBk5CGlkjdT7Xp2MIC9Hcq0sLF8+52JhQ oADOXH6n64e+sSgSZqob94EKnPiS7qVhjHG/codClYC45sMeWi0EJgVMDCBkpBGnjo/x fFLAKikWDZ+fHWHju/JG8sr+EDjK0ul6J8S5aVMWHuito6dP6ez+cBslbaF9QD2srASx bA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1uvdqv1v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:14 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 38CFC10002A; Wed, 12 Feb 2020 19:45:10 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 30F622C60B1; Wed, 12 Feb 2020 19:45:10 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:09 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [RESEND PATCH 08/10] env: ext4: introduce new function env_ext4_save_buffer Date: Wed, 12 Feb 2020 19:44:59 +0100 Message-ID: <20200212184501.5911-9-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.47] 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.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 at phobos.denx.de X-Virus-Status: Clean Split the function env_ext4_save to prepare the erase support Signed-off-by: Patrick Delaunay --- env/ext4.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/env/ext4.c b/env/ext4.c index aa77261649..49ed06659f 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -43,10 +43,9 @@ __weak const char *env_ext4_get_dev_part(void) return (const char *)CONFIG_ENV_EXT4_DEVICE_AND_PART; } -#ifdef CONFIG_CMD_SAVEENV -static int env_ext4_save(void) +#if defined(CONFIG_CMD_SAVEENV) +static int env_ext4_save_buffer(env_t *env_new) { - env_t env_new; struct blk_desc *dev_desc = NULL; disk_partition_t 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,28 @@ static int env_ext4_save(void) CONFIG_ENV_EXT4_FILE, ifname, dev, part); return 1; } - gd->env_valid = ENV_VALID; + return 0; +} +#endif + +#ifdef CONFIG_CMD_SAVEENV +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; } #endif /* CONFIG_CMD_SAVEENV */ From patchwork Wed Feb 12 18:45:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237014 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=XszC712k; 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 48HpWw2nc8z9s1x for ; Thu, 13 Feb 2020 05:46:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6136081282; Wed, 12 Feb 2020 19:45:30 +0100 (CET) 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="XszC712k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EFE658125A; Wed, 12 Feb 2020 19:45:21 +0100 (CET) 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 E505C81246 for ; Wed, 12 Feb 2020 19:45:15 +0100 (CET) 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 01CIgmr7006915; Wed, 12 Feb 2020 19:45:15 +0100 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=T49wc0rO2e6EaBeFaHoTUHy06Qx+rOGUUHUf+keKcXI=; b=XszC712keeWijFZ3j4jLB+gcx4LU3L0WW/Rqr10wU61hwQe6ubgwAnnC03x4030R0Wra N5SApRcuJvI/KvQf/P8lHcq4AyxUGEc/xrnVt9j/v0xn6xXEmv+M9hWjczD1E/vsRWq1 pXh9HheWlaQdeUTYF4BgylPwlTRNxt1oZwUnXcqKEU8a4tAfih5kZXAnkZlqbvRL+f98 53r/gGx5/faQgkksnnrBmF8v6T3O0lQu0LgwdLHSXXcFUoLpklUgBPqJyf2rZT1fkEvB tUb9GvVuNN6kv92YwX4Impxlqy52HOqEDX3A4g0OI9MR91ZQQDAi9/++HA3rwVXOw7kB 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 2y1urhg7pw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:15 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id F0D80100034; Wed, 12 Feb 2020 19:45:10 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E82982C60B1; Wed, 12 Feb 2020 19:45:10 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:10 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [RESEND PATCH 09/10] env: ext4: add support of command env erase Date: Wed, 12 Feb 2020 19:45:00 +0100 Message-ID: <20200212184501.5911-10-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-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.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 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 --- env/ext4.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/env/ext4.c b/env/ext4.c index 49ed06659f..aec2a33fad 100644 --- a/env/ext4.c +++ b/env/ext4.c @@ -43,7 +43,7 @@ __weak const char *env_ext4_get_dev_part(void) return (const char *)CONFIG_ENV_EXT4_DEVICE_AND_PART; } -#if defined(CONFIG_CMD_SAVEENV) +#if defined(CONFIG_CMD_SAVEENV) || defined(CONFIG_CMD_ERASEENV) static int env_ext4_save_buffer(env_t *env_new) { struct blk_desc *dev_desc = NULL; @@ -102,6 +102,25 @@ static int env_ext4_save(void) } #endif /* CONFIG_CMD_SAVEENV */ +#if defined(CONFIG_CMD_ERASEENV) +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; +} +#endif + static int env_ext4_load(void) { ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE); @@ -161,4 +180,7 @@ U_BOOT_ENV_LOCATION(ext4) = { #ifdef CONFIG_CMD_SAVEENV .save = env_save_ptr(env_ext4_save), #endif +#if defined(CONFIG_CMD_ERASEENV) + .erase = env_ext4_erase, +#endif }; From patchwork Wed Feb 12 18:45:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1237016 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=Y+zxxYHs; 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 48HpXJ2N5dz9s3x for ; Thu, 13 Feb 2020 05:46:56 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 840D581285; Wed, 12 Feb 2020 19:45:37 +0100 (CET) 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="Y+zxxYHs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A77A381246; Wed, 12 Feb 2020 19:45:22 +0100 (CET) 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 BA4AA8122B for ; Wed, 12 Feb 2020 19:45:17 +0100 (CET) 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 01CIgmr8006915; Wed, 12 Feb 2020 19:45:16 +0100 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=i7Vhq2AKy88I6syR3OsQ1Jp/4BTcvRJJs9TFoUqgET8=; b=Y+zxxYHsUHoPZ5gqBUnr5/arJ/q94Sz4kXAT7CGKfjETmlQAmKAsue5YPGklulN+cNsU EqMit4vf460nRmBawfUE1zocBAIGIxVyzSeIT8MkyKKm4Z5WNx2TBOeuKj1QXBDm8Wpk sdeFSvBi92u29npT1CvaJ4FD+K62Q3gu76uA9/6an3Yxzk+cuitB6gAvDtaroFpR4hid re0QS7DCn/7tA2YRUYfn4jBgKTgnDCDcD9fiKzAZgtJ+clPjbQCCRlFyXlSvcq455i1o bE8AdgIgrncWAcnGhQJ7EKnJ/G7y5WvoLFmYxVKg2CqYtO5De+ln6NV2NEF6j+MJWMVY XA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 2y1urhg7px-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Feb 2020 19:45:16 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B5F6F100038; Wed, 12 Feb 2020 19:45:11 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id ACC412C60B1; Wed, 12 Feb 2020 19:45:11 +0100 (CET) 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; Wed, 12 Feb 2020 19:45:11 +0100 From: Patrick Delaunay To: CC: Patrick Delaunay , Mario Six , Simon Glass , Stephen Warren , U-Boot STM32 Subject: [RESEND PATCH 10/10] test: sandbox: add test for erase command Date: Wed, 12 Feb 2020 19:45:01 +0100 Message-ID: <20200212184501.5911-11-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200212184501.5911-1-patrick.delaunay@st.com> References: <20200212184501.5911-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.45] X-ClientProxiedBy: SFHDAG5NODE3.st.com (10.75.127.15) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.572 definitions=2020-02-12_08:2020-02-12, 2020-02-12 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.1 at phobos.denx.de X-Virus-Status: Clean Add test for the erase command tested on ENV in EXT4. Signed-off-by: Patrick Delaunay --- configs/sandbox64_defconfig | 1 + configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 1 + configs/sandbox_spl_defconfig | 1 + test/py/tests/test_env.py | 20 ++++++++++++++++++-- 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index 6172259924..a92dc957e8 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -25,6 +25,7 @@ CONFIG_CMD_BOOTZ=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/configs/sandbox_defconfig b/configs/sandbox_defconfig index 28a6211189..82a980e652 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -29,6 +29,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_INFO=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 1324aaca37..93d587fe38 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -22,6 +22,7 @@ CONFIG_CMD_BOOTZ=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 eadcdb9f43..2337eade06 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -31,6 +31,7 @@ CONFIG_CMD_BOOTZ=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 d35ad888a7..a71b4c2571 100644 --- a/test/py/tests/test_env.py +++ b/test/py/tests/test_env.py @@ -423,7 +423,7 @@ def test_env_ext4(state_test_env): response = c.run_command('ext4ls host 0:0') assert 'uboot.env' not in response - """ env_location: ENVL_EXT4 (2) + """ env location: ENVL_EXT4 (2) """ response = c.run_command('env_loc 2') assert 'Saving Environment to EXT4' in response @@ -453,7 +453,23 @@ def test_env_ext4(state_test_env): response = c.run_command('echo $?') assert response == "0" - """ restore env_location: ENVL_NOWHERE (12) + 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')