From patchwork Sat Jan 10 20:28:44 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1458 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=1768077016; bh=HDzbREbggsIqSuMzZt0bksVgFQGGvICVOxEPPZPbNFU=; 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=sXdpeVNN6t7k9xhLQLPC5jFn0HwexwROFUFeyKqcM3ZmQEuz5/XIf1dRKLd0oXr7s 6CqBHpANxrAsztXTNs4dLnjHZgM2mybw7//4O13WYh/IGGgLvx5X+SdpKlRSA4kYIu ovez4v3jDK8RsHLFH5E26OMyK+rBWWSuEfIiRXtChH4VOz0BFyV75ck69u8nbB7e0w MedPV7Dgn0fz/kKrA7XDijPUyjWYvt9W0FIADeVIrgGSx0d6nzC2FL4Ih8rN6/6Mmr HBNJ2p/VZ1jKLv4P6KJcWqhHbi6sVvocVAr7iukycS91Cz932NDs/DleM3p4QT8Y// 3u/fk8TW2wVpw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8EAFB69296 for ; Sat, 10 Jan 2026 13:30:16 -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 DJEHR_nG5m4j for ; Sat, 10 Jan 2026 13:30:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077016; bh=HDzbREbggsIqSuMzZt0bksVgFQGGvICVOxEPPZPbNFU=; 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=sXdpeVNN6t7k9xhLQLPC5jFn0HwexwROFUFeyKqcM3ZmQEuz5/XIf1dRKLd0oXr7s 6CqBHpANxrAsztXTNs4dLnjHZgM2mybw7//4O13WYh/IGGgLvx5X+SdpKlRSA4kYIu ovez4v3jDK8RsHLFH5E26OMyK+rBWWSuEfIiRXtChH4VOz0BFyV75ck69u8nbB7e0w MedPV7Dgn0fz/kKrA7XDijPUyjWYvt9W0FIADeVIrgGSx0d6nzC2FL4Ih8rN6/6Mmr HBNJ2p/VZ1jKLv4P6KJcWqhHbi6sVvocVAr7iukycS91Cz932NDs/DleM3p4QT8Y// 3u/fk8TW2wVpw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7CB5469290 for ; Sat, 10 Jan 2026 13:30:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077014; bh=HR3aec+n5GdyapjL5rp1X11KXp8kZEtLkWhMjxihhfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NGTNPQtQwaOOl8e30SDbUtWB2OBsuMA4lBFgkRYF7xbEB1jzsxR1StQpI7SS5LyLO KFKR4org9ed2y0OfCgnrcfj0TXwWlJK+VDMMoGBRp/adSs4WH88ZVNm+7vlMS239e6 wqfCr0L0gWeZG0Hmyrb1dP5YLgMPSmNf+kxE3DUPkc+ArXJzBLhWSn0oukjHRhj8TN emOlSHM0CQgesSmmUYoIHHRQT6U6WHXgCPtd4yh6NmR48juEmq5pQbDMcFQ1iTG3OO L5klq4N3loxzJFTeUYI5pxlnEICvg191ZtzGF8g/0fI69w1YAiD7jMXOgRDZVYeNKU 7tALk5d81Iq4g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B955669290; Sat, 10 Jan 2026 13:30:14 -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 XPxMLwaFoCfO; Sat, 10 Jan 2026 13:30:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768077009; bh=zsLNuZETk0PNbUmxZyZ21mwTzQykxMZwMKFSEeu0QiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mSQz9xB9NAUIfHBnEWqn2cPZuiwv/m5fSMAdiVu7Iqrtw7UFn5U7d5Qd4cR2wljHp yOzPpmvhcJaAs8hXL/UQ147TktZtlcn5p4PJZwB0vSYHxIzF+G6Mx1ipvMO43IO7rT E7muzfSO2qERsQvjLhRsFda2u5IaH4PAY/v68YHecZ5CSYBpIi195ndlswJ2vlyYba DvG15doBTaXD8DHX12dJ9XymuJf97WD+H5KQN9bKKvZImp13zSraE9EU5WA01RKk6H 8H9GE+V6hHLP7Y/uJbm7a74SjL9O+z2bRj8lxfWqhDXxePvX7QGUc1SF/mjW9shWnt AzSS0O9FTUMLQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0D65B6927E; Sat, 10 Jan 2026 13:30:08 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 10 Jan 2026 13:28:44 -0700 Message-ID: <20260110202906.187370-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260110202906.187370-1-sjg@u-boot.org> References: <20260110202906.187370-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: EO25OHLXKSSZPVYA3B7RQQDL2O2HH3MH X-Message-ID-Hash: EO25OHLXKSSZPVYA3B7RQQDL2O2HH3MH 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 12/26] boot: pxe: Add the kernel to the files list when parsing 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 When parsing a kernel label, add the kernel path to the files list with type PFT_KERNEL. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/pxe_parse.c | 15 +++++++-------- test/boot/pxe.c | 32 ++++++++++++++++++++------------ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/boot/pxe_parse.c b/boot/pxe_parse.c index 51fce1d5737..8bd9d66f486 100644 --- a/boot/pxe_parse.c +++ b/boot/pxe_parse.c @@ -547,16 +547,15 @@ static int parse_label_kernel(char **c, struct pxe_label *label) return -ENOMEM; s = strstr(label->kernel, "#"); - if (!s) - return 1; - - label->config = strdup(s); - if (!label->config) - return -ENOMEM; + if (s) { + label->config = strdup(s); + if (!label->config) + return -ENOMEM; - *s = 0; + *s = 0; + } - return 1; + return label_add_file(label, label->kernel, PFT_KERNEL) ? : 1; } /* diff --git a/test/boot/pxe.c b/test/boot/pxe.c index df7cf2a781a..6b2d521c8e8 100644 --- a/test/boot/pxe.c +++ b/test/boot/pxe.c @@ -190,11 +190,13 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) ut_asserteq_str("/initrd.img", label->initrd); ut_asserteq_str("/dtb/board.dtb", label->fdt); ut_assertnull(label->fdtdir); - ut_asserteq(2, label->files.count); - ut_asserteq_str("/dtb/overlay1.dtbo", + ut_asserteq(3, label->files.count); + ut_asserteq_str("/vmlinuz", alist_get(&label->files, 0, struct pxe_file)->path); - ut_asserteq_str("/dtb/overlay2.dtbo", + ut_asserteq_str("/dtb/overlay1.dtbo", alist_get(&label->files, 1, struct pxe_file)->path); + ut_asserteq_str("/dtb/overlay2.dtbo", + alist_get(&label->files, 2, struct pxe_file)->path); ut_asserteq_str("Booting default Linux kernel", label->say); ut_asserteq(0, label->ipappend); ut_asserteq(0, label->attempted); @@ -214,7 +216,9 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) ut_assertnull(label->initrd); ut_assertnull(label->fdt); ut_asserteq_str("/dtb/", label->fdtdir); - ut_asserteq(0, label->files.count); + ut_asserteq(1, label->files.count); + ut_asserteq_str("/vmlinuz-rescue", + alist_get(&label->files, 0, struct pxe_file)->path); ut_assertnull(label->say); ut_asserteq(3, label->ipappend); ut_asserteq(0, label->attempted); @@ -254,7 +258,9 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) ut_assertnull(label->initrd); ut_assertnull(label->fdt); ut_assertnull(label->fdtdir); - ut_asserteq(0, label->files.count); + ut_asserteq(1, label->files.count); + ut_asserteq_str("/boot/image.fit", + alist_get(&label->files, 0, struct pxe_file)->path); ut_assertnull(label->say); ut_asserteq(0, label->ipappend); ut_asserteq(0, label->attempted); @@ -274,7 +280,9 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) ut_assertnull(label->initrd); ut_assertnull(label->fdt); ut_assertnull(label->fdtdir); - ut_asserteq(0, label->files.count); + ut_asserteq(1, label->files.count); + ut_asserteq_str("/boot/included-kernel", + alist_get(&label->files, 0, struct pxe_file)->path); ut_assertnull(label->say); ut_asserteq(0, label->ipappend); ut_asserteq(0, label->attempted); @@ -296,7 +304,7 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) * environment, and verify overlay files can be loaded. */ label = list_first_entry(&cfg->labels, struct pxe_label, list); - ut_asserteq(2, label->files.count); + ut_asserteq(3, label->files.count); /* Set environment variables for file loading */ ut_assertok(env_set_hex("kernel_addr_r", PXE_KERNEL_ADDR)); @@ -315,15 +323,15 @@ static int pxe_test_parse_norun(struct unit_test_state *uts) ut_asserteq(PXE_KERNEL_ADDR, ctx.kern_addr); ut_asserteq(PXE_FDT_ADDR, ctx.fdt_addr); - /* Verify overlays were loaded to valid addresses */ - ut_assert(alist_get(&label->files, 0, - struct pxe_file)->addr >= PXE_OVERLAY_ADDR); + /* Verify overlays were loaded to valid addresses (indices 1 and 2) */ ut_assert(alist_get(&label->files, 1, struct pxe_file)->addr >= PXE_OVERLAY_ADDR); + ut_assert(alist_get(&label->files, 2, + struct pxe_file)->addr >= PXE_OVERLAY_ADDR); /* Second overlay should be at a higher address than the first */ - ut_assert(alist_get(&label->files, 1, struct pxe_file)->addr > - alist_get(&label->files, 0, struct pxe_file)->addr); + ut_assert(alist_get(&label->files, 2, struct pxe_file)->addr > + alist_get(&label->files, 1, struct pxe_file)->addr); /* Verify no more console output */ ut_assert_console_end();