From patchwork Thu Sep 11 21:44:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 292 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=1757627101; bh=KLQhNGbYa1sHAUSUL1Jr5YFpp2b1CRjT+dbdX1IR0kk=; 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=kDl2T709Ah6LGjgrJ5HfORbhxov6rHDEkQxo6VJLytsoleb79lk9LZPK2Gprp8PKb cSujVAMQJz+RY1s+GiNXNgJarwtCQOeI9dMRyelh7m3SyqObe2pyw502ymB89+h+HH fzGavaQsumr6eXTVUDZuM+6bF6pGMqaS4COLxwtt0x5ruchYEiiyaySx4ddaoU5EjK Ub/dpfCM1Gu+ZdrMAqvIinWPTnNVryck+qq8fVZXfxYE5lzj5xH6raUssejLTwk+tg ItUfvlBznP+xfUd8F5hBHDZ5drOsQmXFL1xGITwQLseo0D31TSyWh8TGlNIM89rTGb 8IarXt5tKKo3g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BE95D67B26 for ; Thu, 11 Sep 2025 15:45:01 -0600 (MDT) 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 f1_meSPh3vjy for ; Thu, 11 Sep 2025 15:45:01 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757627100; bh=KLQhNGbYa1sHAUSUL1Jr5YFpp2b1CRjT+dbdX1IR0kk=; 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=cNk8rloqOrNmQl4I3n5JrxG0tT5Nkfw3jhsEnx5+alx054LkCHIQn9eQk8vb1UZXs tiVzLiSLR1XdZ3tIOjfcqLJyToOOs8SWsHLSBa8Ad1t2IAYsTUB89uI4rSNT24jP8o 3G62lA+gRxmLVDkGXzEysdpfS1QN6gOnMV0qtoH6i9EuvVPUzMiNyvSncwXZlgMvjB dqIqlbPbfCiY/DnRj3YCNNVgq3mMBtdThw8OAqbI7x/zSGBUJz45sY6RLnQ+iAaSl3 PRDGy0pG8LvNXCiU4IJWA63KsuvxuAwWTOcu25BHvf0mQZdubYPRb/azuFyBtPHHBe 8Bh73u5umMV/g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BE49867A5B for ; Thu, 11 Sep 2025 15:45:00 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757627099; bh=ptTyj3ymBZYLV4Ybl96uE1twXdb99KbsRNSILBp06Ic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wg9sNtX/pDMFDJEzTaS6xKY3bbl3zH+KACvwhf8s+973kW0teQbn7JDaVPFxuxSO2 kFBRgUhXS5rmHmBIOpr+7HC/LoRKxAnJ5NPiCxqjzUyluojJx6ywH5p3kUB47coqHF vi7Ljylf+G0BCutNNnuXCydr52rHgzV+Su/1eCQM7jkIoTS6c7U9RGLCEDQAUKBfNM I3cSObxmBIIdcYJYFqDVvcsiWjzx671vY6DUmTGKFIcFk/uPdStezGNXYK4+/ySNqc pbEWw+9fU3ew9gGmp3DIrKFy8n55AwABzp/HM6WtpO+InOsFsjU+IAHtuO8dJH8DQ8 pbdEW5SAhYSNQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1D67067ADD; Thu, 11 Sep 2025 15:44:59 -0600 (MDT) 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 YE20bX5Qga1G; Thu, 11 Sep 2025 15:44:59 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1757627098; bh=rGy36dGisVjSnLB+gZKKAa9XyhjoXe8QlhmK8Jjzm6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jkQuAStIH/LKFK2SdENdhFCa3F3IN4rgJxgz+lRdKjVde2KlrQVeydyskTL4T5taQ LUL5pUgrdIraeFBsmgw6P/jwd4zaLgjg8FDBUo7E8Llt3FTcEUBwkgF2XkP3Z4lPYJ jGttXG8ncfakoIcG/6mYpSy3MCgUBAXwpfNO9FHa4dTMRraL3LiPG4HFftiCGl97V2 c33Q34C5Rn3OwioxNFhElhtmf8/RAIegxKFk5BWqkkLwO3jl+l3GvY4jBbWFWEifod vqKhuE0eLQFS0ERWrAbWXkKxAO15hmqlP3iO5CRMukFnpd8jJHzudcaNR8xQoSFG81 eUXr0G60udptQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 8A28967A59; Thu, 11 Sep 2025 15:44:58 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 11 Sep 2025 15:44:10 -0600 Message-ID: <20250911214425.3687188-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250911214425.3687188-1-sjg@u-boot.org> References: <20250911214425.3687188-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: MKZAW7PRZKKPJBJBTCTWMQNIJQGNFA44 X-Message-ID-Hash: MKZAW7PRZKKPJBJBTCTWMQNIJQGNFA44 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/14] ulib: Add a way to obtain the version 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 It is possible to simply read the 'version_string' variable, but it seems better to add a proper API call to get this. It is already defined in lib/ulib/ulib.c Add a prototype to u-boot-lib.h Make use of it from the demo program. Fix the comment for ulib_uninit() while we are here. Signed-off-by: Simon Glass --- examples/ulib/demo.c | 2 +- include/u-boot-lib.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/ulib/demo.c b/examples/ulib/demo.c index 9d916d3878a..5077fcda0a6 100644 --- a/examples/ulib/demo.c +++ b/examples/ulib/demo.c @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) } demo_show_banner(); - printf("U-Boot version: %s\n", version_string); + printf("U-Boot version: %s\n", ulib_get_version()); printf("\n"); /* Use U-Boot's os_open to open a file */ diff --git a/include/u-boot-lib.h b/include/u-boot-lib.h index aabc77aa4eb..934cc33eff5 100644 --- a/include/u-boot-lib.h +++ b/include/u-boot-lib.h @@ -25,10 +25,17 @@ struct global_data; int ulib_init(char *progname); /** - * ulib_uninit() shut down the U-Boot librrary + * ulib_uninit() - shut down the U-Boot library * * Call this when your program has finished using the library, before it exits */ void ulib_uninit(void); +/** + * ulib_get_version() - Get the version string + * + * Return: Full U-Boot version string + */ +const char *ulib_get_version(void); + #endif