From patchwork Fri Jan 9 23:11:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1403 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=1768000366; bh=rMiGjwKTgQC7TRS+1yUglZRT+HjJSnWlSgwWt4rNpJc=; 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=BBdXcPrdvzREH7VF6ttM2Qhpggf0BOXOoFBn5DGpvqABAqxgK1hAW3gt0D0WUfVJn 0WBChlWMxV2FV0UHxikox/iAKuFNAZPQ9l77JCk3HB8OqAVioi8kfOe6eKaOFWsfsl BbLUT+hA5YLtYN23TCRX9OzqjGyPITMq/4VhbU+CQ+s2c0cS8BhUudj9nHeCQ2rhFj 38XykxG91w0F9nm6UGFORnVaIHJjDHQyLMVUeVIG5ER+yY3o9Kt1ZStC7dtW4b3Rpc 1sxvXk5XeJ/d558DBRLBAx0Makq7HYtggLFqm7CcfTi1Tmx8Q6UpuLU0g7CGXnbkoM jIgpwGJkgbvPg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3D4B169245 for ; Fri, 9 Jan 2026 16:12:46 -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 6FiTy6L2DToe for ; Fri, 9 Jan 2026 16:12:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768000366; bh=rMiGjwKTgQC7TRS+1yUglZRT+HjJSnWlSgwWt4rNpJc=; 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=BBdXcPrdvzREH7VF6ttM2Qhpggf0BOXOoFBn5DGpvqABAqxgK1hAW3gt0D0WUfVJn 0WBChlWMxV2FV0UHxikox/iAKuFNAZPQ9l77JCk3HB8OqAVioi8kfOe6eKaOFWsfsl BbLUT+hA5YLtYN23TCRX9OzqjGyPITMq/4VhbU+CQ+s2c0cS8BhUudj9nHeCQ2rhFj 38XykxG91w0F9nm6UGFORnVaIHJjDHQyLMVUeVIG5ER+yY3o9Kt1ZStC7dtW4b3Rpc 1sxvXk5XeJ/d558DBRLBAx0Makq7HYtggLFqm7CcfTi1Tmx8Q6UpuLU0g7CGXnbkoM jIgpwGJkgbvPg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0FD3369243 for ; Fri, 9 Jan 2026 16:12:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768000363; bh=njGja6c0dK+JxbrKdbNDnRI6r31EbpiI197A8hKJl2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TJUASqU4uJWtnlvg6dPVT7dehMQti1omzxWNLrfvKHKRnLbkeoHtU+gXvFgKM+0Ne 6NvMIDQ+3t75jB92PJG/vvdUxP2VXR82SCiskoUTtb2mztFWkmJ3aaxKDkUSVyi0sR Ec8rP4c9j65zmnXySRaPzBmPBLjrCrb0Qgryk7tzL08TeDMuejs/Kbv6+CUFQvxpUn R5Fiit0mqnW4VysafDE6R6fa+N1vWTV0cEc0T3SpP/cGTo80mqLtwGqZevSSDpHT92 tvaIhlbUiRXJKayKmAKnVdc1xAAdTJzp4pW6gnUMfigVunMeNUq2OiWKEbF9a69mhx gKK97ZEze5nNw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E81FB6923A; Fri, 9 Jan 2026 16:12:43 -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 9_YJbnnxu_FB; Fri, 9 Jan 2026 16:12:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768000363; bh=+Gdb+0x0QCLhAeClOH9kDoupXUm32L+3Hu/nk83azIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rLHBbY9DmYDOXRH9WPult8lEUEEb5etr5MsHHrDykSjaRNUx5Lr4S9KrMjGm13EZl YCmXlzJkIVSI3YBOx9ezfuubTi976GFVHGVDDN9fkqbLxJ7SIXwBj0Abjc/bOtZqMT SZxsmhI+SWgYNOZBq49MvlmQfscH9eOnBU/poL4OiFsGtbTbdBW5eLpNDSIQnUbd5y 3IR+Uvl0mjK4QNLddABq0YwJJH0Qp8PeJ5+vwANnbb4A2FJ7+GyrB9vlY3weM32ME5 SXFa1Wv/rAd1hOxydrWW7LhQnes3xRqafGOaPLuwnRJ2MVAGQ0NiDznaozBGF5sTss B+Ai/DiTg6ytQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 399BE69206; Fri, 9 Jan 2026 16:12:43 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 9 Jan 2026 16:11:16 -0700 Message-ID: <20260109231151.4056804-8-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: EJKI7JNI3I6BFOWTDTGAO4A37J6YBMKV X-Message-ID-Hash: EJKI7JNI3I6BFOWTDTGAO4A37J6YBMKV 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 07/32] test: pxe: Add a test for missing fdtoverlay_addr_r 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 Add a test that verifies the behaviour when a label has fdtoverlays defined in the extlinux.conf but fdtoverlay_addr_r is not set in the environment. The expected behaviour is that the overlay loading is skipped with a warning message ("Invalid fdtoverlay_addr_r for loading overlays") but the FDT is still loaded successfully, allowing the boot to proceed without overlays. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- test/boot/pxe.c | 87 ++++++++++++++++++++++++++++++++ test/py/tests/test_pxe_parser.py | 7 +++ 2 files changed, 94 insertions(+) diff --git a/test/boot/pxe.c b/test/boot/pxe.c index 2ee2ad24a7d..46b26496fbd 100644 --- a/test/boot/pxe.c +++ b/test/boot/pxe.c @@ -609,6 +609,93 @@ PXE_TEST_ARGS(pxe_test_errors_norun, UTF_CONSOLE | UTF_MANUAL, { "fs_image", UT_ARG_STR }, { "cfg_path", UT_ARG_STR }); +/** + * Test overlay loading when fdtoverlay_addr_r is not set + * + * This tests that when a label has fdtoverlays but fdtoverlay_addr_r is not + * set, the overlay loading is skipped with an appropriate warning message, + * but the FDT is still loaded successfully. + */ +static int pxe_test_overlay_no_addr_norun(struct unit_test_state *uts) +{ + const char *fs_image = ut_str(PXE_ARG_FS_IMAGE); + const char *cfg_path = ut_str(PXE_ARG_CFG_PATH); + struct pxe_test_info info; + struct pxe_context ctx; + struct pxe_label *label; + struct pxe_menu *cfg; + ulong addr = PXE_LOAD_ADDR; + void *fdt; + uint i; + + ut_assertnonnull(fs_image); + ut_assertnonnull(cfg_path); + + info.uts = uts; + + /* Bind the filesystem image */ + ut_assertok(run_commandf("host bind 0 %s", fs_image)); + + /* Set up the PXE context */ + ut_assertok(pxe_setup_ctx(&ctx, pxe_test_getfile, &info, true, cfg_path, + false, false, NULL)); + + /* Read and parse the config file */ + ut_asserteq(1, get_pxe_file(&ctx, cfg_path, addr)); + + cfg = parse_pxefile(&ctx, addr); + ut_assertnonnull(cfg); + + /* Consume parsing output */ + ut_assert_nextline("Retrieving file: %s", cfg_path); + ut_assert_nextline("Booting default Linux kernel"); + ut_assert_nextline("Retrieving file: /extlinux/extra.conf"); + for (i = 3; i <= 16; i++) + ut_assert_nextline("Retrieving file: /extlinux/nest%d.conf", i); + ut_assert_console_end(); + + /* + * Set up environment for loading, but do NOT set fdtoverlay_addr_r. + * This should cause overlay loading to be skipped with a warning. + */ + ut_assertok(env_set_hex("kernel_addr_r", PXE_KERNEL_ADDR)); + ut_assertok(env_set_hex("ramdisk_addr_r", PXE_INITRD_ADDR)); + ut_assertok(env_set_hex("fdt_addr_r", PXE_FDT_ADDR)); + ut_assertok(env_set("fdtoverlay_addr_r", NULL)); /* Clear it */ + + /* Get the first label (linux) which has fdtoverlays */ + label = list_first_entry(&cfg->labels, struct pxe_label, list); + ut_asserteq_str("linux", label->name); + ut_assertnonnull(label->fdtoverlays); + + /* Load the label - should succeed but skip overlays */ + ut_assertok(pxe_load_label(&ctx, label)); + + /* FDT should be loaded */ + ut_asserteq(PXE_FDT_ADDR, ctx.conf_fdt); + fdt = map_sysmem(PXE_FDT_ADDR, 0); + ut_assertok(fdt_check_header(fdt)); + + /* + * Check console output - FDT loaded, but overlays skipped with + * warning about missing fdtoverlay_addr_r + */ + ut_assert_nextline("Retrieving file: /vmlinuz"); + ut_assert_nextline("Retrieving file: /initrd.img"); + ut_assert_nextline("Retrieving file: /dtb/board.dtb"); + ut_assert_nextline("Invalid fdtoverlay_addr_r for loading overlays"); + ut_assert_console_end(); + + /* Clean up */ + destroy_pxe_menu(cfg); + pxe_destroy_ctx(&ctx); + + return 0; +} +PXE_TEST_ARGS(pxe_test_overlay_no_addr_norun, UTF_CONSOLE | UTF_MANUAL, + { "fs_image", UT_ARG_STR }, + { "cfg_path", UT_ARG_STR }); + /** * Test pxe_get_file_size() function * diff --git a/test/py/tests/test_pxe_parser.py b/test/py/tests/test_pxe_parser.py index 61ff6d11e3e..b728fb86946 100644 --- a/test/py/tests/test_pxe_parser.py +++ b/test/py/tests/test_pxe_parser.py @@ -460,3 +460,10 @@ class TestPxeParser: with ubman.log.section('Test PXE alloc'): ubman.run_ut('pxe', 'pxe_test_alloc', fs_image=fs_img, cfg_path=cfg_path) + + def test_pxe_overlay_no_addr(self, ubman, pxe_image): + """Test overlay loading when fdtoverlay_addr_r is not set""" + fs_img, cfg_path = pxe_image + with ubman.log.section('Test PXE overlay no addr'): + ubman.run_ut('pxe', 'pxe_test_overlay_no_addr', + fs_image=fs_img, cfg_path=cfg_path)