summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuanpeng Ni <yuanpengni@chromium.org>2022-10-14 15:37:23 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-22 10:34:21 +0000
commit84c65cd3e18484de8245d6dbadbbd71dfc762067 (patch)
tree57226090324c5328a906d3131e11704acbddd3ad
parent9a1be550f92c15b0b0f2fb058493470346b48753 (diff)
downloadvboot-84c65cd3e18484de8245d6dbadbbd71dfc762067.tar.gz
vboot_reference: Check OS/firmware mismatch and report to UMA
Compare fwid with firmware installer manifest to see if they mismatch, then report the result to UMA. BUG=b:211005753 TEST=Manual test BRANCH=None Signed-off-by: Yuanpeng Ni <yuanpengni@chromium.org> Change-Id: Id5ed7ad95f4f5439d30fdad9314e8e2b317834ab Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3960435 Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
-rwxr-xr-xutility/dev_debug_vboot27
1 files changed, 27 insertions, 0 deletions
diff --git a/utility/dev_debug_vboot b/utility/dev_debug_vboot
index a5d34eda..bd9942a7 100755
--- a/utility/dev_debug_vboot
+++ b/utility/dev_debug_vboot
@@ -171,6 +171,31 @@ fix_old_names() {
true
}
+report_firmware_mismatch() {
+ # Check for mismatched OS/firmware and send UMA metrics
+ if ! type "chromeos-firmwareupdate" >/dev/null 2>&1 ; then
+ debug "Skip checking firmware mismatch: missing 'chromeos-firmwareupdate'."
+ return 1
+ fi
+
+ local cros_fwid="$(crossystem fwid 2>/dev/null)"
+
+ local model="$(cros_config / name || echo unknown)"
+ local manifest="$(chromeos-firmwareupdate --manifest 2>/dev/null)"
+ local expect_fwid=$(echo "${manifest}" |
+ jq -c -r ".${model}.host.versions.rw" 2>/dev/null)
+
+ if [ -z "${expect_fwid}" ] || [ "${expect_fwid}" = "null" ]; then
+ debug "Failed to get the expected fwid for model '${model}'."
+ elif [ "${cros_fwid}" = "${expect_fwid}" ]; then
+ info "Report UMA metrics: System firmware matched OS bundled firmware."
+ metrics_client -e "Platform.Firmware.Mismatch" 0 2
+ else
+ info "Report UMA metrics: System firmware mismatched OS bundled firmware."
+ metrics_client -e "Platform.Firmware.Mismatch" 1 2
+ fi
+}
+
##############################################################################
# Here we go...
@@ -384,4 +409,6 @@ for kname in ${kernparts}; do
kc=$(expr $kc + 1)
done
+report_firmware_mismatch || true
+
exit 0