From patchwork Fri Jan 9 23:11:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1416 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768000429; bh=h3RMWHVJz4mLJZeWvc+HRsO4wqmKnmFbs0HKdjQQ+Sk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=rvT8Rs0shqi9cc45m5g4fYcgh7dJdRVeVLHgaix4pjaf7t98itYD1evgolfc2KId6 +PDICTzxYFw5vXvc91VBWgUzeoFqpH3+Hl1CLGDhPGWCoraLiYhS4ZIYUO7crL4vpA GI3501rPFsTNV7bXk4vWthzpCd7KU+SEkaTJgaGzOWrhgDgMzZjNnm8qWHUGpfBqsJ Ht3HsJt0rJPytymL1XAMh2il2ZSVQi62bnRNxzXISVOWNs8D1k0mZ8/1oALeQCpA43 6MFDxtipkpdxaezMZTlrj0i1biXZINbGQmbMnoCJ7B4ZZe6vXai/6VORgq7Wa6GLp2 tSF1My5P/jB6A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6648E69221 for ; Fri, 9 Jan 2026 16:13:49 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id IF5moTGRTvLQ for ; Fri, 9 Jan 2026 16:13:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768000427; bh=h3RMWHVJz4mLJZeWvc+HRsO4wqmKnmFbs0HKdjQQ+Sk=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=i8NKf2i/4EMnMP60T8dqIOvOymOekGbpaFQwNboNrR9MQY3H0m4XgCswj57+iS3/k vOAY/SCoU9Wdl+hzrTwmqj+m1kXLNLlsUZph9z11vcLUlnpJQ8IC4T01sZva9OT42X pV8wy6W224CCzyoh9Lk84RQRJtmsG1xJ344XfqXQ51e874+QAByS7qn6rIQDJO+P58 fX3e7CXEj5Kroq8gdtQCUWL7hWnyyMtzzQovZgG0r2qqMyjcdIgtGeszEAyOivp0vm hFqvnStsIsqZZNmvcWXVnedJgBS9Jsu1hLbASv7mrPkH031ikat61veRPIs8SHDLuY FRAwQHImHcO9Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 85EFF6924E for ; Fri, 9 Jan 2026 16:13:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768000425; bh=KTjZ6WHKKM022uNin3DFJ0hBnvsbQkRPXnnZvfrsr7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOsRmguqAUPQnep7PGzBzzsFeA6ERWVp2IoaKQmwExtlKRZDWQT+FztWvqG4ygyfQ gleMsFYz+eMi6oaIqLLffnRKmHuOU8MLYOFwGzSBHUBZXJZ+lWyjT4k8QbysMkgGon Fu/cRzowwiXBuZ+b6l6Vt+XBBJs5+oN5AmL64h0bW+Gu+jJdvzTFPJcfyUh8KKleQ/ CTnkIK6Z7cE+OnveEXKj3cQpWPS3exMx9qyQ0qi+XZ5+dJ2c0MX06EZH1498E28e1u 7jKTS3CZyVVYPy9HxTgBMFIUWz5F+fnq6ccyudCH532wxPd6OZA7kmhh5qB02MTaq0 sbZvf4zWKrJ4g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E3BEE5FF82; Fri, 9 Jan 2026 16:13:45 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 8Qa8DyrptcLJ; Fri, 9 Jan 2026 16:13:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768000421; bh=07TDSKNTopUxnGTQsl/fNBNswXYSt7TWUO7gEzgTGNE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W65oVvLPsj19+ztZ5K4JE1W4SOCua7RwzYV9EK5aYNOyBKV9twBnFPl3pjmHNR8rm IU+zcs2oDwHE7HxRfrxl3Z/k00i4Yv3QnvsDqWokmeTCmYxqL3QMdI7sOG/rb2pBar dDwen9N86t8d93QhB9KoUGGT1rPvF6fVhDQlLRO8WdxD/sTJIZxJarWsneQXwkVZ8Z zN8wjSzHwM2HH9y+2udcmDjSZOafyAZNdSnAyUPnI4+etad28pAv/X7X7Dng8Ml959 8eFGKme8GJtlGHkpJLVDcEHqEegUJPnrjIMDx+OYRqX2Mg7+5NkxEKkmFpZTm6mx34 jdBIpznI4vHKg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4583769218; Fri, 9 Jan 2026 16:13:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 9 Jan 2026 16:11:29 -0700 Message-ID: <20260109231151.4056804-21-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260109231151.4056804-1-sjg@u-boot.org> References: <20260109231151.4056804-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: IQBUBF2SKKVKESY6GCIUSINAFTFIQ7RY X-Message-ID-Hash: IQBUBF2SKKVKESY6GCIUSINAFTFIQ7RY X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 20/32] boot: pxe: Use ctx->fdt in label_boot_fdtoverlay() List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Use ctx->fdt instead of re-mapping from the fdt_addr_r environment variable. Since ctx->fdt is set after loading the FDT, it is available for use by the overlay code. This avoids a crash when the FDT is loaded via LMB allocation without fdt_addr_r being set, and removes the dependency on the global working_fdt variable. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/pxe_utils.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index c0ef524f3f1..05102914717 100644 --- a/boot/pxe_utils.c +++ b/boot/pxe_utils.c @@ -308,16 +308,11 @@ static void label_boot_fdtoverlay(struct pxe_context *ctx, struct pxe_label *label) { char *fdtoverlay = label->fdtoverlays; - struct fdt_header *working_fdt; char *fdtoverlay_addr_env; ulong fdtoverlay_addr; - ulong fdt_addr; int err; - /* Get the main fdt and map it */ - fdt_addr = hextoul(env_get("fdt_addr_r"), NULL); - working_fdt = map_sysmem(fdt_addr, 0); - err = fdt_check_header(working_fdt); + err = fdt_check_header(ctx->fdt); if (err) return; @@ -366,7 +361,7 @@ static void label_boot_fdtoverlay(struct pxe_context *ctx, } /* Resize main fdt */ - fdt_shrink_to_minimum(working_fdt, 8192); + fdt_shrink_to_minimum(ctx->fdt, 8192); blob = map_sysmem(fdtoverlay_addr, 0); err = fdt_check_header(blob); @@ -376,7 +371,7 @@ static void label_boot_fdtoverlay(struct pxe_context *ctx, goto skip_overlay; } - err = fdt_overlay_apply_verbose(working_fdt, blob); + err = fdt_overlay_apply_verbose(ctx->fdt, blob); if (err) { printf("Failed to apply overlay %s, skipping\n", overlayfile);