From patchwork Sat Jul 24 15:03:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1509513 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=MaJZqR2I; dkim-atps=neutral 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 4GX8dw2xdRz9sX1 for ; Sun, 25 Jul 2021 01:06:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D7C4582EE6; Sat, 24 Jul 2021 17:05:48 +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="MaJZqR2I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B728D82F12; Sat, 24 Jul 2021 17:04:55 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 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 286AF82EB5 for ; Sat, 24 Jul 2021 17:03:57 +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@chromium.org Received: by mail-oi1-x22b.google.com with SMTP id y18so5408340oiv.3 for ; Sat, 24 Jul 2021 08:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z7AGaKgT/lZ8tYvNytAH+/deImsRKJmnpW82uf2ooSs=; b=MaJZqR2IbKfeeLjJDy32zWGVngFO0taJwzO56hPdephDLyIZMci8j8I7FRjQGTxd87 WH+FW2mbvp9zLJIrQsOFugakvvlCL3cy+5OrezZSAY2ncWV575xIKASI37dh15vsVlGa iBShQxCQcxwQSYeGR6b9twt11dmVuWjC4kFDU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z7AGaKgT/lZ8tYvNytAH+/deImsRKJmnpW82uf2ooSs=; b=LrZ3MMcb4BJiSwFCA4TWg4gLVIwoYPZoCrMpc6BxmBxp5RfOBKF9dCzxjEjy3NRvRy UNbgLzd0yyg2zrRHBjweVEnwwDsmwqcMVC4sz8B0EYIXU0YfYnHEOGZJC/tPSUYuDpRp KiL/ZCfRNMLy+YRIUDrX1CM8XbqArE5aXc0yN5SLGmL7qO0Skmw7lM/Dt7PdwSjqA29e iFY71GGOgm7tSwR+HHQip28++bbEEXekgNeAELrDqNdp/Et3AHX+92VXdx8FAO7X/xBu gTYpmIqrW/Yd9IR1mL3R3pKQAoPl2F0haJUGyuXAQYYrEmIe7cH0XUbHX8IuYyU+Q4pH Mwow== X-Gm-Message-State: AOAM533f+6f4qt7v8l3MdMBc7j7b36WkYC3EGVt/ZDSY1/JWlTFNKF9J FZzbwTHa0U8I4qm/hx+BsnwiKYru4DrDTsnX X-Google-Smtp-Source: ABdhPJxHsFP+/15qj3RPrdnSWO3JZhWH9wxpHZPfTsQN5K/I3wHBqt6hl0fJ3LKxC8aHE5bUEMHNCg== X-Received: by 2002:aca:4f57:: with SMTP id d84mr6325633oib.71.1627139035615; Sat, 24 Jul 2021 08:03:55 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id w190sm6704082oif.17.2021.07.24.08.03.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Jul 2021 08:03:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , "Jonathan A . Kollasch" , Marek Vasut , Heinrich Schuchardt , =?utf-8?q?Marek_Beh=C3=BAn?= , Eugeniu Rosca , Roland Gaudig , Stefan Herbrechtsmeier , Sean Anderson , Simon Glass Subject: [PATCH v2 09/14] doc: Convert command-line info to rST Date: Sat, 24 Jul 2021 09:03:36 -0600 Message-Id: <20210724150341.243074-10-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.432.gabb21c7263-goog In-Reply-To: <20210724150341.243074-1-sjg@chromium.org> References: <20210724150341.243074-1-sjg@chromium.org> MIME-Version: 1.0 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 Take this part of the README and put it into rST format. Signed-off-by: Simon Glass --- Changes in v2: - Add an SPDX header to the file too README | 41 ------------------------------- doc/usage/cmdline.rst | 56 +++++++++++++++++++++++++++++++++++++++++++ doc/usage/index.rst | 1 + 3 files changed, 57 insertions(+), 41 deletions(-) create mode 100644 doc/usage/cmdline.rst diff --git a/README b/README index 1472b40bc45..fbb8895dbbb 100644 --- a/README +++ b/README @@ -3507,47 +3507,6 @@ The signature of the callback functions is: The return value is 0 if the variable change is accepted and 1 otherwise. -Command Line Parsing: -===================== - -There are two different command line parsers available with U-Boot: -the old "simple" one, and the much more powerful "hush" shell: - -Old, simple command line parser: --------------------------------- - -- supports environment variables (through setenv / saveenv commands) -- several commands on one line, separated by ';' -- variable substitution using "... ${name} ..." syntax -- special characters ('$', ';') can be escaped by prefixing with '\', - for example: - setenv bootcmd bootm \${address} -- You can also escape text by enclosing in single apostrophes, for example: - setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off' - -Hush shell: ------------ - -- similar to Bourne shell, with control structures like - if...then...else...fi, for...do...done; while...do...done, - until...do...done, ... -- supports environment ("global") variables (through setenv / saveenv - commands) and local shell variables (through standard shell syntax - "name=value"); only environment variables can be used with "run" - command - -General rules: --------------- - -(1) If a command line (or an environment variable executed by a "run" - command) contains several commands separated by semicolon, and - one of these commands fails, then the remaining commands will be - executed anyway. - -(2) If you execute several variables with one call to run (i. e. - calling run with a list of variables as arguments), any failing - command will cause "run" to terminate, i. e. the remaining - variables are not executed. Note for Redundant Ethernet Interfaces: ======================================= diff --git a/doc/usage/cmdline.rst b/doc/usage/cmdline.rst new file mode 100644 index 00000000000..b3dbdb8b230 --- /dev/null +++ b/doc/usage/cmdline.rst @@ -0,0 +1,56 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +Command-line Parsing +==================== + +The command line is available in U-Boot proper, enabled by CONFIG_CMDLINE which +is on by default. It is not enabled in SPL. + +There are two different command-line parsers available with U-Boot: +the old "simple" one, and the much more powerful "hush" shell: + +Simple command-line parser +-------------------------- + +This takes very little code space and offers only basic features: + +- supports environment variables (through setenv / saveenv commands) +- several commands on one line, separated by ';' +- variable substitution using "... ${name} ..." syntax +- special characters ('$', ';') can be escaped by prefixing with '\', + for example:: + + setenv bootcmd bootm \${address} + +- You can also escape text by enclosing in single apostrophes, for example:: + + setenv addip 'setenv bootargs $bootargs ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname::off' + +Hush shell +---------- + +This is similar to Bourne shell, with control structures like: + +- `if`... `then` ... `else`... `fi` +- `for`... `do` ... `done` +- `while` ... `do` ... `done` +- `until` ... `do` ... `done` + +Hush supports environment ("global") variables (through setenv / saveenv +commands) and local shell variables (through standard shell syntax +`name=value`); only environment variables can be used with the "run" command + +The Hush shell is enabled with `CONFIG_HUSH_PARSER`. + +General rules +------------- + +#. If a command line (or an environment variable executed by a "run" + command) contains several commands separated by semicolon, and + one of these commands fails, then the remaining commands will be + executed anyway. + +#. If you execute several variables with one call to run (i. e. + calling run with a list of variables as arguments), any failing + command will cause "run" to terminate, i. e. the remaining + variables are not executed. diff --git a/doc/usage/index.rst b/doc/usage/index.rst index 40b796a3a91..2d2e8486e67 100644 --- a/doc/usage/index.rst +++ b/doc/usage/index.rst @@ -9,6 +9,7 @@ Use U-Boot fit netconsole partitions + cmdline Shell commands --------------