From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BD30C433EF for ; Fri, 29 Oct 2021 08:58:09 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0223261166 for ; Fri, 29 Oct 2021 08:58:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0223261166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 550E6835A2; Fri, 29 Oct 2021 10:58:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="QrMsUbfr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 38D648356D; Fri, 29 Oct 2021 10:58:04 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (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 64E1D835A2 for ; Fri, 29 Oct 2021 10:57:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 0D24E61166; Fri, 29 Oct 2021 08:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635497877; bh=iU/hspHgiHk+38jzPI5lMHEy6NEBVPsgVob0NuCuikU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QrMsUbfr6oE7m358bFySwmkk/N7MIN9rBBYCjWHZONqvl0ZDaN/PMXmaYMQPkzyj8 AHtfCuPBFmtNXSWnD2VotKNXF97dyUG7KfqSdLIPdqwhwGK+8xo6gxs5kJYhS2V7s9 oi/dl5Lq3pJcOcCP39FDytiJwb/9fTTbsso6KXSZq4dOCoFWdvaK/ThP/RHbYMv61Y c0sMXEnrZ/r2ppiZycoTL+DydUwMiaRzBoiSrlTsEgp+To3KPJ11irkOQqvRcLg3g6 q/9vPaHMnfjLyX0OdBWvb9tQPA61QPARYbs6V9TaaRmcIS84MINA2u3I2DLDvV0QyL 5itIb7Vor6eqw== Date: Fri, 29 Oct 2021 10:57:54 +0200 From: Marek =?UTF-8?B?QmVow7pu?= To: Simon Glass Cc: Stefan Roese , Pali =?UTF-8?B?Um9ow6Fy?= , u-boot@lists.denx.de, Marek =?UTF-8?B?QmVow7pu?= Subject: Re: [PATCH 4/5] env: Add support for board specific special default environment Message-ID: <20211029105754.7f735db9@thinkpad> In-Reply-To: References: <20211028032810.18146-1-kabel@kernel.org> <20211028032810.18146-5-kabel@kernel.org> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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.103.2 at phobos.denx.de X-Virus-Status: Clean On Thu, 28 Oct 2021 21:17:41 -0600 Simon Glass wrote: > Hi Marek, >=20 > On Wed, 27 Oct 2021 at 21:28, Marek Beh=C3=BAn wrote: > > > > From: Marek Beh=C3=BAn > > > > The default_environment[] buffer is built at compile time, but sometimes > > it makes sense for some default environment variables to be determined > > at runtime, for example: > > - one board code may support different boards, and needs that > > fdtfile, board, board_name > > are set appropriately when command > > env default -a > > is executed > > - some boards may want to prohibit the > > env default -a > > command to remove device MAC addresses stored in > > ethaddr, ethNaddr. > > This is the case for the ESPRESSObin board code, for example, where > > currently the board_late_init() function rewrites the default > > environment array to achieve this. > > > > Add a new board specific function, > > > > const char *board_special_default_env(unsigned i, const char **name); > > > > which returns the value of i-th board special default environemnt > > variable, while storing it's name to *name. > > > > Add default weak implementation of this functions returning NULL. > > > > Add code to default environemnt handlers in env/common.c, which iterate > > these special board default environment variables and get it's values in > > precedence to values in the default_environment[] buffer. > > > > Signed-off-by: Marek Beh=C3=BAn > > --- > > env/common.c | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++-- > > 1 file changed, 96 insertions(+), 3 deletions(-) =20 >=20 > What do you think about using a sysinfo driver for this? There are > already a lot of weak functions in U-Boot. I confess I am looking at sysinfo API for the first time just now. It seems like a reasonable thing, but how to combine with default environment for this? The thing is that Pali's code for ESPRESSObin needs to prohibit deleting the ethaddrs from env with "env default -a", because there were issues with the mac address being lost... Marek