Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 15AC0C433EF for ; Wed, 6 Jul 2022 11:19:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C94C84542; Wed, 6 Jul 2022 13:19:32 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1657106372; bh=88nfbOmB4p1pP5XOMCB3jnxABhZgwx1HTOphtBzlAjQ=; h=From:To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=aDbnMWzg9esUfrCr5DkGtfq9JpFrOEThwgk2fzH0YrH/9tR7u1yJExgRemyBPJz7S UAbvbSjoFslgcJQ8emQzF5Ss8GCwVOqtsgJaPRZZwHGDxqr0z/1kNFJfhjRPmxvnZZ blOwTUaEEK4gJAg89VWeOYer5c3zMD8i1z1F0kj5ao1q6vNhtZAHoToyYpy47ujzbk 4Tz1dZCcQQjmU4di+EX7rt4FCH0A1nE9KJ0XZsjLI8sCsq5iaYRzrPrbPj1LTxhcud 6R+P2lsmQ+NQLgvgaozWiVGYl19t+FZd7bY1t28U3GVZ8/GcUerOHI+eBdu6nMPCUU hC4e+0Zi/xKlg== Received: from maia.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: hws@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id DAE438453F; Wed, 6 Jul 2022 13:19:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1657106371; bh=88nfbOmB4p1pP5XOMCB3jnxABhZgwx1HTOphtBzlAjQ=; h=From:To:Cc:Subject:Date:From; b=TApd87iouMKbEVYeLlInYkipRvXNRJlOilYg+JvYNE6slUrlg+nWjYJMvUIPUk1Em Rfhz6Tx8Z1EAJLMZkvWOqLkgaiyl+vzE3rSF5SbgwEYbeRDr2GASo4V0kBF95NcnSi /0zjFyx90/9B++B56/+v5zohUV2H52sGQmRDg64KzZw1awyasGtSOKVvndQLEjHPYo Ew6ni3W4/4BfI8m1EJ7w9eS3W9iZLrK9QnGupb4umsF6xc8+sQ2OirdvY0dERVXTGd kAX1U2RHFB3QPAfw/Qo4r6cBcDbfqf11wAzFASzAvCzwLwgkbGZVoEB6IiAQrPKoW1 kCGkD3K2o/WTw== From: Harald Seiler To: Tom Rini , u-boot@lists.denx.de Cc: Simon Glass , Patrick Delaunay , Harald Seiler Subject: [PATCH] console: Add option to keep it silent until env is loaded Date: Wed, 6 Jul 2022 13:19:10 +0200 Message-Id: <20220706111910.791466-1-hws@denx.de> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add a config-option which forces the console to stay silent until the proper environment is loaded from flash. This is important when the default environment does not silence the console but no output must be printed when 'silent' is set in the flash environment. After the environment from flash is loaded, the console will be silenced/unsilenced depending on it. If PRE_CONSOLE_BUFFER is also used, the buffer will now be flushed if the console should not be silenced. Signed-off-by: Harald Seiler --- common/Kconfig | 10 ++++++++++ common/console.c | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/common/Kconfig b/common/Kconfig index fdcf4536d0..506a4d6245 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -120,6 +120,16 @@ config SILENT_CONSOLE_UPDATE_ON_RELOC (e.g. NAND). This option makes the value of the 'silent' environment variable take effect at relocation. +config SILENT_CONSOLE_UNTIL_ENV + bool "Keep console silent until environment is loaded" + depends on SILENT_CONSOLE + help + This option makes sure U-Boot will never use the console unless the + environment from flash does not contain the 'silent' variable. If + set, the console is kept silent until after the environment was + loaded. Use this in combination with PRE_CONSOLE_BUFFER to print out + earlier messages after loading the environment when allowed. + config PRE_CONSOLE_BUFFER bool "Buffer characters before the console is available" help diff --git a/common/console.c b/common/console.c index 0013d183ae..f0f5a9cf80 100644 --- a/common/console.c +++ b/common/console.c @@ -893,6 +893,11 @@ static bool console_update_silent(void) if (!IS_ENABLED(CONFIG_SILENT_CONSOLE)) return false; + if (IS_ENABLED(CONFIG_SILENT_CONSOLE_UNTIL_ENV) && !(gd->flags & GD_FLG_ENV_READY)) { + gd->flags |= GD_FLG_SILENT; + return false; + } + if (env_get("silent")) { gd->flags |= GD_FLG_SILENT; return false; -- 2.36.1