From patchwork Mon Feb 16 01:34:49 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1881 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=1771205732; bh=ojTn5dp5Q7kW9WGP2BO6vN6Bppn+479H+9vi1hvlEpc=; 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=pUVCtxOlf0tmH2vkqXyP0znHaBJIjWKydT3XVW4HMjwV5UlmXQjRcuCSPBt/DvnUg Zb8YymJ1drd2XauP2cLO40I/z4YIoP4N6awoBeuORrfLhgm3TBPTiTzC+UTierMzPQ /MU8aL0KCSCH6hXScAGzXJyyoISz/PvbexTKfy0Wy3+3EjZIwSYxjRARyRIRBjvOT6 tqclHtAoi6HJ1d0heq9ubMTMpTmOSfAmH5zPqxSaHlSnSploUzjD8S79DsteIwO3ot SqEdU9CjX9TyYDjlS+zW9iABuZN+rgOtZgd4AZmF31nTaDlYkgNaV438Gw4p7xerEo D5Lo5gmFIoPzA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1AE4669BD1 for ; Sun, 15 Feb 2026 18:35: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 LMOrJodgirbJ for ; Sun, 15 Feb 2026 18:35:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205732; bh=ojTn5dp5Q7kW9WGP2BO6vN6Bppn+479H+9vi1hvlEpc=; 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=pUVCtxOlf0tmH2vkqXyP0znHaBJIjWKydT3XVW4HMjwV5UlmXQjRcuCSPBt/DvnUg Zb8YymJ1drd2XauP2cLO40I/z4YIoP4N6awoBeuORrfLhgm3TBPTiTzC+UTierMzPQ /MU8aL0KCSCH6hXScAGzXJyyoISz/PvbexTKfy0Wy3+3EjZIwSYxjRARyRIRBjvOT6 tqclHtAoi6HJ1d0heq9ubMTMpTmOSfAmH5zPqxSaHlSnSploUzjD8S79DsteIwO3ot SqEdU9CjX9TyYDjlS+zW9iABuZN+rgOtZgd4AZmF31nTaDlYkgNaV438Gw4p7xerEo D5Lo5gmFIoPzA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07CB869BCE for ; Sun, 15 Feb 2026 18:35:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205730; bh=wRVMMBnUNIcGvs/FSEfxxdWk8XLVHzqrKshpRnnbeMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/3QS77WLISKMbuRkwoGwg5VkPN2Zg60BicAWNNSycLJ+b2PO3f1OqfgOrL76wMl9 nPdyCMsyN7uWuPvw44duXfcrlD9tk0QKj0GVpxF/tAC3uFEHhCaIjFIGm4jBUSdul5 koESMQzR1nRbu+uxJPAUl2kDlH0ncYz3LpI1EavgcabRuFz4hzQdduBcnguMS7e5j/ Btqv6KYr1wv7Jfrkrgkw2cAzr+w0YExG2fr8O+NllEcMl5DzPIGC0Mh9NpbV4jb0dG 8sTrpwVKow2+0PoCSNoWpbJ01rW772TShJ1gSTbpnBJomjpLS+2CMe6gnSzCfmOB1u v5NDRMifHmr5Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3D9B269AD9; Sun, 15 Feb 2026 18:35:30 -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 CYCXprUuOmrY; Sun, 15 Feb 2026 18:35:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205726; bh=bK4mrSqSVrP5C5Klh82rxNIYEtbeoH47BoTBXLefC4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FBQXBa19XjVCrH+/Xw9ma7owwXsybuMPm3KnOesR3s1Ahhmr6UbdHgibAGIc3k2Ab dyunEA0eeYUJkNQ95nEOgANF6c2wVWgfqu0U69zIzZPDKTPGyLOVNmGhx8QuLtC+lE OSSY8I6MDmttZdEVS18PqjYsZBv3+IOQkopuBucaIBMkpgM08YpIlXw+ZrvClyHT/L rzV1wz5hxpFvub+RVLuAQIIh2FGqG7k9CXDfAi1aA6UkjDzZ5xb6s0iyg+M/OtoXXG N444Wgz4UYBwGNSq5AHsTtRLtLsKtsEXg/8vgDX6J0LBQ5nczZHe4iMjE3jJi99s0K sJpS2AO5tHQlA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id DD25469BCE; Sun, 15 Feb 2026 18:35:25 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:49 -0700 Message-ID: <20260216013511.4079770-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ETUWTDFUI2HXYBMSXRCAP3LZGSSPWE3K X-Message-ID-Hash: ETUWTDFUI2HXYBMSXRCAP3LZGSSPWE3K 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 01/17] ulib: Skip empty archives in build_api.py objcopy step List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When CONFIG_ULIB is enabled for cross-compiled EFI builds, some built-in.o archives are empty (e.g. arch/riscv/cpu/generic/built-in.o for efi-riscv_app64). The objcopy --redefine-sym command fails on empty files. Skip them by checking the file size before calling objcopy, producing an empty output file to keep the archive list consistent. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- scripts/build_api.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/build_api.py b/scripts/build_api.py index aa8b4f16a1a..a82cd83503c 100755 --- a/scripts/build_api.py +++ b/scripts/build_api.py @@ -356,6 +356,12 @@ class SymbolRedefiner: Returns: bool: True if file was modified, False otherwise """ + # Skip empty archives (objcopy cannot process them) + if os.path.getsize(path) == 0: + with open(outfile, 'wb'): + pass + return False + # Always run objcopy to apply redefinitions self.redefine_file(path, outfile) From patchwork Mon Feb 16 01:34:50 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1882 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=1771205738; bh=VeS5Ll2e0RCfKa9RnyHWMyj6JI1EJUIWQSsQ1IKFp60=; 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=EcPnK1Nf+O4YFjpV2jY+C1AIOGAH+saYRgbX76shwt75pqyp0oPQEGbRrKeNArrBQ rmg/swKlsGhy9ISoIbCzHkQEZnTMxclCp+TiYDzZk4jOLr/YrteHeunQkVZcE8oxjI fbCs6BrNPOwXZeWdV47zqQ/pv+gndUk30nYyB4hgM5VQyVxzBfO5co6AchxWNsSyzf 5lJBwLKMFq+bi/6YrDgcoHw54u+X5IvoJ/9KOH8uuU3e+nzva+XX6ybPm/JBhx1WRp sMG0+QDe+m5Gsml6+mTnBG9V6nnSnKpbLEVDzcLaV9+ff0HB0d/rfb5jK4pUvKGDz1 Si/5YfiJMorRw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3394869BCE for ; Sun, 15 Feb 2026 18:35: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 10024) with ESMTP id ndHP3W9PHMn6 for ; Sun, 15 Feb 2026 18:35:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205738; bh=VeS5Ll2e0RCfKa9RnyHWMyj6JI1EJUIWQSsQ1IKFp60=; 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=EcPnK1Nf+O4YFjpV2jY+C1AIOGAH+saYRgbX76shwt75pqyp0oPQEGbRrKeNArrBQ rmg/swKlsGhy9ISoIbCzHkQEZnTMxclCp+TiYDzZk4jOLr/YrteHeunQkVZcE8oxjI fbCs6BrNPOwXZeWdV47zqQ/pv+gndUk30nYyB4hgM5VQyVxzBfO5co6AchxWNsSyzf 5lJBwLKMFq+bi/6YrDgcoHw54u+X5IvoJ/9KOH8uuU3e+nzva+XX6ybPm/JBhx1WRp sMG0+QDe+m5Gsml6+mTnBG9V6nnSnKpbLEVDzcLaV9+ff0HB0d/rfb5jK4pUvKGDz1 Si/5YfiJMorRw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1856669B01 for ; Sun, 15 Feb 2026 18:35:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205736; bh=G9wf6qrfR1EKIpILtcbHcQYlk4hfB8LQZAkKbOk85X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rw5jlFi+wD+F0s4YIh2Ic+bt9uiBd6vwse6bQN926ywX/B6qGoIZRLRcXSWb7Dasd pIVh96xKZ+OYyTAy23nvm0XewPgswUFqBdkLz9s/vP9vAfiw5igzYYqQ0kUn+Xw/AJ J8VyiI7A+YPwP8EK0QIeirFz1lyDDdXOodAW0M1FzCgNJkQtYuv1NkZLozIWySicCV 0ytN9ZKReHutP22tP45O1U56rSk7MfA1nqIKprjwX3IXbiA9nmovFUyt36qAc5BNhO 0h61hLlt/OGVChCWBNBkvgh4wyE4WsmgZYdroNJtJE/cYMfDLVOuIcIsd8USYZNkuo 0Z8agkbCiOHjw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B8D6C69BCC; Sun, 15 Feb 2026 18:35:36 -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 l0Kz8n6WGi99; Sun, 15 Feb 2026 18:35:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205730; bh=cQEeN44BQuln0hjiOj+1xJfF5KJlKJofy8zRkEQiJQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wvTtdsq4HmjuxnThXpRA/BZ6gxdyalpa/D97kdiGaUzPw8IXjDEH+4v8ISyBlk45g 82PrmJ/jgV+xZ60SiasklkPrQyMXwJz6RG4vjiBB3XnKHby7I+LDzHPZ5UZ689bwPh +nyd7oHPNbDZzNsRjNAFcLebkC1f/+uzyWGsBUSWN7eYNkq07014yTRIUN4mQjpf3i fbrDkI0P1qLcmgJ3ew5bLa6uG8p3Q/OEaR7Y6WMbx7g1mqiyS+De2apzsiczAKn5Uq 4u7Qq1CxIkuoh89O6EcPwDP9m5pjVMAOmdlHxz5hqHS8OyKiiqwNt755yyWW4VGSq4 EFfP5B+qXdbWg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 83B7969B01; Sun, 15 Feb 2026 18:35:30 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:50 -0700 Message-ID: <20260216013511.4079770-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FY5HS5JBHGSOMSXZJU4ZAKDCKOBBAT2B X-Message-ID-Hash: FY5HS5JBHGSOMSXZJU4ZAKDCKOBBAT2B 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/17] ulib: Build the static test binary by default 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 ulib_test_static binary has a build rule in the Makefile but is not added to the INPUTS targets, so it is never built automatically. The test_ulib_static pytest then fails because the binary does not exist. Add test/ulib/ulib_test_static to the INPUTS line for sandbox builds, since the binary uses HOSTCC and can only run on the host. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index f1fdace661d..be1814e009c 100644 --- a/Makefile +++ b/Makefile @@ -1060,6 +1060,9 @@ ifneq ($(cc-name),clang) ifeq ($(NO_LIBS),) INPUTS-$(CONFIG_ULIB_SHARED_LIB) += libu-boot.so test/ulib/ulib_test INPUTS-$(CONFIG_ULIB) += libu-boot.a +ifdef CONFIG_SANDBOX +INPUTS-$(CONFIG_ULIB) += test/ulib/ulib_test_static +endif ifdef CONFIG_EXAMPLES ifdef CONFIG_SANDBOX INPUTS-$(CONFIG_ULIB) += examples_ulib examples_rust From patchwork Mon Feb 16 01:34:51 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1883 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=1771205741; bh=CeAekYYT6CrmHa/7GR28r1nZ57yeeU5ou+LbhBU8jkM=; 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=TzPC9Bf3YnwkDQvLfnRJJu75jbGXVOl98ozPRAmTm3BFukQ4ZPueSrDAzYqVTP3Fp BbBkfGyq5hUXYtb+NGghwXn71O2aDihp4sCvWbb4lvHFDJ6GK7yjVQoQhSlDgUJuEt uTHDo51g80cmQ41WFMaP86e0B7XE4rbRcxBSGSd5HLKKYARhnEd+V9OZpgkmDsgcu3 CbkOTuh6+vwfEr2sPSRxMSomUMVCs+DJSexZXsiAxYbFeSDFdvWhTJyySN/1YzH629 ljp728Q91BR85Xk7NxKMCREdZV3OAyfeuf4CeLEeIaXTeoXr7QsPgu+n62XHjmewAx CQuqnbf4A0mKA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AAA3369BCC for ; Sun, 15 Feb 2026 18:35:41 -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 M9NWZDCa47ST for ; Sun, 15 Feb 2026 18:35:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205741; bh=CeAekYYT6CrmHa/7GR28r1nZ57yeeU5ou+LbhBU8jkM=; 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=TzPC9Bf3YnwkDQvLfnRJJu75jbGXVOl98ozPRAmTm3BFukQ4ZPueSrDAzYqVTP3Fp BbBkfGyq5hUXYtb+NGghwXn71O2aDihp4sCvWbb4lvHFDJ6GK7yjVQoQhSlDgUJuEt uTHDo51g80cmQ41WFMaP86e0B7XE4rbRcxBSGSd5HLKKYARhnEd+V9OZpgkmDsgcu3 CbkOTuh6+vwfEr2sPSRxMSomUMVCs+DJSexZXsiAxYbFeSDFdvWhTJyySN/1YzH629 ljp728Q91BR85Xk7NxKMCREdZV3OAyfeuf4CeLEeIaXTeoXr7QsPgu+n62XHjmewAx CQuqnbf4A0mKA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 99FB969BCE for ; Sun, 15 Feb 2026 18:35:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205740; bh=2twAtSfiJxGDWwaq6dm0gR7EEkEZCnDYVW8ytP17Vz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fAuHveebVbec9wlrJWlWumR4l5NR+rkCyR+xtcxMS1HYNq538O5yRli2DLaAshOK+ DU8JbUAIGq0ja2A8sdlfYdg+0sr5IMcSP9BW8ZZapMFuq/mGpHWaEHQo9csXKm55yA xO6mGZWlsU2jSppjFReYjffD/t7YJ/q+Pa6MADqGLWAy/UENcOkDU3XA29pleaO31y Gfkr66zms6d0q3xZfKemrqZNXKmPyrk5SBV9np4pF81pArGKf9DPE3SK+DeYtibpvb pBB1eX0vUZj+ra8Bma1E6vWqWu/cdjViwSmTcQQE05yeV41Buju7w4KYvSMJOYek31 LhPjjp1W1C+LA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C05C069B01; Sun, 15 Feb 2026 18:35: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 10026) with ESMTP id xGbNMmFTZNbX; Sun, 15 Feb 2026 18:35:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205735; bh=JsZJsCjy4TV9+tOyJOEbhGC9mq3ZpHiAiUVwOUj7PaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UrWXx8ghC7BPfEaxGbINe0FsEo0OrsTSHHTspXB9r3fsbqD0xXBDQUn1Xx/339WDD mMZa0HP83RrpHa7/KvAC0v2MD4gfY8smIlpuIN6uUJssD0tR5SEsZffXfzSW6S6r3E fBnsJs3HL73abWPXu2x8lG8Z9NAjOnPqd82WVtNcJRlXroxsPPoFaen9HE0PbuA95d L7wmREYg0Q3bhagqfBGU7dCJkaLHWgFlWV7/Ayz1/gijfpNwfxTTzTD+8OpziH49hV iQiZF18KUclx9CQBY76erJ5sIgNEqBhGARtIYlIjAcc75Kn/eI/wANqF4G3dyNyXVH J/BXlib6lOEsw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EDD1069AD9; Sun, 15 Feb 2026 18:35:34 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:51 -0700 Message-ID: <20260216013511.4079770-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XVYVBYDRL62F6Z2HDI2UDZ7GMPQCIOLV X-Message-ID-Hash: XVYVBYDRL62F6Z2HDI2UDZ7GMPQCIOLV 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 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/17] ulib: test: Add localqemu marker to skip tests in lab 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 Some tests launch their own QEMU process via subprocess rather than using the lab's managed U-Boot instance. In lab mode the locally launched QEMU produces empty output, causing assertion failures. There isn't really any point in running these tests on the lab since they run happily in CI. Add a 'localqemu' pytest marker and the corresponding setup_localqemu() hook in conftest.py that skips marked tests when ubconfig.role is set. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- doc/develop/pytest/usage.rst | 9 +++++++++ test/py/conftest.py | 15 +++++++++++++++ test/py/pytest.ini | 1 + test/py/tests/test_ulib.py | 1 + 4 files changed, 26 insertions(+) diff --git a/doc/develop/pytest/usage.rst b/doc/develop/pytest/usage.rst index 9ba6ed429a9..32037d47dcd 100644 --- a/doc/develop/pytest/usage.rst +++ b/doc/develop/pytest/usage.rst @@ -596,3 +596,12 @@ option not to be set. The following annotation requires CONFIG_RISCV=n: .. code-block:: python @pytest.mark.notbuildconfigspec('riscv') + +The localqemu marker indicates that a test launches its own QEMU process +rather than using the lab's managed U-Boot instance. Tests with this marker +are automatically skipped when running in lab mode (i.e. when ``--role`` is +set), since the locally launched QEMU is not available in that environment: + +.. code-block:: python + + @pytest.mark.localqemu diff --git a/test/py/conftest.py b/test/py/conftest.py index eb64f2a82be..b7a03669751 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -818,6 +818,20 @@ def setup_role(item): if required_roles and ubconfig.role not in required_roles: pytest.skip(f'board "{ubconfig.role}" not supported') +def setup_localqemu(item): + """Process any 'localqemu' marker for a test. + + Skip this test if running in lab mode (i.e. role is set), since the + test launches its own QEMU rather than using the lab's U-Boot. + + Args: + item (pytest.Item): The pytest test item + """ + for _ in item.iter_markers('localqemu'): + if ubconfig.role: + pytest.skip('test requires local QEMU (not supported in lab)') + return + def start_test_section(item): anchors[item.name] = log.start_section(item.name) @@ -840,6 +854,7 @@ def pytest_runtest_setup(item): setup_requiredtool(item) setup_singlethread(item) setup_role(item) + setup_localqemu(item) def pytest_runtest_protocol(item, nextitem): """pytest hook: Called to execute a test. diff --git a/test/py/pytest.ini b/test/py/pytest.ini index 0a0268ec247..bebb22cd3d6 100644 --- a/test/py/pytest.ini +++ b/test/py/pytest.ini @@ -14,3 +14,4 @@ markers = slow: U-Boot: Specific test will run slowly. singlethread: Cannot run in parallel role: U-Boot: Indicates the lab 'role' which can execute this test + localqemu: U-Boot: Test launches its own QEMU, skip in lab mode diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index aff586c4d79..16af47fd840 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -210,6 +210,7 @@ def test_ulib_api_header(ubman): assert 'ub_snprintf(char *buf, size_t size, const char *fmt, ...)' in out assert 'ub_vprintf(const char *fmt, va_list args)' in out +@pytest.mark.localqemu @pytest.mark.boardspec('qemu-x86') @pytest.mark.buildconfigspec("examples") def test_ulib_demo_rom(ubman): From patchwork Mon Feb 16 01:34:52 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1884 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=1771205745; bh=3+e3bKRK17377pywV/oZhfnH/dRAii49Uy4t8ue/9Xw=; 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=AsfbPSuDJAcojSDTFoNxJ18TFmmJRPnPiciu/PtBH++wB1c25Zovm6CEWHsyiaHIA NhxPVao7ueen8waV3oM7iq1IElpU4sF1rHD3SJ6mfIA1w6Q58AiChBMEQRS4n6nWsq tP0NJg6qiZww8mW3qTjGE4zrkQtfWqgfQ68wfi48L//l59emFpi7LFY+Hhni/8/WeX apcL7v86PVky8REy3cfDLxKFVlHuBy/Go9SbpiPspViyGFPBuxPVJ+ESwOV7kFBPlX LdQC1fWSZsDYmDpeqMzA8zp67i61DjJ1wyoYes6YJ+mN7hPYEEb6r+lXBIeFy4kf4W r/XJZk7lpLRmg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2AE0A69BD8 for ; Sun, 15 Feb 2026 18:35: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 10024) with ESMTP id wFFMAgnaDPp8 for ; Sun, 15 Feb 2026 18:35:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205745; bh=3+e3bKRK17377pywV/oZhfnH/dRAii49Uy4t8ue/9Xw=; 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=AsfbPSuDJAcojSDTFoNxJ18TFmmJRPnPiciu/PtBH++wB1c25Zovm6CEWHsyiaHIA NhxPVao7ueen8waV3oM7iq1IElpU4sF1rHD3SJ6mfIA1w6Q58AiChBMEQRS4n6nWsq tP0NJg6qiZww8mW3qTjGE4zrkQtfWqgfQ68wfi48L//l59emFpi7LFY+Hhni/8/WeX apcL7v86PVky8REy3cfDLxKFVlHuBy/Go9SbpiPspViyGFPBuxPVJ+ESwOV7kFBPlX LdQC1fWSZsDYmDpeqMzA8zp67i61DjJ1wyoYes6YJ+mN7hPYEEb6r+lXBIeFy4kf4W r/XJZk7lpLRmg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 19F5E69BCC for ; Sun, 15 Feb 2026 18:35:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205743; bh=qw1ep4haejEqn2t8jkLzdrgulV97RCcAEEUvJDgMzBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U9M+anMyy9tkg6ZIyKAmf/EY9KpOvYAEGYt3Dg+kdMjYRekn2iPs5I2lkaCju9ELj AQrgeRMI9bLvwyHPXoH0A1oVdFF8qoU2tR2tRcIvI6I2V38FIRTs7Prv0qKGYCwzIQ JarD/2dJMUDDlfzwdAiuPV1QzvZK3Xupbxf/4fSm4Ar+TXm5Rh8s7cklmpabE1ZIWv G00iJWbQBsn/3McdxlriIozJXGFrTL0Yl+nvAjP8PsGYEUsaaDDadsMxps+OTLy2mE Pe5m/x53i3oOnNz+eQM9b0elBHOIKDfGa7QgbK5nH6zVPgwCAsTjCHjOOBOpdQEV4F Dm4CotdyriWSg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CAB3169B01; Sun, 15 Feb 2026 18:35:43 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id cPXfp_-zqWaj; Sun, 15 Feb 2026 18:35:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205741; bh=jHOJZdGbjeArm3wkaS/zRG4PXWtto06uwJD8J+fKU+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uMG5ORN+pce9IGGut5fQ9Qg73HWyUho1OInXc6PinqvAwfgeRyYYzIkwC5A9dkSwB x87P1/v15kZmD4hz3bLQjOih5Jqyifuy2lMPcAPIh1Der3BsWNBhG3G1v2g7zhpayu k7n/UmSVFI7jAhr2Ne9BxtsDZ0SbJuyZRWBDOJjqVUCoERd4AwTcqZL9UX8rp1yrtp 1S0MAYkcotXzSV7zc554bRgeLAeSQAQGsS7wPCuJfmOPgVLtXWP3bzcNAs+4OL2ulM JZQF174mzxnoc3B3m0MXcjtc2kQwoPEDTaQRiKExVGE0qnK8JZPGw6SBge2q3TCqAd e8LRJ/702anqQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 10A9569AD9; Sun, 15 Feb 2026 18:35:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:52 -0700 Message-ID: <20260216013511.4079770-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CY43ZMDIXW4KTIKLL2DPP4ZHDAUSNVUY X-Message-ID-Hash: CY43ZMDIXW4KTIKLL2DPP4ZHDAUSNVUY 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/17] ulib: test: Detect clang instead of checking binaries 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 ulib tests skip when build artefacts are missing, with a comment saying this happens with clang. This is fragile since a missing binary for any other reason is silently skipped. Use ubman.config.buildconfig to check for CONFIG_CC_IS_CLANG and skip explicitly when clang is detected. Otherwise assert that the expected artefacts exist, so a genuine build failure is reported as a test failure. Add boardspec('sandbox') to test_ulib_shared since it runs a host binary directly, which only works on sandbox. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 41 ++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 16af47fd840..957417ede31 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -16,6 +16,7 @@ def check_output(out): assert 'Uses libc printf before ulib_init' in out assert 'another printf()' in out +@pytest.mark.boardspec('sandbox') @pytest.mark.buildconfigspec("ulib") def test_ulib_shared(ubman): """Test the ulib shared library test program""" @@ -23,9 +24,11 @@ def test_ulib_shared(ubman): build = ubman.config.build_dir prog = os.path.join(build, 'test', 'ulib', 'ulib_test') - # Skip test if ulib_test doesn't exist (clang) - if not os.path.exists(prog): - pytest.skip('ulib_test not found - library build may be disabled') + # ulib is not yet supported with clang + if ubman.config.buildconfig.get('config_cc_is_clang'): + pytest.skip('ulib not supported with clang') + + assert os.path.exists(prog), 'ulib_test not found in build dir' out = utils.run_and_log(ubman, [prog], cwd=build) check_output(out) @@ -38,9 +41,11 @@ def test_ulib_static(ubman): build = ubman.config.build_dir prog = os.path.join(build, 'test', 'ulib', 'ulib_test_static') - # Skip test if ulib_test_static doesn't exist (clang) - if not os.path.exists(prog): - pytest.skip('ulib_test_static not found - library build may be disabled') + # ulib is not yet supported with clang + if ubman.config.buildconfig.get('config_cc_is_clang'): + pytest.skip('ulib not supported with clang') + + assert os.path.exists(prog), 'ulib_test_static not found in build directory' out = utils.run_and_log(ubman, [prog]) check_output(out) @@ -115,9 +120,11 @@ def test_ulib_demos(ubman): examples = os.path.join(src, 'examples', 'ulib') test_program = os.path.join(build, 'test', 'ulib', 'ulib_test') - # Skip test if ulib_test doesn't exist (clang) - if not os.path.exists(test_program): - pytest.skip('ulib_test not found - library build may be disabled') + # ulib is not yet supported with clang + if ubman.config.buildconfig.get('config_cc_is_clang'): + pytest.skip('ulib not supported with clang') + + assert os.path.exists(test_program), 'ulib_test not found in build dir' # Build the demo programs - clean first to ensure fresh build, since this # test is run in the source directory @@ -148,9 +155,11 @@ def test_ulib_rust_demos(ubman): examples = os.path.join(src, 'examples', 'rust') test_program = os.path.join(build, 'test', 'ulib', 'ulib_test') - # Skip test if ulib_test doesn't exist (clang) - if not os.path.exists(test_program): - pytest.skip('ulib_test not found - library build may be disabled') + # ulib is not yet supported with clang + if ubman.config.buildconfig.get('config_cc_is_clang'): + pytest.skip('ulib not supported with clang') + + assert os.path.exists(test_program), 'ulib_test not found in build dir' # Check if cargo is available try: @@ -183,9 +192,11 @@ def test_ulib_api_header(ubman): hdr = os.path.join(ubman.config.build_dir, 'include', 'u-boot-api.h') - # Skip if header doesn't exist (clang) - if not os.path.exists(hdr): - pytest.skip('u-boot-api.h not found - library build may be disabled') + # ulib is not yet supported with clang + if ubman.config.buildconfig.get('config_cc_is_clang'): + pytest.skip('ulib not supported with clang') + + assert os.path.exists(hdr), 'u-boot-api.h not found in build directory' # Read and verify header content with open(hdr, 'r', encoding='utf-8') as inf: From patchwork Mon Feb 16 01:34:53 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1885 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=1771205750; bh=mKR9+mxLSCKoiqHiUyaDmFQptHHSIgaYjjWhp/zFSMA=; 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=gxXmtypGWMIWHugxTUkAmgKecPDTfqi8hsf6VnOPxmI0YCCeKTbmFiWBMDZKOzWaa HLLnXuBLQZqYrXnF7SB24UGQhovSPTsS5bfSfC68qjhlT0Xr/ZW3vdN1I2gEMJ3+YA 1CMToEpuqzwL04h6cABNOVnsgRZuWnpyfkkKXSBgOSV4EBMlK99qiW7GoEFs2Rj+rJ h/69Mvzq7hq9Jj3/4ErIdc0/yIX7/MRFc24aWBswJCrrfdDJqRayUy5LluRfBnE4Tl irLbjfJdRgwSPGosabUwsMhVtCyHICv3kZYSXfLF6WTeYjfpFy3tNEmw3PRlhOdk8i aEM1Xakt1kVgw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 97A4B69BDB for ; Sun, 15 Feb 2026 18:35: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 10024) with ESMTP id IdEy3GMxNpen for ; Sun, 15 Feb 2026 18:35:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205750; bh=mKR9+mxLSCKoiqHiUyaDmFQptHHSIgaYjjWhp/zFSMA=; 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=gxXmtypGWMIWHugxTUkAmgKecPDTfqi8hsf6VnOPxmI0YCCeKTbmFiWBMDZKOzWaa HLLnXuBLQZqYrXnF7SB24UGQhovSPTsS5bfSfC68qjhlT0Xr/ZW3vdN1I2gEMJ3+YA 1CMToEpuqzwL04h6cABNOVnsgRZuWnpyfkkKXSBgOSV4EBMlK99qiW7GoEFs2Rj+rJ h/69Mvzq7hq9Jj3/4ErIdc0/yIX7/MRFc24aWBswJCrrfdDJqRayUy5LluRfBnE4Tl irLbjfJdRgwSPGosabUwsMhVtCyHICv3kZYSXfLF6WTeYjfpFy3tNEmw3PRlhOdk8i aEM1Xakt1kVgw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 84C4569BCC for ; Sun, 15 Feb 2026 18:35:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205748; bh=xoWvyh1DIBCeEMkUlfZyt7n/db7yPwLoRpipZyI59c4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L9d2HpVCd/VkYjsmV7oRAMesuD5r0DARjGl3ZadCQwsJQDD4I7f2mbDgNQgoC+bYx fvpIdgCUQCIQ9LOhPValgE/vhRUfZ+IuxWefln1RqoH/L3dZuZHFIp4tpCKG5hCGcv mkapCo/gOtpxmpJ4gbH+rMzRRwK5o1bgY/xpvS2o7q0IpUqzWwWkBuqGPmI55xknM+ GO5VcypdSPxumEx8OT2itjODO6H+CqO56UJrwChXFyS0ZUDoFt/KQ3kmwtdx9VsMzm yx2hIS3bbjMhBV218NySQUpUREwBtJMoC5u3lyMw9rykBQsHs81Bp9JlI0qb51eBSF Ozhu1CRzY7nQw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7056969B01; Sun, 15 Feb 2026 18:35:48 -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 N0YaMKIa9rxf; Sun, 15 Feb 2026 18:35:48 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205744; bh=YPMa/JxrK5Cw2ERILwlOmh7Jfi7JaLLBAaVdbntKNP8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=De0xVWfzI+5tmm2e0mAhdiuK8rR00knLZAIJsAIQVM+4n2uf+6MmvlRs1FPT1LaSN LmFDcq6QOUk4yywpyWJ50HawdzI4rw1bRpIoOs48Hef/dRBSI33enxUr3WksIBjoSk graJxZraIrepTkE3eGb7drxCkZEDI53q2shhBhi+wXTSoXGLadBcMoS/U8wLdvJq/v 72QtbsD5TfViEk0x9/+jYFop/GvINjR9InpH3MUSpShmYnIp2zjlPVaW3/R9Qxw/xW HE/82dy1SxUSzIAgjO5MwkawTXYuMqQoyuBs7SdsBkgOxjTHsLfGDJZzfqxMuu80tu gPjfWF6wut/dA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1B2AE69AD9; Sun, 15 Feb 2026 18:35:44 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:53 -0700 Message-ID: <20260216013511.4079770-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: OMIZPYNZYWLC3NH6ILHSYOWW3KWCISDR X-Message-ID-Hash: OMIZPYNZYWLC3NH6ILHSYOWW3KWCISDR 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 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/17] 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 The example build rules (link command, object lists, objcopy, and final-target logic) are duplicated in each arch Makefile. As more architectures gain ulib support, this duplication grows. Extract the common rules into scripts/Makefile.ulib-example, so that each arch's Makefile sets EXAMPLE_ARCH (and optionally EXAMPLE_APPEND_DTB or EXAMPLE_POST_LINK), then includes the shared file. Convert x86 to use it. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- arch/x86/Makefile | 31 ++------------------- scripts/Makefile.ulib-example | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 29 deletions(-) create mode 100644 scripts/Makefile.ulib-example diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 7df20c43de1..661e75fbdaa 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -65,34 +65,7 @@ u-boot-x86-reset16.bin: u-boot-x86-16bit.elf FORCE $(call if_changed,objcopy) endif -# x86 example targets: re-link U-Boot with example objects providing main() -# -# The example .o files are compiled via kbuild (examples/ulib/Kbuild). -# This re-links u-boot with those objects so the example's strong main() -# overrides the weak one in board_r.c, using the shared u-boot-link helper. ifdef CONFIG_EXAMPLES -INPUTS-$(CONFIG_ULIB) += examples_x86 - -PHONY += examples_x86 - -X86_EXAMPLES := demo - -quiet_cmd_u-boot-example = LD $@ - cmd_u-boot-example = $(call u-boot-link,$(example-objs),$@.map) - -# Per-example object lists (matches examples/ulib/Makefile:demo_objs) -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) - -# Binary targets (same objcopy flags as u-boot-nodtb.bin) -OBJCOPYFLAGS_demo-nodtb.bin = $(OBJCOPYFLAGS_u-boot-nodtb.bin) -examples/ulib/demo-nodtb.bin: examples/ulib/demo FORCE - $(call if_changed,objcopy) - -examples_x86: $(foreach e,$(X86_EXAMPLES),examples/ulib/$(e)-nodtb.bin) FORCE - @: +EXAMPLE_ARCH := x86 +include scripts/Makefile.ulib-example endif diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example new file mode 100644 index 00000000000..fd7c60e4483 --- /dev/null +++ b/scripts/Makefile.ulib-example @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# Common build rules for ulib example programs. +# +# Re-links U-Boot with example objects providing main(). The example .o +# files are compiled via kbuild (examples/ulib/Kbuild). This re-links +# u-boot with those objects so the example's strong main() overrides the +# weak one in board_r.c, using the shared u-boot-link helper. +# +# Required variables (set by arch Makefile before including): +# EXAMPLE_ARCH - architecture name (x86, arm, riscv, ...) +# +# Optional variables: +# EXAMPLE_APPEND_DTB - set to y to append DTB to the binary +# EXAMPLE_POST_LINK - extra recipe line run after linking the ELF + +INPUTS-$(CONFIG_ULIB) += examples_$(EXAMPLE_ARCH) +PHONY += examples_$(EXAMPLE_ARCH) + +ULIB_EXAMPLES := demo + +quiet_cmd_u-boot-example = LD $@ + cmd_u-boot-example = $(call u-boot-link,$(example-objs),$@.map) + +# 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) + +# 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) + +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) + +examples_$(EXAMPLE_ARCH): \ + $(foreach e,$(ULIB_EXAMPLES),examples/ulib/$(e).bin) FORCE + @: +else +examples_$(EXAMPLE_ARCH): \ + $(foreach e,$(ULIB_EXAMPLES),examples/ulib/$(e)-nodtb.bin) FORCE + @: +endif From patchwork Mon Feb 16 01:34:54 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1886 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=1771205752; bh=P1DWGyIEpfGNjkukUf9CpgCquRDJNt2Q9xW+uISMnPI=; 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=P/F1o2RivCfH09fMtorDWjTk3YhAgbfvNotGaTPGkEwxP4369prqWyDkKGbZzmx9a /a0T9CjX4CdEts8rgractdsmYZLdt3byfATcq/gkr5tjJbMkV7fNIR0nvIZafy/bjv m5MAI9cNAUvo2e9uc4xKHOUgjvHfXevlVJjT78e21j3sgQbnTKRjpkNXvfMbvHIVLd XCOXnfMvB8rE7DobRA0LOD/oYtB52oFIKsvm9mdEeTHzXE5MGrHNr8k1uh1Ed9Hs3u W0j3oO0wu0OWM+2gQC+SV5//dz0RX0VqLSmfPAJ2K/s/6N19yYKRXHi+TRPnbMWEi8 nJ5lT31qzg4Ig== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EE70D69B01 for ; Sun, 15 Feb 2026 18:35:52 -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 MBBlOWUYR4b1 for ; Sun, 15 Feb 2026 18:35:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205751; bh=P1DWGyIEpfGNjkukUf9CpgCquRDJNt2Q9xW+uISMnPI=; 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=StJ/bFQl8uSvyQa43m89VEE1m7xtSJpO/wbLUJ51IKjvK5DGm5KhTEL0Z0IJ2WJ0n a+pjKTMYZZxK/eDgJVJuTtkZcYjs8VR98EvKuOit/MeokGpP0/UrRAkky2+v5FiCwF r550p7lG+Ll8Ve5k89M+2lufrTtXI7IdRaDTfECgP1gI3nOqMr+QMJCpxyysbZCHXX 98yNJghUeCiJZLM+lpEE9KfqYv4ydY6r++milBURIuHrUZp5FAPBOnslMpuHLAAflp d7Vj7ogLdkmvCaHuTglEKtWE/RZqR31/bJKVsJ42rNdDLLCJVc2m0h8Vee5VrAqyi8 TpGIgj5EA3a/Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 455D869BDD for ; Sun, 15 Feb 2026 18:35:51 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205749; bh=Z+HUXhz6h2tiS64Tv/7wr64cfpHqGhQPAIhzqBwWkaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tut7lozqLKq2TdGnD0+L/KTu7wbPkw0LG44Cvn5tXdl/JCpkO1hKb0UVyjWR0iXVu ATsZTr6YJpWtLia+VVDdZaaSCPEotObpIZhr1Yib+47jgPn6dkXaPhIVqBoI2ZLGd/ a9kvdYQdn/nysBU/nge3Zj9SJSDWbLBlVl6lg9SF2qwkwORBwAEULK4/hux9lt1jsM 8+ELmbwdYu1m/jfPxt2ZeYix6BspfdmnJjhIVNtYiIdjdAsfcFC1d4bGZH2ooi0zTM 7cxafVjWK+YAvjNpiAMwcktnWqwZQrcjj1LpFW+zRghYts3pVCVwWjylazECSOvOJQ rHy1N2e84LcfQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6066869B01; Sun, 15 Feb 2026 18:35:49 -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 PJurQAa9BGhC; Sun, 15 Feb 2026 18:35:49 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205749; bh=eBswu9vi9d7TXOtxThaWNzMdlLeinR1kx3o1VKo8Fms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYzHgwmGVKCGIirm3LTZ67uDJOHLFdzQDnymg42+SEZr1EMuX/uA+DJ/QwZ8jVE6Y F+yar8airKjgKB4elH3cIbVcct4otJ8LxFO5IMQ3KZx2FUg0nBY9oWz4Ef72IPKM4i O64MMaS7YWOYJQ9oQiQd9RYvRRqLTJyPnwdENcsv+P27cDZYzrtH8flOW7SSgsVIWu mPHYy5/nOVvQtivxg5Y2kInoc85IOnl3b9QjVDsnZxhtfsILQKFoaRGZQg865IwR5M sUIAn/Z4H0W60RJnTTjtwOI2mET4JpqUumBS1Vl2EA+oF7lFL6y7inMmjjQ6nQxpyl S5EbfSC3RelKQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B70D369AD9; Sun, 15 Feb 2026 18:35:48 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:54 -0700 Message-ID: <20260216013511.4079770-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GRLZ665DLJLRRLM4F3VZXV33UQER25JW X-Message-ID-Hash: GRLZ665DLJLRRLM4F3VZXV33UQER25JW 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 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/17] ulib: x86: Add demo pytest 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 Enable CONFIG_ULIB and CONFIG_EXAMPLES in qemu-x86_64_nospl_defconfig so that the demo.rom binary is built. Add test_ulib_demo_rom_64() which boots demo.rom under qemu-system-x86_64 and verifies the expected output, following the same pattern as the existing qemu-x86 test. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- configs/qemu-x86_64_nospl_defconfig | 2 ++ test/py/tests/test_ulib.py | 37 ++++++++++++++++++++++------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/configs/qemu-x86_64_nospl_defconfig b/configs/qemu-x86_64_nospl_defconfig index 4452b8c6e0a..950d2d2e419 100644 --- a/configs/qemu-x86_64_nospl_defconfig +++ b/configs/qemu-x86_64_nospl_defconfig @@ -79,4 +79,6 @@ CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_GENERATE_ACPI_TABLE=y CONFIG_CMD_DHRYSTONE=y # CONFIG_GZIP is not set +CONFIG_ULIB=y +CONFIG_EXAMPLES=y CONFIG_UNIT_TEST=y diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 957417ede31..b1ce5792801 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -221,19 +221,26 @@ def test_ulib_api_header(ubman): assert 'ub_snprintf(char *buf, size_t size, const char *fmt, ...)' in out assert 'ub_vprintf(const char *fmt, va_list args)' in out -@pytest.mark.localqemu -@pytest.mark.boardspec('qemu-x86') -@pytest.mark.buildconfigspec("examples") -def test_ulib_demo_rom(ubman): - """Test the ulib demo ROM image under QEMU x86.""" +def run_x86_rom_demo(ubman, qemu_binary): + """Boot the demo ROM image under QEMU and check for expected output. + + Locates 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-i386') + """ build = ubman.config.build_dir demo_rom = os.path.join(build, 'demo.rom') assert os.path.exists(demo_rom), 'demo.rom not found in build directory' - assert shutil.which('qemu-system-i386'), 'qemu-system-i386 not found' + assert shutil.which(qemu_binary), f'{qemu_binary} not found' + + cmd = [qemu_binary, '-bios', demo_rom, '-nographic', '-no-reboot'] - cmd = ['qemu-system-i386', '-bios', demo_rom, '-nographic', - '-no-reboot'] with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: try: @@ -250,3 +257,17 @@ def test_ulib_demo_rom(ubman): assert 'helper: Adding 42 + 13 = 55' in out assert '=================================' in out assert 'Demo complete' in out + +@pytest.mark.localqemu +@pytest.mark.boardspec('qemu-x86') +@pytest.mark.buildconfigspec("examples") +def test_ulib_demo_rom(ubman): + """Test the ulib demo ROM image under QEMU x86.""" + run_x86_rom_demo(ubman, 'qemu-system-i386') + +@pytest.mark.localqemu +@pytest.mark.boardspec('qemu-x86_64_nospl') +@pytest.mark.buildconfigspec("examples") +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') From patchwork Mon Feb 16 01:34:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1887 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=1771205753; bh=R6aPMhV27Qvq3a5q9JKS/ZhqvfNH7Q8Xo4SQtuAmQG0=; 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=UuT0i7RehqP1O/mqAHLoKsI/Hoon8ESJ7wECo9xJhGC/RAHkRo+3pHe4B9A2vRRLJ eu7gRIE9xwGC+jS3pXW5DiV4iry6ooObFyWcctcVyiJpvyIPp+IdN2umbUmVIcGSkG MWTSTSeuAquZcZ4x/QJdIIUqugkBr/dvX3HzjqZWOwE4Ng2mrtQUe5+h469Xh1DSYu W1pQy3dp6ai8jg9tsGVql4SCtTqchdUU+/G6rWhpuwd7Q890bXbTmbjAzqzWy+wA2j N4Q2zT54nauOkHz+bp75PNqrnhcqyb5jCabUu14f4oCqtKzLdnXek2hysbbjQFckg5 zeM/iifm+LWYw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 56CE669BE1 for ; Sun, 15 Feb 2026 18:35:53 -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 VR67TiWvT3kv for ; Sun, 15 Feb 2026 18:35:53 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205752; bh=R6aPMhV27Qvq3a5q9JKS/ZhqvfNH7Q8Xo4SQtuAmQG0=; 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=s/lLmjtZgeJaH1UdLYUv5OJX7VxoLOHBdRXP2zbzd9kCGvK/VocjA1H6VSnZLG+l6 wCciREztEkUW/tTZT+lUTnAMRhDxs6yfeDXvYfZQJyN0iGiYynEyjJ7f0Tb529PLYO 1mxSb/fwA9E7nqYPC7FCO2O9qZlZknSa1SibEHzQ4mqCf/uVYDn5w+Hi3ya4KklZ3F rmRiU6u70cxTOyYa6IIQcLtQZmi8aBnW77ITXCc8YwQGWrP0yC2dViO4ZVGeJP0MUq FY0n6Uv6iHVcHQjFFAXrnhCFCQ6sI2XNumSdIOTa2u5/8osF9zpfSkU2eveUGDNjSU 1oz6MEkB3i8jA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AC44069BDF for ; Sun, 15 Feb 2026 18:35:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205750; bh=tXg75FOD/AkOBRSDYHMFwdaIo9Pg+8NMwfgIzYlOkOk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hiagr2NozGTW9iMVf2PEWWGMnAJ8vFibYaxvStUwOzmDa5up6iXzuk9i0NOjkX+0E T7nQKZMYaj5RMIX1NXDPfPPloIP/ZQjGuyAztf501jX1Bf+yzFgQIedLRYJrwaM18K RrBR0qFSDOVIXnqOL4p+Juft+dag0062mdhh4NlgCfgaA6bA1xzrKe8AXqVDkmrc5B 66RCrTnMI6iNkMdCDdKUBFN6zeh8tzDm7gFjw5XgFCAdKPCG2xikfgCzABRROKUOuY ywJlBIEosZK4fQd3OqfDasEeE/rU0KoQUyzl77HNF7SY8fCQv8nRf2gGy3r6dbdwj7 ujZgHOcmQ7Gtw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4D98B69B01; Sun, 15 Feb 2026 18:35: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 mlrVwQm4NwJu; Sun, 15 Feb 2026 18:35:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205749; bh=ShJtPLVg4405ZpA6+d6fo+FYgEurxmx/A2gtkun+fI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f2KUA5GLEkNGd1pqEtNn/aiKVTzRm7F65hTNn6vRuGfVM942gikBO8/R3AuUS5sYZ HLiF9lDhODitMIftYo7Ts/NXWDvJW/Ex1HS9poB8aVw/u7R8l23xMvpUh0yLk3glIs dbg95QimI2tHvKT1HthcJRC1C6guqAI2CO8eOsuwksIXsjtvBKTwR3pwgeOO3ki6aI gYDpp/+WvHs/YXvxYz26mCcDc+5+ZYeZKOK4Nbz7F5gqOeEHKomstZTvcdP2jb41PO LjMswH9SajGH0R4RhdXdGUEmldZf8XtVRpc0xl8BSks12qJfHjvjD5BRx0/siudPgm hrp30VrLrnMQw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9DC8069AD9; Sun, 15 Feb 2026 18:35:49 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:55 -0700 Message-ID: <20260216013511.4079770-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7OWPN44RKYT6UIOSPCQ2L5LYSWYSTDMC X-Message-ID-Hash: 7OWPN44RKYT6UIOSPCQ2L5LYSWYSTDMC 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/17] ulib: arm: Add demo binary and examples 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 Add build infrastructure to compile and link the ulib demo for ARM64. In this case, arch/arm/Makefile re-links U-Boot with example objects using the u-boot-link helper, so the example's strong main() overrides the weak default, then creates demo-nodtb.bin and appends the devicetree to produce demo.bin Unlike x86 which uses a ROM image, ARM64 produces a binary that is loaded directly via QEMU's -bios parameter. Enable CONFIG_EXAMPLES in qemu_arm64_defconfig so the demo is built by default. Add a pytest which boots demo.bin under qemu-system-aarch64 and verifies the expected output. Also refactor the test code to share QEMU demo helpers between x86 and ARM64: run_qemu_demo() handles subprocess execution with timeout, and assert_demo_output() validates the expected output strings. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/arm/Makefile | 6 ++++ configs/qemu_arm64_defconfig | 2 ++ examples/ulib/Kbuild | 2 +- test/py/tests/test_ulib.py | 68 +++++++++++++++++++++++++++--------- 4 files changed, 60 insertions(+), 18 deletions(-) diff --git a/arch/arm/Makefile b/arch/arm/Makefile index 90e7d33c881..9c521a11f29 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -124,5 +124,11 @@ ifneq (,$(filter $(SOC), kirkwood)) libs-y += arch/arm/mach-mvebu/ endif +ifdef CONFIG_EXAMPLES +EXAMPLE_ARCH := arm +EXAMPLE_APPEND_DTB := y +include scripts/Makefile.ulib-example +endif + # deprecated -include $(machdirs)/config.mk diff --git a/configs/qemu_arm64_defconfig b/configs/qemu_arm64_defconfig index 4e0bfa3a572..507c08bc514 100644 --- a/configs/qemu_arm64_defconfig +++ b/configs/qemu_arm64_defconfig @@ -76,3 +76,5 @@ CONFIG_TPM_PCR_ALLOCATE=y CONFIG_GENERATE_SMBIOS_TABLE_VERBOSE=y CONFIG_UTHREAD=y CONFIG_UNIT_TEST=y +CONFIG_ULIB=y +CONFIG_EXAMPLES=y diff --git a/examples/ulib/Kbuild b/examples/ulib/Kbuild index 88d6a805b91..f1f0131ae11 100644 --- a/examples/ulib/Kbuild +++ b/examples/ulib/Kbuild @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0+ # -# Example objects for x86 platforms (compiled via kbuild, not linked into +# Example objects for platform builds (compiled via kbuild, not linked into # u-boot). The standalone Makefile is used for sandbox builds instead. extra-y += demo.o demo_helper.o diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index b1ce5792801..94d40256c59 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -221,6 +221,39 @@ def test_ulib_api_header(ubman): assert 'ub_snprintf(char *buf, size_t size, const char *fmt, ...)' in out assert 'ub_vprintf(const char *fmt, va_list args)' in out +def assert_demo_output(out): + """Assert that demo output contains expected strings. + + Args: + out (str): Decoded output string from QEMU + """ + assert 'U-Boot Library Demo Helper' in out + assert '==========================' in out + assert 'U-Boot version:' in out + assert 'helper: Adding 42 + 13 = 55' in out + assert '=================================' in out + assert 'Demo complete' in out + +def run_qemu_demo(qemu_cmd): + """Run a ulib demo under QEMU and return output. + + Args: + qemu_cmd (list): QEMU command and arguments (e.g. + ['qemu-system-i386', '-bios', 'demo.rom', ...]) + + Returns: + str: Decoded stdout from QEMU + """ + with subprocess.Popen(qemu_cmd, stdout=subprocess.PIPE, + stderr=subprocess.PIPE) as proc: + try: + stdout, _ = proc.communicate(timeout=5) + except subprocess.TimeoutExpired: + proc.kill() + stdout, _ = proc.communicate() + + return stdout.decode('utf-8', errors='replace') + def run_x86_rom_demo(ubman, qemu_binary): """Boot the demo ROM image under QEMU and check for expected output. @@ -240,23 +273,8 @@ def run_x86_rom_demo(ubman, qemu_binary): assert shutil.which(qemu_binary), f'{qemu_binary} not found' cmd = [qemu_binary, '-bios', demo_rom, '-nographic', '-no-reboot'] - - with subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) as proc: - try: - stdout, _ = proc.communicate(timeout=5) - except subprocess.TimeoutExpired: - proc.kill() - stdout, _ = proc.communicate() - - out = stdout.decode('utf-8', errors='replace') - - assert 'U-Boot Library Demo Helper' in out - assert '==========================' in out - assert 'U-Boot version:' in out - assert 'helper: Adding 42 + 13 = 55' in out - assert '=================================' in out - assert 'Demo complete' in out + out = run_qemu_demo(cmd) + assert_demo_output(out) @pytest.mark.localqemu @pytest.mark.boardspec('qemu-x86') @@ -271,3 +289,19 @@ def test_ulib_demo_rom(ubman): 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') + +@pytest.mark.localqemu +@pytest.mark.boardspec('qemu_arm64') +@pytest.mark.buildconfigspec("examples") +def test_ulib_demo_arm64(ubman): + """Test the ulib demo binary under QEMU ARM64.""" + build = ubman.config.build_dir + demo_bin = os.path.join(build, 'examples', 'ulib', 'demo.bin') + + assert os.path.exists(demo_bin), 'demo.bin not found in build directory' + assert shutil.which('qemu-system-aarch64'), 'qemu-system-aarch64 not found' + + cmd = ['qemu-system-aarch64', '-machine', 'virt', '-cpu', 'cortex-a57', + '-nographic', '-no-reboot', '-bios', demo_bin] + out = run_qemu_demo(cmd) + assert_demo_output(out) From patchwork Mon Feb 16 01:34:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1888 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=1771205758; bh=yOt9SaKWw4HyOO1DN7h8g56ZjTqsv6dZ9+7gpPEJ/6o=; 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=Q/drknxcngrMsMl7u0DYOOwP4oqdJw/De5eD2XUHpw7a8V5vw5n+o5Pdmp/P7BY2v rOiGR+PCMa/HG+n2wd1q+yKz3hEiCTAyqx/1OdkPQkgc5B8mR2OQweHi+GH+72Shja vlMSfQ8T8nSjay3mKLlC6iPDP1fC5rX5ByfsVpynFOowoCZwh32wpZ3o8fXbVQGAOp 7/hSPBmP6CTn7wukAWbLl/VxPPbrhIZLgxoTZXUGOqa4YJotTEVugHoPY01naEljwA JREsjNc+29uiPDlXmpXv4jHU4FVNy2OZcdWdq1mtU6UEJTdVJHVbssbRIJCIT2ioam 1z3D+Q+MiGdww== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7939A69B01 for ; Sun, 15 Feb 2026 18:35: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 sDo0Juyl8t_f for ; Sun, 15 Feb 2026 18:35:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205758; bh=yOt9SaKWw4HyOO1DN7h8g56ZjTqsv6dZ9+7gpPEJ/6o=; 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=Q/drknxcngrMsMl7u0DYOOwP4oqdJw/De5eD2XUHpw7a8V5vw5n+o5Pdmp/P7BY2v rOiGR+PCMa/HG+n2wd1q+yKz3hEiCTAyqx/1OdkPQkgc5B8mR2OQweHi+GH+72Shja vlMSfQ8T8nSjay3mKLlC6iPDP1fC5rX5ByfsVpynFOowoCZwh32wpZ3o8fXbVQGAOp 7/hSPBmP6CTn7wukAWbLl/VxPPbrhIZLgxoTZXUGOqa4YJotTEVugHoPY01naEljwA JREsjNc+29uiPDlXmpXv4jHU4FVNy2OZcdWdq1mtU6UEJTdVJHVbssbRIJCIT2ioam 1z3D+Q+MiGdww== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 659C469BDB for ; Sun, 15 Feb 2026 18:35:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205755; bh=9yYWNYVRp6XWBs4xJKffYObcrz0C7txLZiNQFXsUcpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIub3iCMciP1qZ4+e72BCoEYfw5TEgtuA6hhjzEdCPWHaIW1XlczYor264KHqclNL Pr3+NhMhRIEjpejvPtzL+WNZclxgNt7P87i3s/fDc/K6A8+C50m9A8wQgvsc5bjC2t 2UY7SdyGBGZFvEjJB6hDwp4a9JHryVWbLJy0ZY8YbUqD0EE1uGXnN0aEZH9hqumZsG 72GYdm/luWSAPWMOoQA2lAxlsqrMDVuKQL0/trMH0pnpEovqDSdXV5EEA95Law19qo e1tX6v/atlF6aukOIXe8SWpOAzowCM4XLluGpnW5gRX+9bFkuIYvtOdQH2zcuygqzF Ajd4XMAwLOSVA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A50FC69BDB; Sun, 15 Feb 2026 18:35: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 2LD_z1rnpk5a; Sun, 15 Feb 2026 18:35:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205750; bh=bZ5AD7r6XWawSYy+XBNB1RE4Y2FFxC+rudM1itgs6AU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sk8shJOAmrnV0hxWiMGSFqTuz6r3EUzD+dCppJJialx8XHWj/pZLiyG/DzFB1/DOI fD50zBIXTtsgJGuDbtCtMPvuPuwab5gYOnwgosJ38CbGMLJTfDIDrFIqLenAdhv2tU sudTok0hc58BDGz6FlScabJ7T0wcom1P9dFLPWd8+kpeEzFziltpGS2lsWrAn1xPXS zzSpqWHpJFtn1xVH/nn2GWs5uq1LdEPEqavwTK89AYBRNGCkXpPjaT6W9++D7UKhkV 1/92ONJR/H6k60eXyHJuiLOhr0dJlUkqjSOnK5hT3A3TLFAxu0ds5nC0b+wC9/jChF RB/gPVyMtXWPA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8F8F869AD9; Sun, 15 Feb 2026 18:35:50 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:56 -0700 Message-ID: <20260216013511.4079770-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 3RPB3VB2SAOMJNQ3UPLYH24LIVIU5XEJ X-Message-ID-Hash: 3RPB3VB2SAOMJNQ3UPLYH24LIVIU5XEJ 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/17] ulib: riscv: Add demo binary and examples 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 riscv64 example following the same pattern as ARM64. The demo binary is re-linked with the example objects and then run through prelink-riscv to resolve GOT entries, which is required for RISC-V static PIE binaries. Enable CONFIG_ULIB and CONFIG_EXAMPLES in qemu-riscv64_defconfig and add a pytest for the demo. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/Makefile | 7 ++++++ configs/qemu-riscv64_defconfig | 2 ++ test/py/tests/test_ulib.py | 42 +++++++++++++++++++++++++++------- 3 files changed, 43 insertions(+), 8 deletions(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index aaa5a02e17c..afae33812e4 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -62,3 +62,10 @@ endif libs-y += arch/riscv/cpu/ libs-y += arch/riscv/cpu/$(CPU)/ libs-y += arch/riscv/lib/ + +ifdef CONFIG_EXAMPLES +EXAMPLE_ARCH := riscv +EXAMPLE_APPEND_DTB := y +EXAMPLE_POST_LINK = @tools/prelink-riscv $@ +include scripts/Makefile.ulib-example +endif diff --git a/configs/qemu-riscv64_defconfig b/configs/qemu-riscv64_defconfig index 6b2fed4ad16..4423d36b782 100644 --- a/configs/qemu-riscv64_defconfig +++ b/configs/qemu-riscv64_defconfig @@ -22,3 +22,5 @@ CONFIG_FLASH_SHOW_PROGRESS=0 CONFIG_SYS_MAX_FLASH_BANKS=2 CONFIG_UTHREAD=y CONFIG_UNIT_TEST=y +CONFIG_ULIB=y +CONFIG_EXAMPLES=y diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 94d40256c59..71fe751efc9 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -290,18 +290,44 @@ 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') -@pytest.mark.localqemu -@pytest.mark.boardspec('qemu_arm64') -@pytest.mark.buildconfigspec("examples") -def test_ulib_demo_arm64(ubman): - """Test the ulib demo binary under QEMU ARM64.""" +def run_bios_demo(ubman, qemu_binary, extra_qemu_args=None): + """Boot the demo.bin binary under QEMU and check for expected output. + + Locates 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-aarch64') + extra_qemu_args (list): Additional QEMU arguments + (e.g. ['-cpu', 'cortex-a57']) + """ build = ubman.config.build_dir demo_bin = os.path.join(build, 'examples', 'ulib', 'demo.bin') assert os.path.exists(demo_bin), 'demo.bin not found in build directory' - assert shutil.which('qemu-system-aarch64'), 'qemu-system-aarch64 not found' + assert shutil.which(qemu_binary), f'{qemu_binary} not found' - cmd = ['qemu-system-aarch64', '-machine', 'virt', '-cpu', 'cortex-a57', - '-nographic', '-no-reboot', '-bios', demo_bin] + 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") +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-riscv64') +@pytest.mark.buildconfigspec("examples") +def test_ulib_demo_riscv64(ubman): + """Test the ulib demo binary under QEMU RISC-V 64.""" + run_bios_demo(ubman, 'qemu-system-riscv64') From patchwork Mon Feb 16 01:34:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1889 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=1771205761; bh=UTZqlyE0zpA495N4h/7f6AxnncfFlQ7Gtn3bC9FCeUo=; 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=kh9diUa0w/QeLiNcOX9JWpnCA4PIethxTn7i5do8rK8lE32/pneEC++4uHHgkJRpX OQssLzP/g4RsgAosc3uJq98tCY/btvgdLhKnd5gA7OpWxMkSEwXDlRt908QfVoP2+/ kbXHKHETyR9iY6KZaPoNs/lG+i6TM8z+jB8Z+VA/ypLRppOfnpxYUFwyRz4Nj0IaSV SOWDJMH2p7CPNH7yn3/7ntKkW9R0QLV8sQf9XC2aI9EcmPhI9GB6OJB3oCRBeH9h5A VcSXiJSfR/d0niMXAKQzvU0OzZgysgs4/Rz/+VN2HJ1HleNZx8p7T0Cr7Rr3/2mf8u zTkqh6/0rqX1Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0C4F169AD9 for ; Sun, 15 Feb 2026 18:36: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 1cpjp1HuuZkz for ; Sun, 15 Feb 2026 18:36:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205759; bh=UTZqlyE0zpA495N4h/7f6AxnncfFlQ7Gtn3bC9FCeUo=; 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=l1YCNI6ZXm/jNa2rX1QwYcew63Zn4CnaRSkwU1BHuPGbIrrD3aPwdMHu1DRR9Q2Dt wa6b27G3NqXOqzPvkU9CygRYpjaUTcyC6HPhcXNZBNY46JpPIl6D8r3UnN2kQnpIMc NeyO8I7i0WndU0PY+qF1kzO4G6o3MNR82v+qV6k5G9VV2s1pB2eEd0CE+ydPUU5XoC U1rr3/qGPQrS0oR2IR0u52eC7U8UjDYPCIJQxLz4/TiyR47GVKnT0sKGHFSiKtD4TX 5k6kmoPayNbqRmGi44nmf9af5gP+ysGJmk9IysaTGGkim16ytivpLYU9VUOotMg3nc D2moKi20KTw3g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1E11669BE5 for ; Sun, 15 Feb 2026 18:35:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205755; bh=RNhzgwUarEoxbwYROEC22IZ/g6d+9mGDyOLqT5GgOjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iS2b0bGUrYvmEjPA53Fod+f2hwHpx9vLHKLQM0VrAPjglJsRHvke0w7AtAc+FTceX xeMYNkeONi2snKDsT70Mv2klR0VSjd4dCl0oCI5//RLx0m2NNjEQwhvYgTJoFBGdNQ 8Z9JLYV1+Ftn6xvhbCKF7MDM0MnT9PGlpXl4HZ0gQ4T0TnNVLW89mSlyFvHWiGstym iPGjGOZ7YfGf7blDOaCHxYla1kzgzp4JeHLcSqaIjlzQztvIHDC5qoYubeQMHx2V+f vfhe6SM5naVKaxLJFbY7tqwtO11fGdlpBmt3oZD/aEJvPqJezyH7/L5Md8+ZwuPVXw rZ/aKkNspHCNA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BA81F69AD9; Sun, 15 Feb 2026 18:35: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 VKlMcQuTAVNj; Sun, 15 Feb 2026 18:35:55 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205755; bh=Dy9O0eKWwRwjg9rckvsoxAoE9HfyodiyMfan763lOb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cShAdxOHJ6+YdfAFMim/7F0FPH8I3LCj1HvpSuN0h77w/6YVVjNdotiQzzzMZNJw4 /CqrHoXU4patXxXB9ylqJURgZdC6BP8z9EOL8eALPWTTuCcl9FFqYlR4atE0iSFukM qvvwG721S1vRo/1XKyICuocF7P+ZKtOzuUqkEBL0vN+4HfljY2MVT8DtVxOMZkQ0EM Ny+d2BZX/Ii7BOBs7cOSOM33q7zSvhaWCwSc8xwBbEcW2QiCuKczWFKsxfpSU1XJku 5ak56z805o9hTJiUB9WWn5Jma1bplLg53Gi8De4oayb2UiIQQ8ei9OY4ymiiwUsYG/ 3LM4uY6ryoyAg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2E09A69B01; Sun, 15 Feb 2026 18:35:55 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:57 -0700 Message-ID: <20260216013511.4079770-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: UMIFGBFD3RMGPS43B2TDIJTAYGEBS3YR X-Message-ID-Hash: UMIFGBFD3RMGPS43B2TDIJTAYGEBS3YR 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/17] ulib: efi: Use ulib_has_main() in efi_main() 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 entry point currently hardcodes is_ulib to false when calling efi_startup(). This means EFI app builds cannot run ulib demo binaries, since the GD_FLG_ULIB flag is never set. Use ulib_has_main() instead, which returns false by default (weak symbol) but returns true when a demo's strong version is linked in. This allows the same efi_main.o to work for both normal U-Boot and ulib demo EFI binaries without needing a separate source file. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- lib/efi_client/efi_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/efi_client/efi_main.c b/lib/efi_client/efi_main.c index e94460c86e1..dfd44695227 100644 --- a/lib/efi_client/efi_main.c +++ b/lib/efi_client/efi_main.c @@ -8,13 +8,14 @@ #include #include +#include efi_status_t EFIAPI efi_main(efi_handle_t image, struct efi_system_table *sys_table) { efi_status_t ret; - ret = efi_startup(image, sys_table, false); + ret = efi_startup(image, sys_table, ulib_has_main()); if (ret) return ret; From patchwork Mon Feb 16 01:34:58 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1890 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=1771205761; bh=ZGPffVSkY2mm0RetqAPzPqvolQ3+hQj9A3OSba+sRmU=; 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=v/npHZngUNTcAFoMKsj5eqe9x+RJIod/uyHM3MbpmPFlOg/hn51zeuOPoKf9QKE7S a+FfCDe0SKnrl53a8/Va7w6Uo7HcdxPlonHhxvkevI5H3ulUaHstojNR6CRnOcHd0F YYbgUO8VihS39jIK+rdK4p3hwoBmPHS1DSSr7i+QA2+mseZvDkh2bo6VVHh2eVsgNO QKEYZsdX3niNA5hsOZCFZTN8wJZPberom3fwW4vbKcWgYVa7NfrbIz9X7w1tcG7M7H gjKJO/TsVGApaIHitWyGno7uLXTEjdqefNJ/vxRQhmr5obdH17QwCKlog+lMSrKQZr jP/XEKgiXtagw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4979B69BFB for ; Sun, 15 Feb 2026 18:36: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 0-uQxNm458zT for ; Sun, 15 Feb 2026 18:36:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205760; bh=ZGPffVSkY2mm0RetqAPzPqvolQ3+hQj9A3OSba+sRmU=; 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=LYLdjw111yrAv2YHUyw/6czXCnhNzQgNNi8Nk7aaLFDztRLrYk3kiuRv9KYq690Bt AdhDPccwQj7223D45Z6znT+aKO7xh10hTCoY1KJAD+YfkS8mHNPe+K+GHUbDvbpKBj c3fL6IC8kmJaJgx3LPOzLvp3/x5kp6KG5CmgO5LJMtMB1n2lkrTXfxcL3ZejKXREMN B7UHqiGQ0B/TG5gxgincne3oA8hQkYpdo6fyvpaTNLSkc4dooo4t3rHodhhfzKYSTB rp3SiJoPdYhXzbo+WybOKxKKReMIb27RilWTMmQN/gVsvnxiriY8ODRB2jQqGwLw6j gIA8Onv76MlDw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3B8C969BEB for ; Sun, 15 Feb 2026 18:36:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205756; bh=/QkljqKmwpUYbyvcLW62xkXcxzNzLYCwnrHjpYxCtaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LcoGJR/FJzRmu7lbVOATqHkq2hJR/Raaq7jmDXp/6uLqicQbgofgJW1SFQGFwmbWb 7G1vECqYbE2yskyfg/piN5ulBorSnfIXKRJuP3WFFe0ADLoA6bVk+rYhf0VjMJO21O l/ILAoXbyLvs0oKuu+ILE2viVHQ6/UnK1rXMLtI1t1lV+wETVHMYYT0o6lfXLRYgqN tMRW7+Jh21PXMBwuSFjRY8AUNTgNp/nFUlBXJudb0D86mL1H8IdhIgrotcCJ/1BgKz ct7Na48KPReDKyJ3z/yRAKoBtk55JDMu7KbySts1w5JfHntXAxnnzk3+CyiA5ee9Y2 roCLFN+fdZ6lQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8589C69AD9; Sun, 15 Feb 2026 18:35:56 -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 QbuSZ8xTxrUn; Sun, 15 Feb 2026 18:35:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205756; bh=pRL4uo7mDyiJyiGKLRUGpOimNUR765Q/Il+xPS7WQ/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d2oAPbmHTt6N8C9ERfs264kKEV4fD/UB62RiiL+lIRZpRKUXeJtsQIvSUyy0Sp4I/ rMmygMQozkLmgp4t7ZcTNFSJgnF8MOriVLgygCeg9fAVxXfUiIdkROsHJgRgN1BHeO TFAvYgM78YR5QbLHOZ5aI4dEoEII+WZXR8O1xFzXlu3DqCb/ie7mIEwAW51yJDNdMB TWo3Ee7rnNLrAzKmoUxf5udtDZuqy8l4TCSmPbggDFrRhKQYOJL71D8jYnHQAEMdKD 29/X8xA56HkWvV+eIe+hS1OPr8OcLx1yh+TNbtbHzqiDTswjod+s78leRB4eledLrQ 3ebFimUEi0irA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0422F69B01; Sun, 15 Feb 2026 18:35:55 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:58 -0700 Message-ID: <20260216013511.4079770-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 53OBCLDKIL6IHNFMLOTTS4D3RWYI3BVM X-Message-ID-Hash: 53OBCLDKIL6IHNFMLOTTS4D3RWYI3BVM 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/17] ulib: x86: Add demo-app.efi target for EFI app builds 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 x86 example targets currently only produce raw binaries (demo-nodtb.bin), which do not work for EFI app builds that need PE format output. Add an EFI-specific path that embeds the DTB and converts the demo ELF to a PE binary (demo-app.efi), following the same flow as u-boot-app.efi. Non-EFI builds continue to produce demo-nodtb.bin as before. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- scripts/Makefile.ulib-example | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/Makefile.ulib-example b/scripts/Makefile.ulib-example index fd7c60e4483..575dedcfbf2 100644 --- a/scripts/Makefile.ulib-example +++ b/scripts/Makefile.ulib-example @@ -31,6 +31,17 @@ examples/ulib/demo: $(example-demo-objs) u-boot FORCE $(call if_changed,u-boot-example) $(EXAMPLE_POST_LINK) +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) + +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 @@ -49,3 +60,4 @@ examples_$(EXAMPLE_ARCH): \ $(foreach e,$(ULIB_EXAMPLES),examples/ulib/$(e)-nodtb.bin) FORCE @: endif +endif # CONFIG_EFI_APP From patchwork Mon Feb 16 01:34:59 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1891 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=1771205761; bh=iRZbN3RQiQe9E3d9HAAEbIYBf8u1WFuzTK+mJEdlPtM=; 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=sYIGckryxuLoQTcd+uEXKADWpY5wZWOWstAU5Bx9uifO+zgOqkxKe2iBCeIIjB6Wy rz4Pq4CYKlORGWPTMNDyaHIDTE95O2wZYxWvyZxGs4bSu/RMRH26iTEapxA54S7e06 jv+NofoaEl5Nxp/u1CfmwqfJhXA4bLS8QosKGAj2YVVc426zd7+uaxbA6tn7IIaxmE JavzYCmb6Vmwfj77sEHTPLAslqAMc1z5JudgiHommOLwAHVT35dtq6K5GG051tLDIP kPe2VPNDlDxLgkJibCh7l4mekR11MIh098L9G7l9jcpBLuYszoKQyPtiQF8L/7OkF6 Oa6Ei1ckmVviQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9C87869B01 for ; Sun, 15 Feb 2026 18:36: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 O7YoAhjLxJ_O for ; Sun, 15 Feb 2026 18:36:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205760; bh=iRZbN3RQiQe9E3d9HAAEbIYBf8u1WFuzTK+mJEdlPtM=; 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=a56qsl8jiEt5g4ukqGqEqFGfus2TQaFXkz05Dx+l5FyDX9Qmj5Hcw+ZYr+QD6dX4O QmLZqfETYLWHNdthH1E0C7BGRFb41O5lvq0OnurcIX1RP68z9asEHw26zM3GHIk3gB 3man2qu4SGPGgf59yTm1iyj4i2lilcwMi9X5NE8hknj1Qg/FVQUE++VpmxFtSL6BQb JnPF+TC0vN4l/y40fm4G84tWo5kV9LTUV8q4MN0EsuE8uUEbaofnnHPIhXBSNIRV5h doSkGQJqzPHwBdAJCTtGagO36p4YaeV5U/XV17i0DOUHsPBCFaYemlRmg4tfY9Tx78 l7OatUPUqcVXg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BA30E69BF1 for ; Sun, 15 Feb 2026 18:36:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205757; bh=dgGOzPQhGtAyJewf2rAgq3ShvL0575CQBZB69AC3/As=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vUIoyK3gLC8Vl8Ad1cvCynWHjd85qkdHaRSFMzfeHDIWDQVEo3zm/zD4fmHk8wrXj poLuDGRA/TrxJaLjxE7GLxyraPmWIRjs5LsLvuR4f8IicrBva8aMp2SKn7ya+VHx+u saNvVWYv1/yDb5sDv0BTAWh7SZ+TrWfNQP/B8RZYoYHxyIJpbQkiosYFhoZY4PVc/G ztBZAx8d2OMUmXZPFn56dOdevByyYQkNHWAU9opUJjAZPrDtEztiSnJzChYqfCW0Ht 6M8jDtldfnUKR4aC+o2L1EXeMY796lckSEarAwEhHinNJ0sEBqUFVunzuoB3IcN4Hi atQ8JZBdjbOcw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5326F69AD9; Sun, 15 Feb 2026 18:35:57 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id l_Z22JjVLTZB; Sun, 15 Feb 2026 18:35:57 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205757; bh=zzsfAgrtsMMHSGBYDTkt425AKGOt9UD/frpUL8NfeNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QIXYBizQox4rG6Ju3kmlX0FUe75o8ioBt4KpY1su4qCLq8haKu5EOo5fuFYYVwwVU Y6YQP0knDgOWFVyZhLW0ojIZ0MievfGAskGz4LYs4qy4NVEXmBVe4kmXjoTIU2qYXi K5HLnic3yw+gAwUUSJNNwxE51KO3UC4AHSCplYWygtJeSQa5yLV5VI/2hHViXAqRZ6 eezBK8iYEd7EkZyNDgeK/X1vvE90Z3x4736Usmtf1KRKximoDS+WijL/6QOfo8p/cW Ez++aLBCla9+8Xoggdt2nrPE+x2Q0pgEmGRhtBqJ3Q/LmW5ckCECW6Xu71RQ1+/dVv aQSm1TRLamWOA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id C8C1F69B01; Sun, 15 Feb 2026 18:35:56 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:34:59 -0700 Message-ID: <20260216013511.4079770-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TBNLJQH63CSJ4525JVAG7PATUVGKBPW6 X-Message-ID-Hash: TBNLJQH63CSJ4525JVAG7PATUVGKBPW6 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/17] ulib: x86: Enable examples 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 Enable CONFIG_ULIB and CONFIG_EXAMPLES so that the demo-app.efi binary is built alongside u-boot-app.efi. This allows the ulib demo to run as a standalone EFI application under OVMF/QEMU. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/efi-x86_app64_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/efi-x86_app64_defconfig b/configs/efi-x86_app64_defconfig index 874feee862a..3f9783faf6f 100644 --- a/configs/efi-x86_app64_defconfig +++ b/configs/efi-x86_app64_defconfig @@ -50,4 +50,6 @@ CONFIG_BMP_16BPP=y CONFIG_BMP_24BPP=y CONFIG_CMD_DHRYSTONE=y CONFIG_TPM=y +CONFIG_ULIB=y +CONFIG_EXAMPLES=y # CONFIG_GZIP is not set From patchwork Mon Feb 16 01:35:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1892 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=1771205761; bh=sRtZKE8V+23WOosVj/kbiEqLABs07xfq2zVqGHbRSSg=; 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=KQOJ5tymASv7bWeHc6lSxzc1MUV3Qy+ulW4FIhqXR4Ic6eauK8zCen//zoBebzNhE s0mb9L998MATW90jBfrcRoltycDII+5ih5NcTqZa6ClODjif2OyYvb+r6mUdSN+e4z vr9ktBbb4/blFCnQgkyVj0RO1EODTkm0LoSKYJ5YUsmjtpCI1Y16cgXAyBkP3IdEYo H6y+ZxEqtu8hSHqxCfuGB83sGjnS0zp95Jw+nSGaIw/GZzkdEun2khUmquqs35XBB+ QVveM0uSlQqO/sU8vZrZHcZjHb96CJ1syoxikuC0M46UEzxWJAMIDOLvbUxJQNGQUn R/rJcYv1iCsbw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DD18469BE9 for ; Sun, 15 Feb 2026 18:36: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 XFFxZnBMzuUg for ; Sun, 15 Feb 2026 18:36:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205761; bh=sRtZKE8V+23WOosVj/kbiEqLABs07xfq2zVqGHbRSSg=; 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=KQOJ5tymASv7bWeHc6lSxzc1MUV3Qy+ulW4FIhqXR4Ic6eauK8zCen//zoBebzNhE s0mb9L998MATW90jBfrcRoltycDII+5ih5NcTqZa6ClODjif2OyYvb+r6mUdSN+e4z vr9ktBbb4/blFCnQgkyVj0RO1EODTkm0LoSKYJ5YUsmjtpCI1Y16cgXAyBkP3IdEYo H6y+ZxEqtu8hSHqxCfuGB83sGjnS0zp95Jw+nSGaIw/GZzkdEun2khUmquqs35XBB+ QVveM0uSlQqO/sU8vZrZHcZjHb96CJ1syoxikuC0M46UEzxWJAMIDOLvbUxJQNGQUn R/rJcYv1iCsbw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 329D469BE8 for ; Sun, 15 Feb 2026 18:36:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205758; bh=3qv5aGETdW2ZthM0J3C5qGXKnlh4BFA7sUYOcl3cHAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTltIx0d/x/kZ0ZTs/VAyyTT7CNZUNkQ8iNF0Yh7CAwA8fZFwRP/3zfS4J+QSlZ2L 66uhnaaNCK5KceL6XXxSsFDyVatyb22MpdrDJKwAsbuOY9bZ3DCWKtunU7Ly1HkhPP IsNyc6OdYqn3EHFYISL7jnbyCZCNGnymg7Cp8wPu5vmB3DEAXUHTN7mOMMh0tHMZRG d+hXLTVP70zyd9tD6prCzvz37RR/S3R6h0jYmVC3nXR+/qSIZeJAlHc9013VlUyGDm a+gxVyqHWe+o7NyiDQ3s7IVW7DNsukv1UGri7Qg1EGnXdJATl4KZIhz8VDX+yN6hXJ i9soD0GDUrs/A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3FB0969AD9; Sun, 15 Feb 2026 18:35: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 10026) with ESMTP id cH47WENWlTEe; Sun, 15 Feb 2026 18:35:58 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205757; bh=kX5oUKvgmdJM0mfVYCOmZWp9z7PaAvsvmcO/XqdWSwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJhm4/zI2VbndiXUZcilwxfiCcmPO5XKPdaE7NAdaqjC1zujFqx7ndiKU65gi2KeA gzhfVHY0aEzVGyk/JnwUAHYKWpD4V5dBRxR/VzllHPg3XmBJ4wC2mMPIYUljlN4zS9 dKRrW4SEFVksaO3LP1euRjSJGb2/QiYy0jBk0BCcg2hoCn+6qu5oezYj6gT4USQKcE DXGrL1uHTctWVjQKXNkRYQA+xwlD+1OYQsMNSyFPlYqzFPatvRzBwQa+h95fD8L540 C+zdcdCrkaQ+88V6B3D0kA7GaIG8ZNKwfp1NKzwNjGrUQKPCf8jAh6Us9P8rPbH14N zrq3IW10NMxww== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9648969B01; Sun, 15 Feb 2026 18:35:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:35:00 -0700 Message-ID: <20260216013511.4079770-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: H7HLT5LNDB2LVG7LECV752D3KHYPEIAO X-Message-ID-Hash: H7HLT5LNDB2LVG7LECV752D3KHYPEIAO 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/17] ulib: test: Add a pytest for efi-x86_app64 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 Add test_ulib_demo_efi_x86() which boots demo-app.efi under QEMU x86_64 with OVMF firmware. The test writes a startup.nsh script next to demo-app.efi in the build directory, then boots QEMU with the FAT directory and checks for the expected demo output. Also add a timeout parameter to run_qemu_demo() since OVMF boot takes longer than bare-metal demos. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 71fe751efc9..1c98b8b6880 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -234,12 +234,13 @@ def assert_demo_output(out): assert '=================================' in out assert 'Demo complete' in out -def run_qemu_demo(qemu_cmd): +def run_qemu_demo(qemu_cmd, timeout=5): """Run a ulib demo under QEMU and return output. Args: qemu_cmd (list): QEMU command and arguments (e.g. ['qemu-system-i386', '-bios', 'demo.rom', ...]) + timeout (int): Seconds to wait before killing QEMU (default 5) Returns: str: Decoded stdout from QEMU @@ -247,7 +248,7 @@ def run_qemu_demo(qemu_cmd): with subprocess.Popen(qemu_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc: try: - stdout, _ = proc.communicate(timeout=5) + stdout, _ = proc.communicate(timeout=timeout) except subprocess.TimeoutExpired: proc.kill() stdout, _ = proc.communicate() @@ -331,3 +332,35 @@ def test_ulib_demo_arm64(ubman): 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('efi-x86_app64') +@pytest.mark.buildconfigspec("examples") +def test_ulib_demo_efi_x86(ubman): + """Test the ulib demo EFI application under QEMU x86_64 with OVMF.""" + build = ubman.config.build_dir + efi_dir = os.path.join(build, 'examples', 'ulib') + demo_efi = os.path.join(efi_dir, 'demo-app.efi') + + assert os.path.exists(demo_efi), 'demo-app.efi not found in build directory' + assert shutil.which('qemu-system-x86_64'), 'qemu-system-x86_64 not found' + + ovmf_code = '/usr/share/OVMF/OVMF_CODE_4M.fd' + ovmf_vars = '/usr/share/OVMF/OVMF_VARS_4M.fd' + assert os.path.exists(ovmf_code), 'OVMF firmware not found' + + with open(os.path.join(efi_dir, 'startup.nsh'), 'w', + encoding='utf-8') as nsh: + nsh.write('fs0:demo-app.efi\n') + + # OVMF needs a writable copy of the vars file + vars_copy = os.path.join(efi_dir, 'OVMF_VARS_4M.fd') + shutil.copy(ovmf_vars, vars_copy) + + cmd = ['qemu-system-x86_64', + '-drive', f'if=pflash,format=raw,file={ovmf_code},readonly=on', + '-drive', f'if=pflash,format=raw,file={vars_copy}', + '-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) From patchwork Mon Feb 16 01:35:01 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1893 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=1771205765; bh=/qV2B4FZPb8IMBK9YYxxLsR61Rgv/v+znSh0mvok4tw=; 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=XT6+3JR7O+TPajkJi3jP6Yqyh3yPDnjhMYUD2KeHK4OOWsf2ksqMCNrWz7M6L7XHn JudefeV+F5Vl0kwDoZPyR6XtR51xzMLT4i6zGES3vpZ3IOwiV9cY6+ffENG/PZUotS 35YekYJR3n9XLujyd23l5YaURUPMLXM4y5ufYnrPXUdL9JSwNInmBngoC8W3LfFG6O zWnU6uyeCXMbEs2Vitl5gY3bn0jXjErZn3gmO0iKTwozRSSKh1FNljOOF91qSlG2tR yxgx5tI8Q7eagzPfSHrSuLCmg0WGDKNQDBia1K4IA61nnllfCBApaprJBo5G+BFqXe j2+Hok1yaXArw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CA20B69BCC for ; Sun, 15 Feb 2026 18:36:05 -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 apS-Yw5qInmH for ; Sun, 15 Feb 2026 18:36:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205765; bh=/qV2B4FZPb8IMBK9YYxxLsR61Rgv/v+znSh0mvok4tw=; 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=XT6+3JR7O+TPajkJi3jP6Yqyh3yPDnjhMYUD2KeHK4OOWsf2ksqMCNrWz7M6L7XHn JudefeV+F5Vl0kwDoZPyR6XtR51xzMLT4i6zGES3vpZ3IOwiV9cY6+ffENG/PZUotS 35YekYJR3n9XLujyd23l5YaURUPMLXM4y5ufYnrPXUdL9JSwNInmBngoC8W3LfFG6O zWnU6uyeCXMbEs2Vitl5gY3bn0jXjErZn3gmO0iKTwozRSSKh1FNljOOF91qSlG2tR yxgx5tI8Q7eagzPfSHrSuLCmg0WGDKNQDBia1K4IA61nnllfCBApaprJBo5G+BFqXe j2+Hok1yaXArw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B520D69BDB for ; Sun, 15 Feb 2026 18:36:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205764; bh=V++lR+YtgT+cMT/fjuoMsxeNCi9u8rKhu+afnPywA7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/V/3TQPRXoDyxII2uMk+hw9Vo0VCCPVlOqGJeG9g44Rpi45MUcLcjteqHGKs2JTc XkYkwUzKXTPhk544BemAzLx20UHo55GV4xiWlAf4bTKsdCYn1yZCHetyjgTuGC04k9 Id7CXZnuF9O6VGnrIk8sTzpPtj4lIQ+PPs0V/hSEW/YJWrFv2KF9U+z3Kf/CzsrOn5 HWGU/+qUlpnLeGIE5kSJrJAJGiyfwOcD3s+sDyD+zNUD1A22q8YJZmw3IKNQEqvtLO Vv+wF/7GSy+Vo7miLh6cASKyqY13zws2gHUisfvZgl7u72edY1+qQ4osey92V3g7/O YKnNxkdKm0PTQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3BB9369BDD; Sun, 15 Feb 2026 18:36: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 tvXcdVIqihRV; Sun, 15 Feb 2026 18:36:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205758; bh=BDlg26XxCms/dMChtqXYO38o8fFkCOVdXE4U71yGMGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/3YzSENaa5P+M7I6z/koP94bZI75RQ4fB3kNJsa7G7tIFd/QGzJyFWo/OE64e9go g3yRbsGafLhDYrV+WbO4SK1pYQzNEOUV8qoVDtLHM4coKChcy9fz2pEsFPHURMO/r9 dFXWn+PL6xQqp9KzC1e9PVYYDNd/SkSrSuXoNc+/1ie/XEc7WZHwe2xr7O1kWaMNqb f13DrwGeWfQ+8cCC0EMWS0vjuJYafqJjIkGOaS2rXA2DDXlonzI9ela0enQcpCa438 +XqVTB1mSJiYnYtYWdR7ENOUoTbWQsQ5ge09e6SdH3PgEera92RSlHh8aH4eHZs86B O/XYSFyqmRxvA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8432769BDB; Sun, 15 Feb 2026 18:35:58 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:35:01 -0700 Message-ID: <20260216013511.4079770-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DA6XZCNX2WXU3ZQX4JMJCOCHBIVCLF74 X-Message-ID-Hash: DA6XZCNX2WXU3ZQX4JMJCOCHBIVCLF74 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/17] ulib: arm: Enable demo EFI binary 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 Enable CONFIG_ULIB and CONFIG_EXAMPLES in efi-arm_app64_defconfig so that the demo-app.efi binary is built. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- configs/efi-arm_app64_defconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configs/efi-arm_app64_defconfig b/configs/efi-arm_app64_defconfig index 35e8b4d36ed..a9c4686a106 100644 --- a/configs/efi-arm_app64_defconfig +++ b/configs/efi-arm_app64_defconfig @@ -53,4 +53,6 @@ CONFIG_CONSOLE_TRUETYPE=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_FAT_WRITE=y +CONFIG_ULIB=y +CONFIG_EXAMPLES=y CONFIG_CMD_DHRYSTONE=y From patchwork Mon Feb 16 01:35:02 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1894 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=1771205770; bh=MdFPPEB8osSvNZeKBgJytl5wJEyuU0LK+Rt5RqjsTwM=; 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=tuq8D+6d2oeSVSIT445tIOcKVWFmOPOcPEbCgYxz6gjJdQgiYYaJzwvr5dFqIBRJi LgS5rFwOWfCNi7MQW86MTcw5xHkPzLkzROqpJlXshp1bRg4xuI6MNF9Vqs+JDIbKk5 3PGpKtfIuTK7L/oqYT86dvIW7z8hkb6+YB//WhHVt3HyE94phcculf2SoMzmEU9RAe 099HSylLmM7NYVZQ2LS8rDFHVDiUxk3BEH73SCGMViaTJMu/KArmvpj5xyhzU1IGyK Mm0T+/BCfO9WexGIJH6Poy88eLIo1AM5xPeDihEnKXmft7jiHxLFfz73DNsGsb4EM9 mpHVTqzoCuuCg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4536A69BDF for ; Sun, 15 Feb 2026 18:36: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 L6CsyV-_cyVP for ; Sun, 15 Feb 2026 18:36:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205770; bh=MdFPPEB8osSvNZeKBgJytl5wJEyuU0LK+Rt5RqjsTwM=; 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=tuq8D+6d2oeSVSIT445tIOcKVWFmOPOcPEbCgYxz6gjJdQgiYYaJzwvr5dFqIBRJi LgS5rFwOWfCNi7MQW86MTcw5xHkPzLkzROqpJlXshp1bRg4xuI6MNF9Vqs+JDIbKk5 3PGpKtfIuTK7L/oqYT86dvIW7z8hkb6+YB//WhHVt3HyE94phcculf2SoMzmEU9RAe 099HSylLmM7NYVZQ2LS8rDFHVDiUxk3BEH73SCGMViaTJMu/KArmvpj5xyhzU1IGyK Mm0T+/BCfO9WexGIJH6Poy88eLIo1AM5xPeDihEnKXmft7jiHxLFfz73DNsGsb4EM9 mpHVTqzoCuuCg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 33B3369BDB for ; Sun, 15 Feb 2026 18:36:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205768; bh=t4x1BQQ5Pg/LINt7cqn0IRUdornoBjj5N5yp/5r4wfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k5CWy+2nap69+jQWieLfwXQ5dR+etT5RZ5cHyUPdnsUAjFkB5qk7SoqaailqwPF2H a/e7tEHNRp1eWrUCtybxX4ZiF1Y0QfCYyePxd+TPDjiYvlRyJbI3D89dorfpcEEnpv zhJSTYRB7nMsfpjoBzIKLWCsKNXoKtuJ5y0614nUmf2+Ewm0x1CdnIAekkuiejR9Su GZZ7evCn5oTN4WlvWehsNij/6xHuMetzxAHJDCs2opxfR3uDOoA7zaDskKX2/rzIsu wtdnNL6+6r8jjk5Nip63Eacpe5i00ZM/n45Wykl+xKjMqBRDu8KOO0jcSojqmafiaP IxmWa187ogWNA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3AAE969BDB; Sun, 15 Feb 2026 18:36:08 -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 IKj1hwiFw39d; Sun, 15 Feb 2026 18:36:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205763; bh=JhKkVVIbPWvryqKi+eKBSC2SnWEcozTZfjt1QsCYSv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fG8hN9y81Rs0Nj/GABY++6I4Kjwqf8HMnUqzrdi+8d3eNJuHeFT1CsbAnGOqhKTvH QCrO+rUxXNvQlfPYtezaZac7NA2AogWw4ZxV+FA0smfvY6B4oFzxneDFryH3xzEENT oX4dZShrDRcBMjH2K7u7mL+GE0QvfsvuNB9ZI3RHcSX2vQgS3UXHQ4+zu2XYpN+Euc V4+olRasC6YAE7miARjo8aqcjOai1hp//WgGtpABW9RY4KFUM1HkOyZc/jQ2o10V+U bPyIe39pmc5popSSNNk6/RnVdhXfXk8v/EzGWv0WwLPoLjr/RPIdlRKTXMJUNnQsZO GyBoToLTpTN/w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2A37069B01; Sun, 15 Feb 2026 18:36:03 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:35:02 -0700 Message-ID: <20260216013511.4079770-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: Q3F7XBTL2TJYZXK6E25CGSU3N5RTBGBJ X-Message-ID-Hash: Q3F7XBTL2TJYZXK6E25CGSU3N5RTBGBJ 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 14/17] ulib: riscv: Enable demo EFI binary 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 Enable CONFIG_ULIB and CONFIG_EXAMPLES in efi-riscv_app64_defconfig so that the demo-app.efi binary is built. Skip the prelink-riscv step on EFI builds since the shared-object linking style has no dynamic section for prelink to process. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- arch/riscv/Makefile | 2 +- configs/efi-riscv_app64_defconfig | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile index afae33812e4..acfdb9e167f 100644 --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -66,6 +66,6 @@ libs-y += arch/riscv/lib/ ifdef CONFIG_EXAMPLES EXAMPLE_ARCH := riscv EXAMPLE_APPEND_DTB := y -EXAMPLE_POST_LINK = @tools/prelink-riscv $@ +EXAMPLE_POST_LINK = $(if $(CONFIG_EFI_APP),,@tools/prelink-riscv $@) include scripts/Makefile.ulib-example endif diff --git a/configs/efi-riscv_app64_defconfig b/configs/efi-riscv_app64_defconfig index f18bfb653ad..d48ecf19585 100644 --- a/configs/efi-riscv_app64_defconfig +++ b/configs/efi-riscv_app64_defconfig @@ -52,4 +52,6 @@ CONFIG_CONSOLE_TRUETYPE=y CONFIG_SYS_WHITE_ON_BLACK=y CONFIG_CONSOLE_SCROLL_LINES=5 CONFIG_FAT_WRITE=y +CONFIG_ULIB=y +CONFIG_EXAMPLES=y CONFIG_CMD_DHRYSTONE=y From patchwork Mon Feb 16 01:35:03 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1895 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=1771205773; bh=G58+tz6kF8VWz++rdhyV6QcwM7A73p9VXyhRM6+wy80=; 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=uWft/553htf1TKrjwbQSk+jbcQ8F/6zjDI305vfugM3VuG4RlHVk1sINcwni5EHD0 4HnfWmdWgTufaEC4jlOphr6qjmtZ4zo8s97tjC+P/Xs495iKzcjIpFnMS4oflxm3J0 IPS0Z/NSIL6R996T8gi4V72Yp7YuLAMjO45CarsqDUGmJbk7NB6jIxJaPpLrNSrKYY FHARQv6Js8L6amWxyUobxwZKVs3olnNTrm5sNLrzgYE2KjUQnGgvE1l01NqyfuLrQ8 9H117EUTBDx9+f8P1hAIlSc9klfq87iF4ZGeroiwLVAskr6WRFDfZxdn8SUO/peviv bEvUTGJG66fnA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AA56869BDB for ; Sun, 15 Feb 2026 18:36:13 -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 CN7Mfv0kswo2 for ; Sun, 15 Feb 2026 18:36:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205773; bh=G58+tz6kF8VWz++rdhyV6QcwM7A73p9VXyhRM6+wy80=; 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=uWft/553htf1TKrjwbQSk+jbcQ8F/6zjDI305vfugM3VuG4RlHVk1sINcwni5EHD0 4HnfWmdWgTufaEC4jlOphr6qjmtZ4zo8s97tjC+P/Xs495iKzcjIpFnMS4oflxm3J0 IPS0Z/NSIL6R996T8gi4V72Yp7YuLAMjO45CarsqDUGmJbk7NB6jIxJaPpLrNSrKYY FHARQv6Js8L6amWxyUobxwZKVs3olnNTrm5sNLrzgYE2KjUQnGgvE1l01NqyfuLrQ8 9H117EUTBDx9+f8P1hAIlSc9klfq87iF4ZGeroiwLVAskr6WRFDfZxdn8SUO/peviv bEvUTGJG66fnA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 96CBA69BDD for ; Sun, 15 Feb 2026 18:36:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205772; bh=TchDHfsIgoj2p/3iLAp4NS0D6z29LR00a2jKiHTTA0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCHCmjEywF5SC/dJPbHG+jErsfon8+1sAIM3Bo8z7yMKNoYhnUxblh2QWnyA/2WlM kjrSOda9HUCHlDlOAfC7akRKaR39w2NXphf4E0/CWTBdl5F6qzqPLE1deg8U3hWyxC sqVB4W7uzspO8evZYVTq1SISreaY84v9hNxp5fI6b/PaJGD1lGbdCmoav85TOjrTFr DCUYOgX3baqHWOOHwWN8UNYR3z9Jw3bTEOaQFKcsdne+VlUmuLtvceCnEC2NIfvpgd o5tyDZID2tiTP//q+7v/BKwocUVl6J/Te7OfKrD3Z3i1yeEETu5y6b7azvfLXDtRgr jU/SYrenz4d1A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9C8A969BDB; Sun, 15 Feb 2026 18:36:12 -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 L9PS2O0pI3OM; Sun, 15 Feb 2026 18:36:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205768; bh=1qdcLv/rfSIT/PcklgX31ixviuzEOC+Io2Q+06ENFbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j0z5Fuf/szYJHdjYHQNQWIBTwZKWMC3644oPClW47iVPmgavx72PyoOh1OJQmDqIf EKfHLhC7T7xk+JDYzhVSIA9T3bIySb3msfnAEjttO9BcSOaCppRj7wjJdCd1VpIeTY 7ba6yF0jZlfteL/h0xFV5Y8SGk2BaXFvY32IVZmy0+69OdH5wL5MSYpjptskxb6baS RCQVyz34Vbvbzg9cmIWB8zYzttvwHpuFFgndw95OoCWy2H30KtJ3CGn0m0FH75b5aQ sf9zyKi02zKVr7jPUFmuYhb+m9D8BPprUDmkGE4O4mdBs+FT/tbejWg84YrPqIZvS9 2hTMu80cz5xcQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 03E1169BCC; Sun, 15 Feb 2026 18:36:07 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:35:03 -0700 Message-ID: <20260216013511.4079770-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YQ2XHH3IRF2GN5MRAUQT72EAIVOWQ7BN X-Message-ID-Hash: YQ2XHH3IRF2GN5MRAUQT72EAIVOWQ7BN 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 15/17] ulib: test: Add EFI demo pytest for 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 Add run_efi_demo() helper that writes a startup.nsh script next to demo-app.efi in the build directory, boots QEMU with the given UEFI firmware, and checks for the expected demo output. Refactor test_ulib_demo_efi_x86() to use the shared helper and add test_ulib_demo_efi_arm64() which uses qemu-system-aarch64 with the appropriate firmware path. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 69 ++++++++++++++++++++++++++++---------- 1 file changed, 51 insertions(+), 18 deletions(-) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index 1c98b8b6880..c7d79515bb9 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -6,6 +6,7 @@ import os import shutil import subprocess +import tempfile import pytest import utils @@ -333,34 +334,66 @@ 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('efi-x86_app64') -@pytest.mark.buildconfigspec("examples") -def test_ulib_demo_efi_x86(ubman): - """Test the ulib demo EFI application under QEMU x86_64 with OVMF.""" +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. + + Writes a startup.nsh script next to 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, 'demo-app.efi') assert os.path.exists(demo_efi), 'demo-app.efi not found in build directory' - assert shutil.which('qemu-system-x86_64'), 'qemu-system-x86_64 not found' - - ovmf_code = '/usr/share/OVMF/OVMF_CODE_4M.fd' - ovmf_vars = '/usr/share/OVMF/OVMF_VARS_4M.fd' - assert os.path.exists(ovmf_code), 'OVMF firmware not found' + 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:demo-app.efi\n') - # OVMF needs a writable copy of the vars file - vars_copy = os.path.join(efi_dir, 'OVMF_VARS_4M.fd') - shutil.copy(ovmf_vars, vars_copy) + cmd = [qemu_binary] - cmd = ['qemu-system-x86_64', - '-drive', f'if=pflash,format=raw,file={ovmf_code},readonly=on', - '-drive', f'if=pflash,format=raw,file={vars_copy}', - '-drive', f'file=fat:rw:{efi_dir},format=raw', - '-nographic', '-no-reboot', '-nic', 'none'] + # 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") +def test_ulib_demo_efi_x86(ubman): + """Test the ulib demo EFI application under QEMU x86_64 with OVMF.""" + run_efi_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") +def test_ulib_demo_efi_arm64(ubman): + """Test the ulib demo EFI application under QEMU aarch64 with UEFI.""" + run_efi_demo(ubman, 'qemu-system-aarch64', + '/usr/share/qemu-efi-aarch64/QEMU_EFI.fd', None, + ['--machine', 'virt', '-cpu', 'max']) From patchwork Mon Feb 16 01:35:04 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1896 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=1771205776; bh=LAnsR7O/TTSHaU1PjSS/VNPbWyhKahcTvgJv2e9csEM=; 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=dR10Hg8L6+oP1Dy837czGfzIaxJpSWV/V94y74+EnI6Ertrx7SwlCxN486EmcPPI9 kRrcpj01Vc4iBDqXvcs22XBh9uc7jdXFfmy5tkAYRakgH8AFaFpW6xN+vvmfNy5bUl o63oz+3eLepzFNUriguzpyjlfHYcCnwGBrEpIMAiZziuk8opRzeZUOhmT0+l1tg4lg MjDDaxn8/phSit3AayqrbRr4J8f1eN+hj7NHfMfn//6hW9BKHxMuBkoO0SS+XvTMtN x96DZAhoquM5swPJbg6ht5027n53PwKmW/47gCsnBTzJLryxevKU+TgxSoHr8sF8id 0gtzocXJvTEuA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 12C4B69BE1 for ; Sun, 15 Feb 2026 18:36: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 HbZZ1vEotkqB for ; Sun, 15 Feb 2026 18:36:16 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205775; bh=LAnsR7O/TTSHaU1PjSS/VNPbWyhKahcTvgJv2e9csEM=; 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=aAGfgWIguw5c007JRFV0goC1uMDi6QNcLpWXBL7hr/qPdkUcY4lVVexpBGXYqBRes ZikT9v+9dgCui1rGBQSvC/FuXth+KRd3jz8PGo6p7vB+sQwF5um7qDeH+WkDTNWeHh QO2d90U9DVLsB+k+nF4FqZ24PDkCI8HA0tMyQxvSkQRAoh3v4HL6/MQEYnvZgV6hAx jUfSxD30n0PjNCAII5kqUxnke3i9Q9M0JOj9UM55FBwXxStoY6mE5La3vwGAihspAi H6M4PZMnjvsdrw79fqWC92fDxhVYPh5xsSbXsm8+/yR4s19zyq4pr6YQXZFTAXjdO7 gAFAoteUixEdQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 59D3F69BDD for ; Sun, 15 Feb 2026 18:36:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205773; bh=IK1B2JPz1CVI3VxJJ7v/hO3sjIzq3SlclHgHYHe7ZRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=etv4I7+5Oa897T5MmF77qUIkuJCpglVPa+aWZ1hUY3ybrxtE/g+EhOd7uEorcvJym qV+hckvzc9iJYDlWzswOu5KpMdEIv8kCiPNR3gQxaEA3XKCSwQX0rSnc7uYlLT/tkx XTno97rIHYrTEcYyr1tPQhLSq7gx+FkAjj9Z1Ci+/S16FiHW4xxF0tA17GnixEJxj8 P4cJ6YLVV2k6z/8iP+/KUwBXOcAS9+jMXmizVxYTm6h0gxBSA/1ce9pCY9L10mDiQD 9ffvpLW/ZHWuUtwFNTMLjcvcCG09uJxJmAwPmSQjYWo3hJqAmREYtacB7toCcQO/n0 aUAocvKrYSilA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2AE4769BCC; Sun, 15 Feb 2026 18:36:13 -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 H-UeDQd6JMHI; Sun, 15 Feb 2026 18:36:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205772; bh=oie1iTHfUiIzyQBZBr+iQm6UHh+gO9jP/5W1BsJ0G5o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R+7aoBD+NnRZeT/S/jB0qUj1nH9+8kId7OTv9pzqDdHUx3bza2RrZ+kXbNyfOwW71 Lmi4u5oOV3ubRjsZzpr1fx6+keoAvPuSfaUN3YpVbNWe1Bzr822cHt18CVVyAfxWpO mN/LYEbGZTzv8AaB/bwGZLhtMICPmmxKEkG1XVvLAZRsx/3Kb60Y/uHcoGtKa4f1ZG ACwDDqYQCdrfF2w1PzFdks2wfIyAAMa0H/xmpeXDUnnjW6xCIBB6oAtg50vAQx1zgc la7MNsCEZGSZIvGraxKtTUNMqgTMRccVfIP5btbujhDfcsPLdao6TC4oQouPUsrJT6 +cZXnOgayv1pA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9911B69B01; Sun, 15 Feb 2026 18:36:12 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:35:04 -0700 Message-ID: <20260216013511.4079770-17-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 7JDPNBUTFALUH6U3U553UWRZCS3BORAX X-Message-ID-Hash: 7JDPNBUTFALUH6U3U553UWRZCS3BORAX 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 16/17] ulib: test: Add EFI demo pytest for 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 test_ulib_demo_efi_riscv64() which uses the run_efi_demo() helper to boot demo-app.efi under qemu-system-riscv64 with the appropriate UEFI firmware. Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- test/py/tests/test_ulib.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/py/tests/test_ulib.py b/test/py/tests/test_ulib.py index c7d79515bb9..50784ea9c60 100644 --- a/test/py/tests/test_ulib.py +++ b/test/py/tests/test_ulib.py @@ -397,3 +397,13 @@ def test_ulib_demo_efi_arm64(ubman): run_efi_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") +def test_ulib_demo_efi_riscv64(ubman): + """Test the ulib demo EFI application under QEMU RISC-V 64 with UEFI.""" + run_efi_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 Mon Feb 16 01:35:05 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1897 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=1771205778; bh=VqAtHEvCiO8UIGhDAYHVPxuWO/O7f3KvQYBX4FAAvL0=; 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=WcqRbGxXmCVYDqHmLFzmTtfP/3mrrO1dRimNCvIcyho16XMxj6t84lf4ZY5AYUntZ 3ita3V5jxiaSKQNrZcizrDBL25f4j23YZxvHuxz5rxLP11cJNu2rdZW0l73cvmLuFP JjN/4xbt2Mb1/kAGxzaEIgKmzhjrQo2izgB0UDHwHKxSG26Yel4UDIX5yYOSzIczxd +d6x/bzt6FiKm9jVnEr7R724M0KvSQmm8wyfO7yu2z40hj9z6/qkIQ7WfYSb5rCZMq xwPpd2yP0zx0tvJ1nQgEyxzTBkNiZ1NwrywspnFgoxJ1ND+pBEsFlsysS6kFH+hV1z YMXx3Inr6EJtg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6835A69BE5 for ; Sun, 15 Feb 2026 18:36: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 ZcrMQWK5Pbwh for ; Sun, 15 Feb 2026 18:36:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205777; bh=VqAtHEvCiO8UIGhDAYHVPxuWO/O7f3KvQYBX4FAAvL0=; 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=wPSU7jV9ZND03hMjm4sUrk3NtKCmob707giUYuinSC7BCsnph7em5h3itM1IaxWMH 8BtMhsXbfugG+kYSBETzzQaebJTqoJz7qYxIrBuq37Am8QD+UPdg1Q8GwR4sz9ijcH TAq3x/usqboHg9BOeaDy/pgeyH4hWLeshoSziZ80yBOWDjny0Xoprv1BajOhdaj78H 2qwGBMZoe8amCIf+toyb3d5yzNe28viWWz8KONJnB8PIowzNH4lUR+AS9C3PokFnVO 6+5bEPChY858sWMWfBNnX7uLnzqMI00StZxKM/ki9+KNkmYRuJjuAkr7aSnjfY3f1S g/yNLCQzBnK2g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CE8BA69BCC for ; Sun, 15 Feb 2026 18:36:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205775; bh=TYlEU61zSZX0Umtaf4vTjm3G9xyjukgiqsEClv4ss0Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZNmIMQ2LclG9yXi3JJizl6x1ExXr2/hzaGOCVs0iidD/QTqzyDsbQY4rJcE4SIqIm jjRoknv51fQ3EeiV9rGMgGFoKiCqz/rMtvgonAFPPn1SW2STXmFWMW8nCRfB/KEYOG hr/K2YWSaQu84DPwRkL6Y5m18V7abl8zU3QQjC1/aXLJHO15J9nukXhubRzkP9p6Lf C4fVEBaEhgXYP1u+yFTQbGNzMBjmHhw17n38DuwaGzJnGsyWA7eETyQ8JdF52fJfis qkjt1bB0Pj9udm8t52F7/mdrzK6DYsrRMBykBLgiPnsAUfPEqeYx1ifgUhXjgwJ20k 3f2QOUoFWmL1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E248569BCC; Sun, 15 Feb 2026 18:36:15 -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 P0Xj_8Ohyn_w; Sun, 15 Feb 2026 18:36:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1771205773; bh=Jv0CVkZbijDPPDmuVUF5flt7aIwwNqQytmHhNavQsRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sQZRc6p6ANEHQErqi8un1s5QC1d6+1GgSJx2xo0YS1QcanxcXciqA/4DiuvQsvbUr dJNoxEzXQ4Odc948/IHse/CjbMPca+ladwboOdKhrI5Azsymzjm+yiCmiGlvA9Kklm Sw9hnmAZeXg5nrEcJN2NoTojBp/1C1Xu7W0GFsoCOCPOF7ggy2dg5/MHBsNH4oz3Tl C/T7cQ43+f9qb6JZpMm/go5CsQluRdKYAJXhzrKqYUR9F0tl+Iq9Mgq+CYs9hFEHC4 h+80d6Kxhj923ougOZwYh9fHQRS/2mKnhQRdY7vLdbEgEvLkf++kNG68yT6Siocqdr GxIaXgtddU6uQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7125B69B01; Sun, 15 Feb 2026 18:36:13 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 15 Feb 2026 18:35:05 -0700 Message-ID: <20260216013511.4079770-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260216013511.4079770-1-sjg@u-boot.org> References: <20260216013511.4079770-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: CTDSJB6ITP26RDRO4XOXP47WXR6VJN7O X-Message-ID-Hash: CTDSJB6ITP26RDRO4XOXP47WXR6VJN7O 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 17/17] ulib: scripts: Add RISC-V support to build-qemu 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 build-qemu script accepts --arch riscv via build_helper's argument parser but raises ValueError since no riscv block exists. Add RISC-V support with: - Board names qemu-riscv64/qemu-riscv32 (and _spl variants) - QEMU binary selection (qemu-system-riscv64/riscv32) - Machine type 'virt' with TCG acceleration - Tianocore firmware path (RISCV_VIRT_CODE.fd) - virtio-gpu-pci display setup (shared with arm, since the virt machine has no native VGA) Co-developed-by: Claude Opus 4.6 Signed-off-by: Simon Glass --- scripts/build-qemu | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/build-qemu b/scripts/build-qemu index 4f77eb88167..5c69457647e 100755 --- a/scripts/build-qemu +++ b/scripts/build-qemu @@ -9,7 +9,7 @@ It assumes that board config - your OS images are in ${imagedir}/{distroname}/ -So far the script supports only ARM and x86 +So far the script supports ARM, RISC-V and x86 """ import argparse @@ -122,6 +122,8 @@ class BuildQemu: elif args.use_tianocore: if args.arch == 'arm': bios_override = Path(self.tiano, 'OVMF-pure-efi.aarch64.fd.64m') + elif args.arch == 'riscv': + bios_override = Path(self.tiano, 'RISCV_VIRT_CODE.fd') else: bios_override = Path(self.tiano, 'OVMF-pure-efi.x64.fd') if not bios_override.exists(): @@ -156,6 +158,23 @@ class BuildQemu: self.board = 'qemu_arm64' self.helper.qemu = 'qemu-system-aarch64' self.qemu_extra.extend(['-cpu', 'cortex-a57']) + elif args.arch == 'riscv': + if args.xpl: + self.board = 'qemu-riscv64_spl' + default_bios = 'u-boot.bin' + else: + self.board = 'qemu-riscv64' + default_bios = 'u-boot.bin' + self.helper.qemu = 'qemu-system-riscv64' + self.qemu_extra.extend(['-machine', 'virt']) + if not args.kvm: + self.qemu_extra.extend(['-accel', 'tcg']) + if self.helper.bitness == 32: + if args.xpl: + self.board = 'qemu-riscv32_spl' + else: + self.board = 'qemu-riscv32' + self.helper.qemu = 'qemu-system-riscv32' elif args.arch == 'x86': self.board = 'qemu-x86' default_bios = 'u-boot.rom' @@ -291,7 +310,7 @@ class BuildQemu: # SCT usually runs headlessly if self.args.serial_only or self.args.sct_seq: qemu_cmd.extend(['-display', 'none']) - elif self.args.arch == 'arm': + elif self.args.arch in ('arm', 'riscv'): qemu_cmd.extend(['-device', 'virtio-gpu-pci']) qemu_cmd.extend(['-device', 'qemu-xhci', '-device', 'usb-kbd', '-device', 'usb-tablet', '-device', 'usb-mouse'])