All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick DELAUNAY <patrick.delaunay@foss.st.com>
To: gianluca <gianlucarenzi@eurek.it>, <u-boot@lists.denx.de>
Cc: Gianluca Renzi <icjtqr@gmail.com>,
	U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>,
	Patrice CHOTARD <patrice.chotard@foss.st.com>
Subject: Re: U-BOOT 2021.07 and STM32MP15x issues for Trusted Boot Chain
Date: Thu, 22 Jul 2021 11:03:50 +0200	[thread overview]
Message-ID: <6ba30090-b390-9e07-4d1a-b21ae0d40106@foss.st.com> (raw)
In-Reply-To: <454648fd-7145-fe3f-c95d-dd17c33d8f17@eurek.it>

Hi Gianluca,

On 7/22/21 10:01 AM, gianluca wrote:
> Hello list,
> I was wondering what I am doing wrong following the procedure 
> explained in the doc/board/st/stm32mp1.rst documentation file.
>
> I am using the latest git version (the Makefile says 2021.07).
>
> My goal is to run from sdcard in trusted boot chain (TrustZone secure 
> monitor) the evaluation kit STM32MP157C-DK2.
>
> The procedure says:
>
>> The **Trusted** boot chain
>> ``````````````````````````
>>
>> defconfig_file : stm32mp15_trusted_defconfig
>>
>> +-------------+-------------------------+------------+-------+
>>     |  ROM code   | FSBL                    | SSBL       | OS |
>>     + +-------------------------+------------+-------+
>>     |             |Trusted Firmware-A (TF-A)| U-Boot     | Linux |
>> +-------------+-------------------------+------------+-------+
>>     | TrustZone   |secure monitor |
>> +-------------+-------------------------+------------+-------+
>>
>> TF-A performs a full initialization of Secure peripherals and installs a
>> secure monitor, BL32:
>>
>>   * SPMin provided by TF-A or
>>   * OP-TEE from specific partitions (teeh, teed, teex).
>>
>> U-Boot is running in normal world and uses the secure monitor to access
>> to secure resources.
>
> As far as I understand there is only a single first-stage-boot-loader 
> (FSBL) and a second-stage-boot-loader (SSBL), otherwise in the *Basic 
> Boot Chain* I have FSBL1 and FSBL2 _and_ a SSBL.
>
>

FSBL1 / FBSL2 => can be use for basic or trusted boot chain = it is 2 
copy for the FSBL for failsafe update

the ROM code will check integrity of FSBL1 ..... if it is failing, it 
will use FSBL2 instead


This feature allo to always boot even if FSBL1 update is interrupted....

if this feature is not needed you can remove the second FSBL partition.


>> Build Procedure
>> ---------------
>>
>> 1. Install the required tools for U-Boot
>>
>>    * install package needed in U-Boot makefile
>>      (libssl-dev, swig, libpython-dev...)
>>
>>    * install ARMv7 toolchain for 32bit Cortex-A (from Linaro,
>>      from SDK for STM32MP15x, or any crosstoolchains from your 
>> distribution)
>>      (you can use any gcc cross compiler compatible with U-Boot)
>>
>
> Done. I am in a Debian Buster DevelWorkstation, so everything is 
> coming from the official repos.
>
> At the moment the arm toolchain is: > arm-linux-gnueabihf-gcc -v
>
(...)


>>
>> 6. Output files
>>
>>    BootRom and TF-A expect binaries with STM32 image header
>>    SPL expects Gianlucafile with U-Boot uImage header
>>
>>    So in the output directory (selected by KBUILD_OUTPUT),
>>    you can found the needed files:
>>
>>   - For **Trusted** boot (with or without OP-TEE)
>>
>>      - FSBL = **tf-a.stm32** (provided by TF-A compilation)
>>      - SSBL = **u-boot.stm32**
>
> No tf-a.stm32 for TrustZone Boot but only the u-boot.stm32 file.
>

"tf-a.stm32" is provided by TF-A compilation (see after.


>>
>>   - For Basic boot
>>
>>      - FSBL = spl/u-boot-spl.stm32
>>      - SSBL = u-boot.img
>
> find . -name 'tf-a.stm32'
>
> find . -name '*tf-a*'
>
> find . -name '*tfa*'
> ./include/config/tfaboot.h
> ./include/config/arch/support/tfaboot.h
>
> Where is the tf-a.stm32?????
>
> Something missing by my side???
>
>
> Regards,
> Gianluca Renzi


"TF-A"  = "Trusted Firmware-A"  is a separate component and it need to 
be compiled separately.

TF-A references =

- https://www.trustedfirmware.org/projects/tf-a/

- https://trustedfirmware-a.readthedocs.io/en/latest/

=> https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/


For build information at upstream, you can check

https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/tree/docs/plat/stm32mp1.rst

For first test you can use SP_min as secure monitor:

|make CROSS_COMPILE=arm-linux-gnueabihf- PLAT=stm32mp1 ARCH=aarch32 
ARM_ARCH_MAJOR=7 AARCH32_SP=sp_min STM32MP_SDMMC=1 STM32MP_EMMC=1 
STM32MP_RAW_NAND=1 STM32MP_SPI_NAND=1 STM32MP_SPI_NOR=1 
DTB_FILE_NAME=stm32mp157c-ev1.dtb |

I will update the stm32mp1 readme to indicate these missing information.


you need to compile 2 projects

- TF-A => FSBL

- U-Boot => SSBL


PS: to have a full secure support support with FIP (when  it will be 
supported on TF-A side),

you can use OP-TEE as the secure OS.... but it is a separate project

TF-A REF =

- https://www.op-tee.org/

- https://optee.readthedocs.io/en/latest/

- BUILD = 
https://optee.readthedocs.io/en/latest/building/devices/stm32mp1.html

=> https://github.com/OP-TEE/optee_os


In this case you need to compile the binary include in FIP

- OP-TEE => Secure OS

- U-Boot => SSBL


Then you can compile:

- TF-A => FSBL & FIP (including OP-TEE and U-Boot)


Regards

Patrick


      reply	other threads:[~2021-07-22  9:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-22  8:01 U-BOOT 2021.07 and STM32MP15x issues for Trusted Boot Chain gianluca
2021-07-22  9:03 ` Patrick DELAUNAY [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ba30090-b390-9e07-4d1a-b21ae0d40106@foss.st.com \
    --to=patrick.delaunay@foss.st.com \
    --cc=gianlucarenzi@eurek.it \
    --cc=icjtqr@gmail.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.