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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 272AAC433EF for ; Mon, 20 Sep 2021 12:31:10 +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 93CB76109E for ; Mon, 20 Sep 2021 12:31:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 93CB76109E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=denx.de 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 4AC8F83257; Mon, 20 Sep 2021 14:31:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1632141068; bh=i8qBMo0Eiu5M9o8SSpRJgnMHVcO4D095g5yKyGInNms=; h=To:cc:From:Subject:In-reply-to:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=HWwUju9BzEExGHGMCPjFBkeWRpLDw3WDRBlYYWHYc1Kfq4aF5wwOxaFL4h8Ki7dv0 NrmKufws4TKSTJ5TTQFkf0gdiHD1nJCxsxTsgpW+AUIwMKVDOQTYmNjTRixuGZMgc6 zrkGodhYo4h2OPNuSWjt4TWvVciLqsG7ivj+k9T8oNealBbF3fHaQ+8NOdI3rnr7ws tD8Q1sru0fuK1QnezfINVKMq9eltr2maCaofsyuC/BAM/5mMsKHY7DMr4S813uBOGf zzoETcl4nbdDPZFRZxgiQs2Sfc4LYA+A8P3C5XbdktUZoEyDOeG9GAsfPZ73gWaaP3 6mkDuj2Zw5yBA== Received: from janitor.denx.de (unknown [62.91.23.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: noc@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id A138C83257 for ; Mon, 20 Sep 2021 14:31:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1632141065; bh=i8qBMo0Eiu5M9o8SSpRJgnMHVcO4D095g5yKyGInNms=; h=To:cc:From:Subject:In-reply-to:References:Date:From; b=soNXrf6gUbSzfu1s7hD8nQgALvRO4Kbj4bPafT6ZqMqaAVZWXnWXD/GYSTWV1omcl HcBqoUZUzjmgS9k91pPJ7EQs+mH7JcXMpsNSEA+XCGbanTXzVBbCHJHoFY7ID5fNmX 9zm7VkLfJ5hhkT5s46bw7ZPB96uLbivKdjOMC7cYn7eC/E4Ry5R2A92LiHwbhDKL+l ItOnuTl3R4vhJPaHDs8bJ9SkG4JMbDFShCMb24tzAVZ1ayeIlnR3k9jBViIllttLzR 15Q+GZn60IUVS9pDnn5IBxuAD/turzY+Li7g1WJ11Cqi0/1vMom/2L4mWq4SsKEThq kk+mPU1JOqMDQ== Received: by janitor.denx.de (Postfix, from userid 108) id 545B3A024D; Mon, 20 Sep 2021 14:31:05 +0200 (CEST) Received: from gemini.denx.de (gemini.denx.de [10.4.0.2]) by janitor.denx.de (Postfix) with ESMTPS id 621EFA0058; Mon, 20 Sep 2021 14:30:57 +0200 (CEST) Received: from gemini.denx.de (localhost [IPv6:::1]) by gemini.denx.de (Postfix) with ESMTP id 513D61E0F1B; Mon, 20 Sep 2021 14:30:57 +0200 (CEST) To: Simon Glass cc: U-Boot Mailing List , Tom Rini , Bin Meng , Joe Hershberger , =?UTF-8?q?Marek=20Beh=C3=BAn?= , =?UTF-8?q?Pali=20Roh=C3=A1r?= From: Wolfgang Denk Subject: Re: [PATCH v4 3/5] env: Allow U-Boot scripts to be placed in a .env file MIME-Version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8bit In-reply-to: <20210919125937.v4.3.If789ba3e2667c46c03eda3386ca84a863baeda55@changeid> References: <20210919185950.3813952-1-sjg@chromium.org> <20210919125937.v4.3.If789ba3e2667c46c03eda3386ca84a863baeda55@changeid> Comments: In-reply-to Simon Glass message dated "Sun, 19 Sep 2021 12:59:48 -0600." Date: Mon, 20 Sep 2021 14:30:57 +0200 Message-ID: <1819736.1632141057@gemini.denx.de> 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 Dear Simon, In message <20210919125937.v4.3.If789ba3e2667c46c03eda3386ca84a863baeda55@changeid> you wrote: > ... > +It is also possible to create an environment file with the name > +`board//env/.env` for your board. If that file is not present > +then U-Boot will look for `oard//env/common.env` so that you can a/oard/board/ > +have a common environment for all vendor boards. Actually it would be nice to look for `board//env/common.env` first, and then for `board//env/.env` - and if both exost, they should be concatenated, so a vendor can keep all common definitions in the common.env, and have only board specific definitions in the .env files - otherwise he would have to repeat everything in the board files, and the common file makes little sense. > +This is a plain text file where you can type your environment variables in > +the form `var=value`. Blank lines and multi-line variables are supported. > +The conversion script looks for a line that starts with a letter or number > +and has an equals sign immediately afterwards. Spaces before the = are not > +permitted. It is a good idea to indent your scripts so that only the 'var=' > +appears at the start of a line. This is not correct. Variable names can be more complex: => setenv _foo 1 => setenv ,bar 2 => setenv /baz 3 etc. > +For example, for snapper9260 you would create a text file called > +`board/bluewater/env/snapper9260.env` containing the environment text. > + > +Example:: > + > + stdout=serial > + #ifdef CONFIG_LCD > + stdout+=,lcd Is that a new feature? I didn't see it documented anywhere? > + #endif > + bootcmd= > + /* U-Boot script for booting */ > + > + if [ -z ${tftpserverip} ]; then > + echo "Use 'setenv tftpserverip a.b.c.d' to set IP address." > + fi > + > + usb start; setenv autoload n; bootp; > + tftpboot ${tftpserverip}: > + bootm > + failed= > + /* Print a message when boot fails */ > + echo CONFIG_SYS_BOARD boot failed - please check your image > + echo Load address is CONFIG_SYS_LOAD_ADDR You _must_ define a clear syntax for the file, including indentation rules. Otherwise there is plenty chance for incorrect arsing. > + # Is this the start of a new environment variable? > + if (match($0, "^([^ =][^ =]*)=(.*)", arr)) { This is not what you document above. > + if (length(env) != 0) { > + # Record the value of the variable now completed > + vars[var] = env > + } What in case of length == 0 ? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de Imitation is the sincerest form of plagarism.