Skip to content

Commit ba78e86

Browse files
committed
WIP: initrd: report EC version (not tested)
Signed-off-by: Maciej Pijanowski <maciej.pijanowski@3mdeb.com>
1 parent d0a7cdb commit ba78e86

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

initrd/bin/oem-system-info-xx30

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ kernel=$(uname -s -r)
5151
FB_OPTIONS=""
5252
if whiptail --version | grep "fbwhiptail"; then FB_OPTIONS="--text-size 12"; fi
5353
whiptail_type $BG_COLOR_MAIN_MENU $FB_OPTIONS --title 'System Info' \
54-
--msgbox "${BOARD_NAME}\nFW_VER: ${FW_VER}\nKernel: ${kernel}\nCPU: ${cpustr} RAM: ${memtotal} GB $battery_status\n$(fdisk -l | grep -e '/dev/sd.:' -e '/dev/nvme.*:' | sed 's/B,.*/B/')\n\n$(cat /tmp/devices_usb_pci)" 0 80
54+
--msgbox "${BOARD_NAME}\nFW_VER: ${FW_VER}$([ -n "$EC_VER" ] && echo "\nEC_VER: ${EC_VER}")\nKernel: ${kernel}\nCPU: ${cpustr} RAM: ${memtotal} GB $battery_status\n$(fdisk -l | grep -e '/dev/sd.:' -e '/dev/nvme.*:' | sed 's/B,.*/B/')\n\n$(cat /tmp/devices_usb_pci)" 0 80

initrd/etc/functions

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ fw_version() {
102102
echo "${FW_VER::-10}"
103103
}
104104

105+
ec_version() {
106+
# EC firmware version from DMI type 11 OEM Strings (if present).
107+
# The raw sysfs entry has a 5-byte header followed by null-terminated strings.
108+
local raw="/sys/firmware/dmi/entries/11-0/raw"
109+
[ -f "$raw" ] || return
110+
tail -c +6 "$raw" | tr '\0' '\n' | sed -n 's/^EC firmware version: *//p'
111+
}
112+
105113
preserve_rom() {
106114
TRACE_FUNC
107115
new_rom="$1"

initrd/etc/gui_functions

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,13 @@ show_system_info() {
172172
cpustr=$(cat /proc/cpuinfo | grep 'model name' | uniq | sed -r 's/\(R\)//;s/\(TM\)//;s/CPU //;s/model name.*: //')
173173
kernel=$(uname -s -r)
174174

175+
local ec_ver_line=""
176+
[ -n "$EC_VER" ] && ec_ver_line="
177+
EC_VER: ${EC_VER}"
178+
175179
local msgbox="${BOARD_NAME}
176180
177-
FW_VER: ${FW_VER}
181+
FW_VER: ${FW_VER}${ec_ver_line}
178182
Kernel: ${kernel}
179183
180184
CPU: ${cpustr}

initrd/init

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ fi
222222

223223
# export firmware version
224224
export FW_VER=$(fw_version)
225+
export EC_VER=$(ec_version)
225226

226227
# Add our boot devices into the /etc/fstab, if they are defined
227228
# in the configuration file.

0 commit comments

Comments
 (0)