From e1a263ce3bc620c94b8271779125c3242a911407 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Fri, 20 Dec 2024 14:51:19 -0500 Subject: [PATCH] init: warn user that if CONFIG_QUIET_MODE was enabled in board config at build time but disabled through Configuration Settings applied override, early measurement output got suppressed Also tell user that those early suppressed messages can be seen under /tmp/debug.txt Signed-off-by: Thierry Laurion --- initrd/bin/cbfs-init | 4 ++-- initrd/init | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/initrd/bin/cbfs-init b/initrd/bin/cbfs-init index a31fc194..c82e8a23 100755 --- a/initrd/bin/cbfs-init +++ b/initrd/bin/cbfs-init @@ -6,8 +6,8 @@ set -e -o pipefail # This extraction and measurement cannot be suppressed by quiet mode, since # config.user is not yet loaded at this point. # To suppress this output, set CONFIG_QUIET_MODE=y needs be be set in /etc/config -# which is defined at buiid time under board configuration file to be part of initrd.cpio -# This script is called from initrd/init +# which is defined at build time under board configuration file to be part of initrd.cpio +# This script is called from initrd/init so really early in the boot process to put files in place in initramfs TRACE_FUNC diff --git a/initrd/init b/initrd/init index 28e42ca2..1b1044fa 100755 --- a/initrd/init +++ b/initrd/init @@ -109,12 +109,21 @@ fi if [ "$CONFIG_QUIET_MODE" = "y" ]; then # check origin of quiet mode setting =y: if it is under /etc/config.user then early cbfs-init outputs are not suppressible # if it is under /etc/config then early cbfs-init outputs are suppressible - if ! grep -q 'CONFIG_QUIET_MODE="y"' /etc/config.user 2>/dev/null; then + if grep -q 'CONFIG_QUIET_MODE="y"' /etc/config 2>/dev/null; then echo "Quiet mode enabled: refer to '/tmp/debug.log' for boot measurements traces" >/dev/tty0 else echo "Runtime Quiet mode: refer to '/tmp/debug.log' for additional boot measurements traces past this point" >/dev/tty0 echo "To suppress earlier boot measurements traces, enable CONFIG_QUIET_MODE=y in your board configuration at build time." >/dev/tty0 fi +# If CONFIG_QUIET_MODE enabled in board config but disabled from Config->Configuration Settings +# warn that early boot measurements output was suppressed prior of this point +elif [ "$CONFIG_QUIET_MODE" = "n" ]; then + # if CONFIG_QUIET_MODE=n in /etc/config.user but CONFIG_QUIET_MODE=y in /etc/config then early cbfs-init outputs are suppressed + # both needs to be checked to determine if early boot measurements traces were suppressed + if grep -q 'CONFIG_QUIET_MODE="y"' /etc/config 2>/dev/null && grep -q 'CONFIG_QUIET_MODE="n"' /etc/config.user 2>/dev/null; then + echo "Early boot measurements traces were suppressed per CONFIG_QUIET_MODE=y in your board configuration at build time (/etc/config)" >/dev/tty0 + echo "Runtime Quiet mode disabled: refer to '/tmp/debug.log' for cbfs-init related traces prior of this point" >/dev/tty0 + fi fi TRACE_FUNC