Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2197014/?format=api
{ "id": 2197014, "url": "http://patchwork.ozlabs.org/api/patches/2197014/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/db31f5b213b57b802c5db7309941b5fab94dec2c.1771275704.git.daniel@makrotopia.org/", "project": { "id": 18, "url": "http://patchwork.ozlabs.org/api/projects/18/?format=api", "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, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<db31f5b213b57b802c5db7309941b5fab94dec2c.1771275704.git.daniel@makrotopia.org>", "list_archive_url": null, "date": "2026-02-16T21:24:29", "name": "[RFC,20/20] boot: bootmeth: openwrt: add slot configuration from environment", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "08a64d3b545b3b64ce12984e0337906d0cc4d9f9", "submitter": { "id": 64091, "url": "http://patchwork.ozlabs.org/api/people/64091/?format=api", "name": "Daniel Golle", "email": "daniel@makrotopia.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/uboot/patch/db31f5b213b57b802c5db7309941b5fab94dec2c.1771275704.git.daniel@makrotopia.org/mbox/", "series": [ { "id": 492351, "url": "http://patchwork.ozlabs.org/api/series/492351/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/list/?series=492351", "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/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2197014/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2197014/checks/", "tags": {}, "related": [], "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=2a01:238:438b:c500:173d:9f52:ddab:ee01; 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\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\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 4fFG6v5VH2z1xpl\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 08:26:31 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 77AE783F00;\n\tMon, 16 Feb 2026 22:25:05 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id F19DA83E8E; Mon, 16 Feb 2026 22:24:49 +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 050A083CB9\n for <u-boot@lists.denx.de>; Mon, 16 Feb 2026 22:24:48 +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 1vs653-000000002rV-1Gh8; Mon, 16 Feb 2026 21:24:33 +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:29 +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 20/20] boot: bootmeth: openwrt: add slot configuration\n from environment", "Message-ID": "\n <db31f5b213b57b802c5db7309941b5fab94dec2c.1771275704.git.daniel@makrotopia.org>", "References": "<cover.1771275704.git.daniel@makrotopia.org>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=utf-8", "Content-Disposition": "inline", "Content-Transfer-Encoding": "8bit", "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": "Add configurable multi-slot boot with slot names and boot order\ndefined via environment variables. This enables production/recovery\ndual-boot (or any number of named slots).\n\nNew environment variables:\n\n- openwrt_slot_<name>=<location> -- defines a named slot. <name> is\n an arbitrary label (e.g. \"production\", \"recovery\"). <location> is\n a GPT partition label, MTD partition name, or UBI volume name.\n\n- openwrt_boot_order=<name1> <name2> ... -- space-separated list of\n slot names that are eligible for booting. Only partitions/volumes\n whose name matches a configured slot's location are probed.\n\nWithout openwrt_boot_order, all partitions/volumes are probed\n(backward-compatible with the Milestone 1/2 behavior). When set,\nonly partitions matching a defined slot pass the filter.\n\nThe matched slot name is stored in bflow->os_name for later use by\nboot-loop avoidance (Milestone 4) and boot menu display.\n\nThe MTD and UBI bootdevs now delegate to bootmeth_read_bootflow()\ninstead of setting BOOTFLOWST_READY directly, so that slot filtering\nis applied uniformly across all storage backends.\n\nExample configuration:\n\n openwrt_slot_production=firmware\n openwrt_slot_recovery=recovery\n openwrt_boot_order=production recovery\n\nSigned-off-by: Daniel Golle <daniel@makrotopia.org>\n---\n boot/bootmeth_openwrt.c | 130 ++++++++++++++++++++++++++++++++--------\n 1 file changed, 104 insertions(+), 26 deletions(-)", "diff": "diff --git a/boot/bootmeth_openwrt.c b/boot/bootmeth_openwrt.c\nindex d448697fe08..6e90a203ed6 100644\n--- a/boot/bootmeth_openwrt.c\n+++ b/boot/bootmeth_openwrt.c\n@@ -24,6 +24,63 @@\n #include <linux/libfdt.h>\n #include <linux/sizes.h>\n \n+/**\n+ * openwrt_match_slot() - check if a partition name matches a configured slot\n+ * @part_name: GPT label, MTD partition name, or UBI volume name\n+ * @slot_namep: set to strdup'd slot name on match (caller must free)\n+ *\n+ * When ``openwrt_boot_order`` is set in the environment, only partitions\n+ * whose name matches one of the ``openwrt_slot_<name>`` locations are\n+ * accepted. Without ``openwrt_boot_order``, all partitions pass.\n+ *\n+ * Return: 0 if accepted, -ENOENT if filtered out\n+ */\n+static int openwrt_match_slot(const char *part_name, char **slot_namep)\n+{\n+\tconst char *order, *p;\n+\n+\t*slot_namep = NULL;\n+\n+\torder = env_get(\"openwrt_boot_order\");\n+\tif (!order)\n+\t\treturn 0;\n+\n+\tif (!part_name)\n+\t\treturn -ENOENT;\n+\n+\tp = order;\n+\twhile (*p) {\n+\t\tchar name[64], var[80];\n+\t\tconst char *location, *end;\n+\t\tint len;\n+\n+\t\twhile (*p == ' ')\n+\t\t\tp++;\n+\t\tif (!*p)\n+\t\t\tbreak;\n+\n+\t\tend = p;\n+\t\twhile (*end && *end != ' ')\n+\t\t\tend++;\n+\n+\t\tlen = end - p;\n+\t\tif (len >= sizeof(name))\n+\t\t\tlen = sizeof(name) - 1;\n+\t\tmemcpy(name, p, len);\n+\t\tname[len] = '\\0';\n+\t\tp = end;\n+\n+\t\tsnprintf(var, sizeof(var), \"openwrt_slot_%s\", name);\n+\t\tlocation = env_get(var);\n+\t\tif (location && !strcmp(part_name, location)) {\n+\t\t\t*slot_namep = strdup(name);\n+\t\t\treturn 0;\n+\t\t}\n+\t}\n+\n+\treturn -ENOENT;\n+}\n+\n static int openwrt_check(struct udevice *dev, struct bootflow_iter *iter)\n {\n \tif (bootflow_iter_check_blk(iter))\n@@ -34,40 +91,61 @@ static int openwrt_check(struct udevice *dev, struct bootflow_iter *iter)\n \n static int openwrt_read_bootflow(struct udevice *dev, struct bootflow *bflow)\n {\n-\tstruct blk_desc *desc = dev_get_uclass_plat(bflow->blk);\n \tconst char *part_name = NULL;\n-\tstruct disk_partition info;\n-\tvoid *buf;\n+\tchar *slot_name = NULL;\n \tint ret;\n \n-\t/* Get partition geometry */\n-\tret = part_get_info(desc, bflow->part, &info);\n-\tif (ret)\n-\t\treturn log_msg_ret(\"part\", ret);\n-\n-\tpart_name = (const char *)info.name;\n-\n-\t/* Read first block to probe for an FDT/FIT header */\n-\tbuf = memalign(SZ_1K, desc->blksz);\n-\tif (!buf)\n-\t\treturn log_msg_ret(\"mem\", -ENOMEM);\n+\tif (bflow->blk) {\n+\t\tstruct blk_desc *desc = dev_get_uclass_plat(bflow->blk);\n+\t\tstruct disk_partition info;\n+\t\tvoid *buf;\n+\n+\t\tret = part_get_info(desc, bflow->part, &info);\n+\t\tif (ret)\n+\t\t\treturn log_msg_ret(\"part\", ret);\n+\n+\t\tpart_name = (const char *)info.name;\n+\n+\t\t/* Check slot filter before expensive I/O */\n+\t\tret = openwrt_match_slot(part_name, &slot_name);\n+\t\tif (ret)\n+\t\t\treturn -ENOENT;\n+\n+\t\t/* Read first block to probe for an FDT/FIT header */\n+\t\tbuf = memalign(SZ_1K, desc->blksz);\n+\t\tif (!buf) {\n+\t\t\tfree(slot_name);\n+\t\t\treturn log_msg_ret(\"mem\", -ENOMEM);\n+\t\t}\n+\n+\t\tret = blk_read(bflow->blk, info.start, 1, buf);\n+\t\tif (ret != 1) {\n+\t\t\tfree(buf);\n+\t\t\tfree(slot_name);\n+\t\t\treturn log_msg_ret(\"rd\", -EIO);\n+\t\t}\n+\n+\t\tif (fdt_check_header(buf)) {\n+\t\t\tfree(buf);\n+\t\t\tfree(slot_name);\n+\t\t\treturn -ENOENT;\n+\t\t}\n \n-\tret = blk_read(bflow->blk, info.start, 1, buf);\n-\tif (ret != 1) {\n \t\tfree(buf);\n-\t\treturn log_msg_ret(\"rd\", -EIO);\n-\t}\n \n-\t/* Must start with a valid FDT header */\n-\tif (fdt_check_header(buf)) {\n-\t\tfree(buf);\n-\t\treturn -ENOENT;\n-\t}\n+\t\t/* Show the GPT partition label as Filename */\n+\t\tbflow->fname = strdup(part_name);\n+\t} else {\n+\t\t/* MTD or UBI — partition/volume name in bootmeth_priv */\n+\t\tpart_name = bflow->bootmeth_priv;\n \n-\tfree(buf);\n+\t\tret = openwrt_match_slot(part_name, &slot_name);\n+\t\tif (ret)\n+\t\t\treturn -ENOENT;\n+\t}\n \n-\t/* Show the GPT partition label as Filename */\n-\tbflow->fname = strdup(part_name);\n+\tif (slot_name)\n+\t\tbflow->os_name = slot_name;\n \n \tbflow->state = BOOTFLOWST_READY;\n \n", "prefixes": [ "RFC", "20/20" ] }