From 00ce2f4d1c1b378c4125c4efd84b096929aebaca Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Fri, 19 Apr 2024 14:16:41 -0400 Subject: [PATCH] ash_functions: Log board and version when entering recovery shell Log the board and version when entering the recovery shell. Extract the firmware version logic from init. Currently this is the only way to get the debug log. If we add a way from the GUI, we may want to log the board and version somewhere else too. Signed-off-by: Jonathon Hall --- initrd/etc/ash_functions | 8 ++++++++ initrd/init | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/initrd/etc/ash_functions b/initrd/etc/ash_functions index db591a55..54b72108 100644 --- a/initrd/etc/ash_functions +++ b/initrd/etc/ash_functions @@ -42,6 +42,12 @@ LOG() { echo "LOG: $*" >>/tmp/debug.log } +fw_version() { + local FW_VER=$(dmesg | grep 'DMI' | grep -o 'BIOS.*' | cut -f2- -d ' ') + # chop off date, since will always be epoch w/timeless builds + echo "${FW_VER::-10}" +} + preserve_rom() { TRACE "Under /etc/ash_functions:preserve_rom" new_rom="$1" @@ -232,6 +238,8 @@ recovery() { touch /tmp/config . /tmp/config + DEBUG "Board $CONFIG_BOARD - version $(fw_version)" + if [ "$CONFIG_TPM" = "y" ]; then DEBUG "Extending TPM PCR 4 for recovery shell access" tpmr extend -ix 4 -ic recovery diff --git a/initrd/init b/initrd/init index 67a179b7..93bd5222 100755 --- a/initrd/init +++ b/initrd/init @@ -203,9 +203,7 @@ if [ "$CONFIG_BASIC" = "y" ]; then fi # export firmware version -export FW_VER=$(dmesg | grep 'DMI' | grep -o 'BIOS.*' | cut -f2- -d ' ') -# chop off date, since will always be epoch w/timeless builds -FW_VER=${FW_VER::-10} +export FW_VER=$(fw_version) # Add our boot devices into the /etc/fstab, if they are defined # in the configuration file.