{"id":2197013,"url":"http://patchwork.ozlabs.org/api/1.0/patches/2197013/?format=json","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/1.0/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<7f98de4d33c063072fff8e20af5a31a41cab7130.1771275704.git.daniel@makrotopia.org>","date":"2026-02-16T21:24:20","name":"[RFC,19/20] boot: bootmeth: openwrt: add openwrt_boot_script hook for bootconf","commit_ref":null,"pull_url":null,"state":"rfc","archived":false,"hash":"a180b6134efb53e059d6d0641e3702f6223c103a","submitter":{"id":64091,"url":"http://patchwork.ozlabs.org/api/1.0/people/64091/?format=json","name":"Daniel Golle","email":"daniel@makrotopia.org"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/1.0/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/7f98de4d33c063072fff8e20af5a31a41cab7130.1771275704.git.daniel@makrotopia.org/mbox/","series":[{"id":492351,"url":"http://patchwork.ozlabs.org/api/1.0/series/492351/?format=json","date":"2026-02-16T21:21:14","name":"boot: add OpenWrt boot method and on-demand FIT loading","version":1,"mbox":"http://patchwork.ozlabs.org/series/492351/mbox/"}],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2197013/checks/","tags":{},"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=85.214.62.61; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=none (p=none dis=none) header.from=makrotopia.org","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de; dmarc=none (p=none dis=none)\n header.from=makrotopia.org","phobos.denx.de;\n spf=pass smtp.mailfrom=daniel@makrotopia.org"],"Received":["from phobos.denx.de (phobos.denx.de [85.214.62.61])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fFG6k6p2cz1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 08:26:22 +1100 (AEDT)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 3744C83EE2;\n\tMon, 16 Feb 2026 22:25:05 +0100 (CET)","by phobos.denx.de (Postfix, from userid 109)\n id 46FED83D5D; Mon, 16 Feb 2026 22:24:43 +0100 (CET)","from pidgin.makrotopia.org (pidgin.makrotopia.org\n [IPv6:2a07:2ec0:3002::65])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 66D7283B8A\n for <u-boot@lists.denx.de>; Mon, 16 Feb 2026 22:24:41 +0100 (CET)","from local\n by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256)\n (Exim 4.99) (envelope-from <daniel@makrotopia.org>)\n id 1vs64u-000000002qu-23IR; Mon, 16 Feb 2026 21:24:24 +0000"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-1.9 required=5.0 tests=BAYES_00,\n RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham\n autolearn_force=no version=3.4.2","Date":"Mon, 16 Feb 2026 21:24:20 +0000","From":"Daniel Golle <daniel@makrotopia.org>","To":"Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>,\n Quentin Schulz <quentin.schulz@cherry.de>,\n Daniel Golle <daniel@makrotopia.org>,\n Kory Maincent <kory.maincent@bootlin.com>,\n Mattijs Korpershoek <mkorpershoek@kernel.org>,\n Martin Schwan <m.schwan@phytec.de>, Anshul Dalal <anshuld@ti.com>,\n Ilias Apalodimas <ilias.apalodimas@linaro.org>,\n Sughosh Ganu <sughosh.ganu@arm.com>, Aristo Chen <jj251510319013@gmail.com>,\n\t=?utf-8?b?54mbIOW/l+Wujw==?= <Zone.Niuzh@hotmail.com>,\n Marek Vasut <marek.vasut+renesas@mailbox.org>,\n Heinrich Schuchardt <xypron.glpk@gmx.de>,\n Wolfgang Wallner <wolfgang.wallner@at.abb.com>,\n Frank Wunderlich <frank-w@public-files.de>,\n David Lechner <dlechner@baylibre.com>,\n Osama Abdelkader <osama.abdelkader@gmail.com>,\n Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,\n Michael Trimarchi <michael@amarulasolutions.com>,\n Miquel Raynal <miquel.raynal@bootlin.com>,\n Andrew Goodbody <andrew.goodbody@linaro.org>,\n Yegor Yefremov <yegorslists@googlemail.com>,\n Mike Looijmans <mike.looijmans@topic.nl>,\n Weijie Gao <weijie.gao@mediatek.com>,\n Alexander Stein <alexander.stein@ew.tq-group.com>,\n Neil Armstrong <neil.armstrong@linaro.org>,\n Mayuresh Chitale <mchitale@ventanamicro.com>,\n Paul HENRYS <paul.henrys_ext@softathome.com>, u-boot@lists.denx.de","Cc":"John Crispin <john@phrozen.org>, Paul Spooren <mail@aparcar.org>","Subject":"[RFC PATCH 19/20] boot: bootmeth: openwrt: add openwrt_boot_script\n hook for bootconf","Message-ID":"\n <7f98de4d33c063072fff8e20af5a31a41cab7130.1771275704.git.daniel@makrotopia.org>","References":"<cover.1771275704.git.daniel@makrotopia.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<cover.1771275704.git.daniel@makrotopia.org>","X-Mailman-Approved-At":"Mon, 16 Feb 2026 22:25:02 +0100","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Some boards need to probe hardware at boot time to determine the\ncorrect FIT configuration. For example, the BPi-R3 checks whether\nSPI-NAND or SPI-NOR is present and selects the matching FIT config\noverlay accordingly.\n\nAdd an optional script hook: if the environment variable\nopenwrt_boot_script is set, its content is executed as a U-Boot\ncommand string right before bootconf is read. This lets board\nconfigurations assemble the correct bootconf value dynamically:\n\n  setenv openwrt_boot_script 'if nand info; then\n    setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nand;\n  else\n    setenv bootconf $bootconf_base#$bootconf_emmc#$bootconf_nor;\n  fi'\n\nThe hook runs once per boot attempt, after the image loader is set up\nbut before bootm_run() is called.\n\nSigned-off-by: Daniel Golle <daniel@makrotopia.org>\n---\n boot/bootmeth_openwrt.c | 12 ++++++++++++\n 1 file changed, 12 insertions(+)","diff":"diff --git a/boot/bootmeth_openwrt.c b/boot/bootmeth_openwrt.c\nindex e1f47b58f61..d448697fe08 100644\n--- a/boot/bootmeth_openwrt.c\n+++ b/boot/bootmeth_openwrt.c\n@@ -12,6 +12,7 @@\n #include <bootflow.h>\n #include <bootm.h>\n #include <bootmeth.h>\n+#include <command.h>\n #include <dm.h>\n #include <env.h>\n #include <image.h>\n@@ -113,6 +114,17 @@ static int openwrt_boot(struct udevice *dev, struct bootflow *bflow)\n \tbootm_init(&bmi);\n \tbmi.loader = &ldr;\n \n+\t/*\n+\t * Optional script hook: run the command in openwrt_boot_script\n+\t * before reading bootconf. Boards use this to probe hardware\n+\t * and assemble the correct FIT configuration string, e.g.:\n+\t *\n+\t *   setenv openwrt_boot_script 'if nand info; then ...'\n+\t */\n+\tconf = env_get(\"openwrt_boot_script\");\n+\tif (conf)\n+\t\trun_command(conf, 0);\n+\n \t/* FIT config selection via #conf suffix */\n \tconf = env_get(\"bootconf\");\n \tif (conf) {\n","prefixes":["RFC","19/20"]}