From patchwork Fri Feb 20 00:19:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1907 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=1771546806; bh=06YVy/mEBvTrmqlPJeZ3SDRtv9hdOFtIAOtcxZ/zkWc=; 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=uv8o2LyF3+6/JpD1wxE2sa8LhUa1WJSF/TI3bqlM6BBGnhjLRLuV4nlHW/cb2WoIY yDFaBs7yalVeEhHcIzGXpnEY9qsLEKlmiSOnYlFu/yAnJuqR0nlmI6O73MQInuY0B/ YXlm1IEPkQ17EgC2x1w52SQ6TzXIKEqQBVxcGQErWSqqO+PP+U47RkcUbSojoC/bvq DUcLr+4Gat25rZS7dYkj/LX7hFesTcQdo2/QRE/QrwjiX8wZ0Z/V5LEau+TYMJnRG6 K01oVsmHJ58q3WutnqBOyVnHrhBp+++y92wbS1IwcfwKqJfHm1Q+qOl6VAsRQ5ydwO XvIQGn/jClPSA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E4DB869C8C for ; Thu, 19 Feb 2026 17:20:06 -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 VEQ-CKXpxlK2 for ; Thu, 19 Feb 2026 17:20:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546806; bh=06YVy/mEBvTrmqlPJeZ3SDRtv9hdOFtIAOtcxZ/zkWc=; 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=uv8o2LyF3+6/JpD1wxE2sa8LhUa1WJSF/TI3bqlM6BBGnhjLRLuV4nlHW/cb2WoIY yDFaBs7yalVeEhHcIzGXpnEY9qsLEKlmiSOnYlFu/yAnJuqR0nlmI6O73MQInuY0B/ YXlm1IEPkQ17EgC2x1w52SQ6TzXIKEqQBVxcGQErWSqqO+PP+U47RkcUbSojoC/bvq DUcLr+4Gat25rZS7dYkj/LX7hFesTcQdo2/QRE/QrwjiX8wZ0Z/V5LEau+TYMJnRG6 K01oVsmHJ58q3WutnqBOyVnHrhBp+++y92wbS1IwcfwKqJfHm1Q+qOl6VAsRQ5ydwO XvIQGn/jClPSA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D314C69C87 for ; Thu, 19 Feb 2026 17:20:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546804; bh=cV3jla6USorx4XjEtAXAz7iNBPNck3RWPTvFDyV7tEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jcylg2euSWxHMPssvbXofGY1BXux18mwwrQ40wNmlJ7N6hFotbESazOhBTnVLoOgu 4ATL4Uyxnmj2fDqh9+wyWir+vxf4c1gBDJwC/I0hHN+M+2udHTpjOvEtgEt7+QTX8l S6Fs4GC8qiA3GTBZ3FkTe4vwK3PUK4l1fz8qFs642tIv3Zuu9moSgiIDnDocRbgShH SwTDWZ1mNDOY+uNOKxOlwApKOc+OjoTTyG3OJhr1I7F92eWRtDrFjTdOiMDh2GPFRX whan02rLT1eQnESONS4FtbVt5ySYxyopsoBESW47ZVQsDV5Xv6gV27MEQvKl+/v7la QNZT9kPV7GkTA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BF6C269C0B; Thu, 19 Feb 2026 17:20:04 -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 towqt4hiAOOO; Thu, 19 Feb 2026 17:20:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546800; bh=nkGYBWkiQdjmiTFoOvYJuM1UbsUcEeQr6gHaSfUpFLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TggQocCYVY5Ol5dx40Sk5D39jZsBngknNvSUKD33dWSkTN9LkCWTXr00SUpJBx2RO qGcG7DF16gUFDz2CUQzHCFEjtO3RN6a1yeI9kawfotL6dWwrJOugqqlBqDfc9JQjHb aRT50PyKpUpuMVMZEL3cnKvmym76TXhtcheQNCmLyodvFVq2OkEfGE1ZoDDWP+BXyc F3fTQw0Vh04MlBW4PcMwyIXQyZYe00BykRfn8TqcOEO0lKGrvUMO3zgDYwiGGsimaN iIK5e72BqjqJE5NcVmjesupknG3/8KHs79oavwys29K2g9zChQ4vdIVYb4wH3Rom83 e1hkR5/6DuTFw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7504F69C7C; Thu, 19 Feb 2026 17:20:00 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:13 -0700 Message-ID: <20260220001926.2366140-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260220001926.2366140-1-sjg@u-boot.org> References: <20260220001926.2366140-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7BMH3OKZ3X2JVDRU2YAENEMFUOH2MEMW X-Message-ID-Hash: 7BMH3OKZ3X2JVDRU2YAENEMFUOH2MEMW 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: Simon Glass , "Claude Opus 4 . 6" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/13] ulib: x86: Add Rust demo for qemu-x86_64_nospl 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 Define the x86_64-unknown-none Rust target and enable CONFIG_RUST_EXAMPLES in the qemu-x86_64_nospl defconfig. Add the DTS node for the Rust demo binary and a QEMU boot test. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/x86/dts/u-boot.dtsi | 18 +++++++++++++++++ configs/qemu-x86_64_nospl_defconfig | 1 + scripts/Makefile.ulib-example | 1 + test/py/tests/test_ulib.py | 30 +++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+) diff --git a/arch/x86/dts/u-boot.dtsi b/arch/x86/dts/u-boot.dtsi index 69925c49c49..57b7be9ae29 100644 --- a/arch/x86/dts/u-boot.dtsi +++ b/arch/x86/dts/u-boot.dtsi @@ -213,4 +213,22 @@ }; }; }; #endif + +#ifdef CONFIG_RUST_EXAMPLES +/ { binman { + rust-demo-rom { + filename = "rust-demo.rom"; + insert-template = <&rom_common>; + + blob { + filename = "examples/ulib/rust-demo-nodtb.bin"; + offset = ; + }; + u-boot-dtb { + }; + fdtmap { + }; + }; +}; }; +#endif #endif diff --git a/configs/qemu-x86_64_nospl_defconfig b/configs/qemu-x86_64_nospl_defconfig index 950d2d2e419..91aabf5d1a2 100644 --- a/configs/qemu-x86_64_nospl_defconfig +++ b/configs/qemu-x86_64_nospl_defconfig @@ -81,4 +81,5 @@ CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set CONFIG_ULIB=y CONFIG_EXAMPLES=y +CONFIG_RUST_EXAMPLES=y CONFIG_UNIT_TEST=y diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index 18d526f5b6b..4d8af88b898 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -21,6 +21,7 @@ ULIB_EXAMPLES := demo # --- Rust examples --- RUSTC := rustc +RUST_TARGET_x86 := x86_64-unknown-none RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)) ifeq ($(CONFIG_RUST_EXAMPLES),y) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 50784ea9c60..5ca46df0fe8 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -292,6 +292,36 @@ def test_ulib_demo_rom_64(ubman): """Test the ulib demo ROM image under QEMU x86_64.""" run_x86_rom_demo(ubman, 'qemu-system-x86_64') +def run_x86_rom_rust_demo(ubman, qemu_binary): + """Boot the Rust demo ROM image under QEMU and check for expected output. + + Locates rust-demo.rom in the build directory, launches the given QEMU + binary with it, and asserts that the expected demo output is present. + + Args: + ubman (ConsoleBase): Test fixture providing build directory + etc. + qemu_binary (str): QEMU system binary + (e.g. 'qemu-system-x86_64') + """ + build = ubman.config.build_dir + demo_rom = os.path.join(build, 'rust-demo.rom') + + assert os.path.exists(demo_rom), \ + 'rust-demo.rom not found in build directory' + assert shutil.which(qemu_binary), f'{qemu_binary} not found' + + cmd = [qemu_binary, '-bios', demo_rom, '-nographic', '-no-reboot'] + out = run_qemu_demo(cmd) + assert_demo_output(out) + +@pytest.mark.localqemu +@pytest.mark.boardspec('qemu-x86_64_nospl') +@pytest.mark.buildconfigspec("rust_examples") +def test_ulib_rust_demo_rom_64(ubman): + """Test the Rust ulib demo ROM image under QEMU x86_64.""" + run_x86_rom_rust_demo(ubman, 'qemu-system-x86_64') + def run_bios_demo(ubman, qemu_binary, extra_qemu_args=None): """Boot the demo.bin binary under QEMU and check for expected output.