From patchwork Sun Jan 19 07:37:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Johnson X-Patchwork-Id: 1225364 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=none (p=none dis=none) header.from=lixil.net 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 480mqf0vFdz9sRV for ; Sun, 19 Jan 2020 18:38:06 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C9973817F8; Sun, 19 Jan 2020 08:38:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9F1848182B; Sun, 19 Jan 2020 08:37:58 +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=0.0 required=5.0 tests=SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from crane.lixil.net (crane.lixil.net [71.19.154.81]) by phobos.denx.de (Postfix) with ESMTP id 8B7C6817F1 for ; Sun, 19 Jan 2020 08:37:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=lixil.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mrjoel@lixil.net Received: from dark.lixil.net (unknown [IPv6:2601:8c3:4100:b411:34d1:f09e:1618:a814]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mrjoel@lixil.net) by crane.lixil.net (Postfix) with ESMTPSA id CD5CB31DCC8; Sun, 19 Jan 2020 00:37:51 -0700 (MST) From: Joel Johnson To: Tom Rini Subject: [RFC PATCH] Provide mechanism for build-time default env entries Date: Sun, 19 Jan 2020 00:37:38 -0700 Message-Id: <20200119073738.29189-1-mrjoel@lixil.net> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Joe Hershberger , u-boot@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean This enables the building user to specify environment values to be included in the static default_environment with an image. This is useful to build multiple otherwise like configured images, varying by environment unique entries. --- I expected something like this to already be present, but couldn't find such a mechanism. I also assumed that something similar may have been proposed previously, but also couldn't find anything via searching. Signed-off-by: Joel Johnson --- env/Kconfig | 19 +++++++++++++++---- include/env_default.h | 3 +++ 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/env/Kconfig b/env/Kconfig index ed12609f6a..5049cb78be 100644 --- a/env/Kconfig +++ b/env/Kconfig @@ -556,14 +556,25 @@ config SYS_RELOC_GD_ENV_ADDR Relocate the early env_addr pointer so we know it is not inside the binary. Some systems need this and for the rest, it doesn't hurt. +config USER_ENV_SETTINGS + string "User build-time additional environment entries" + help + This value is reserved for the building user to provide custom + environment entries to be added to the default environment. Care must + be taken to not break the environment, incompatible entries may cause + failure to compile, or failure of the target board to properly + initialize or boot. The format is key=value pairs, with entries + separated by C-style escaped null terminated values, such as: + "key1=valueA\0key2=valueB\0key3=valueC". + config USE_DEFAULT_ENV_FILE bool "Create default environment from file" help Normally, the default environment is automatically generated - based on the settings of various CONFIG_* options, as well - as the CONFIG_EXTRA_ENV_SETTINGS. By selecting this option, - you can instead define the entire default environment in an - external file. + based on the settings of various CONFIG_* options, combined with values + of board specific CONFIG_EXTRA_ENV_SETTINGS and user provided + CONFIG_USER_ENV_SETTINGS. By selecting this option, you can instead + define the entire default environment in an external file. config DEFAULT_ENV_FILE string "Path to default environment file" diff --git a/include/env_default.h b/include/env_default.h index 56a8bae39a..9396a34715 100644 --- a/include/env_default.h +++ b/include/env_default.h @@ -109,6 +109,9 @@ const uchar default_environment[] = { #endif #ifdef CONFIG_EXTRA_ENV_SETTINGS CONFIG_EXTRA_ENV_SETTINGS +#endif +#ifdef CONFIG_USER_ENV_SETTINGS + CONFIG_USER_ENV_SETTINGS #endif "\0" #else /* CONFIG_USE_DEFAULT_ENV_FILE */