blob: 17bf4a414f01aed2f5c6e2a94251b0d3ae26dffb [file] [log] [blame]
Paul Sokolovskyfdd85d62021-12-01 13:39:42 +03001#!/usr/bin/env python3
2#
3# Copyright (c) 2021, Linaro Limited
Sandrine Bailleux0bcf4132022-03-31 11:15:51 +02004# Copyright (c) 2022, Arm Limited. All rights reserved.
Paul Sokolovskyfdd85d62021-12-01 13:39:42 +03005#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8
9import re
10import sys
11from subprocess import check_call
12
13
14PATTERN = "\
15Digest(\\s|\\w)*:\\s(\\w{2}\\s){16}|\
16 : (\\w{2}\\s){16}|\
17 Event\\w*\\s*:\\s\\w+\\s"
18
19
20# Extract pertinent information from TPM side.
21with open(sys.argv[1]) as f, open("ftpm_event_log", "w") as out:
22 for l in f:
23 m = re.search(PATTERN, l)
24 if m:
25 print(m.group(), file=out)
26
27# Extract pertinent information from TF side.
28with open(sys.argv[1].replace("uart1", "uart0")) as f, open("tfa_event_log", "w") as out:
Sandrine Bailleux0bcf4132022-03-31 11:15:51 +020029 # Wait for the start of the event log dump.
Paul Sokolovskyfdd85d62021-12-01 13:39:42 +030030 for l in f:
Sandrine Bailleux0bcf4132022-03-31 11:15:51 +020031 if re.search("TCG_EfiSpecIDEvent:", l):
32 break
33
34 for l in f:
35 # Look for the end of the event log dump.
36 if re.search("Booting BL31", l):
37 break
38
39 # Capture relevant lines in between start and end strings
Paul Sokolovskyfdd85d62021-12-01 13:39:42 +030040 m = re.search(PATTERN, l)
41 if m:
42 print(m.group(), file=out)
43
44# Compare it to match.
45check_call("diff -s -u tfa_event_log ftpm_event_log", shell=True)