Skip to content

Commit

Permalink
init: warn user that if CONFIG_QUIET_MODE was enabled in board config…
Browse files Browse the repository at this point in the history
… 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 <insurgo@riseup.net>
  • Loading branch information
tlaurion committed Dec 20, 2024
1 parent a452925 commit 7c49fde
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 2 additions & 2 deletions initrd/bin/cbfs-init
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 10 additions & 1 deletion initrd/init
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7c49fde

Please sign in to comment.