From patchwork Fri Feb 20 00:19:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1903 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=1771546787; bh=WEInh3Bo6Dfbk8qStxwpFqJULFGeLHAlMDeGOELWvFU=; 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=OZI7kf77o+5McGGRwbUxeSjHDUR/wQKx5OGQHkOtp4FzgpbnDEVWnyPpeb3/8mwRD MjZfrvU+0HE/GjTUtWfhA1c04jhF+0mMWS5S5DcW0y0KegWClBaJG749dq4RZK6Qn0 fm0hoPZ6+PucOEpzJWv8vFQSJOxdxrLBH+Nlmc0EdawDh+mLtSAq9Ut+rJRK2QeCDk Q9j0F84abF79H1zvJ7aicrEsDbmYqOA6r41r6rCjrAN4TZstud9pIxTqW+6Z9AaLXd 89ri5YsVjTgZUBjshpLB4RXdBHQ/61ITTLe8y+q0yD4kZkXksZRyJsBDUTlywT1xOv p7oCmuvJi9Cjw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C096B69C8C for ; Thu, 19 Feb 2026 17:19:47 -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 yrV0fe2HntUo for ; Thu, 19 Feb 2026 17:19:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546787; bh=WEInh3Bo6Dfbk8qStxwpFqJULFGeLHAlMDeGOELWvFU=; 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=OZI7kf77o+5McGGRwbUxeSjHDUR/wQKx5OGQHkOtp4FzgpbnDEVWnyPpeb3/8mwRD MjZfrvU+0HE/GjTUtWfhA1c04jhF+0mMWS5S5DcW0y0KegWClBaJG749dq4RZK6Qn0 fm0hoPZ6+PucOEpzJWv8vFQSJOxdxrLBH+Nlmc0EdawDh+mLtSAq9Ut+rJRK2QeCDk Q9j0F84abF79H1zvJ7aicrEsDbmYqOA6r41r6rCjrAN4TZstud9pIxTqW+6Z9AaLXd 89ri5YsVjTgZUBjshpLB4RXdBHQ/61ITTLe8y+q0yD4kZkXksZRyJsBDUTlywT1xOv p7oCmuvJi9Cjw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ADC6E69C87 for ; Thu, 19 Feb 2026 17:19:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546785; bh=aKXhQWJZ7cjZcKkKGzaM59lVgDCUDS0w5ZdvrBvHX30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v2cMdvR68P2ZnQ6zAr6odJN8x3IuwV+IZHviHYMgJZLTd8ixxdPlZmbPiWpYg9dkO at0RYAO5q0+jlzEzN9uK8IhY59dmwUwBXr44fFeIUETh+zR0kjZQHfc3fTb30yPnhO 3xoWbGJH3UrvjW29VqEChdFcjMkjRQ5FSdm3ik0G5tzL695nWyoRRosoQBfXwVOb6u 5v90UzDotvRQUulXyR4wv4U6DDs1xIUhbNP9wq4UzBdcdBpCc4003etPAlHZLJH7AO UfHyi/zmMnz7UGsno7IrZDmgJ8V1FHf/PSfQTbFvjmxfEuApy77pau0akA+F2PQwNZ kD0WOmN4m/7JA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E113369C85; Thu, 19 Feb 2026 17:19: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 C38HqHP8Nrxk; Thu, 19 Feb 2026 17:19:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546781; bh=E8W3Yn7n+LNSC66eTDRyzUcPV3pFPptvj+UKr8zW1/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u6yBeHmAgus1hBlnFUGHwDhiJ1ksns5Vks+wtljs4uGAQ2nmRIeibV1fpUoaN5Epb IjVrCZa284F8+zgMNTF6zqH/Cn1kHvjxKplKuas39f+bwpywryLXPmUPuXqDWAVKD8 PshqA+GuyRDRphuqi/DZtMHS1Yf52HVijOFqeBgDNN9UgA6yXw6hlecEVpAjak/xTV iAkbeRiPByWlFxeY0mX3nnADMIU6G1O4gAhYeoRGE7lJs1RWX4ilADx8DRjbgzRS4i 8SaOh49dhb4p6PuUIvTC3z2tNjZdaAzSQtucxH72w6mt9Y+FFDVBsul/+gxJs+OH9D a1y9KZiCpqo3A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8AC9469C7C; Thu, 19 Feb 2026 17:19:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:09 -0700 Message-ID: <20260220001926.2366140-2-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: 37DW3FZIPPU5WWT4DUPHDZBNCWA2YBD2 X-Message-ID-Hash: 37DW3FZIPPU5WWT4DUPHDZBNCWA2YBD2 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/13] ulib: x86: Disable regparm when Rust examples are enabled 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 The regparm=3 calling convention is incompatible with Rust's extern "C" ABI, which uses cdecl (all arguments on the stack). Rather than adding an inline-assembly bridge for every non-variadic C call, automatically disable regparm when CONFIG_RUST_EXAMPLES is set by defaulting X86_NO_REGPARM to y. Also update setjmp.S to use the stack-based calling convention when regparm is disabled, since its _REGPARM define was unconditional. This is somewhat less efficient but is a worthwhile trade-off when using Rust. Signed-off-by: Simon Glass --- arch/x86/Kconfig | 11 +++++------ arch/x86/cpu/i386/setjmp.S | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 4fdfe5b90fe..14ee4a6d400 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -755,16 +755,15 @@ config X86_HARDFP config X86_NO_REGPARM bool "Disable register parameters (regparm=3)" depends on !X86_64 + default y if RUST_EXAMPLES help By default, U-Boot on 32-bit x86 uses -mregparm=3 to pass the first three function arguments in registers (EAX, EDX, ECX) rather than on - the stack. This is more efficient but can cause issues with debugging - tools or when interfacing with code that expects the standard calling - convention. + the stack. This is more efficient but is incompatible with Rust's + extern "C" ABI which uses the standard cdecl convention. - Select this option to disable regparm and use the standard i386 - calling convention where all arguments are passed on the stack. This - may be useful for debugging or for running in certain emulators. + This is automatically enabled when RUST_EXAMPLES is set. It may + also be useful for debugging or for running in certain emulators. config HAVE_ITSS bool "Enable ITSS" diff --git a/arch/x86/cpu/i386/setjmp.S b/arch/x86/cpu/i386/setjmp.S index eceeafa7c8b..f699850680c 100644 --- a/arch/x86/cpu/i386/setjmp.S +++ b/arch/x86/cpu/i386/setjmp.S @@ -5,7 +5,9 @@ * From Linux arch/um/sys-i386/setjmp.S */ +#ifndef CONFIG_X86_NO_REGPARM #define _REGPARM +#endif /* * The jmp_buf is assumed to contain the following, in order: From patchwork Fri Feb 20 00:19:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1904 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=1771546791; bh=PW0tmYyaDkSixSaizyzxnlBqYZmvIqQE1Vy6DRmHMlg=; 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=baWvx743JcXpNuFYVdqY6hk22qLb1V/K35BT8uRVlwuPlfz5Mmhe56dT4vS4EX9ww hdw1aCUMY6FYCrQfrxS4wqk020Sevd5TuxOO25Tf5P1WwDF6o/1CnKWgXqvbIh2yoU ozupveNJ8l7IvU99NdTIjFOCUkyA0RJJOerV0JHpxrEXG6sqIcKnfkgaRO2oZWDOFg ceohLj4aD7dehGgBi7L6yhFgJCQ1XUNsRsjtYMCVYgAE/yq3Wu96W7OiOhdG8d852+ Ts84Lv9aOiO2XjoWSWlN+vNYYKvtSHV+t5wXUg7UMr4VJNhoRqXWznSdr/ZwxJvK7+ Twwyob37yS1LA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 35C5469C8E for ; Thu, 19 Feb 2026 17:19:51 -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 DlwwbeYfqwVr for ; Thu, 19 Feb 2026 17:19:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546791; bh=PW0tmYyaDkSixSaizyzxnlBqYZmvIqQE1Vy6DRmHMlg=; 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=baWvx743JcXpNuFYVdqY6hk22qLb1V/K35BT8uRVlwuPlfz5Mmhe56dT4vS4EX9ww hdw1aCUMY6FYCrQfrxS4wqk020Sevd5TuxOO25Tf5P1WwDF6o/1CnKWgXqvbIh2yoU ozupveNJ8l7IvU99NdTIjFOCUkyA0RJJOerV0JHpxrEXG6sqIcKnfkgaRO2oZWDOFg ceohLj4aD7dehGgBi7L6yhFgJCQ1XUNsRsjtYMCVYgAE/yq3Wu96W7OiOhdG8d852+ Ts84Lv9aOiO2XjoWSWlN+vNYYKvtSHV+t5wXUg7UMr4VJNhoRqXWznSdr/ZwxJvK7+ Twwyob37yS1LA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 25D9A69C89 for ; Thu, 19 Feb 2026 17:19:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546790; bh=P5K79Z5YQwkFJvoX8WVbPPiFR6R17ulUboEpvt5sB5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DuPQcDBzUR2hFveJJIvbClGG2iJ5vxOX5t7WfLaYGMjgyEOi65n/zsf7awcHsagD/ ZIlRD5pb14coSGrZhyurbDAPXPAtpQOuwff9UV06YqE1zj8wxLAWpHYsDpq/dhVs4L uypFh7krzXYdlDqJSECIpvru0rdIUhiTuKOBh1QnXZPwPZ48xcY3C85rx1mBh4IUfk knb+SwqnpxGEZ15XreggMFBrCnbVkBf/TWdFDglRS91sLbQcNAusenBFmX+iREtUXZ kRhaW0cHKIlnvD39SbxamjA9eGJ3GClUhP3V/RFIcKFoEW2pXYaveeb8GWsTGknVNg w2e/zI9JZErdg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7840169C85; Thu, 19 Feb 2026 17:19:50 -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 oriZyq175fGC; Thu, 19 Feb 2026 17:19:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546786; bh=vh5ap5vIJ5YIdWDDFmbh7eH54ZtKKDSemkJGxjUPCeM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IOFzgm2nn61uZ+FWziV84tXzkQ66kDc1qKRRYdHrMLjeJ2lv2eOC9NzpPz8TqJHGk 6maG4bQsiNjYpklYCv9MeY5tyrFeneMXQpgIOOpz/VX1IgIXDmGFBfGYX6LnrnimAw rebykj8t5a3vsxodcX0pOuIhf3B/D26PmMVXYoV1rzix1eZuErhX7qvCPdGpiUtel3 PwThYKnTpX2zuiTM8PPDYaeKmB29/z8DeFS5oZf7RE0Y2itIJ637oXLdJvAECtDu8L s9fIvZLrJQigc3RsNangqSCgK72qhsm054yesX6K4wGEocF3UYQWEt3pP/Do8Z+B7o UY74vX4E0nwZw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2A08F69C7C; Thu, 19 Feb 2026 17:19:46 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:10 -0700 Message-ID: <20260220001926.2366140-3-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: DJX3YFJYECERQMU7Y65X6FC4BAK7VB6L X-Message-ID-Hash: DJX3YFJYECERQMU7Y65X6FC4BAK7VB6L 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 02/13] disk: part_efi: Check the block size in part_test_efi() 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 The ALLOC_CACHE_ALIGN_BUFFER_PAD() macro divides by desc->blksz to compute alignment padding, causing a Divide Error when blksz is 0. This happens when bootmeth_rauc scans block devices that have no block size set. This happens on qemu-x86, for example. Return -ENOENT early when blksz is zero, since a device without a block size cannot have a valid EFI partition table. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- disk/part_efi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/disk/part_efi.c b/disk/part_efi.c index fbed515b303..b48ff518b03 100644 --- a/disk/part_efi.c +++ b/disk/part_efi.c @@ -314,9 +314,18 @@ static int __maybe_unused part_get_info_efi(struct blk_desc *desc, int part, static int part_test_efi(struct blk_desc *desc) { - ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, desc->blksz); long ret; + /* + * An ATAPI device (e.g. CD-ROM) may have blksz == 0 if the + * capacity query failed or no media is present. The buffer + * macro below divides by blksz, so bail out early. + */ + if (!desc->blksz) + return -ENOENT; + + ALLOC_CACHE_ALIGN_BUFFER_PAD(legacy_mbr, legacymbr, 1, desc->blksz); + /* Read legacy MBR from block 0 and validate it */ ret = blk_dread(desc, 0, 1, (ulong *)legacymbr); if (IS_ERR_VALUE(ret)) From patchwork Fri Feb 20 00:19:11 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1905 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=1771546798; bh=oA3hePKY/UpuYfJAUgC/uA8KN5fGbFK1rnqffRDUWzs=; 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=JWIpw3xjRN5qMci3q2Abu8TSrSA7w6Nx1wbPFzcKjxHzQuATM20yD2ImatdTI59LY dYAzB4qYy8p/JRM9+EsI/Io62Gqo1cFda5ZWv3hGAkv/7Jo82Kb+c3HVoOqJIsGsYf Z13IoKlmshsHxE9B5C8bEK/Ovxkw25xb7Dtca5jr332mmbD6WzQg0d1xXi11pr8FaH zBqQO+cc1uee+0dgUVsywiCSFkWnOGWeDOzQ3hiEa1kzEswFz/3QTh+AgyH7OuCQe+ a4UBPt4RKO4GmF0f2FAklkMTFn13o7t1F064Nnrp5Ir/6HjbveTjqTsH3NLOblfXUA U+Mpw9vtjIsDQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0847D69C8F for ; Thu, 19 Feb 2026 17:19:58 -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 4UMW0sJY0of6 for ; Thu, 19 Feb 2026 17:19:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546797; bh=oA3hePKY/UpuYfJAUgC/uA8KN5fGbFK1rnqffRDUWzs=; 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=le0cr4b7K973OX8oWLucb17B/83OUC5DRSbjvtaQ5DOgS9E/ILYn4EZT8MAbt9fqX Sed8EYfwNr48ZwEb2ZvDCEN4MxBQTI6mCNd306D/yETEn2CYKrw22baw8hjFZ0K2rT 4mcRfS3sG3lQ/FBEpsePLvbMqgulEk4dZjhVIDzcZ4i8/hZBPWksj5baXxZBUIp7Bp CVnshMFvXJHUN7IUJZiRC1t21u9RM2XTxG7TvVe5PqUdTBB2vNYlolMNj0VA/Dfdo7 YKaWJGNsf99l8Ym7tgKK92KLgiWzjqVePsworEWAHVyOjlhz/adyVc2CD/8zatoyR4 9w7TxnctxjCKQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EA3F769C87 for ; Thu, 19 Feb 2026 17:19:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546795; bh=StK7VJbckN8L8v/4hvDmVvTHOrPj6yHRFjg7AeOcNbc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6aHgs84/nrx3Y73ANHQRbJbnBIRoOb1GYhiTaySADKSb86CJtlD6cZvNSN/GaxUF 7IHZEhYx0OG4vYR9NhciZ54IYtvG1VW7OY0bj3Cc9Q1OTth+qXre/2pG2XWIs7rY46 tooPZ5jlbUpUcZS4O0pdAYYWaaUuK+QsYpll/itb2BP1ixuayG45TV6v5BUP6JMBRm kFI9DoIge9mS2jbss2lzuiOpP1PP/i9inbSkQhqoDbMAqqJ2NeeUFJ3ZpsymOg4a+i p4abV7+Hj5exH5Qb1gGl+QPZaLONi8onyBFIqj7Yk+fXAg5js88DMYVw1V2gxzt1C0 /ig/wkKflzdxw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 960E569C85; Thu, 19 Feb 2026 17:19:55 -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 5vfaAxwzifFr; Thu, 19 Feb 2026 17:19:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546791; bh=y33N8lMZ/8cYfnfYaQwa48rXfMlm8vfdlRa8QetYEcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xo9p0o0S78w2F9iXCuHgqJP++jv7KYpeJhctUqk9VWdZnAJBqxhrwBNgV8GoT1fB/ EUM1OMmGRZ5RWwMakO7ZE7gPt+en1O8nru+/oyCFPSWy7c8qb3L1u5v4qgxIh686At wHRfVaZ7bPmYXWnQmUdL77qUnCQ+iUzEZyLrl4AEsob/kIEVZdzS8IaO7KR9DcobrD TIZi7jxQ9xDFIEKXtnHedeqUkPEHwcY+/xN6+T7b3yUyO5L4ZAoy3uz94IzzbtOALB EWJ7zr0vAFlwaCCx2n1GYKEYfqpbqIHNuzNMiYdG57YAuIm90mXwXiF/X6WU35tDLg wac3s48BQCA1Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B10F369C7C; Thu, 19 Feb 2026 17:19:50 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:11 -0700 Message-ID: <20260220001926.2366140-4-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: BSD7ODVDCTBUC3SYUQEVUOTIRE5HLHL3 X-Message-ID-Hash: BSD7ODVDCTBUC3SYUQEVUOTIRE5HLHL3 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 03/13] ulib: Extract common example build rules for demo 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 Generalise the per-example link, objcopy and cat rules in Makefile.ulib-example from demo-specific to foreach+eval over the ULIB_EXAMPLES list. This is a pure refactoring that produces identical build output but makes it straightforward to add further examples. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- scripts/Makefile.ulib-example | 48 +++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index 575dedcfbf2..796b74b0c14 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -25,32 +25,52 @@ quiet_cmd_u-boot-example = LD $@ # Per-example object lists (matches examples/ulib/Kbuild) example-demo-objs := examples/ulib/demo.o examples/ulib/demo_helper.o -# Link each example ELF (depends on u-boot to ensure archives exist) -examples/ulib/demo: $(example-demo-objs) u-boot FORCE - $(eval example-objs := $(example-demo-objs)) - $(call if_changed,u-boot-example) - $(EXAMPLE_POST_LINK) +# Generate link rule for each example +define example_link_rule +examples/ulib/$(1): $$(example-$(1)-objs) u-boot FORCE + $$(eval example-objs := $$(example-$(1)-objs)) + $$(call if_changed,u-boot-example) + $$(EXAMPLE_POST_LINK) +endef + +$(foreach e,$(ULIB_EXAMPLES),$(eval $(call example_link_rule,$(e)))) ifeq ($(CONFIG_EFI_APP),y) # EFI: embed DTB and convert to PE binary -OBJCOPYFLAGS_demo-app.efi := $(OBJCOPYFLAGS_EFI) -examples/ulib/demo-app.efi: examples/ulib/demo dts/dt.dtb FORCE - $(if $(CONFIG_OF_SEPARATE),$(call if_changed,embeddtb)) - $(call if_changed,zobjcopy) +$(foreach e,$(ULIB_EXAMPLES),\ + $(eval OBJCOPYFLAGS_$(e)-app.efi := $$(OBJCOPYFLAGS_EFI))) + +define example_efi_rule +examples/ulib/$(1)-app.efi: examples/ulib/$(1) dts/dt.dtb FORCE + $$(if $$(CONFIG_OF_SEPARATE),$$(call if_changed,embeddtb)) + $$(call if_changed,zobjcopy) +endef + +$(foreach e,$(ULIB_EXAMPLES),$(eval $(call example_efi_rule,$(e)))) examples_$(EXAMPLE_ARCH): \ $(foreach e,$(ULIB_EXAMPLES),examples/ulib/$(e)-app.efi) FORCE @: else # Binary target (without DTB) -OBJCOPYFLAGS_demo-nodtb.bin = $(OBJCOPYFLAGS_u-boot-nodtb.bin) -examples/ulib/demo-nodtb.bin: examples/ulib/demo FORCE - $(call if_changed,objcopy) +$(foreach e,$(ULIB_EXAMPLES),\ + $(eval OBJCOPYFLAGS_$(e)-nodtb.bin = $$(OBJCOPYFLAGS_u-boot-nodtb.bin))) + +define example_nodtb_rule +examples/ulib/$(1)-nodtb.bin: examples/ulib/$(1) FORCE + $$(call if_changed,objcopy) +endef + +$(foreach e,$(ULIB_EXAMPLES),$(eval $(call example_nodtb_rule,$(e)))) ifeq ($(EXAMPLE_APPEND_DTB),y) # Binary with DTB appended -examples/ulib/demo.bin: examples/ulib/demo-nodtb.bin dts/dt.dtb FORCE - $(call if_changed,cat) +define example_bin_rule +examples/ulib/$(1).bin: examples/ulib/$(1)-nodtb.bin dts/dt.dtb FORCE + $$(call if_changed,cat) +endef + +$(foreach e,$(ULIB_EXAMPLES),$(eval $(call example_bin_rule,$(e)))) examples_$(EXAMPLE_ARCH): \ $(foreach e,$(ULIB_EXAMPLES),examples/ulib/$(e).bin) FORCE From patchwork Fri Feb 20 00:19:12 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1906 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=1771546801; bh=KhQjKx6OBUUo/E8plJwn2sW1VCwudyMItBfACuiCCUs=; 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=O1K14rXNO9ggAmX2nfLZvvyecerK/dls3Q61GM4aZ9ZA38DQlH91U8zVmu6zzmxpt WwdJkrgGbvssZZj2L/FYpNq+XPnyA6lcPV0ig1pLedSwiBXaVRsrUQwCRjWsOk7pbD OiBiTomOFCSP5miYXIjAzw+hJ7ah+7gZQf66QgJ9SoWWhfeuKd+NCW4yr+p5Msxow4 NTr9pzdQFBcPpXMg+1L61C807BIODWWcO6XzMUa5MWIgbiZyQmBhF8V0/Ps0lXZY+D Jj6uzapH6ZrD9qlECqg/H7f+9PklfPw8JTdw1xEn0mGv+mTMzkzMVlIh6cZdl5nb6c tNF3MAvIa6k6Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 74FBB69C8F for ; Thu, 19 Feb 2026 17:20:01 -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 f8g3QsjYSuKC for ; Thu, 19 Feb 2026 17:20:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546801; bh=KhQjKx6OBUUo/E8plJwn2sW1VCwudyMItBfACuiCCUs=; 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=O1K14rXNO9ggAmX2nfLZvvyecerK/dls3Q61GM4aZ9ZA38DQlH91U8zVmu6zzmxpt WwdJkrgGbvssZZj2L/FYpNq+XPnyA6lcPV0ig1pLedSwiBXaVRsrUQwCRjWsOk7pbD OiBiTomOFCSP5miYXIjAzw+hJ7ah+7gZQf66QgJ9SoWWhfeuKd+NCW4yr+p5Msxow4 NTr9pzdQFBcPpXMg+1L61C807BIODWWcO6XzMUa5MWIgbiZyQmBhF8V0/Ps0lXZY+D Jj6uzapH6ZrD9qlECqg/H7f+9PklfPw8JTdw1xEn0mGv+mTMzkzMVlIh6cZdl5nb6c tNF3MAvIa6k6Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6330169C0B for ; Thu, 19 Feb 2026 17:20:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546800; bh=PDNhFFaRxGWEZLE0DCxDupMb9cylnfZg8oGGE7gNF08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wp4TNWGx6Y1rGKp94eIFGyVbe8RCU8tSS/h824fsfRsyoqoLWtPUKszheNkQ/46eZ Vol0tmXPQosRnuYq3AAOzh4FI4tS5emZt7Uxv79fY3n9Su5pp5tyM17hER5xw+g8Dg +eteXbzRD1SOW5L112F4C0FZrObzaB2SDO/F+Xlub1XCfpllizyfesLxHS6LiZ4qGE RrLS5dxlQQqZiHSDVbqh6KjmmsVqzZw6+Bt1soZKxkMn2ZjcaHZugOOUHqM6N8AC7V s5rp7ax62G1of0oAwVC169JqrEyYrFqPHT37/fkGIyisaw0NP+9dHzeQ0mlFAUeG/7 YyCN5NxlaHkYQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 639BD69C0B; Thu, 19 Feb 2026 17:20:00 -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 O6qjCdTnnwWA; Thu, 19 Feb 2026 17:20:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546796; bh=AwVIMGtg8hFmilJVQkSmePWpYL1KjGDNKPI7tXxikOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=onRXqKQZ3hJO6S+2wSiX3pURPZfabf5y000PTuw+ucv79uokRmrwaAtbR3PvlXlJo sAEEBtXnziy/95KR0kVpuAPPWQjFOBuP1pqjre++PPLwVqJ0kC8SI/93GVGBDJ7qT2 QNb/ro9Km9EXBvIcQ0tyluSXztQBZoc+VA12/X71kXYQ78lfa/F1zyr2oB+bwqG5/O WwArol+uM7s9KLecIYZlojuxeDk7x/yk2VWU2yLmnZIBBRMpKDw9q652T2po6GJOv2 7WJpVshMZ3dTV1TabhPB1WHCA8qveQNSFHk4FHh8nwFlqoZzJWuKRvdMTowjBzOY4f zMiZNgDMEnydg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id DCC6D69C7C; Thu, 19 Feb 2026 17:19:55 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:12 -0700 Message-ID: <20260220001926.2366140-5-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: GOL6URKMCZHJ2WCGCDWGMQ4IGCHOIFZE X-Message-ID-Hash: GOL6URKMCZHJ2WCGCDWGMQ4IGCHOIFZE 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 04/13] ulib: Add Rust demo example 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 #![no_std] Rust equivalent of the C ulib demo, compiled to an object file with rustc and linked into U-Boot via the existing u-boot-link mechanism. The Rust demo calls the same C helpers (demo_show_banner, demo_show_footer, demo_add_numbers) via FFI and produces identical output, so assert_demo_output() works unchanged. Use core::ptr::addr_of!() rather than a reference cast to access the extern static version_string, since the compiler cannot prove that an extern static is non-null and would emit a call to an undefined panic symbol. Add CONFIG_RUST_EXAMPLES Kconfig option to gate the Rust examples. When enabled, rustc must be available with the appropriate target for the architecture. Clear MAKEFLAGS when invoking rustc so that it does not inherit make's --jobserver-auth file descriptors, which would produce a spurious warning on every compilation. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- examples/Kconfig | 13 +++++++++ examples/ulib/rust_demo.rs | 55 +++++++++++++++++++++++++++++++++++ scripts/Makefile.ulib-example | 17 +++++++++++ 3 files changed, 85 insertions(+) create mode 100644 examples/ulib/rust_demo.rs diff --git a/examples/Kconfig b/examples/Kconfig index 5738d555d22..7f099808908 100644 --- a/examples/Kconfig +++ b/examples/Kconfig @@ -9,6 +9,19 @@ config EXAMPLES U-Boot provides an legacy API for standalone applications. Examples are provided in directory examples/. +config RUST_EXAMPLES + bool "Build Rust example programs" + depends on EXAMPLES + help + Build example programs written in Rust alongside the C + examples. The Rust demo calls the same C helpers via FFI + and produces identical output. + + Requires a Rust toolchain (rustc) with the appropriate + cross-compilation target for the architecture, e.g. + x86_64-unknown-none for x86_64 or aarch64-unknown-none + for ARM64. + config EXAMPLES_STANDALONE bool "Compile standalone examples" depends on !SANDBOX diff --git a/examples/ulib/rust_demo.rs b/examples/ulib/rust_demo.rs new file mode 100644 index 00000000000..7a85658520d --- /dev/null +++ b/examples/ulib/rust_demo.rs @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Rust demo program showing U-Boot library functionality +// +// Demonstrates calling C helper functions from Rust via FFI, producing +// identical output to demo.c so assert_demo_output() works unchanged. +// +// Copyright 2026 Canonical Ltd. +// Written by Simon Glass + +#![no_std] +#![no_main] + +use core::ffi::c_int; + +extern "C" { + fn printf(fmt: *const u8, ...) -> c_int; + fn demo_show_banner(); + fn demo_show_footer(); + fn demo_add_numbers(a: c_int, b: c_int) -> c_int; + static version_string: u8; +} + +#[no_mangle] +pub extern "C" fn ulib_has_main() -> bool { + true +} + +fn demo_run() -> c_int { + unsafe { + demo_show_banner(); + // Use addr_of!() rather than &version_string to avoid a + // null-pointer check: &T must be non-null, but the compiler + // cannot prove that for an extern static, so it emits a call + // to an undefined panic symbol that crashes ld.bfd on aarch64. + printf( + b"U-Boot version: %s\n\0".as_ptr(), + core::ptr::addr_of!(version_string), + ); + printf(b"\n\0".as_ptr()); + demo_add_numbers(42, 13); + demo_show_footer(); + } + 0 +} + +#[no_mangle] +pub extern "C" fn main() -> c_int { + demo_run() +} + +#[panic_handler] +fn panic(_: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index 796b74b0c14..18d526f5b6b 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -19,11 +19,28 @@ PHONY += examples_$(EXAMPLE_ARCH) ULIB_EXAMPLES := demo +# --- Rust examples --- +RUSTC := rustc +RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)) + +ifeq ($(CONFIG_RUST_EXAMPLES),y) +ULIB_EXAMPLES += rust-demo +endif + quiet_cmd_u-boot-example = LD $@ cmd_u-boot-example = $(call u-boot-link,$(example-objs),$@.map) +quiet_cmd_rustc_obj = RUSTC $@ + cmd_rustc_obj = \ + mkdir -p $(dir $@) && \ + MAKEFLAGS= $(RUSTC) --edition 2021 --emit=obj -o $@ --target=$(RUST_TARGET) $< + +examples/ulib/rust_demo.o: examples/ulib/rust_demo.rs FORCE + $(call if_changed,rustc_obj) + # Per-example object lists (matches examples/ulib/Kbuild) example-demo-objs := examples/ulib/demo.o examples/ulib/demo_helper.o +example-rust-demo-objs := examples/ulib/rust_demo.o examples/ulib/demo_helper.o # Generate link rule for each example define example_link_rule 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. From patchwork Fri Feb 20 00:19:14 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1908 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=1771546810; bh=2rQoYjDVimXA0vVz93wb2RLcEGpBqIJ5y7EIjX3xQM8=; 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=RqtumOD8eGmBRqbqALAwNzNhJF8X/WdYjLhdGuZPqoiPhW3Bt7yPM14WsXpAYq9b3 TqATHv6rJ/r2Eiacxy12/7ODDC+SkNnWqrp5tXEs2HFt+cP976H+6lSBxZ7pXYBDRb sRrpUwrqamywF3I5FcXti/9BDdyNV8IOfiGdHo4sW4rHckyAY6zeaAXyijxR7898vK WHp0b2vl+trNcjp1PwakHSty/v6oYS6z+aMBWo8YhzMxYqTtpo4wf46m0PCJJqoAkw jvpB9Zp8gRpdVcvyxzKwYliYG2DXc/hmSMSsqouBxDooIwDYOZARtAY1D1nuHFJBgg NG5G41Za7uBMw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5D39169C8C for ; Thu, 19 Feb 2026 17:20:10 -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 6aSSPGKtQ_4Q for ; Thu, 19 Feb 2026 17:20:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546810; bh=2rQoYjDVimXA0vVz93wb2RLcEGpBqIJ5y7EIjX3xQM8=; 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=RqtumOD8eGmBRqbqALAwNzNhJF8X/WdYjLhdGuZPqoiPhW3Bt7yPM14WsXpAYq9b3 TqATHv6rJ/r2Eiacxy12/7ODDC+SkNnWqrp5tXEs2HFt+cP976H+6lSBxZ7pXYBDRb sRrpUwrqamywF3I5FcXti/9BDdyNV8IOfiGdHo4sW4rHckyAY6zeaAXyijxR7898vK WHp0b2vl+trNcjp1PwakHSty/v6oYS6z+aMBWo8YhzMxYqTtpo4wf46m0PCJJqoAkw jvpB9Zp8gRpdVcvyxzKwYliYG2DXc/hmSMSsqouBxDooIwDYOZARtAY1D1nuHFJBgg NG5G41Za7uBMw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4B76B69C89 for ; Thu, 19 Feb 2026 17:20:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546809; bh=EccnzlSk7m5BCM5FElYc2q5R3WL7ev0dSeXDVKzW/MQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wbntylq4raCcCGGDYZbnadJkj/Cf8BiymxyBxhBzSiLchgfs16EAV+rpCLaHlUZER J1jyYQfQAFQQopxtJhd0E5ILn7LIGU+SbLbJ4896CSq2Qk6pyQoShlfp69bxd5TrYW R87fC72OnOvso8kF+87+k/CrJ/uJ3w2vyH5K0FMoctp2DR4bRHA7Ai4Pv5qFNS/pWe pbdbUDqosTfvCCL5cuSvAApKsNEcrjZQMFePSD+nMQQATpr2lK3iUHBQrvjTHUZ0ak 5wys7UG+tuIVIeJ7h7/ljTDrLNLwnb98Rr+E7kW7zUUIU9RnzIiEMFKtKSj4aZexL4 d83PRySLV/uMg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E92969C0B; Thu, 19 Feb 2026 17:20:09 -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 xm4pc6u8CFAu; Thu, 19 Feb 2026 17:20:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546805; bh=NiJDvs+0tVC5UHVe+8LWF4gJSP8Lt22eIxnalRnnQv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/Ol2V4wQ3za8zJr/Rbo48srbs2URnY3xQLczDnTV4ewCASYNy7UQR2+QENssz2ty ZZpSr3Ny8UDe1MZUWiQdX0NxyJfsuLH/P+92j9z9ohe31BDSfIDOwzIFJvkeAnvLYZ 5Oema04FT08p2TzErP0Jwg52Wzr3O5KhC2YkwWKqgC0QtxrAra+wy5qTa12FJQud+A ebiv14yZXHoxGo7u4Im5b4Fh/spH824SJ4SqXzDMyTK+pxEj02TT8+yYVcYZbPRrr+ F1q7VlHaze0ft7BByGGbLeL4C5+rEi92VGGx60cdUJftjeXoDEH36GZqJKU2xba8Ro 3QsgOg0eh7i1w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 07C7169C7C; Thu, 19 Feb 2026 17:20:04 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:14 -0700 Message-ID: <20260220001926.2366140-7-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: Y6NM6KXJCTI6JSSVRZZQBIGVTBAI72XM X-Message-ID-Hash: Y6NM6KXJCTI6JSSVRZZQBIGVTBAI72XM 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 06/13] ulib: x86: Add 32-bit Rust target support 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 There is no built-in i686-unknown-none Rust target, so use i686-unknown-linux-gnu with flags to disable unwinding and force static relocations, which produces a clean freestanding ELF 32-bit object suitable for linking into U-Boot. Select the Rust target and flags based on CONFIG_X86_64 so that the 64-bit build continues to use x86_64-unknown-none with its built-in defaults (PIE-compatible code, no unwinding). Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- scripts/Makefile.ulib-example | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index 4d8af88b898..a398f3e9621 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -21,8 +21,18 @@ ULIB_EXAMPLES := demo # --- Rust examples --- RUSTC := rustc -RUST_TARGET_x86 := x86_64-unknown-none +RUST_TARGET_x86 := i686-unknown-linux-gnu +RUST_TARGET_x86_64 := x86_64-unknown-none +RUST_FLAGS_x86 := -C panic=abort -C relocation-model=static +RUST_FLAGS_x86_64 := + +ifdef CONFIG_X86_64 +RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)_64) +RUST_FLAGS := $(RUST_FLAGS_$(EXAMPLE_ARCH)_64) +else RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)) +RUST_FLAGS := $(RUST_FLAGS_$(EXAMPLE_ARCH)) +endif ifeq ($(CONFIG_RUST_EXAMPLES),y) ULIB_EXAMPLES += rust-demo @@ -34,7 +44,8 @@ quiet_cmd_u-boot-example = LD $@ quiet_cmd_rustc_obj = RUSTC $@ cmd_rustc_obj = \ mkdir -p $(dir $@) && \ - MAKEFLAGS= $(RUSTC) --edition 2021 --emit=obj -o $@ --target=$(RUST_TARGET) $< + MAKEFLAGS= $(RUSTC) --edition 2021 --emit=obj -o $@ \ + --target=$(RUST_TARGET) $(RUST_FLAGS) $< examples/ulib/rust_demo.o: examples/ulib/rust_demo.rs FORCE $(call if_changed,rustc_obj) From patchwork Fri Feb 20 00:19:15 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1909 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=1771546816; bh=TaYvj/vjk8olr3anNsY9AmF05B3JPi4oWY902ig2ZNg=; 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=Uzh9v1/ZjqRDv3NQvcJ4+8cJr3sqpdXRObwPkMqA40Ykul5/8cdT0cyGqFw9mDBfl u/M4ocwdloMstjLkPhVmu+1bKUYXLeIW6iLTz13oeBN9hbgC1dcD3k+7WvxWyWeSgL XCl5vaqFcmmyGRkfVKvCtzCJJvpdd4WvLTryhkOC2LxH/GQUEGKNpJFNl4m8x7vhXO 1SlYCHG4MLVqtWb+zjGsI6HaMrKQgKOhdudgQ5BLfK5eeQYTcjrv+7HwjYxCK2wOku x+OpixOKSJhWneF+P+YQdBWrnPcSpkFsZSiW7rOR7t4UU/9ReDahOSy/BzycYeHwZa aCjCWshYaD5LA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4646069C7C for ; Thu, 19 Feb 2026 17:20: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 bHs8M0YJsKNb for ; Thu, 19 Feb 2026 17:20:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546816; bh=TaYvj/vjk8olr3anNsY9AmF05B3JPi4oWY902ig2ZNg=; 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=Uzh9v1/ZjqRDv3NQvcJ4+8cJr3sqpdXRObwPkMqA40Ykul5/8cdT0cyGqFw9mDBfl u/M4ocwdloMstjLkPhVmu+1bKUYXLeIW6iLTz13oeBN9hbgC1dcD3k+7WvxWyWeSgL XCl5vaqFcmmyGRkfVKvCtzCJJvpdd4WvLTryhkOC2LxH/GQUEGKNpJFNl4m8x7vhXO 1SlYCHG4MLVqtWb+zjGsI6HaMrKQgKOhdudgQ5BLfK5eeQYTcjrv+7HwjYxCK2wOku x+OpixOKSJhWneF+P+YQdBWrnPcSpkFsZSiW7rOR7t4UU/9ReDahOSy/BzycYeHwZa aCjCWshYaD5LA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 33ADF69C89 for ; Thu, 19 Feb 2026 17:20:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546814; bh=f3fY2TdqEoJvwyp20E5bweB36ipp+b6mVss2rT5BOiM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cvis7/nSct8AKkPIwQS8bJAMK1W8K7+lC4euUC9wp5oHubDPcz5NvkifAMCRN7Hpb 5NVbX08uxnK/tHAgCTy8MExw8j5kN2ieAP/zofPW8xWtRFpgYcsRkmYYLu1bFxFcec hUNYiJ6Pume5UF4uPxdW9Eyanm7vaJ/mNDMXxN+CGQiNWH9RvQDKeljI494ctQ7zLq PyNH6Axf+Txkjd5+FtWZQQ6ohhrmb8s4IFGl+2koQ5M86WLptervta/u09eQE/VB2w 9TWR2mnIYBQKhgZOZqHt52pkfE20csD3xxT8E4R0VbiOpHceIKsq3hNLk902bc5isc SN4uw0mU5t5Jw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 22B2369C0B; Thu, 19 Feb 2026 17:20: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 QFb0UZc_RNT7; Thu, 19 Feb 2026 17:20:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546810; bh=eZLv8Ypj75y8CJa6LCH1lB+w5Zaj0Tp/7FKoP/J7Kfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZuAiwB/ON0HMx2IW0scZPVlWZvizi2U1yed3gDzlhl4pnb1CDTd9rMkdbDULPkJF okhQFdKOZFcwGma3nNtMBHahnZtz7/+z7rdiJXz3igaBZVnugWx5Rt3ltfBrw8Dkei +PNVBTy9aRXCNip0jda187bIe7tQDApSNJBvqp7UYwiRzndJlll4WDcfkraLP8ggr9 z4m/Kn8Thranxn3FwMWcUh0Bs6ruwbjKlhmWH4eQhYuuvRO2QaUZAZPpgggWHepq2k uqe3CoexJ0rbvVppxnVUFzEonnAo0b/HDy8JgKbI9k9ClvAr5rqLBboHT+c63dfKzF Ov3t82K3CNb4w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CF74A69C7C; Thu, 19 Feb 2026 17:20:09 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:15 -0700 Message-ID: <20260220001926.2366140-8-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: AKERXIZHMBF6H6OSLOKKFXOCQJOPIHTU X-Message-ID-Hash: AKERXIZHMBF6H6OSLOKKFXOCQJOPIHTU 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 07/13] ulib: x86: Enable Rust demo for qemu-x86 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 Enable CONFIG_RUST_EXAMPLES in qemu-x86_defconfig and add a pytest for the 32-bit Rust demo ROM, using the existing run_x86_rom_rust_demo() helper with qemu-system-i386. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/qemu-x86_defconfig | 1 + test/py/tests/test_ulib.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/configs/qemu-x86_defconfig b/configs/qemu-x86_defconfig index 2275ff9de1a..5e68c8283ec 100644 --- a/configs/qemu-x86_defconfig +++ b/configs/qemu-x86_defconfig @@ -15,6 +15,7 @@ CONFIG_GENERATE_PIRQ_TABLE=y CONFIG_GENERATE_MP_TABLE=y CONFIG_ULIB=y CONFIG_EXAMPLES=y +CONFIG_RUST_EXAMPLES=y CONFIG_FIT=y CONFIG_BOOTSTD_FULL=y CONFIG_BOOTSTAGE=y diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 5ca46df0fe8..2090a06efbc 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -315,6 +315,13 @@ def run_x86_rom_rust_demo(ubman, qemu_binary): out = run_qemu_demo(cmd) assert_demo_output(out) +@pytest.mark.localqemu +@pytest.mark.boardspec('qemu-x86') +@pytest.mark.buildconfigspec("rust_examples") +def test_ulib_rust_demo_rom(ubman): + """Test the Rust ulib demo ROM image under QEMU x86.""" + run_x86_rom_rust_demo(ubman, 'qemu-system-i386') + @pytest.mark.localqemu @pytest.mark.boardspec('qemu-x86_64_nospl') @pytest.mark.buildconfigspec("rust_examples") From patchwork Fri Feb 20 00:19: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: 1910 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=1771546818; bh=vwsFB1C1cCME4F11eQulWAMY3HyJAaGyXnli2do4LJo=; 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=GRfMOAHZW9nwm86zN6/OK+zI7C17XZ5wWrXg1jwSaa3g0WT3lgBwJfDUaNJCFDswv rRbLISt7MQuaAwlN3+KUigs2UowKGFpQGN2baHMm+noHALjC0LeQlzYglijP9ebWrK p7lfj8OjIM1qiin3y3IVcbKKtErpXfCKOSXS/+AMnDCyAms5cP3lspgP69rnLK6tkJ 2vBVlOjYL2tE/7/g1OR24kHrYOMo0/wbrFAVYtd4PLZn9zakSU5REz0BeBTUE6KqI7 v0pCzTeeabCbQNO/WgwBg6SHd8+6M54dytbemoogS7Av8FZrfMpGzkrrswHNH+Z3O/ DLlNODMpyEmfw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ADDD369C89 for ; Thu, 19 Feb 2026 17:20:18 -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 uvWvbZWTuhv8 for ; Thu, 19 Feb 2026 17:20:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546816; bh=vwsFB1C1cCME4F11eQulWAMY3HyJAaGyXnli2do4LJo=; 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=kKVcLzN6j5NKn/Ug+UMqBjAiuJggjH/8OayWebjkgIv60u6cuRu+oUByUfMoNFJEM RAWy2QzlgNrfuFvm+L42V8sbytH7GIeJIpP406UbVyX8gAththYrOeW+mP3hxeik5e oO8q60t2aU+wGLkie0fqLUDj2mWshUJjI3D1P0p3d5oSrLkJA5REN6hSuihMvUR6+o Dt8QuSNm18x/INu0F0vmjL75faqQvpsf+6NcC1ks0/INVOtcc5NIXFnjaAYUtypgp7 YT2XwvmpqAwvL8aiaVubTszPY+UpGCidj1CVAgPjL4Yrha2QDy7I9xeTp1eQ/90G+c TSxe/xASurbsg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A62CE69C87 for ; Thu, 19 Feb 2026 17:20:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546814; bh=YlZIFKkUpqUNI/YYAJYeSPCZAgFvrfuh85QY7izA2ks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P62ycUL0GifcJHxb7mQkCWNnlqvAy0gb6hM5ya8gE4MaIAErrcmfqHb7WYCe6iAw2 9YKzKGVhpgHGW/RzO5oEL0lEIsgRHUoLi6v3vbm13A5tqGJkTYIcRzTXaCPWLih6Lv Ve9Qsh53dyNyeE+pgAf79qpOpwk5vrbhYzpq3+ouT+SwdGO90czMn7aG6ewsHx8K9B PLqZpyi48DkivRIj0o9RZpkY1OjpSTfhgGmOyAxdNTfjrjyL1xtJ2+BUuk+VSkWvCP CpNTAAiSW1XNljPFeiPWvqByVPtiHLyDmM+jJaEyq9RPEig0jrTDumEromvOZT63vv lsJJhYIUItnbQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DC0F769C87; Thu, 19 Feb 2026 17:20: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 4daeLZemXdPd; Thu, 19 Feb 2026 17:20:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546814; bh=qRkBkxJI/NBRZVwM3sOQo0eiQ0Abh5ISJ6cVU7Kas4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UBCsvnu/GKtj0iUQc9SKVvsNQJIPBNxhy/qA8nFzXot3wMjdXtB48vnsN+YcuA58V 5/MrcceE23uPeHUWN0uN77j9vbNMorZGbZK8YHP3sZWNPFPukTbNhsu0QA0Cd4hmhJ CvZW3w7SPjNSrMEWAERc/Twg88g8K603gkrJsFTLSfsJd540MU6L9EnUmGFHOeDKE8 HSa5uI/K+6TEjDpGURTTr/iRjTMfB8ce28SmEBx02KjgabYqHfVE5Ea8Yx+0Y9T1cm ssbaI0mlla4QLToVoipiRlVHpKUB4gu27Ez0HI9NOjBxqq4Pqw4WCSh7hKjQiJuVam Nx4T2zKJMMUBw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5E6CA69C7C; Thu, 19 Feb 2026 17:20:14 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:16 -0700 Message-ID: <20260220001926.2366140-9-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: LJJUPBR4XOSAPT7VQLTMIBF4TLFBHXME X-Message-ID-Hash: LJJUPBR4XOSAPT7VQLTMIBF4TLFBHXME 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 08/13] ulib: riscv: Enable Rust demo for qemu-riscv64 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 The Rust ulib demo currently works on x86 (32-bit and 64-bit) but not on RISC-V. Unlike x86, RISC-V has no calling-convention mismatch, so Rust's extern "C" naturally matches the standard ABI with no extra flags. Add the riscv64gc-unknown-none-elf built-in Rust target (which already has panic-strategy: abort) and enable CONFIG_RUST_EXAMPLES in the qemu-riscv64 defconfig so that rust-demo.bin is produced alongside demo.bin Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/qemu-riscv64_defconfig | 1 + scripts/Makefile.ulib-example | 2 ++ 2 files changed, 3 insertions(+) diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index 4423d36b782..d30b017169e 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -24,3 +24,4 @@ CONFIG_UTHREAD=y CONFIG_UNIT_TEST=y CONFIG_ULIB=y CONFIG_EXAMPLES=y +CONFIG_RUST_EXAMPLES=y diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index a398f3e9621..ae3f75b33fb 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -25,6 +25,8 @@ RUST_TARGET_x86 := i686-unknown-linux-gnu RUST_TARGET_x86_64 := x86_64-unknown-none RUST_FLAGS_x86 := -C panic=abort -C relocation-model=static RUST_FLAGS_x86_64 := +RUST_TARGET_riscv := riscv64gc-unknown-none-elf +RUST_FLAGS_riscv := ifdef CONFIG_X86_64 RUST_TARGET := $(RUST_TARGET_$(EXAMPLE_ARCH)_64) From patchwork Fri Feb 20 00:19:17 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1911 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=1771546823; bh=CFCUQjjGrL/pErnnzt8FaqExOKvXLq9AciodHeCq47U=; 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=Bj4G6mqIG8J19tpPWvZLo2ZnxehMRsEmJGuG3IYS97BRitVZd0k/uYZwOW1UGL6PW 15eLr6etAeTTdCc0nV2VktX0a8e6PT2fXIPVbBK5YdMd6JRH7ShwTOk4XeZiBuH3dr NkgRIWwDIXqyq4PKJQdXqXOedfssj5XnXoZk+LpydDUQxVVRPEoxrOOrC5HNRNNvDn Te7Thw64L1liNsKVgr+6Kqr6b9dfctIzVadhYX/HvwdkdXFFBc4mNp0u4FZHGloPqv jbx7JE3xMfPJWWb6O5MudnELZJRsK1PcjhT98Y/gDPw4p1D7eDU8kZgnYgfg7W7G9c GSoZK29DidaMw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1E97069C8F for ; Thu, 19 Feb 2026 17:20:23 -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 CMdf4PH-6lgy for ; Thu, 19 Feb 2026 17:20:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546823; bh=CFCUQjjGrL/pErnnzt8FaqExOKvXLq9AciodHeCq47U=; 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=Bj4G6mqIG8J19tpPWvZLo2ZnxehMRsEmJGuG3IYS97BRitVZd0k/uYZwOW1UGL6PW 15eLr6etAeTTdCc0nV2VktX0a8e6PT2fXIPVbBK5YdMd6JRH7ShwTOk4XeZiBuH3dr NkgRIWwDIXqyq4PKJQdXqXOedfssj5XnXoZk+LpydDUQxVVRPEoxrOOrC5HNRNNvDn Te7Thw64L1liNsKVgr+6Kqr6b9dfctIzVadhYX/HvwdkdXFFBc4mNp0u4FZHGloPqv jbx7JE3xMfPJWWb6O5MudnELZJRsK1PcjhT98Y/gDPw4p1D7eDU8kZgnYgfg7W7G9c GSoZK29DidaMw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0E84369C87 for ; Thu, 19 Feb 2026 17:20:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546821; bh=Dn+sxU80BRiIKSvEGNaMVWVxFU40EGnQV9d25Mh7j8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vxifE2R3nKjPLp26XZoT6OKKjxjmvJCTv9GesrcdX7KxcYQbb6ORYzcj17nHwif23 1z4t5VLevw0ewF3PaqBof4tUaSZGQYV7U8F4sPlFIF2EJpN70xSbJNmTr/DevRgOst I0VLKwojCQ58M5QSB+HKJcU7Ndo5mBuiqeImljNCcOj+jW48SBlzseH7xJL6dgP7uE VSlxmP3CQDzkaeJQ/NzTfUO6S6ZOz71md5Flgcl2kV79lg8m3KTvvNKKTAtxoKf+oj x6tYwxML7wYgaCCtXIVqahiLGuznh27xgLeE4kA/RV/T5H5Pt7bxM38qq1CAQ8SQHU e0kwE0gnY18Hg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0317669C87; Thu, 19 Feb 2026 17:20:21 -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 Wjk75Uh0Yc9G; Thu, 19 Feb 2026 17:20:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546815; bh=Nf+XAes5z2R+RJxSEtqoVrn55ra2ZRKwb2i9CPbZNP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h5ukRhaTzVGTAjT+dHorpjitwhSgCctEf+mxNDf5VSZ0SLoYCh5FnJSHYNCdCz17I 9AB72cTUCodtX1ckfwMOMB4IJb/o40k/7cuaVHLBibw9c0SlsTYFTgNULL7IWBnX/J wSsX+rCVFL6nL0XHhaRgGgcZtksq54SuVMvmbegD5ZxTI8YxbzLLworsYgZLyy/2NJ hx31T8En4gCF2496aVEu4RxcqjrZRDwW433qRqdOJ+rOpl74LOj2bi+bISD12IPGWc Yoz4+fhJhmTTU5DaIfLY8e3yOqbF2yTuLPUyOadJ0rwEuzUBgLw1nE6DVC4qOXHtko 4rtokpQWWuCWw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2813569C0B; Thu, 19 Feb 2026 17:20:15 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:17 -0700 Message-ID: <20260220001926.2366140-10-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: LDAA7KAVPVS3ODJZFG6TWCL6UZ6IECLV X-Message-ID-Hash: LDAA7KAVPVS3ODJZFG6TWCL6UZ6IECLV 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 09/13] ulib: riscv: Add Rust demo test for qemu-riscv64 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 run_bios_rust_demo() helper that mirrors run_bios_demo() but boots rust-demo.bin instead of demo.bin, and a test_ulib_rust_demo_riscv64 test that exercises it under qemu-system-riscv64. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 2090a06efbc..b6fa30bcfd2 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -357,6 +357,34 @@ def run_bios_demo(ubman, qemu_binary, extra_qemu_args=None): out = run_qemu_demo(cmd) assert_demo_output(out) +def run_bios_rust_demo(ubman, qemu_binary, extra_qemu_args=None): + """Boot the rust-demo.bin binary under QEMU and check expected output. + + Locates rust-demo.bin in the build directory, launches the given QEMU + binary with it as -bios, 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-riscv64') + extra_qemu_args (list): Additional QEMU arguments + """ + build = ubman.config.build_dir + demo_bin = os.path.join(build, 'examples', 'ulib', 'rust-demo.bin') + + assert os.path.exists(demo_bin), \ + 'rust-demo.bin not found in build directory' + assert shutil.which(qemu_binary), f'{qemu_binary} not found' + + cmd = [qemu_binary, '-machine', 'virt', '-nographic', '-no-reboot', + '-bios', demo_bin] + if extra_qemu_args: + cmd += extra_qemu_args + out = run_qemu_demo(cmd) + assert_demo_output(out) + @pytest.mark.localqemu @pytest.mark.boardspec('qemu_arm64') @pytest.mark.buildconfigspec("examples") @@ -371,6 +399,13 @@ def test_ulib_demo_riscv64(ubman): """Test the ulib demo binary under QEMU RISC-V 64.""" run_bios_demo(ubman, 'qemu-system-riscv64') +@pytest.mark.localqemu +@pytest.mark.boardspec('qemu-riscv64') +@pytest.mark.buildconfigspec("rust_examples") +def test_ulib_rust_demo_riscv64(ubman): + """Test the Rust ulib demo binary under QEMU RISC-V 64.""" + run_bios_rust_demo(ubman, 'qemu-system-riscv64') + def run_efi_demo(ubman, qemu_binary, fw_code, fw_vars, extra_qemu_args=None): """Run a ulib demo EFI application under QEMU with UEFI firmware. From patchwork Fri Feb 20 00:19:18 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1912 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=1771546827; bh=7whvtcDwRw4POPLCh3KGu5/3A0xVwnTlR0gjQCp/D+E=; 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=W4irPEwkVYYfmaujH5lBepcPS4+g3IOulSjfoLcQ1jMW54wvwgu0j4GEwm+w8I8oa GgugqJMcrY5n7dPZRXb84cHzhIsYfqzRdPdVZy3bxkFz3nk6kw7kP9IriuaZGv90Ej spiDoB5IhHXKCG+IQmsSZIwLd8Hf8ZbZkrKZKYTss6zjO4Qqh45uIirl0U7TgLJL5M HB4rqBnaa/ZsU1JfkK3jDIPwmShSm1gVaN7dFf2J42wFoae+BDBpSCUNiXqC9p16j6 +PMa2YQmnLVoqgBtX+xMQNLX+UXMlO2FGWlhwHM4kogtWQzrQxgmnX2aPaMLDTMvuV RBiSVUZd9Z/qg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 985FD69C8F for ; Thu, 19 Feb 2026 17:20:27 -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 I0NiXMM13YwQ for ; Thu, 19 Feb 2026 17:20:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546827; bh=7whvtcDwRw4POPLCh3KGu5/3A0xVwnTlR0gjQCp/D+E=; 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=W4irPEwkVYYfmaujH5lBepcPS4+g3IOulSjfoLcQ1jMW54wvwgu0j4GEwm+w8I8oa GgugqJMcrY5n7dPZRXb84cHzhIsYfqzRdPdVZy3bxkFz3nk6kw7kP9IriuaZGv90Ej spiDoB5IhHXKCG+IQmsSZIwLd8Hf8ZbZkrKZKYTss6zjO4Qqh45uIirl0U7TgLJL5M HB4rqBnaa/ZsU1JfkK3jDIPwmShSm1gVaN7dFf2J42wFoae+BDBpSCUNiXqC9p16j6 +PMa2YQmnLVoqgBtX+xMQNLX+UXMlO2FGWlhwHM4kogtWQzrQxgmnX2aPaMLDTMvuV RBiSVUZd9Z/qg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 853E469C87 for ; Thu, 19 Feb 2026 17:20:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546825; bh=dQ9O8zDh4PH6YE3Ol4WDCBTULvaKDVJbDxuz+kj4avk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ezRVIxCh8xJ/n6TwDSdEtazQy9Km+RPgn6W6vuGGc+CKbOOt8heIDRRP9xDbDFJ+o wOrjZLs0NMoit8OegcE9udMkC1YenER/BDEf6dWOt997gtdx8xPQaQLA7r+8vC7DWY okQkJzQ0EKSiLJgkJkXni2b+laRocNu2SVNaNdsLUZJsVEz2qAv/cU3/Qfqc6DsGq0 T1HVxKgWijef0hqrrrvqQmfxJt4JGGDQib3PJV6+TO6jdQa2znuuwTm50VDls0fw5T 6WZjnDFWBmlCZv1OkoIrEl5h2eex2hpAVA8CIRaKB/Q5QT3z5zNctJI1A3cjTZZAQG J9E1dPvX8Y4xQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 88F8F69C87; Thu, 19 Feb 2026 17:20:25 -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 P3Ln1iJGvz8k; Thu, 19 Feb 2026 17:20:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546820; bh=VgaBRSntvrIYr0ZLy0z3ANrV1uGpP/b9sx+VHHmhQmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=en/uh/3+6BysI9NDRQwKuyEotj/Q12zZ/AD1kJyOGO3phuyBCml0ZivWTgLw/JTpN l1u1PSqn6ZgoMK72roulK3JgJH58mJudBEHtcD6zjR4aPwWYRY7Mezqr0TRYZNBf9t HviTSTic0ngo0zPK1Uam89Wf3JU5WDWkNZDPfrIMok31fdVxBMwWJVImQLD3dN3LMo k0L4/A7cHU3LjtLsKqdQjjjM/ytZGu9N8A4LP08VtMyCEQd7ZU3dzr6UassqGHvwlr tWi9+qWZcl725JwMMlxJsqhWrRLEecokUY2nA4rBqPPTKqd2YBZoRXBV9Vgfd4TglB dJi5q9Tnf3uQA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B3E2869C7C; Thu, 19 Feb 2026 17:20:19 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:18 -0700 Message-ID: <20260220001926.2366140-11-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: A7OQAUXLVKBKOZESM7GUC3OYB7NKGTUI X-Message-ID-Hash: A7OQAUXLVKBKOZESM7GUC3OYB7NKGTUI 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 10/13] ulib: x86: Enable Rust demo for efi-x86_app64 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 The C demo already builds and runs as an EFI application on x86_64, but the Rust demo is missing. The EFI build pipeline in Makefile.ulib-example already handles the rust-demo entry via the ULIB_EXAMPLES list, and RUST_TARGET_x86_64 is already defined. Enable CONFIG_RUST_EXAMPLES in efi-x86_app64_defconfig and add a QEMU boot test that launches rust-demo-app.efi under OVMF. Add a shared run_efi_rust_demo() helper that mirrors the existing run_efi_demo() but uses the Rust binary and startup script. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/efi-x86_app64_defconfig | 1 + test/py/tests/test_ulib.py | 57 +++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index 3f9783faf6f..394bab55f0b 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -52,4 +52,5 @@ CONFIG_CMD_DHRYSTONE=y CONFIG_TPM=y CONFIG_ULIB=y CONFIG_EXAMPLES=y +CONFIG_RUST_EXAMPLES=y # CONFIG_GZIP is not set diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index b6fa30bcfd2..8ec5e985b52 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -452,6 +452,54 @@ def run_efi_demo(ubman, qemu_binary, fw_code, fw_vars, extra_qemu_args=None): out = run_qemu_demo(cmd, timeout=15) assert_demo_output(out) +def run_efi_rust_demo(ubman, qemu_binary, fw_code, fw_vars, + extra_qemu_args=None): + """Run a Rust ulib demo EFI application under QEMU with UEFI firmware. + + Writes a startup.nsh script next to rust-demo-app.efi in the build + directory, boots QEMU with the given firmware, and checks for + expected output. + + Args: + ubman (ConsoleBase): Test fixture providing build directory + etc. + qemu_binary (str): QEMU system binary name + (e.g. 'qemu-system-x86_64') + fw_code (str): Path to UEFI firmware code file + fw_vars (str): Path to UEFI firmware variables file (or None) + extra_qemu_args (list): Additional QEMU arguments + """ + build = ubman.config.build_dir + efi_dir = os.path.join(build, 'examples', 'ulib') + demo_efi = os.path.join(efi_dir, 'rust-demo-app.efi') + + assert os.path.exists(demo_efi), \ + 'rust-demo-app.efi not found in build directory' + assert shutil.which(qemu_binary), f'{qemu_binary} not found' + assert os.path.exists(fw_code), f'UEFI firmware not found: {fw_code}' + + with open(os.path.join(efi_dir, 'startup.nsh'), 'w', + encoding='utf-8') as nsh: + nsh.write('fs0:rust-demo-app.efi\n') + + cmd = [qemu_binary] + + # Set up firmware pflash drives + cmd += ['-drive', f'if=pflash,format=raw,file={fw_code},readonly=on'] + if fw_vars: + vars_copy = os.path.join(efi_dir, 'vars.fd') + shutil.copy(fw_vars, vars_copy) + cmd += ['-drive', f'if=pflash,format=raw,file={vars_copy}'] + + if extra_qemu_args: + cmd += extra_qemu_args + + # FAT drive with EFI binary and startup script + cmd += ['-drive', f'file=fat:rw:{efi_dir},format=raw', + '-nographic', '-no-reboot', '-nic', 'none'] + out = run_qemu_demo(cmd, timeout=15) + assert_demo_output(out) + @pytest.mark.localqemu @pytest.mark.boardspec('efi-x86_app64') @pytest.mark.buildconfigspec("examples") @@ -461,6 +509,15 @@ def test_ulib_demo_efi_x86(ubman): '/usr/share/OVMF/OVMF_CODE_4M.fd', '/usr/share/OVMF/OVMF_VARS_4M.fd') +@pytest.mark.localqemu +@pytest.mark.boardspec('efi-x86_app64') +@pytest.mark.buildconfigspec("rust_examples") +def test_ulib_rust_demo_efi_x86(ubman): + """Test the Rust ulib demo EFI app under QEMU x86_64 with OVMF.""" + run_efi_rust_demo(ubman, 'qemu-system-x86_64', + '/usr/share/OVMF/OVMF_CODE_4M.fd', + '/usr/share/OVMF/OVMF_VARS_4M.fd') + @pytest.mark.localqemu @pytest.mark.boardspec('efi-arm_app64') @pytest.mark.buildconfigspec("examples") From patchwork Fri Feb 20 00:19:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1913 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=1771546832; bh=as2rqgVsp3SGm6c4v4r1mo/Gl0T6BnGX2Pg3sECGD0s=; 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=hsiMizi7qJKVCUQrTjAh6ynd83V8X2O78a4chFbrhmlHbx9GNaJdKRIovANZ7i3Ca JbRatNV3qo5v1EPvjQIKdqxuduMHIW8ZRONW7xPm5iSuPv2RsxUhaz51LQXi7tivyg eYs3AQEBJswKQ50RXa256oM86yfv8fzboE2/RhU8dT8yefPltaYnwvmCnHoVo2dp7b 4G/IbprPeYiPKfpJ1eiFs8S92pjxWYnnOSPDCEnSU2zMLEbS//VRjL/qhZqaamv3Vn FSnK3P/0rg/elycco7D6o+9ByEeHoaiu9oHrFsy3JiNfrFJBsP7DPT+9I5EXt/hI/s Iob/yHZWm2R3Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C06C69C8F for ; Thu, 19 Feb 2026 17:20:32 -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 cFv80viOgVPN for ; Thu, 19 Feb 2026 17:20:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546832; bh=as2rqgVsp3SGm6c4v4r1mo/Gl0T6BnGX2Pg3sECGD0s=; 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=hsiMizi7qJKVCUQrTjAh6ynd83V8X2O78a4chFbrhmlHbx9GNaJdKRIovANZ7i3Ca JbRatNV3qo5v1EPvjQIKdqxuduMHIW8ZRONW7xPm5iSuPv2RsxUhaz51LQXi7tivyg eYs3AQEBJswKQ50RXa256oM86yfv8fzboE2/RhU8dT8yefPltaYnwvmCnHoVo2dp7b 4G/IbprPeYiPKfpJ1eiFs8S92pjxWYnnOSPDCEnSU2zMLEbS//VRjL/qhZqaamv3Vn FSnK3P/0rg/elycco7D6o+9ByEeHoaiu9oHrFsy3JiNfrFJBsP7DPT+9I5EXt/hI/s Iob/yHZWm2R3Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2513969C0B for ; Thu, 19 Feb 2026 17:20:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546829; bh=MNe4NGZPMKH7+uMUBwPBF0QsXFG5dGH3w1Ln7AEmUNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sUp2/Sm72IBYStWIM+dfSMj79T0DqRsG31EsYQA4JAmYnQsdCN+FS1VsvnwuJFhrN yshYpOE7/DAfQ1KNeAU+ZEXm65HMsGAISsEcrn4YmdFmij8x08y1E3bH5HBE/lpDPM cA9rwDMNI/+VjruCiw6r45cDc2YmmSZcqQvEx7kYyoF0gcH2TiaNGG8e9HghyilNin e8ZvyfXQ11KILbiphEWcxElytayh8/a5OJdg73aXq9zbP0By/N0OyEle3WmjzWHIpX cg78jY6KucKbFOb4kBiAjHJ0G/NKA/EgnGhK9oSNJ71PrLxwzAGhxKFtTBSM9i2ou5 aBYul/0SO9+SQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EE3DA69C87; Thu, 19 Feb 2026 17:20:29 -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 TghshY8PRDMy; Thu, 19 Feb 2026 17:20:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546824; bh=F+aQNbDtE/y3D/0ZdsPyqKw3SreBnrkECoWDZxo701c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5a2LSa54y6/KDeVgH8pfbvoNwTApNKMDGLL32lW7IqM8NTzGH+8vy/KIR2zlNUZZ LMmZsRhxykdXk0SxTAfk9bgpGYs1wDVE2qYvyS7Zdp0zFEpp3vMDWv1C86RLSmmnc9 N4DgJ/ALU1+V7GgNVMLj15eS8gxSTT4ZVv2FVd59incZoLTnnR2+hgl5cqNPzSR7n7 vsJs7pz3D4VDTiXeQKRJGjf+WB2A57FllQH3ET4G6lGI4S7MFgf+y3JWM5r83ZQcjk yrKQSLDssfdjVa5GKdQv0tdhfL7Nhz5Hye8xTfI6uPE08v1TfcOuz3/3wVOxzNkyLm wiE9IZO7AxdHw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4F3B869C0B; Thu, 19 Feb 2026 17:20:24 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:19 -0700 Message-ID: <20260220001926.2366140-12-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: 7WOIDGUQ5O7B6KLTT24YOKIWO772GZXE X-Message-ID-Hash: 7WOIDGUQ5O7B6KLTT24YOKIWO772GZXE 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 11/13] ulib: arm64: Enable Rust demo for efi-arm_app64 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 The EFI ARM64 board sets EXAMPLE_ARCH to arm but no RUST_TARGET_arm is defined, so the Rust demo cannot build. Since only 64-bit ARM has ULIB support, define RUST_TARGET_arm as aarch64-unknown-none (the same approach used for RISC-V where only 64-bit is supported). Enable CONFIG_RUST_EXAMPLES in efi-arm_app64_defconfig and add a QEMU boot test that launches rust-demo-app.efi under QEMU_EFI.fd. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/efi-arm_app64_defconfig | 1 + scripts/Makefile.ulib-example | 2 ++ test/py/tests/test_ulib.py | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/configs/efi-arm_app64_defconfig b/configs/efi-arm_app64_defconfig index a9c4686a106..4d43a5bc754 100644 --- a/configs/efi-arm_app64_defconfig +++ b/configs/efi-arm_app64_defconfig @@ -55,4 +55,5 @@ CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_FAT_WRITE=y CONFIG_ULIB=y CONFIG_EXAMPLES=y +CONFIG_RUST_EXAMPLES=y CONFIG_CMD_DHRYSTONE=y diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index ae3f75b33fb..fdb5a27fa1d 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -25,6 +25,8 @@ RUST_TARGET_x86 := i686-unknown-linux-gnu RUST_TARGET_x86_64 := x86_64-unknown-none RUST_FLAGS_x86 := -C panic=abort -C relocation-model=static RUST_FLAGS_x86_64 := +RUST_TARGET_arm := aarch64-unknown-none +RUST_FLAGS_arm := RUST_TARGET_riscv := riscv64gc-unknown-none-elf RUST_FLAGS_riscv := diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 8ec5e985b52..851732fa1da 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -527,6 +527,15 @@ def test_ulib_demo_efi_arm64(ubman): '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', None, ['--machine', 'virt', '-cpu', 'max']) +@pytest.mark.localqemu +@pytest.mark.boardspec('efi-arm_app64') +@pytest.mark.buildconfigspec("rust_examples") +def test_ulib_rust_demo_efi_arm64(ubman): + """Test the Rust ulib demo EFI app under QEMU aarch64 with UEFI.""" + run_efi_rust_demo(ubman, 'qemu-system-aarch64', + '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', None, + ['--machine', 'virt', '-cpu', 'max']) + @pytest.mark.localqemu @pytest.mark.boardspec('efi-riscv_app64') @pytest.mark.buildconfigspec("examples") From patchwork Fri Feb 20 00:19:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1914 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=1771546835; bh=uaPjEWOcvfGDGHy+7ay0fPfErLgVFZbdtwIUrfEHL5A=; 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=hEpH8BJEtncXacRdzr3JIemwCNxk+kSg7Nb4FplSK9z00i2l7JvjDLfWLwnDjSHxF KlBgs5NxsXIsVCrD9PhQd7vqj0bQ5VIG3IVlpPIMVxa8jGZHEY2DuRKwo6vKKYJ1Sz M4XbQrQjdRwTng+cu4ZyMYkvC3qmfFGf2x0HmbPGKlGZGvuf49nPHiQBP3Av5zNCou YaLLujygp19Alex4+vNyWY1KPmekhhXK+2RyCombfmtueJzR9+orbBwdgtHh0SSA4s EPTQO54cgxrFiYP7/h8iSg9DBcKa42OYCStjihhXIyoB4cZXCqc7Z/b7Xz97Ru8qvl eWTnCp4mIL3rA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CF3F369C8F for ; Thu, 19 Feb 2026 17:20:35 -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 wN_Mu0-7kMPU for ; Thu, 19 Feb 2026 17:20:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546835; bh=uaPjEWOcvfGDGHy+7ay0fPfErLgVFZbdtwIUrfEHL5A=; 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=hEpH8BJEtncXacRdzr3JIemwCNxk+kSg7Nb4FplSK9z00i2l7JvjDLfWLwnDjSHxF KlBgs5NxsXIsVCrD9PhQd7vqj0bQ5VIG3IVlpPIMVxa8jGZHEY2DuRKwo6vKKYJ1Sz M4XbQrQjdRwTng+cu4ZyMYkvC3qmfFGf2x0HmbPGKlGZGvuf49nPHiQBP3Av5zNCou YaLLujygp19Alex4+vNyWY1KPmekhhXK+2RyCombfmtueJzR9+orbBwdgtHh0SSA4s EPTQO54cgxrFiYP7/h8iSg9DBcKa42OYCStjihhXIyoB4cZXCqc7Z/b7Xz97Ru8qvl eWTnCp4mIL3rA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BF49269C87 for ; Thu, 19 Feb 2026 17:20:35 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546833; bh=Z7kghkfVJIMlSjWAwFGvR2RFSv9thUelT7/uwqd4vmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ogi4W5UAAlg2ewyhI75Mu+keqjn37Dj3Nf0AC4aY/fGdug2k/ZNMvnBUcjtdDRYY1 pYSCUrlVVRuaW5Li/71rBIOypPJDkfjpyyTu2iNuz5ZYCtEjQ1insb0VCSkebR1xT8 fq6wmfadPb025qS6AzU8RlvN7YoUaudQmNhp22jq2TH+N1n6bOhQ0J6e+yBknQouhy DA96R6O2L3HmqOHOy8Q5yCA7F8RnZo6kuaTcPZ7fqgr0WYvZeMrrFa9JgmV9Rvm+/d U+98hIptF9edVJIvm9AsEAvNEGzSiEU0Q++L6MrvqMWSFkaQxuCNGj0HUosdVnxmR1 xmsAHUDV8X1oA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 453E869C0B; Thu, 19 Feb 2026 17:20:33 -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 Nv2bUmYDDo6U; Thu, 19 Feb 2026 17:20:33 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546829; bh=0OevVDM4xDW8dlWd+0BLiz2Jc41XV1w0EpFsuqVACHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tHCmApEUxn8Q+FjxomiY/tLjuq1L0o/LBXE6iGmAWnxSJBRgFSCNaZDWC9TprCx2q 7AtYf8crINXaXAeeNGDTZEjnH3QoZi2qK020mCBFq1t+QTX+CmSuQyK9TpitcYh5cZ O6wvZPNqT4yKsHhgdz/Y1divuTRCyf6pAnLYBh9dQgeIAm8mXRbfVLyhcdrQweCm/m yBvyAsoftzEUM7FOno5Da9ItyWKD0nUFhHkjgVVcclhEi4Xjr/wwsaNivb7ATQMaK1 e9li1oE2NQswQQf6dCLc7aoto6Kx5MywtoaLP++hy6HMbX3c5zLwnaxsUTQBMqosjB YT76hCdWSUuOQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id F1D2869C7C; Thu, 19 Feb 2026 17:20:28 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:20 -0700 Message-ID: <20260220001926.2366140-13-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: GLXOLQ3W6OETA2CMF5NHALGNU2K2I2SN X-Message-ID-Hash: GLXOLQ3W6OETA2CMF5NHALGNU2K2I2SN 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 12/13] ulib: riscv: Enable Rust demo for efi-riscv_app64 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 RUST_TARGET_riscv is already defined as riscv64gc-unknown-none-elf, so the Rust demo just needs to be enabled in the defconfig. Enable CONFIG_RUST_EXAMPLES in efi-riscv_app64_defconfig and add a QEMU boot test that launches rust-demo-app.efi under RISC-V UEFI firmware. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/efi-riscv_app64_defconfig | 1 + test/py/tests/test_ulib.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/configs/efi-riscv_app64_defconfig b/configs/efi-riscv_app64_defconfig index d48ecf19585..e89d392050b 100644 --- a/configs/efi-riscv_app64_defconfig +++ b/configs/efi-riscv_app64_defconfig @@ -54,4 +54,5 @@ CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_FAT_WRITE=y CONFIG_ULIB=y CONFIG_EXAMPLES=y +CONFIG_RUST_EXAMPLES=y CONFIG_CMD_DHRYSTONE=y diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 851732fa1da..65485118812 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -545,3 +545,13 @@ def test_ulib_demo_efi_riscv64(ubman): '/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd', '/usr/share/qemu-efi-riscv64/RISCV_VIRT_VARS.fd', ['--machine', 'virt']) + +@pytest.mark.localqemu +@pytest.mark.boardspec('efi-riscv_app64') +@pytest.mark.buildconfigspec("rust_examples") +def test_ulib_rust_demo_efi_riscv64(ubman): + """Test the Rust ulib demo EFI app under QEMU RISC-V 64 with UEFI.""" + run_efi_rust_demo(ubman, 'qemu-system-riscv64', + '/usr/share/qemu-efi-riscv64/RISCV_VIRT_CODE.fd', + '/usr/share/qemu-efi-riscv64/RISCV_VIRT_VARS.fd', + ['--machine', 'virt']) From patchwork Fri Feb 20 00:19:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1915 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=1771546840; bh=vyZSfk8RKxNCg4qjyYYGE/Sm5pLxDy66/ESerFfQ5oE=; 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=IquCneozPMPQEQsNsKb9xVCirrn9vss/UnQAUPxDJUj3Z0TEy2m8e3Ctc6PMwYU0W x71XnHKuUIMSm9FBmT9DcJjiakOG6aiZBcnFrLXodOdYTrWJB7o2pqkRAgGycnIra7 lbS/e9au6EtcMQI33XVWubXYhbkTK2lFXn+tesvx2Dxvahgv51aU2mK2NfzQdIacTr aAVQMlGNWc9mhH9pOc9ikohaOZFbGBb/ODbKsvnQk3xTn0kVKDw7fkhtNqAzcStmCM Bc2m1y1aifzCrl0ePvlKU+kpFgQJKSH4zwJ8+eFGGIbGLypXLq3x3pYck0bxU3l6oZ 7QE1yyxC8v4tg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4833F69C89 for ; Thu, 19 Feb 2026 17:20:40 -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 07wNMI0n5djB for ; Thu, 19 Feb 2026 17:20:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546840; bh=vyZSfk8RKxNCg4qjyYYGE/Sm5pLxDy66/ESerFfQ5oE=; 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=IquCneozPMPQEQsNsKb9xVCirrn9vss/UnQAUPxDJUj3Z0TEy2m8e3Ctc6PMwYU0W x71XnHKuUIMSm9FBmT9DcJjiakOG6aiZBcnFrLXodOdYTrWJB7o2pqkRAgGycnIra7 lbS/e9au6EtcMQI33XVWubXYhbkTK2lFXn+tesvx2Dxvahgv51aU2mK2NfzQdIacTr aAVQMlGNWc9mhH9pOc9ikohaOZFbGBb/ODbKsvnQk3xTn0kVKDw7fkhtNqAzcStmCM Bc2m1y1aifzCrl0ePvlKU+kpFgQJKSH4zwJ8+eFGGIbGLypXLq3x3pYck0bxU3l6oZ 7QE1yyxC8v4tg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 362A869C7C for ; Thu, 19 Feb 2026 17:20:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546838; bh=aZZxvcxSTVyTIHI50oBlcebrENCYbx41Uu9Q4OGDUec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L5wR+nWQKfOYbc4kRNP4P6siFPvuc7bIAABdD/o4aO2rDVN9BVbxZyziTKk6Tw5sK XJ3Zd3Z2UGIvRVJZjfg4zVt1HlqlAk/W9UM0JOun43++2rluDz1UeZ9Tk8kmbB6r5j 0LsffJOnFXDL+XqaG9a5hkditPNHPAoMjV7M5bpvHSgzmchdHNWVJ9L14kNbhezEdR C6roHLl5Ywn1MPk46UX/QJ04LjOOZqb8KiB0PSIuNSA6BjzGopV7AFJImXEkpKjc84 ujtNR0jkVVjuLat5I0ySuVPLHa+6qTmD5vqODLVcygkRJEnU6ywwE7C2EHcqAJXUzk Lj32RXXQyqXyw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3716B69C0B; Thu, 19 Feb 2026 17:20:38 -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 CUN1bDcS1vSU; Thu, 19 Feb 2026 17:20:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771546833; bh=m4b4saG4BXYHG/g+uiRlOES5iD0uxM7Jy+pA+04bIm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=drFjuGZpWF2976ECLR/E5lv0ymLCfokLeRjYG2L1TvsyjSpEeB6pHQHInpyb9CjkV orYqQ5R6PgchBwvPaQF8os4M2LZQ9y8+nVIj30+d3yuNLGv00SAzevXUd/1lE31BDa 5BWV0qBIQWm/1iODrPPOZpu5YDLJchk6GUmCfN3/JYQAqiCbKMDXvbFjwF+ANQcPxN 0C77EYWn0otNAON73qSzoZ7buJz3Z7f72nHevtuIj+F/djSP03h5elWTLgzWiAB+wa xy2skBe4gt3hXCtR7FOMZmdMv1/Eupg1TE0GRLUtalOl/zF3xNOGxcUoRryzachX5w HjMupo0HtQlTQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 85EBA69C7C; Thu, 19 Feb 2026 17:20:33 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 19 Feb 2026 17:19:21 -0700 Message-ID: <20260220001926.2366140-14-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: IX5EQ5VJ3Y6QOUS5JVND4V7GMFUFO3DW X-Message-ID-Hash: IX5EQ5VJ3Y6QOUS5JVND4V7GMFUFO3DW 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 13/13] ulib: arm64: Enable Rust demo for qemu_arm64 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 RUST_TARGET_arm is defined as aarch64-unknown-none and the Rust source no longer generates undefined panic symbols, so the Rust demo can now build and link for the ARM64 QEMU target. Enable CONFIG_RUST_EXAMPLES in qemu_arm64_defconfig and add a QEMU boot test that launches rust-demo.bin under qemu-system-aarch64. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/qemu_arm64_defconfig | 1 + test/py/tests/test_ulib.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig index 507c08bc514..5c25bd313c6 100644 --- a/configs/qemu_arm64_defconfig +++ b/configs/qemu_arm64_defconfig @@ -78,3 +78,4 @@ CONFIG_UTHREAD=y CONFIG_UNIT_TEST=y CONFIG_ULIB=y CONFIG_EXAMPLES=y +CONFIG_RUST_EXAMPLES=y diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 65485118812..f4234253b7d 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -392,6 +392,13 @@ def test_ulib_demo_arm64(ubman): """Test the ulib demo binary under QEMU ARM64.""" run_bios_demo(ubman, 'qemu-system-aarch64', ['-cpu', 'cortex-a57']) +@pytest.mark.localqemu +@pytest.mark.boardspec('qemu_arm64') +@pytest.mark.buildconfigspec("rust_examples") +def test_ulib_rust_demo_arm64(ubman): + """Test the Rust ulib demo binary under QEMU ARM64.""" + run_bios_rust_demo(ubman, 'qemu-system-aarch64', ['-cpu', 'cortex-a57']) + @pytest.mark.localqemu @pytest.mark.boardspec('qemu-riscv64') @pytest.mark.buildconfigspec("examples")