From patchwork Fri Feb 20 21:32:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1917 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=1771623177; bh=FMdqFZ+YSXPxBCgdCmb0sTwVzuyZ+ktXe62KDZ6CJ30=; 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=t/3M1Bws1vLjdzjx3uzVI5EbxihXTSyHSdlA2TYizwUK2BGtapk9JxPwv8WGXi5ly ErS2sL6dR/IAYk56yHPZVowmDnLTY5pxBlAN2Jinde8A8SRM2OWX4OkaaPEzBTSI1t bqVX/UX5OeI5EzIx27oG6w/rxxAC8Xef1gRMv/mU2E3Lz5/MLO5scchkKV3TBSzO/w EyJA07XZdF3/dJ1dP1VeKnqfg8Nhoe7C7QHUDVuoqNNGLTLX/2Z0YCkvJ67vDVa+Q4 /rbgm6kg8YHLdWvQROr2A7psyohTEhKyHSxvfqV940oAwrqETtPRz0MsGrXRyYKHZP g61llpCmIRoFw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 71F5369CD0 for ; Fri, 20 Feb 2026 14:32:57 -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 MjUklkGPKF_4 for ; Fri, 20 Feb 2026 14:32:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771623176; bh=FMdqFZ+YSXPxBCgdCmb0sTwVzuyZ+ktXe62KDZ6CJ30=; 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=ZO8OiUYu2A2FqYhHoLbMYJ0deAA0s+v4h1PoTTEQ6tJ3YajkBNPATShOTgsYOBByw Se3QfDsO9FPrOPUmSd8yjPcJzGKNfLk6v7nNYvRN8efBy4//ZnBHGwI/W2fD4Dn4nV uvKqT2p9/VhN7pzAEmL8f60i1cAeGlcWnuxuS0zYvLS0cd1fWkYq/+cF5b4ib4ZWOp d+LSV27HNu6B2LPoIAgWFN5aoXSh38h476HUUHjaKSun+WGdNtUjLvR00/l2h3SBZB uW73Gs667Lt2apsaJfao2jiXjvpyRZVyMY30Ry37V+AghlCPfUebNqljCz/TNSiFp+ jhRpGRfqt7d7g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6BE7469CC8 for ; Fri, 20 Feb 2026 14:32:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771623174; bh=NpnxFx8bQSDvcrPrpKswB2+VUFHjvBP5CA6yqIOvn/k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HZCucWQtmtXJqrNDOc8f50p+wrUe/qDESKiABXlS4gYgptANo2IIXhjEfNne8m1Kj yLkOQVZ7N9X44iZMA7hcZ4+fv1xS2m5o1XcqdGveQswC2kmZYuPRtJx13J3Q82Gw5X YBZVMkiOLOHUtzG9suRWPutYfUtA9aqTUUOOQwruZR9SSG+jfFmFUm22wW6gRkzZn5 dfgN9WDoJzVZyV7tR5rxZ1LsapOmzWmINm+6A0YkCzfvcX+4oJEtAWH7Y0Fadk0+3I o44iWMPYSMLXKodv3vzFmXGZuKGFGdHf01CJPg6W/vtKciW07jxbio4MMdMxRO9D6a iJwHb+d5Ds2ag== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6845069CC8; Fri, 20 Feb 2026 14:32:54 -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 W2fPPdWHyokw; Fri, 20 Feb 2026 14:32:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771623174; bh=5ujXxBjYHX3lC2a2zrgfJActzWzZKMDQimDLfpGWrp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fhTVkNERxIUNE+6ZLqHpVApq/00rDrH3h6Y2Yyd06hGBe7lGuSXlLBrBYb11cllgG 4Cjt2sznm9h0VcEdf+BfI6gArhpeYQf1capms5CHxKlUjQ/fBdrrp7NqKS63fPvCCz y8qXBMrAWr2e5dRJodzz+PL7pJoQxW2v4TIckaAvP7CQfYLmlov0dH4K9UdV782O4i kY9Kp/koAVadaefMx5I3QxcRjTYMlseliSyd/8OO/huluEUlBYA2vjAvI1KLE6HM1V +/t3+FkPbBI0Dp2V+bKLqWQ8yhVof0BMFg20GhoM3Vtqy+XDijrtojVidO3Xdg3S1P DPhAwlavfuznQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B624669CC6; Fri, 20 Feb 2026 14:32:53 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 20 Feb 2026 14:32:27 -0700 Message-ID: <20260220213235.2112347-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260220213235.2112347-1-sjg@u-boot.org> References: <20260220213235.2112347-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: Q5YM3KOO6IVXCXB6XRDRSTYR333DAIGX X-Message-ID-Hash: Q5YM3KOO6IVXCXB6XRDRSTYR333DAIGX 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 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 2/6] test: Add QEMU helper for EFI application boards 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 EFI application boards (efi-x86_app32, efi-x86_app64, efi-arm_app64, efi-riscv_app64) build U-Boot as an EFI application that runs under UEFI firmware. They cannot boot directly like normal QEMU boards, so the test framework needs two changes: Add qemu.efi_app, a helper script sourced by console.qemu that stages the EFI binary, a startup.nsh script and a writable copy of the UEFI firmware variables, then adds the appropriate pflash and FAT drive arguments. It supports both standard pflash drives and the blockdev-style pflash needed by the RISC-V virt machine. In conftest.py, skip ensure_spawned() for tests marked with @pytest.mark.localqemu. These tests launch their own QEMU instance, so the framework must not attempt to boot the board itself, which would fail for EFI boards and abort the entire test session. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/hooks/bin/qemu.efi_app | 45 +++++++++++++++++++++++++++++++++++++ test/py/conftest.py | 4 ++++ 2 files changed, 49 insertions(+) create mode 100644 test/hooks/bin/qemu.efi_app diff --git a/test/hooks/bin/qemu.efi_app b/test/hooks/bin/qemu.efi_app new file mode 100644 index 00000000000..c0c40108f79 --- /dev/null +++ b/test/hooks/bin/qemu.efi_app @@ -0,0 +1,45 @@ +# SPDX-License-Identifier: MIT +# Copyright 2026 Canonical Ltd. +# Written by Simon Glass +# +# Helper script sourced by console.qemu for EFI-application boards. +# +# Sets up a staging directory with: +# - u-boot-app.efi copied from the build directory +# - startup.nsh that launches the EFI app +# - a writable copy of the UEFI firmware variables file +# +# Required variables (set by the board conf.*): +# efi_app_binary - name of the EFI app (default: u-boot-app.efi) +# efi_fw_code - path to UEFI firmware code (pflash, read-only) +# efi_fw_vars - path to UEFI firmware vars (pflash template) +# +# Optional: +# efi_use_blockdev - set to "y" for machines that need blockdev-style +# pflash (e.g. RISC-V virt) +# efi_virtio_blk - set to "y" to use virtio-blk for the FAT drive + +efi_app_binary="${efi_app_binary:-u-boot-app.efi}" + +efi_stage="${U_BOOT_BUILD_DIR}/efi_stage" +rm -rf "${efi_stage}" +mkdir -p "${efi_stage}" + +cp "${U_BOOT_BUILD_DIR}/${efi_app_binary}" "${efi_stage}/" +printf 'fs0:%s\n' "${efi_app_binary}" > "${efi_stage}/startup.nsh" +cp "${efi_fw_vars}" "${efi_stage}/vars.fd" + +if [ "${efi_use_blockdev}" = "y" ]; then + ARGS+=" -blockdev node-name=pflash0,driver=file,read-only=on,filename=${efi_fw_code}" + ARGS+=" -blockdev node-name=pflash1,driver=file,filename=${efi_stage}/vars.fd" +else + ARGS+=" -drive if=pflash,format=raw,file=${efi_fw_code},readonly=on" + ARGS+=" -drive if=pflash,format=raw,file=${efi_stage}/vars.fd" +fi + +if [ "${efi_virtio_blk}" = "y" ]; then + ARGS+=" -device virtio-blk-device,drive=efi_fat" + ARGS+=" -drive id=efi_fat,file=fat:rw:${efi_stage},format=raw" +else + ARGS+=" -drive file=fat:rw:${efi_stage},format=raw" +fi diff --git a/test/py/conftest.py b/test/py/conftest.py index b7a03669751..f4c5e390a93 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -530,6 +530,10 @@ def ubman(request): Returns: The fixture value. """ + # Tests marked @pytest.mark.localqemu run QEMU locally, so they + # don't need a target-board connection; return the fixture directly. + if request.node.get_closest_marker('localqemu'): + return ubman_fix if not ubconfig.connection_ok: pytest.skip('Cannot get target connection') return None