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 B977CC433EF for ; Fri, 29 Oct 2021 03:20:38 +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 1E91E6103B for ; Fri, 29 Oct 2021 03:20:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1E91E6103B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.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 82E4A83608; Fri, 29 Oct 2021 05:20:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="nuAeqS1k"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6722F8358A; Fri, 29 Oct 2021 05:19:02 +0200 (CEST) Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 073FD835F1 for ; Fri, 29 Oct 2021 05:18:38 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-oi1-x22b.google.com with SMTP id o83so11415084oif.4 for ; Thu, 28 Oct 2021 20:18:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Pqa/1XGWYth+iBk9jy/uXfjEbZ5DXUdXWDjiMWyNnlA=; b=nuAeqS1kRzYlHzF2XkDbpcKzN3x51Ckpf5A03GfZfIWvjZVTghV4+wGo+f/Hv7CFnP kFyJkeghH1LwkrmizJtpm6Vl1xyLPxcQY9TS01TU+NDeoYQ0t9ODrs621RXMfsDczAuo n2rmbEH2aNITLeceJ7Vi16p7+ANR1O35Ec9/8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Pqa/1XGWYth+iBk9jy/uXfjEbZ5DXUdXWDjiMWyNnlA=; b=Uck+b13FGRe4tPGw6F7iQOnGIvZUKaDZg535L8LTdtLmsk2DboFFJZyfFdUmq9u6Ud SBvSv9IlgoLWuOj1mjz4PGH18HP2QPHziJJVVrE2SIpb93XXa4Obz3li04E6UH2pXrN7 WAf2rZzNDRqbyEcIUWr3Og3WKSsGVRCRqilZGQh1CUyT2L6L8GyizHj2NlFb1cfEhCZJ 8tmtJN9Lgpd1F1bV3zl0tAropxBfJOZ49cPL4g7FFrujff5sSUh95DIdVGvXZ9uW53eW V5eR5/zzpMtgrg3Z87LwNPt0TbjxmwMAHW2k+GtlehxCek+3+Y3v8NeyKkP8PFEpiwPP bD0w== X-Gm-Message-State: AOAM531/xzFED7cniMuYJCgJo9YgbxM2iQKR+RYzfYRLPmSAVzir1F4p An8J/Hj+NgXjTlMA4oCTbtnYlxTtUT1GCf+EwVcO3g== X-Google-Smtp-Source: ABdhPJxMyWsdNrDR8iivuy/l8cqMPOd2ctO7Q2izoWFGfysxh0R3rQkIE9vACFhGxRpiaDIMMChtIWhlTkSlaslaW60= X-Received: by 2002:a05:6808:f07:: with SMTP id m7mr6114240oiw.150.1635477516401; Thu, 28 Oct 2021 20:18:36 -0700 (PDT) MIME-Version: 1.0 References: <20211028032810.18146-1-kabel@kernel.org> <20211028032810.18146-5-kabel@kernel.org> In-Reply-To: <20211028032810.18146-5-kabel@kernel.org> From: Simon Glass Date: Thu, 28 Oct 2021 21:17:41 -0600 Message-ID: Subject: Re: [PATCH 4/5] env: Add support for board specific special default environment To: =?UTF-8?B?TWFyZWsgQmVow7pu?= Cc: Stefan Roese , =?UTF-8?Q?Pali_Roh=C3=A1r?= , u-boot@lists.denx.de, =?UTF-8?B?TWFyZWsgQmVow7pu?= 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 Hi Marek, 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(-) What do you think about using a sysinfo driver for this? There are already a lot of weak functions in U-Boot. Regards, Simon