Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2197003/?format=api
{ "id": 2197003, "url": "http://patchwork.ozlabs.org/api/patches/2197003/?format=api", "web_url": "http://patchwork.ozlabs.org/project/uboot/patch/ab7837536e4567b90d7cb662984dd7e637ef4361.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": "<ab7837536e4567b90d7cb662984dd7e637ef4361.1771275704.git.daniel@makrotopia.org>", "list_archive_url": null, "date": "2026-02-16T21:22:42", "name": "[RFC,09/20] boot: fit: support on-demand loading in fit_image_load()", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d0bde08c4b90f7a7321b40cf9c9319a7f940b0d6", "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/ab7837536e4567b90d7cb662984dd7e637ef4361.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/2197003/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2197003/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 4fFG4d5qnwz1xwD\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 17 Feb 2026 08:24:33 +1100 (AEDT)", "from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 9AFB783E62;\n\tMon, 16 Feb 2026 22:23:19 +0100 (CET)", "by phobos.denx.de (Postfix, from userid 109)\n id B463C83DEB; Mon, 16 Feb 2026 22:23:05 +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 4AE148063E\n for <u-boot@lists.denx.de>; Mon, 16 Feb 2026 22:23:01 +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 1vs63K-000000002im-0rSp; Mon, 16 Feb 2026 21:22:46 +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:22:42 +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 09/20] boot: fit: support on-demand loading in\n fit_image_load()", "Message-ID": "\n <ab7837536e4567b90d7cb662984dd7e637ef4361.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:23:19 +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 an on-demand loading path to fit_image_load() for use when\nimages->loader is set (storage-backed boot).\n\nFor external-data FIT images, the new path avoids dereferencing\nfit + data_offset (which would point into unmapped memory) and\ninstead:\n\n1. Extracts the data offset and size from FDT properties\n (data-position / data-offset + data-size) -- metadata only,\n no payload access.\n\n2. Returns early for IH_TYPE_FILESYSTEM sub-images, which stay on\n storage and are never loaded into RAM (e.g. squashfs rootfs).\n\n3. Determines the RAM destination:\n - If the sub-image has a load address, loads directly there\n via image_loader_map_to() (zero-copy).\n - Otherwise, allocates scratch RAM via image_loader_map().\n\n4. Verifies the hash/signature in-place using\n fit_image_verify_with_data(), which is address-agnostic.\n\n5. Jumps to the common tail, skipping the normal\n fit_image_get_data() + memcpy() sequence since data is already\n at its final location.\n\nThe entire path is gated by 'if (images->loader && external)' and\nUSE_HOSTCC, so the existing in-memory flow is completely unchanged\nwhen no loader is set or when building host tools.\n\nFor inline-data FIT images (no data-position/data-offset), the FDT\nstructure loaded during format detection already contains all sub-\nimage data, so the existing path handles them correctly.\n\nAlso adds a 'struct image_loader *loader' member to struct\nbootm_headers (initialised to NULL).\n\nSigned-off-by: Daniel Golle <daniel@makrotopia.org>\n---\n boot/image-fit.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++\n include/image.h | 4 ++\n 2 files changed, 100 insertions(+)", "diff": "diff --git a/boot/image-fit.c b/boot/image-fit.c\nindex 3ed69b5f7bc..73d3bf7df08 100644\n--- a/boot/image-fit.c\n+++ b/boot/image-fit.c\n@@ -24,6 +24,7 @@ extern void *aligned_alloc(size_t alignment, size_t size);\n #include <linux/sizes.h>\n #include <errno.h>\n #include <log.h>\n+#include <image-loader.h>\n #include <mapmem.h>\n #include <asm/io.h>\n #include <malloc.h>\n@@ -2166,6 +2167,100 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \n \tprintf(\" Trying '%s' %s subimage\\n\", fit_uname, prop_name);\n \n+#if !defined(USE_HOSTCC) && CONFIG_IS_ENABLED(IMAGE_LOADER)\n+\t/*\n+\t * Storage-backed path: when an image_loader is active and the\n+\t * sub-image uses external data, load the payload from storage\n+\t * instead of dereferencing fit + data_offset. The FDT structure\n+\t * (containing all metadata, hashes, and signatures) is already\n+\t * in RAM; only the payload is on storage.\n+\t *\n+\t * Sequence:\n+\t * 1. Print image info (fit_image_select with verify=0)\n+\t * 2. Extract data location from FDT properties (no data access)\n+\t * 3. Skip IH_TYPE_FILESYSTEM sub-images — they stay on storage\n+\t * 4. Determine RAM destination (load address or scratch area)\n+\t * 5. Read payload via image_loader_map_to() / image_loader_map()\n+\t * 6. Verify hash/signature in-place\n+\t * 7. Jump to common tail (FDT validation, output params)\n+\t */\n+\tif (images && images->loader) {\n+\t\tint data_off = 0, data_sz = 0;\n+\t\tbool external = false;\n+\t\tu8 img_type;\n+\n+\t\tif (!fit_image_get_data_position(fit, noffset, &data_off)) {\n+\t\t\texternal = true;\n+\t\t} else if (!fit_image_get_data_offset(fit, noffset, &data_off)) {\n+\t\t\texternal = true;\n+\t\t\tdata_off += ALIGN(fdt_totalsize(fit), 4);\n+\t\t}\n+\n+\t\tif (external && !fit_image_get_data_size(fit, noffset, &data_sz)) {\n+\t\t\t/* Print image info without verifying data */\n+\t\t\tret = fit_image_select(fit, noffset, 0);\n+\t\t\tif (ret) {\n+\t\t\t\tbootstage_error(bootstage_id + BOOTSTAGE_SUB_HASH);\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\n+\t\t\t/* Skip filesystem images — they stay on storage */\n+\t\t\tif (!fit_image_get_type(fit, noffset, &img_type) &&\n+\t\t\t img_type == IH_TYPE_FILESYSTEM) {\n+\t\t\t\t*datap = 0;\n+\t\t\t\t*lenp = 0;\n+\t\t\t\treturn noffset;\n+\t\t\t}\n+\n+\t\t\tlen = data_sz;\n+\t\t\tcomp = IH_COMP_NONE;\n+\t\t\tfit_image_get_comp(fit, noffset, &comp);\n+\n+\t\t\t/* Determine the RAM destination */\n+\t\t\tif (load_op == FIT_LOAD_IGNORED) {\n+\t\t\t\tloadbuf = image_loader_map(images->loader,\n+\t\t\t\t\t\t\t data_off, len);\n+\t\t\t} else if (!fit_image_get_load(fit, noffset, &load)) {\n+\t\t\t\tprintf(\" Loading %s from storage to 0x%08lx\\n\",\n+\t\t\t\t prop_name, load);\n+\t\t\t\tloadbuf = map_sysmem(load, len);\n+\t\t\t\tloadbuf = image_loader_map_to(images->loader,\n+\t\t\t\t\t\t\t data_off, len,\n+\t\t\t\t\t\t\t loadbuf);\n+\t\t\t} else if (load_op == FIT_LOAD_REQUIRED) {\n+\t\t\t\tprintf(\"Can't get %s subimage load address!\\n\",\n+\t\t\t\t prop_name);\n+\t\t\t\treturn -EBADF;\n+\t\t\t} else {\n+\t\t\t\tloadbuf = image_loader_map(images->loader,\n+\t\t\t\t\t\t\t data_off, len);\n+\t\t\t}\n+\n+\t\t\tif (!loadbuf) {\n+\t\t\t\tprintf(\"Failed to load %s from storage\\n\",\n+\t\t\t\t prop_name);\n+\t\t\t\treturn -EIO;\n+\t\t\t}\n+\n+\t\t\tload = map_to_sysmem(loadbuf);\n+\n+\t\t\t/* Verify hash/signature in-place */\n+\t\t\tif (images->verify) {\n+\t\t\t\tputs(\" Verifying Hash Integrity ... \");\n+\t\t\t\tif (!fit_image_verify_with_data(fit, noffset,\n+\t\t\t\t\t\t\t\tgd_fdt_blob(),\n+\t\t\t\t\t\t\t\tloadbuf, len)) {\n+\t\t\t\t\tputs(\"Bad Data Hash\\n\");\n+\t\t\t\t\treturn -EACCES;\n+\t\t\t\t}\n+\t\t\t\tputs(\"OK\\n\");\n+\t\t\t}\n+\n+\t\t\tgoto storage_loaded;\n+\t\t}\n+\t}\n+#endif /* !USE_HOSTCC && CONFIG_IMAGE_LOADER */\n+\n \tret = fit_image_select(fit, noffset, images->verify);\n \tif (ret) {\n \t\tbootstage_error(bootstage_id + BOOTSTAGE_SUB_HASH);\n@@ -2325,6 +2420,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr,\n \t\tputs(\"WARNING: 'compression' nodes for ramdisks are deprecated,\"\n \t\t \" please fix your .its file!\\n\");\n \n+storage_loaded:\n \t/* verify that image data is a proper FDT blob */\n \tif (load_op != FIT_LOAD_IGNORED && image_type == IH_TYPE_FLATDT &&\n \t fdt_check_header(loadbuf)) {\ndiff --git a/include/image.h b/include/image.h\nindex 34efac6056d..ecb3fec26c0 100644\n--- a/include/image.h\n+++ b/include/image.h\n@@ -345,6 +345,8 @@ struct image_info {\n \tuint8_t\t\tarch;\t\t\t/* CPU architecture */\n };\n \n+struct image_loader;\n+\n /*\n * Legacy and FIT format headers used by do_bootm() and do_bootm_<os>()\n * routines.\n@@ -400,6 +402,8 @@ struct bootm_headers {\n \n \tint\t\tverify;\t\t/* env_get(\"verify\")[0] != 'n' */\n \n+\tstruct image_loader *loader;\t/* on-demand storage loader, or NULL */\n+\n #define BOOTM_STATE_START\t0x00000001\n #define BOOTM_STATE_FINDOS\t0x00000002\n #define BOOTM_STATE_FINDOTHER\t0x00000004\n", "prefixes": [ "RFC", "09/20" ] }