xref: /rk3399_ARM-atf/docs/design_documents/measured_boot_dtpm_poc.rst (revision 7e848540159ba8fbb0577c76e4dc0c5bbc542489)
1*a2dd13caSAbhi SinghMeasured Boot using a Discrete TPM (PoC)
2*a2dd13caSAbhi Singh========================================
3*a2dd13caSAbhi Singh
4*a2dd13caSAbhi SinghMeasured Boot is the process of cryptographically measuring the code and
5*a2dd13caSAbhi Singhcritical data used at boot time, for example using a TPM, so that the
6*a2dd13caSAbhi Singhsecurity state can be attested later.
7*a2dd13caSAbhi Singh
8*a2dd13caSAbhi SinghThe current implementation of the driver included in |TF-A| supports several
9*a2dd13caSAbhi Singhbackends and each has a different means to store the measurements.
10*a2dd13caSAbhi SinghThis section focuses on the Discrete TPM backend, which stores measurements
11*a2dd13caSAbhi Singhin a PCR within the TPM. This backend can be paired with the `TCG event log`_
12*a2dd13caSAbhi Singhto provide attestation of the measurements stored in the event log. See
13*a2dd13caSAbhi Singhdetails in :ref:`Measured Boot Design`.
14*a2dd13caSAbhi Singh
15*a2dd13caSAbhi SinghThis section provides instructions to setup and build a proof of concept (PoC)
16*a2dd13caSAbhi Singhthat showcases the use of Measured Boot with a Discrete TPM interface.
17*a2dd13caSAbhi Singh
18*a2dd13caSAbhi Singh.. note::
19*a2dd13caSAbhi Singh   The instructions given in this document are meant to build a PoC to
20*a2dd13caSAbhi Singh   show how Measured Boot on TF-A can interact with a Discrete TPM interface.
21*a2dd13caSAbhi Singh   This PoC is platform specific, and uses a SPI based Discrete TPM, the
22*a2dd13caSAbhi Singh   Raspberry Pi communicates with the TPM via a GPIO pin bit-banged SPI interface.
23*a2dd13caSAbhi Singh   For other platforms, different may be required to interface with the hardware
24*a2dd13caSAbhi Singh   (e.g., different hardware communication protocols) and different TPM interfaces
25*a2dd13caSAbhi Singh   (e.g., |FIFO| vs |CRB|).
26*a2dd13caSAbhi Singh
27*a2dd13caSAbhi SinghComponents
28*a2dd13caSAbhi Singh~~~~~~~~~~
29*a2dd13caSAbhi Singh
30*a2dd13caSAbhi Singh   - **Platform**: The PoC is developed on the Raspberry Pi 3 (rpi3), due to quick
31*a2dd13caSAbhi Singh     driver development and the availability of GPIO pins to interface with a TPM
32*a2dd13caSAbhi Singh     expansion module. Measured boot capabilities using the TCG Event Log are
33*a2dd13caSAbhi Singh     ported to the Raspberry Pi 3 platform inside TF-A. This PoC specifically uses
34*a2dd13caSAbhi Singh     the Raspberry Pi 3 Model B V1.2, but this PoC is compatible with other
35*a2dd13caSAbhi Singh     Raspberry Pi 3 models.
36*a2dd13caSAbhi Singh
37*a2dd13caSAbhi Singh   - **Discrete TPM**: The TPM chip selected is a breakout board compatible with
38*a2dd13caSAbhi Singh     the Raspberry Pi 3 GPIO pins. This PoC uses a |SPI| based LetsTrust TPM
39*a2dd13caSAbhi Singh     breakout board equipped with a Infineon Optiga™ SLB 9670 TPM 2.0 chip. Link
40*a2dd13caSAbhi Singh     to device: https://thepihut.com/products/letstrust-tpm-for-raspberry-pi
41*a2dd13caSAbhi Singh
42*a2dd13caSAbhi Singh   .. note::
43*a2dd13caSAbhi Singh      If you have another TPM breakout board that uses the same
44*a2dd13caSAbhi Singh      Infineon Optiga™ SLB 9670 TPM 2.0 SPI based chip, it will also work.
45*a2dd13caSAbhi Singh      Ensure that the correct GPIO pins are utilized on the Raspberry Pi 3 to
46*a2dd13caSAbhi Singh      avoid communication issues, and possible hardware failures.
47*a2dd13caSAbhi Singh
48*a2dd13caSAbhi Singh   - **TF-A TPM Drivers**: To interface with a physical (Discrete) TPM chip in
49*a2dd13caSAbhi Singh     TF-A, the PoC uses TF-A drivers that provide the command, interface, link,
50*a2dd13caSAbhi Singh     and platform layers required to send and receive data to and from the TPM.
51*a2dd13caSAbhi Singh     The drivers are located in TFA, and not in a |SP|, so that they may be used
52*a2dd13caSAbhi Singh     in early stages such as BL2, and in some cases, BL1. The design of the TPM
53*a2dd13caSAbhi Singh     Drivers is documented here: :ref:`Discrete TPM drivers`.
54*a2dd13caSAbhi Singh
55*a2dd13caSAbhi Singh   - **U-boot BL33**: This PoC showcases measured boot up to BL33, and for
56*a2dd13caSAbhi Singh     simplicity uses a U-boot image for BL33, so that the image is measured and
57*a2dd13caSAbhi Singh     loaded. Currently U-boot does not have Discrete TPM support for the
58*a2dd13caSAbhi Singh     Raspberry Pi 3 platform so the boot flow ends here.
59*a2dd13caSAbhi Singh
60*a2dd13caSAbhi Singh
61*a2dd13caSAbhi SinghBuilding the PoC for the Raspberry Pi 3
62*a2dd13caSAbhi Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63*a2dd13caSAbhi Singh
64*a2dd13caSAbhi Singh**Build instructions for U-Boot.bin for Raspberry Pi 3.**
65*a2dd13caSAbhi Singh
66*a2dd13caSAbhi SinghFirst, the build requires a BL33 firmware image that can be packaged and measured
67*a2dd13caSAbhi Singhby TF-A.
68*a2dd13caSAbhi Singh
69*a2dd13caSAbhi SinghU-boot can be built for the Raspberry Pi 3, but there are some changes to be made
70*a2dd13caSAbhi Singhto allow the build to succeed. First Clone U-boot and enter the repo.
71*a2dd13caSAbhi Singh
72*a2dd13caSAbhi Singh.. code:: shell
73*a2dd13caSAbhi Singh
74*a2dd13caSAbhi Singh    git clone https://github.com/u-boot/u-boot.git
75*a2dd13caSAbhi Singh    cd u-boot
76*a2dd13caSAbhi Singh
77*a2dd13caSAbhi SinghNow to switch to a specific tag ``v2024.04``  for testing purposes, and then build
78*a2dd13caSAbhi Singhthe defconfig labelled ``rpi_3_b_plus_defconfig``.
79*a2dd13caSAbhi Singh
80*a2dd13caSAbhi Singh.. code:: shell
81*a2dd13caSAbhi Singh
82*a2dd13caSAbhi Singh    git checkout tags/v2024.04 -b tfa_dtpm_poc
83*a2dd13caSAbhi Singh    make CROSS_COMPILE=aarch64-linux-gnu- rpi_3_b_plus_defconfig
84*a2dd13caSAbhi Singh
85*a2dd13caSAbhi SinghLastly open the ``.config`` and change ``CONFIG_TEXT_BASE`` and
86*a2dd13caSAbhi Singh``CONFIG_SYS_UBOOT_START`` to ``0x11000000`` to match the BL33 starting point.
87*a2dd13caSAbhi Singh
88*a2dd13caSAbhi Singh.. code:: shell
89*a2dd13caSAbhi Singh
90*a2dd13caSAbhi Singh    vim .config
91*a2dd13caSAbhi Singh    CONFIG_TEXT_BASE=0x11000000
92*a2dd13caSAbhi Singh    CONFIG_SYS_UBOOT_START=0x11000000
93*a2dd13caSAbhi Singh
94*a2dd13caSAbhi SinghTo build the u-boot binary, use the following command.
95*a2dd13caSAbhi Singh
96*a2dd13caSAbhi Singh.. code:: shell
97*a2dd13caSAbhi Singh
98*a2dd13caSAbhi Singh    make CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc)
99*a2dd13caSAbhi Singh
100*a2dd13caSAbhi Singh**Build TF-A for Raspberry Pi 3 with Discrete TPM and Measured Boot.**
101*a2dd13caSAbhi Singh
102*a2dd13caSAbhi SinghCopy over the ``u-boot.bin`` file over to your TF-A working directory.
103*a2dd13caSAbhi Singh
104*a2dd13caSAbhi Singh.. code:: shell
105*a2dd13caSAbhi Singh
106*a2dd13caSAbhi Singh    cp /path/to/u-boot/build/u-boot.bin /path/to/tfa/u-boot.bin
107*a2dd13caSAbhi Singh
108*a2dd13caSAbhi SinghTF-A build command:
109*a2dd13caSAbhi Singh
110*a2dd13caSAbhi Singh.. code:: shell
111*a2dd13caSAbhi Singh
112*a2dd13caSAbhi Singh    CROSS_COMPILE=aarch64-linux-gnu-      \
113*a2dd13caSAbhi Singh    make PLAT=rpi3                        \
114*a2dd13caSAbhi Singh    RPI3_PRELOADED_DTB_BASE=0x200000      \
115*a2dd13caSAbhi Singh    BL33=u-boot.bin                       \
116*a2dd13caSAbhi Singh    SUPPORT_VFP=1                         \
117*a2dd13caSAbhi Singh    DEBUG=0                               \
118*a2dd13caSAbhi Singh    MEASURED_BOOT=1                       \
119*a2dd13caSAbhi Singh    DISCRETE_TPM=1                        \
120*a2dd13caSAbhi Singh    MBOOT_TPM_HASH_ALG=sha256             \
121*a2dd13caSAbhi Singh    TPM_INTERFACE=FIFO_SPI                \
122*a2dd13caSAbhi Singh    MBEDTLS_DIR=/path/to/mbedtls/repo     \
123*a2dd13caSAbhi Singh    LOG_LEVEL=40                          \
124*a2dd13caSAbhi Singh    fip all
125*a2dd13caSAbhi Singh
126*a2dd13caSAbhi SinghThis build command is similar to the one provided in the TF-A Raspberry Pi 3
127*a2dd13caSAbhi Singhplatform port, To learn more about the platform and its build options, visit
128*a2dd13caSAbhi Singh:ref:`Raspberry Pi 3`.
129*a2dd13caSAbhi Singh
130*a2dd13caSAbhi Singh   - ``RPI3_PRELOADED_DTB_BASE`` is given a different address to accommodate the
131*a2dd13caSAbhi Singh     larger BL1 and BL2 firmware sizes, this is to accommodate the TPM drivers
132*a2dd13caSAbhi Singh     that are packaged in BL1 and BL2 for this PoC.
133*a2dd13caSAbhi Singh   - ``BL33`` is the non trusted firmware, in this case the U-Boot binary built
134*a2dd13caSAbhi Singh     earlier.
135*a2dd13caSAbhi Singh   - ``SUPPORT_VFP`` is enabled, allows Vector Floating Point operations in EL3.
136*a2dd13caSAbhi Singh   - ``MEASURED_BOOT`` is enabled to allow the Measured Boot flow.
137*a2dd13caSAbhi Singh   - ``DISCRETE_TPM=1`` enables the build of Discrete TPM drivers.
138*a2dd13caSAbhi Singh   - ``MBOOT_TPM_HASH_ALG=sha256`` sets the hash algorithm to sha256, this is
139*a2dd13caSAbhi Singh     the only algorithm supported by both TF-A Measured Boot and the SLB 9670
140*a2dd13caSAbhi Singh     TPM 2.0.
141*a2dd13caSAbhi Singh   - ``TPM_INTERFACE=FIFO_SPI`` specifies the use of the FIFO SPI interface.
142*a2dd13caSAbhi Singh   - ``MBEDTLS_DIR`` is the path to your local mbedtls repo.
143*a2dd13caSAbhi Singh   - ``LOG_LEVEL=40`` ensures that eventlog is printed at the end of BL1 and BL2.
144*a2dd13caSAbhi Singh
145*a2dd13caSAbhi Singh
146*a2dd13caSAbhi Singh**Hardware Setup:**
147*a2dd13caSAbhi Singh
148*a2dd13caSAbhi Singh   - **TPM Connection**: Connect the LetsTrust TPM board to GPIO pins 17 - 26 on
149*a2dd13caSAbhi Singh     the 40-pin GPIO header on the Raspberry Pi board. The 2x5 header of the TPM
150*a2dd13caSAbhi Singh     module must be aligned to the pins in a specific orientation, match the 3v3
151*a2dd13caSAbhi Singh     and RST pins from the TPM board to pins 17 and 18 respectively on the
152*a2dd13caSAbhi Singh     Raspberry Pi 3 header. See `rpi3 pinout`_.
153*a2dd13caSAbhi Singh
154*a2dd13caSAbhi Singh   - **Serial Console**: Establish a serial connection to the Raspberry Pi 3 to
155*a2dd13caSAbhi Singh     view serial output during the boot sequence. The GND, TXD, and RXD pins,
156*a2dd13caSAbhi Singh     which are labelled 6, 8, and 10 on the Raspberry Pi 3 header respectively,
157*a2dd13caSAbhi Singh     are the required pins to establish a serial connection. The recommended way
158*a2dd13caSAbhi Singh     to connect to the board from another system is to use a USB to serial TTL
159*a2dd13caSAbhi Singh     cable to output the serial console in a easy manner.
160*a2dd13caSAbhi Singh
161*a2dd13caSAbhi Singh   - **SD Card Setup**: Format a SD Card as ``FAT32`` with a default Raspbian
162*a2dd13caSAbhi Singh     installation that is similar to the default Raspberry Pi 3 boot partition,
163*a2dd13caSAbhi Singh     this partition will utilize the default files installed in the root
164*a2dd13caSAbhi Singh     directory with Rasbian such as:
165*a2dd13caSAbhi Singh
166*a2dd13caSAbhi Singh    ::
167*a2dd13caSAbhi Singh
168*a2dd13caSAbhi Singh        bcm2710-rpi3-b.dtb
169*a2dd13caSAbhi Singh        bootcode.bin
170*a2dd13caSAbhi Singh        config.txt
171*a2dd13caSAbhi Singh        fixup.dat
172*a2dd13caSAbhi Singh        start.elf
173*a2dd13caSAbhi Singh
174*a2dd13caSAbhi Singh    Open ``config.txt`` and overwrite the file with the following lines:
175*a2dd13caSAbhi Singh
176*a2dd13caSAbhi Singh    ::
177*a2dd13caSAbhi Singh
178*a2dd13caSAbhi Singh        arm_64bit=1
179*a2dd13caSAbhi Singh        disable_commandline_tags=2
180*a2dd13caSAbhi Singh        enable_uart=1
181*a2dd13caSAbhi Singh        armstub=armstub8.bin
182*a2dd13caSAbhi Singh        device_tree_address=0x200000
183*a2dd13caSAbhi Singh        device_tree_end=0x210000
184*a2dd13caSAbhi Singh
185*a2dd13caSAbhi Singh    These configurations are required to enable uart, enable 64bit mode,
186*a2dd13caSAbhi Singh    use the build TF binary, and the modified rpi3 device tree address
187*a2dd13caSAbhi Singh    and size.
188*a2dd13caSAbhi Singh
189*a2dd13caSAbhi Singh    Copy ``armstub8.bin`` from the TF-A build path to the root folder of the
190*a2dd13caSAbhi Singh    SD card.
191*a2dd13caSAbhi Singh
192*a2dd13caSAbhi Singh    The SD Card is now ready to be booted.
193*a2dd13caSAbhi Singh
194*a2dd13caSAbhi SinghRunning the PoC for the Raspberry Pi 3
195*a2dd13caSAbhi Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
196*a2dd13caSAbhi Singh
197*a2dd13caSAbhi SinghInsert the SD Card into the Raspberry Pi 3 SD card port and boot the system.
198*a2dd13caSAbhi Singh
199*a2dd13caSAbhi SinghTo access the serial console output from the Raspberry Pi 3 you can either:
200*a2dd13caSAbhi Singh
201*a2dd13caSAbhi Singh   - Follow `instructions`_ to use PuTTY to connect to Raspberry Pi 3 serial console.
202*a2dd13caSAbhi Singh
203*a2dd13caSAbhi Singh   - Use the linux ``screen`` command:
204*a2dd13caSAbhi Singh
205*a2dd13caSAbhi Singh      .. code:: shell
206*a2dd13caSAbhi Singh
207*a2dd13caSAbhi Singh        screen /dev/ttyUSB0 115200
208*a2dd13caSAbhi Singh
209*a2dd13caSAbhi SinghOnce booted the output from the serial console will look like this:
210*a2dd13caSAbhi Singh
211*a2dd13caSAbhi Singh.. code:: shell
212*a2dd13caSAbhi Singh
213*a2dd13caSAbhi Singh    Raspberry Pi Bootcode
214*a2dd13caSAbhi Singh
215*a2dd13caSAbhi Singh    Read File: config.txt, 153
216*a2dd13caSAbhi Singh
217*a2dd13caSAbhi Singh    Read File: start.elf, 2975040 (bytes)
218*a2dd13caSAbhi Singh
219*a2dd13caSAbhi Singh    Read File: fixup.dat, 7265 (bytes)
220*a2dd13caSAbhi Singh
221*a2dd13caSAbhi Singh    MESS:00:00:01.170422:0: brfs: File read: /mfs/sd/config.txt
222*a2dd13caSAbhi Singh    MESS:00:00:01.174630:0: brfs: File read: 153 bytes
223*a2dd13caSAbhi Singh    MESS:00:00:01.211473:0: HDMI0:EDID error reading EDID block 0 attempt 0
224*a2dd13caSAbhi Singh    MESS:00:00:01.217639:0: HDMI0:EDID error reading EDID block 0 attempt 1
225*a2dd13caSAbhi Singh    MESS:00:00:01.223977:0: HDMI0:EDID error reading EDID block 0 attempt 2
226*a2dd13caSAbhi Singh    MESS:00:00:01.230313:0: HDMI0:EDID error reading EDID block 0 attempt 3
227*a2dd13caSAbhi Singh    MESS:00:00:01.236650:0: HDMI0:EDID error reading EDID block 0 attempt 4
228*a2dd13caSAbhi Singh    MESS:00:00:01.242987:0: HDMI0:EDID error reading EDID block 0 attempt 5
229*a2dd13caSAbhi Singh    MESS:00:00:01.249324:0: HDMI0:EDID error reading EDID block 0 attempt 6
230*a2dd13caSAbhi Singh    MESS:00:00:01.255660:0: HDMI0:EDID error reading EDID block 0 attempt 7
231*a2dd13caSAbhi Singh    MESS:00:00:01.261997:0: HDMI0:EDID error reading EDID block 0 attempt 8
232*a2dd13caSAbhi Singh    MESS:00:00:01.268334:0: HDMI0:EDID error reading EDID block 0 attempt 9
233*a2dd13caSAbhi Singh    MESS:00:00:01.274429:0: HDMI0:EDID giving up on reading EDID block 0
234*a2dd13caSAbhi Singh    MESS:00:00:01.282647:0: brfs: File read: /mfs/sd/config.txt
235*a2dd13caSAbhi Singh    MESS:00:00:01.286929:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
236*a2dd13caSAbhi Singh    MESS:00:00:01.487295:0: gpioman: gpioman_get_pin_num: pin DISPLAY_DSI_PORT not defined
237*a2dd13caSAbhi Singh    MESS:00:00:01.494853:0: gpioman: gpioman_get_pin_num: pin LEDS_PWR_OK not defined
238*a2dd13caSAbhi Singh    MESS:00:00:01.500763:0: *** Restart logging
239*a2dd13caSAbhi Singh    MESS:00:00:01.504638:0: brfs: File read: 153 bytes
240*a2dd13caSAbhi Singh    MESS:00:00:01.510139:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 0
241*a2dd13caSAbhi Singh    MESS:00:00:01.517254:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 1
242*a2dd13caSAbhi Singh    MESS:00:00:01.524112:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 2
243*a2dd13caSAbhi Singh    MESS:00:00:01.530970:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 3
244*a2dd13caSAbhi Singh    MESS:00:00:01.537826:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 4
245*a2dd13caSAbhi Singh    MESS:00:00:01.544685:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 5
246*a2dd13caSAbhi Singh    MESS:00:00:01.551543:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 6
247*a2dd13caSAbhi Singh    MESS:00:00:01.558399:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 7
248*a2dd13caSAbhi Singh    MESS:00:00:01.565258:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 8
249*a2dd13caSAbhi Singh    MESS:00:00:01.572116:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 9
250*a2dd13caSAbhi Singh    MESS:00:00:01.578730:0: hdmi: HDMI0:EDID giving up on reading EDID block 0
251*a2dd13caSAbhi Singh    MESS:00:00:01.584634:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 0
252*a2dd13caSAbhi Singh    MESS:00:00:01.592427:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 1
253*a2dd13caSAbhi Singh    MESS:00:00:01.599286:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 2
254*a2dd13caSAbhi Singh    MESS:00:00:01.606142:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 3
255*a2dd13caSAbhi Singh    MESS:00:00:01.613001:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 4
256*a2dd13caSAbhi Singh    MESS:00:00:01.619858:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 5
257*a2dd13caSAbhi Singh    MESS:00:00:01.626717:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 6
258*a2dd13caSAbhi Singh    MESS:00:00:01.633575:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 7
259*a2dd13caSAbhi Singh    MESS:00:00:01.640431:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 8
260*a2dd13caSAbhi Singh    MESS:00:00:01.647288:0: hdmi: HDMI0:EDID error reading EDID block 0 attempt 9
261*a2dd13caSAbhi Singh    MESS:00:00:01.653905:0: hdmi: HDMI0:EDID giving up on reading EDID block 0
262*a2dd13caSAbhi Singh    MESS:00:00:01.659769:0: hdmi: HDMI:hdmi_get_state is deprecated, use hdmi_get_display_state instead
263*a2dd13caSAbhi Singh    MESS:00:00:01.668264:0: HDMI0: hdmi_pixel_encoding: 162000000
264*a2dd13caSAbhi Singh    MESS:00:00:01.673988:0: vec: vec_middleware_power_on: vec_base: 0x7e806000 rev-id 0x00002708 @ vec: 0x7e806100 @ 0x00000420 enc: 0x7e806060 @ 0x00000220 cgmsae: 0x7e80605c @ 0x00000000
265*a2dd13caSAbhi Singh    MESS:00:00:01.880234:0: dtb_file 'bcm2710-rpi-3-b.dtb'
266*a2dd13caSAbhi Singh    MESS:00:00:01.889713:0: brfs: File read: /mfs/sd/bcm2710-rpi-3-b.dtb
267*a2dd13caSAbhi Singh    MESS:00:00:01.894375:0: Loaded 'bcm2710-rpi-3-b.dtb' to 0x200000 size 0x7cb2
268*a2dd13caSAbhi Singh    MESS:00:00:01.915761:0: brfs: File read: 31922 bytes
269*a2dd13caSAbhi Singh    MESS:00:00:02.007202:0: brfs: File read: /mfs/sd/config.txt
270*a2dd13caSAbhi Singh    MESS:00:00:02.017277:0: brfs: File read: 153 bytes
271*a2dd13caSAbhi Singh    MESS:00:00:02.020772:0: Failed to open command line file 'cmdline.txt'
272*a2dd13caSAbhi Singh    MESS:00:00:02.042302:0: gpioman: gpioman_get_pin_num: pin EMMC_ENABLE not defined
273*a2dd13caSAbhi Singh    MESS:00:00:02.398066:0: kernel=
274*a2dd13caSAbhi Singh    MESS:00:00:02.455255:0: brfs: File read: /mfs/sd/armstub8.bin
275*a2dd13caSAbhi Singh    MESS:00:00:02.459284:0: Loaded 'armstub8.bin' to 0x0 size 0xdbe74
276*a2dd13caSAbhi Singh    MESS:00:00:02.465109:0: No compatible kernel found
277*a2dd13caSAbhi Singh    MESS:00:00:02.469610:0: Device tree loaded to 0x200000 (size 0x823f)
278*a2dd13caSAbhi Singh    MESS:00:00:02.476805:0: uart: Set PL011 baud rate to 103448.300000 Hz
279*a2dd13caSAbhi Singh    MESS:00:00:02.483381:0: uart: Baud rate change done...
280*a2dd13caSAbhi Singh    MESS:00:00:02.486793:0: uart: Baud rateNOTICE:  Booting Trusted Firmware
281*a2dd13caSAbhi Singh    NOTICE:  BL1: v2.11.0(release):v2.11.0-187-g0cb1ddc9c-dirty
282*a2dd13caSAbhi Singh    NOTICE:  BL1: Built : 10:57:10, Jul  9 2024
283*a2dd13caSAbhi Singh    INFO:    BL1: RAM 0x100ee000 - 0x100f9000
284*a2dd13caSAbhi Singh    INFO:    Using crypto library 'mbed TLS'
285*a2dd13caSAbhi Singh    NOTICE:  TPM Chip: vendor-id 0xd1, device-id 0x0, revision-id: 0x16
286*a2dd13caSAbhi Singh    NOTICE:  rpi3: Detected: Raspberry Pi 3 Model B (1GB, Sony, UK) [0x00a02082]
287*a2dd13caSAbhi Singh    INFO:    BL1: Loading BL2
288*a2dd13caSAbhi Singh    INFO:    Loading image id=1 at address 0x100b4000
289*a2dd13caSAbhi Singh    INFO:    Image id=1 loaded: 0x100b4000 - 0x100c0281
290*a2dd13caSAbhi Singh    INFO:    TCG_EfiSpecIDEvent:
291*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
292*a2dd13caSAbhi Singh    INFO:      EventType          : 3
293*a2dd13caSAbhi Singh    INFO:      Digest             : 00
294*a2dd13caSAbhi Singh    INFO:          : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
295*a2dd13caSAbhi Singh    INFO:          : 00 00 00
296*a2dd13caSAbhi Singh    INFO:      EventSize          : 33
297*a2dd13caSAbhi Singh    INFO:      Signature          : Spec ID Event03
298*a2dd13caSAbhi Singh    INFO:      PlatformClass      : 0
299*a2dd13caSAbhi Singh    INFO:      SpecVersion        : 2.0.2
300*a2dd13caSAbhi Singh    INFO:      UintnSize          : 1
301*a2dd13caSAbhi Singh    INFO:      NumberOfAlgorithms : 1
302*a2dd13caSAbhi Singh    INFO:      DigestSizes        :
303*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
304*a2dd13caSAbhi Singh    INFO:           DigestSize    : 32
305*a2dd13caSAbhi Singh    INFO:      VendorInfoSize     : 0
306*a2dd13caSAbhi Singh    INFO:    PCR_Event2:
307*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
308*a2dd13caSAbhi Singh    INFO:      EventType          : 3
309*a2dd13caSAbhi Singh    INFO:      Digests Count      : 1
310*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
311*a2dd13caSAbhi Singh    INFO:           Digest        : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
312*a2dd13caSAbhi Singh    INFO:          : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
313*a2dd13caSAbhi Singh    INFO:      EventSize          : 17
314*a2dd13caSAbhi Singh    INFO:      Signature          : StartupLocality
315*a2dd13caSAbhi Singh    INFO:      StartupLocality    : 0
316*a2dd13caSAbhi Singh    INFO:    PCR_Event2:
317*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
318*a2dd13caSAbhi Singh    INFO:      EventType          : 1
319*a2dd13caSAbhi Singh    INFO:      Digests Count      : 1
320*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
321*a2dd13caSAbhi Singh    INFO:           Digest        : 55 11 51 d8 8b 7f 41 d3 18 16 f2 e8 80 bf 80 fa
322*a2dd13caSAbhi Singh    INFO:          : b4 03 6d 96 4c a0 0a 98 45 cf 25 2f 1e a9 09 3e
323*a2dd13caSAbhi Singh    INFO:      EventSize          : 5
324*a2dd13caSAbhi Singh    INFO:      Event              : BL_2
325*a2dd13caSAbhi Singh    NOTICE:  BL1: Booting BL2
326*a2dd13caSAbhi Singh    INFO:    Entry point address = 0x100b4000
327*a2dd13caSAbhi Singh    INFO:    SPSR = 0x3c5
328*a2dd13caSAbhi Singh    NOTICE:  BL2: v2.11.0(release):v2.11.0-187-g0cb1ddc9c-dirty
329*a2dd13caSAbhi Singh    NOTICE:  BL2: Built : 10:56:39, Jul  9 2024
330*a2dd13caSAbhi Singh    INFO:    Using crypto library 'mbed TLS'
331*a2dd13caSAbhi Singh    NOTICE:  TPM Chip: vendor-id 0xd1, device-id 0x0, revision-id: 0x16
332*a2dd13caSAbhi Singh    INFO:    BL2: Doing platform setup
333*a2dd13caSAbhi Singh    INFO:    BL2: Loading image id 3
334*a2dd13caSAbhi Singh    INFO:    Loading image id=3 at address 0x100e0000
335*a2dd13caSAbhi Singh    INFO:    Image id=3 loaded: 0x100e0000 - 0x100e706b
336*a2dd13caSAbhi Singh    INFO:    BL2: Loading image id 5
337*a2dd13caSAbhi Singh    INFO:    Loading image id=5 at address 0x11000000
338*a2dd13caSAbhi Singh    INFO:    Image id=5 loaded: 0x11000000 - 0x110a8ad8
339*a2dd13caSAbhi Singh    INFO:    TCG_EfiSpecIDEvent:
340*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
341*a2dd13caSAbhi Singh    INFO:      EventType          : 3
342*a2dd13caSAbhi Singh    INFO:      Digest             : 00
343*a2dd13caSAbhi Singh    INFO:          : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
344*a2dd13caSAbhi Singh    INFO:          : 00 00 00
345*a2dd13caSAbhi Singh    INFO:      EventSize          : 33
346*a2dd13caSAbhi Singh    INFO:      Signature          : Spec ID Event03
347*a2dd13caSAbhi Singh    INFO:      PlatformClass      : 0
348*a2dd13caSAbhi Singh    INFO:      SpecVersion        : 2.0.2
349*a2dd13caSAbhi Singh    INFO:      UintnSize          : 1
350*a2dd13caSAbhi Singh    INFO:      NumberOfAlgorithms : 1
351*a2dd13caSAbhi Singh    INFO:      DigestSizes        :
352*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
353*a2dd13caSAbhi Singh    INFO:           DigestSize    : 32
354*a2dd13caSAbhi Singh    INFO:      VendorInfoSize     : 0
355*a2dd13caSAbhi Singh    INFO:    PCR_Event2:
356*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
357*a2dd13caSAbhi Singh    INFO:      EventType          : 3
358*a2dd13caSAbhi Singh    INFO:      Digests Count      : 1
359*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
360*a2dd13caSAbhi Singh    INFO:           Digest        : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
361*a2dd13caSAbhi Singh    INFO:          : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
362*a2dd13caSAbhi Singh    INFO:      EventSize          : 17
363*a2dd13caSAbhi Singh    INFO:      Signature          : StartupLocality
364*a2dd13caSAbhi Singh    INFO:      StartupLocality    : 0
365*a2dd13caSAbhi Singh    INFO:    PCR_Event2:
366*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
367*a2dd13caSAbhi Singh    INFO:      EventType          : 1
368*a2dd13caSAbhi Singh    INFO:      Digests Count      : 1
369*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
370*a2dd13caSAbhi Singh    INFO:           Digest        : 55 11 51 d8 8b 7f 41 d3 18 16 f2 e8 80 bf 80 fa
371*a2dd13caSAbhi Singh    INFO:          : b4 03 6d 96 4c a0 0a 98 45 cf 25 2f 1e a9 09 3e
372*a2dd13caSAbhi Singh    INFO:      EventSize          : 5
373*a2dd13caSAbhi Singh    INFO:      Event              : BL_2
374*a2dd13caSAbhi Singh    INFO:    PCR_Event2:
375*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
376*a2dd13caSAbhi Singh    INFO:      EventType          : 1
377*a2dd13caSAbhi Singh    INFO:      Digests Count      : 1
378*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
379*a2dd13caSAbhi Singh    INFO:           Digest        : f3 00 5c ed a2 12 8b 76 b7 82 da c5 28 c3 02 52
380*a2dd13caSAbhi Singh    INFO:          : 19 e4 3a 82 f2 3c ab 1e 0d 78 84 9c b5 fe e2 4f
381*a2dd13caSAbhi Singh    INFO:      EventSize          : 14
382*a2dd13caSAbhi Singh    INFO:      Event              : SECURE_RT_EL3
383*a2dd13caSAbhi Singh    INFO:    PCR_Event2:
384*a2dd13caSAbhi Singh    INFO:      PCRIndex           : 0
385*a2dd13caSAbhi Singh    INFO:      EventType          : 1
386*a2dd13caSAbhi Singh    INFO:      Digests Count      : 1
387*a2dd13caSAbhi Singh    INFO:        #0 AlgorithmId   : SHA256
388*a2dd13caSAbhi Singh    INFO:           Digest        : 90 28 81 42 12 b7 9b ca aa 0c 40 76 33 5a 69 71
389*a2dd13caSAbhi Singh    INFO:          : b6 19 2b 90 f2 d2 69 b8 de 8e 6d 05 4d c2 73 f9
390*a2dd13caSAbhi Singh    INFO:      EventSize          : 6
391*a2dd13caSAbhi Singh    INFO:      Event              : BL_33
392*a2dd13caSAbhi Singh    NOTICE:  BL1: Booting BL31
393*a2dd13caSAbhi Singh    INFO:    Entry point address = 0x100e0000
394*a2dd13caSAbhi Singh    INFO:    SPSR = 0x3cd
395*a2dd13caSAbhi Singh    NOTICE:  BL31: v2.11.0(release):v2.11.0-187-g0cb1ddc9c-dirty
396*a2dd13caSAbhi Singh    NOTICE:  BL31: Built : 10:56:58, Jul  9 2024
397*a2dd13caSAbhi Singh    INFO:    rpi3: Checking DTB...
398*a2dd13caSAbhi Singh    INFO:    rpi3: Reserved 0x10000000 - 0x10100000 in DTB
399*a2dd13caSAbhi Singh    INFO:    BL31: Initializing runtime services
400*a2dd13caSAbhi Singh    INFO:    BL31: Preparing for EL3 exit to normal world
401*a2dd13caSAbhi Singh    INFO:    Entry point address = 0x11000000
402*a2dd13caSAbhi Singh    INFO:    SPSR = 0x3c9
403*a2dd13caSAbhi Singh
404*a2dd13caSAbhi Singh
405*a2dd13caSAbhi Singh    U-Boot 2024.04-g84314330-dirty (Apr 23 2024 - 15:41:54 -0500)
406*a2dd13caSAbhi Singh
407*a2dd13caSAbhi Singh    DRAM:  948 MiB
408*a2dd13caSAbhi Singh    RPI 3 Model B (0xa02082)
409*a2dd13caSAbhi Singh    Core:  68 devices, 14 uclasses, devicetree: embed
410*a2dd13caSAbhi Singh    MMC:   mmc@7e202000: 0, mmc@7e300000: 1
411*a2dd13caSAbhi Singh    Loading Environment from FAT... OK
412*a2dd13caSAbhi Singh    In:    serial,usbkbd
413*a2dd13caSAbhi Singh    Out:   serial,vidconsole
414*a2dd13caSAbhi Singh    Err:   serial,vidconsole
415*a2dd13caSAbhi Singh    Net:   No ethernet found.
416*a2dd13caSAbhi Singh    starting USB...
417*a2dd13caSAbhi Singh    Bus usb@7e980000: USB DWC2
418*a2dd13caSAbhi Singh    scanning bus usb@7e980000 for devices...
419*a2dd13caSAbhi Singh    Error: smsc95xx_eth No valid MAC address found.
420*a2dd13caSAbhi Singh    2 USB Device(s) found
421*a2dd13caSAbhi Singh          scanning usb for storage devices... 0 Storage Device(s) found
422*a2dd13caSAbhi Singh    Hit any key to stop autoboot:  2  1  0
423*a2dd13caSAbhi Singh    Card did not respond to voltage select! : -110
424*a2dd13caSAbhi Singh    No EFI system partition
425*a2dd13caSAbhi Singh    No EFI system partition
426*a2dd13caSAbhi Singh    Failed to persist EFI variables
427*a2dd13caSAbhi Singh    No EFI system partition
428*a2dd13caSAbhi Singh    Failed to persist EFI variables
429*a2dd13caSAbhi Singh    No EFI system partition
430*a2dd13caSAbhi Singh    Failed to persist EFI variables
431*a2dd13caSAbhi Singh    Missing TPMv2 device for EFI_TCG_PROTOCOL
432*a2dd13caSAbhi Singh    ** Booting bootflow '<NULL>' with efi_mgr
433*a2dd13caSAbhi Singh    Loading Boot0000 'mmc 0' failed
434*a2dd13caSAbhi Singh    EFI boot manager: Cannot load any image
435*a2dd13caSAbhi Singh    Boot failed (err=-14)
436*a2dd13caSAbhi Singh    Card did not respond to voltage select! : -110
437*a2dd13caSAbhi Singh    No ethernet found.
438*a2dd13caSAbhi Singh    No ethernet found.
439*a2dd13caSAbhi Singh    U-Boot>
440*a2dd13caSAbhi Singh
441*a2dd13caSAbhi Singh
442*a2dd13caSAbhi SinghNext steps for Discrete TPM and Measured Boot development
443*a2dd13caSAbhi Singh~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
444*a2dd13caSAbhi Singh
445*a2dd13caSAbhi SinghIn order to automatically validate the workings of the Discrete TPM, the creation
446*a2dd13caSAbhi Singhof test cases that compare the eventlog image hashes with what is stored in PCR0
447*a2dd13caSAbhi Singhare a great way to test the core functionality of the Discrete TPM in Measured Boot.
448*a2dd13caSAbhi Singh
449*a2dd13caSAbhi SinghDevelopment of Discrete TPM drivers such as a reference FIFO |I2C|, MMIO, and CRB
450*a2dd13caSAbhi Singhdrivers has not started, these drivers will allow a larger number of platform
451*a2dd13caSAbhi Singhto use a Discrete TPM in TF-A.
452*a2dd13caSAbhi Singh
453*a2dd13caSAbhi Singh*Copyright (c) 2025, Arm Limited. All rights reserved.*
454*a2dd13caSAbhi Singh
455*a2dd13caSAbhi Singh.. _TCG event log: https://trustedcomputinggroup.org/resource/tcg-efi-platform-specification/
456*a2dd13caSAbhi Singh.. _rpi3 pinout: https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#gpio
457*a2dd13caSAbhi Singh.. _instructions: https://www.circuitbasics.com/use-putty-to-access-the-raspberry-pi-terminal-from-a-computer/
458*a2dd13caSAbhi Singh.. _workaround:  https://github.com/mhomran/u-boot-rpi3-b-plus
459