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 99041C433F5 for ; Thu, 21 Oct 2021 14:03:11 +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 E1A8C6120C for ; Thu, 21 Oct 2021 14:03:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E1A8C6120C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=konsulko.com 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 0870D8029E; Thu, 21 Oct 2021 16:03:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com 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=konsulko.com header.i=@konsulko.com header.b="dpvi/aeP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 404A98029E; Thu, 21 Oct 2021 16:03:03 +0200 (CEST) Received: from mail-qv1-xf35.google.com (mail-qv1-xf35.google.com [IPv6:2607:f8b0:4864:20::f35]) (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 00CEF80C72 for ; Thu, 21 Oct 2021 16:02:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qv1-xf35.google.com with SMTP id k29so470573qve.6 for ; Thu, 21 Oct 2021 07:02:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nSoXFmiFDJB9u981Nq01tqH+DdixRgsg14tkljfqMAs=; b=dpvi/aePBTmxpGT77Hb/+pubSB2GV9dyOl/pPq1upxhIsONgE0jTfpMK63wBag8uh3 Krpp2IFAP6xKwfT8uAjQVV+dDB0pshXPNcM4EOfMOl/n7wLNakyn5U+Fng5f5k5IBSvs XoTpfd6K6tdKLbQj+V3Nt3QW2m9KtBf8OChN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=nSoXFmiFDJB9u981Nq01tqH+DdixRgsg14tkljfqMAs=; b=BSl1a52Us7kDx3hIdyA2UWebDrdtShQXbkm1TUfCj8xV77iNCts1XLaf8EdCEWFGMe oYTAWJZSNBu9dMfm936fFjvhjHscN0gy+OdlWBVo9CeUkcdvCFzp/QQSJkxXXwRqnyXk zJcSBgcHiR3X/+VrHVhmoOWv4LWqCmxTyHQaF5mUq2R1YpVul46cLnvGhhcugpUNsMir XdkGF4CMAHA6I/GPz8nFKeZqt0r5AZR4Hh6cpAt3CzHUUH94xteeUojoJrO9gCjAOyMX rsoQKl2bSiyJJCilXTlDkz8cTb4mu7TVEMB0IUWaIy1h7nj7J6Zvw+wvUGeP6jODS1Kz a8VA== X-Gm-Message-State: AOAM533b+0uTJpnHSlxsIwIp1huEkh5w5cS3j265u3DHTgfgKg5hjeXr RlA5M0ewYlzCB9m5EDbdWudePQ== X-Google-Smtp-Source: ABdhPJy7DFj3EwU75WhIxtKmhmCtVTWvNVCAW19o8dY4Ut+V18VEe97ljInHY2rgBiciReHyclPKig== X-Received: by 2002:a05:6214:1911:: with SMTP id er17mr2884322qvb.37.1634824975572; Thu, 21 Oct 2021 07:02:55 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b01-cbda-2501-70e1-0160-7cd3.res6.spectrum.com. [2603:6081:7b01:cbda:2501:70e1:160:7cd3]) by smtp.gmail.com with ESMTPSA id bl4sm2692286qkb.44.2021.10.21.07.02.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 07:02:55 -0700 (PDT) Date: Thu, 21 Oct 2021 10:02:53 -0400 From: Tom Rini To: Simon Glass , u-boot-custodians@lists.denx.de, u-boot-board-maintainers@lists.denx.de Cc: U-Boot Mailing List , Marek =?iso-8859-1?Q?Beh=FAn?= , Rasmus Villemoes , Heinrich Schuchardt , Wolfgang Denk , Joe Hershberger Subject: Re: [PATCH v9 0/7] env: Allow environment in text files Message-ID: <20211021140253.GY7964@bill-the-cat> References: <20211019224422.1447059-1-sjg@chromium.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="wshyDeY7iLHeP6at" Content-Disposition: inline In-Reply-To: <20211019224422.1447059-1-sjg@chromium.org> X-Clacks-Overhead: GNU Terry Pratchett 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 --wshyDeY7iLHeP6at Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 19, 2021 at 04:44:15PM -0600, Simon Glass wrote: > One barrier to completing the 7-year-long Kconfig migration is that > the default environment is implemented using ad-hoc CONFIG options. > At present U-Boot environment variables, and thus scripts, are defined > by CONFIG_EXTRA_ENV_SETTINGS. >=20 > It is not really feasible to move the environment to Kconfig as it is > hundreds of lines of text in some cases. >=20 > Even considering the current situation, it is painful to add large > amounts of text to the config-header file and dealing with quoting and > newlines is harder than it should be. It would be better if we could just > type the script into a text file and have it included by U-Boot. >=20 > This is already supported by the CONFIG_USE_DEFAULT_ENV_FILE feature. but > that does not support use of CONFIG options or comments, so is best suited > for use by other build systems wanting to define the U-Boot environment. >=20 > Add a feature that brings in a .env file associated with the board > config, if present. To use it, create a file board//.env or > use CONFIG_ENV_SOURCE_FILE to set a filename. >=20 > The environment variables should be of the form "var=3Dvalue". Values can > extend to multiple lines. This series converts the existing environment > documentation to rST and updates it to explain how to use this. >=20 > Note: this series was originally sent eight years ago: >=20 > https://patchwork.ozlabs.org/project/uboot/patch/1382763695-2849-4-git-se= nd-email-sjg@chromium.org/ >=20 > It has been updated to work with Kconfig, etc. Some review comments in > that patch were infeasible so I have not addressed them. I would like > this series to be considered independently, on its merits. >=20 > Rather than deal with the complexity of rewriting the distro-boot > script, this is disabled for sandbox. The forthcoming bootmethod approach > should provide the same functionality without needing the complex > scripting in the environment. >=20 > Migration needs more thought, although it can be done later. It may be > possible to do migrate automatically, using buildman to extract the > built-in environmnent from the ELF file. >=20 > This would produce a pretty ugly conversion though, since it would drop > all the intermediate variables used to create the environment. >=20 > Better would be to parse the config.h file, figure out the components of > CONFIG_EXTRA_ENV_SETTINGS then output these as separate pieces in the > file. It is not clear how easy that would be, nor whether the result would > be very pretty. Also the __stringify() macro needs to be handled somehow. >=20 > This series is available at u-boot-dm/env-working >=20 > Comments welcome. >=20 > Changes in v9: > - Drop mention of other strange characters > - Clarify that the + restriction is on the variable name not its value > - Add some tests for the script > - Deal with leading tabs > - Squash indentation down to one space > - Convert newlines within strings to spaces, which seems more consistent > - Handle appending an empty string to an empty var > - Fix blank line between tags > - Fix typo in commit message > - More bikeshedding on env_get_autostart() > - Fix '' in cover letter > - Use env_get_yesno() in env_get_autostart() and update docs >=20 > Changes in v8: > - Update commit message to avoid mentioning the 'env' subdirectory > - Update commit message to mention the + restriction, etc. > - Overwrite the env file each time, to avoid incremental-build problems > - Fix ambiguity about what is ignored > - Go into more detail about the change of behaviour with autostart >=20 > Changes in v7: > - Use 'env' basename instead of 'environment' for intermediate output fil= es > - Show a message indicating the source text file being used > - Give an error if CONFIG_EXTRA_ENV_SETTINGS is also defined > - Use CONFIG_ENV_SOURCE_FILE instead of rules to specify the text-file na= me > - Make board.env the default name if CONFIG_ENV_SOURCE_FILE is empty > - Rewrite the documentation > - Drop the use of common.env > - Update awk script to output the whole CONFIG string, or just a comment > - Add new patch to explain the relationship with DEFAULT_ENV_FILE > - A few more tweaks > - Update the cover letter >=20 > Changes in v6: > - Move all updates to a separate patch > - Combine the two env2string.awk patches into one > - Move all updates to a separate patch > - More updates and improvements > - Add new patch to tidy up use of autostart env var >=20 > Changes in v5: > - Minor updates as suggested by Wolfgang > - Explain how to include the common.env file > - Explain why variables starting with _ , and / are not supported > - Expand the definition of how to declare an environment variable > - Explain what happens to empty variables > - Update maintainer > - Move use of +=3D to this patch > - Explain that environment variables may not end in + > - Minor updates as suggested by Wolfgang >=20 > Changes in v4: > - Add new patch to move environment documentation to rST > - Move this from being part of configuring U-Boot to part of building it > - Don't put the environment in autoconf.mk as it is not needed > - Add documentation in rST format instead of README > - Drop mention of import/export > - Update awk script to ignore blank lines, as generated by clang > - Add documentation in rST format instead of README > - Add new patch to move environment documentation to rST >=20 > Changes in v3: > - Adjust Makefile to generate the .inc and .h files in separate fules > - Add more detail in the README about the format of .env files > - Improve the comment about " in the awk script > - Correctly terminate environment files with \n > - Define __UBOOT_CONFIG__ when collecting environment files > - Add new patch to use a text-based environment for sandbox >=20 > Changes in v2: > - Move .env file from include/configs to board/ > - Use awk script to process environment since it is much easier on the br= ain > - Add information and updated example script to README > - Add dependency rule so that the environment is rebuilt when it changes > - Add separate patch to enable C preprocessor for environment files > - Enable var+=3Dvalue form to simplify composing variables in multiple st= eps >=20 > Simon Glass (7): > sandbox: Drop distro_boot > doc: Move environment documentation to rST > env: Allow U-Boot scripts to be placed in a .env file > sandbox: Use a text-based environment > doc: Mention CONFIG_DEFAULT_ENV_FILE > doc: Improve environment documentation > bootm: Tidy up use of autostart env var >=20 > MAINTAINERS | 7 + > Makefile | 66 ++++- > README | 328 ------------------------- > board/sandbox/sandbox.env | 25 ++ > cmd/bootm.c | 4 +- > cmd/elf.c | 3 +- > common/bootm_os.c | 5 +- > config.mk | 2 + > doc/usage/environment.rst | 490 ++++++++++++++++++++++++++++++++++++++ > doc/usage/index.rst | 1 + > env/Kconfig | 18 ++ > env/common.c | 5 + > env/embedded.c | 1 + > include/configs/sandbox.h | 40 ---- > include/env.h | 7 + > include/env_default.h | 11 + > scripts/env2string.awk | 71 ++++++ > test/py/tests/test_env.py | 93 ++++++++ > 18 files changed, 799 insertions(+), 378 deletions(-) > create mode 100644 board/sandbox/sandbox.env > create mode 100644 doc/usage/environment.rst > create mode 100644 scripts/env2string.awk Cc'ing the other lists... --=20 Tom --wshyDeY7iLHeP6at Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmFxcwUACgkQFHw5/5Y0 tyy5ogv/Wc5AeVNw2u8iASFEsqlTgzE4iAHByNF9KIcJnuOM++OB08Ow2S4qntpu ZxVNOBZ/dC7BuqZ6e7pbCTC/edOT7mPRbbsd4R1IAE+886IqSvcJpL7gpP3jYrTj Kmqw2LXKHl7FAwS2cmfd54mByqOEtM/pGC72pas6Jeh69yLbiAAc5a0o6pQ0wX7t m/2a/WOA/L8UFi0FKvrqpimWeeY1A2/1n3FVB2clQF098NJXvu0XpZM+cNtBywgI Y5SjIPUQ0Cvg/uqkPNnWQsZTRQhJfamk2xBWZIlb3HEfen/+ck/tod+DyCMNaYbn BmssZVBWfahjMMAFASaWif7vWKjsuHSR5zFbYTqg6qXGCO+IkK3TIZ8HQMpvRJFY WH5qiyHbTOVHFVh7CNi2Uq0jjsufuoQzd2FgoLZRXw2llh66YCdqqTLKbYqd0UXW FPMUpkeaBIzG0P5pImlpGuZeVhvIhW2MQkTiNOizUVwnmrp65+rZhRHwGK/7SB7b WPOzsLwC =1AeG -----END PGP SIGNATURE----- --wshyDeY7iLHeP6at--