From patchwork Thu Sep 4 13:04:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 228 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=1756991171; bh=4qpY7qiuPm8NhnBWfQWQChG5yIqs2ndsxfl2U1r8UpI=; 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=EHnQtoq1gm5Q8c4qXmgpgu2goJf5xoSG6DKvo7vqBRr+qgYmhL8W1crEzN8U9pNZa wfmNyD23dX9zEifPm8seuTykWPTdEUwCAz7bq6ITzr4y7vFZEAbbk7IRiZGt/s5dIf LHfRAwz35c737sRkMWeHN7sqtuaSKsF/1dCv12Xssglib0KISfY0iVfN3ZZrzakcpu ynV+3B8MI9Gu1XLBQNg2crKohQaNA/ZFZWhpQ9aZ3WI+GaWdAdQyqxc79Cl3wpTl1P aSbSuzIzYQgjz9ZDWYDTfoig0MAJEXu0jrcKGY919F6YJJt1KqsEbETPbo3n8F6ZQA vqDJg6swgZ3QA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 049CB67964 for ; Thu, 4 Sep 2025 07:06:11 -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 yG4lMr4WoBv9 for ; Thu, 4 Sep 2025 07:06:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991170; bh=4qpY7qiuPm8NhnBWfQWQChG5yIqs2ndsxfl2U1r8UpI=; 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=Vq3wv2k39DJr+16kogSTUSllPFh81DqjlVkk2NH5qrsYtVme2eokheSGrjre+ttAA Q0yuiMn9CwMmrHgODB0Bos9S/HY8Q1THmQMQ5uC4a78CndJGQjaidxTNldgCb6uYT/ G/gK4yVNeLkjuU90ob36DHbzcW4C9XUOnmsWD31A//7QQPR6Nlbmhz8efH13K+lkvh PIvofwvxng32GyICHmS8HWlnOqJLb2RF5xXrJeGlc7CRtaR1njKlHPxEjUaRoMudVD 0r3811ivs4UZM8CW6RLDRuJn7c318XSJZBvXBeoqwBMHryb2gYlj8yFi9EMupWreCm t8rwDMut5JDjw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E44E6678BA for ; Thu, 4 Sep 2025 07:06:10 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991168; bh=7JaiiduOfHc41+2bx3YuCb+0KJWpErE2oO79Aix+8zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/1pOsE/kI9AeLi0fSZ7ToMOroiiTAvsAISev50cQwooKppexXm0zBJkC9+65cgS0 4aNAS/bmhV8IbmLgXN31K0KfKA5vfmi8iFHRvYx8G4tPPlJKCLWJPEh2/puMnPFc2k HzHqBbo08smKXk62qUsc7DD0DKeR1ZtYCMAX5SG7wUbrwabr9jK4wyue7+VchT56IC a2pW78u9zraByvWirpk/OrlGckaNPmLPiQRe2Djewjh4o77Ec5XeZWYhZhvaq24Rt2 35MigTYELHcBeCAUuAC+bT9vRMpRBvB2TKuBMqELtqCQGdwJOJt7DeN+FQZHusHa5p 8THmAEGCu07HQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A4897678AB; Thu, 4 Sep 2025 07:06:08 -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 AJEQJT3bV93H; Thu, 4 Sep 2025 07:06:08 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1756991164; bh=KCRI4k9rC5pwEBzYiqRpxMj0mNOEV8bgBfOC0uNiglY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XbO4eHuNn2kfwUluMNad3JgKywkIu6NlvpCCTyVzNcb1x6xBeceg1tm+zCLxTgA0Y 5xzOTHwfRkjSkCGmhHUfKETpUxnTaak5xU6+IlMdUAcAKiB6Fu0iEiAkoo65Yv/6zw kaCI4kH7aoP65afWaKuj5Ht/aFVYrn3DIZtjCCz/dOb3S9+InVTuHYYLLv6j4f1BCc 1+42ymwtby+TGeWH1ZFLeGBfRtF3VVWq1tD5OU5OXmu3Eno0zWwziTBZw4N8cpb5Cs VqK3XkMmEigyWSf+jvAqUq3FYAkt7Pe0d3581UHcxOPXiS7R8RkYQ3vwvHrcTNwUGw Hn5dbXkS5Iofg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5E6A6678BF; Thu, 4 Sep 2025 07:06:04 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Thu, 4 Sep 2025 07:04:47 -0600 Message-ID: <20250904130459.848794-15-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250904130459.848794-1-sjg@u-boot.org> References: <20250904130459.848794-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VK55HGY2WQJKUYKXHD6PUY3S3NYUVBZG X-Message-ID-Hash: VK55HGY2WQJKUYKXHD6PUY3S3NYUVBZG 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 14/18] ulib: Implement GD_FLG_ULIB for library-usage mode 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 new global_data flag GD_FLG_ULIB to indicate that U-Boot is being used as a shared library. This allows suppressing console output that is inappropriate for library usage while preserving normal boot messages for standalone operation. For now the flag must be enabled by the caller and it has no effect. Signed-off-by: Simon Glass --- include/asm-generic/global_data.h | 12 ++++++++++++ test/ulib/ulib_test.c | 1 + 2 files changed, 13 insertions(+) diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index fc99411e5fb..8b59df66ec5 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -758,8 +758,20 @@ enum gd_flags { * drivers shall not be called. */ GD_FLG_HAVE_CONSOLE = 0x8000000, + /** + * @GD_FLG_ULIB: U-Boot is running as a library + * + * For now, this just avoids console output on startup + */ + GD_FLG_ULIB = 0x10000000, }; +#if CONFIG_IS_ENABLED(ULIB) +#define gd_ulib() (gd->flags & GD_FLG_ULIB) +#else +#define gd_ulib() 0 +#endif + #endif /* __ASSEMBLY__ */ #endif /* __ASM_GENERIC_GBL_DATA_H */ diff --git a/test/ulib/ulib_test.c b/test/ulib/ulib_test.c index dd9cc0bb978..621bcd49be9 100644 --- a/test/ulib/ulib_test.c +++ b/test/ulib/ulib_test.c @@ -25,6 +25,7 @@ int main(int argc, char *argv[]) /* init global data */ memset(&data, '\0', sizeof(data)); + data.flags = GD_FLG_ULIB; ret = sandbox_init(argc, argv, &data);