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 <jonathon.hall@puri.sm>
This commit is contained in:
Jonathon Hall 2024-04-19 14:16:41 -04:00
parent a767347afd
commit 00ce2f4d1c
No known key found for this signature in database
GPG Key ID: 1E9C3CA91AE25114
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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.