From patchwork Tue Jul 28 09:51:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick DELAUNAY X-Patchwork-Id: 1337715 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.a=rsa-sha256 header.s=STMicroelectronics header.b=XN7wJ1SH; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BGBms0Y8Hz9sSd for ; Tue, 28 Jul 2020 19:52:45 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5319B823D7; Tue, 28 Jul 2020 11:51:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=st.com header.i=@st.com header.b="XN7wJ1SH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF696823C3; Tue, 28 Jul 2020 11:51:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 56032823BA for ; Tue, 28 Jul 2020 11:51:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=patrick.delaunay@st.com Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06S9nh3V000662; Tue, 28 Jul 2020 11:51:39 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=c2EW0DcG85PrnpWpXOypq0ARi0qitezqSmaW747I800=; b=XN7wJ1SHSRY3bTIzl741BXnHk9j1/gYyjcjLjf1SFTMMzvluOyu9/oAxRs3FahCJu8D6 45wc1w1sznRNdgtkfbsq9uO2qcOlzfvEVQoF/BICzikbXKuDkQ+ZFvKpNYFhcddX3ttT SV8IIrW2m1gw0cBaH8rAQww3+02T6XsJGWqKuvT8+agrA6ZaJzd/R9lITMdxiTJ4vOAu JsctIlQP6/EUebTJp0uIHA/DyhrNcZI0xhSa9ZpuCTEwfLH3KDLz5z5aI6N069jGZj3N FQYsYKP/dGdZdqmQaM/PWmvFC/vLGNhnhRKiTkafQuZKr0CY9lk8/Q5bYRdBGUa6m3jT lA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 32gagv5hsf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jul 2020 11:51:39 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id ECC0710002A; Tue, 28 Jul 2020 11:51:38 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag6node3.st.com [10.75.127.18]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id E2D4B2A70DA; Tue, 28 Jul 2020 11:51:38 +0200 (CEST) Received: from localhost (10.75.127.48) by SFHDAG6NODE3.st.com (10.75.127.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 28 Jul 2020 11:51:38 +0200 From: Patrick Delaunay To: CC: Simon Glass , Patrick Delaunay , Joe Hershberger , Wolfgang Denk , U-Boot STM32 Subject: [PATCH v4 05/14] env: nowhere: add .load ops Date: Tue, 28 Jul 2020 11:51:18 +0200 Message-ID: <20200728095128.2363-6-patrick.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200728095128.2363-1-patrick.delaunay@st.com> References: <20200728095128.2363-1-patrick.delaunay@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.48] X-ClientProxiedBy: SFHDAG6NODE1.st.com (10.75.127.16) To SFHDAG6NODE3.st.com (10.75.127.18) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-28_07:2020-07-28, 2020-07-28 signatures=0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Add the ops .load for nowhere ENV backend to load the default environment. This ops is needed for the command 'env load' Signed-off-by: Patrick Delaunay --- Changes in v4: - don't use env_import in SPL to avoid to increase its size as it is only required for 'env load' command Changes in v3: - new: add load ops in nowhere env/nowhere.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/env/nowhere.c b/env/nowhere.c index f5b0a17652..d33fdf27d0 100644 --- a/env/nowhere.c +++ b/env/nowhere.c @@ -27,8 +27,25 @@ static int env_nowhere_init(void) return 0; } +static int env_nowhere_load(void) +{ + /* + * for SPL, set env_valid = ENV_INVALID is enougth as env_get_char() + * return the default env if env_get is used + * and SPL don't used env_import to reduce its size + * For U-Boot proper, import the default environment to allow reload. + */ + if (!IS_ENABLED(CONFIG_SPL_BUILD)) + env_set_default(NULL, 0); + + gd->env_valid = ENV_INVALID; + + return 0; +} + U_BOOT_ENV_LOCATION(nowhere) = { .location = ENVL_NOWHERE, .init = env_nowhere_init, + .load = env_nowhere_load, ENV_NAME("nowhere") };