Building TorizonOS for the STM32MP boards

1. Overview

This page describes how to build the TorizonOS for the STM32MPx development boards including STM32MP257x-EV1, STM32MP257x-DKx and STM32MP157x-DKx.

2. Understanding Build Structure

The base principles for building the TorizonOS for STM32MP architecture are the same as for the other targets described in the official TorizonOS documentation: Build Torizon OS from Source With Yocto Project/OpenEmbedded | Toradex Developer Center.

The main difference is that the STM32MP build requires 2 additional meta-layers. These are:

  1. meta-st-stm32mp - BSP Layer for the STM32MP targets developed by STMicroelectonics for the OpenSTLinux project https://wiki.st.com/stm32mpu/wiki/Category:Yocto-based_OpenSTLinux_embedded_software

  2. meta-torizon-st - adaptation of the STM32MP BSP for TorizonOS developed by EmCraft.

What follows is the instructions on how to integrate these two layers in to the general TorizonOS Yocto project and then build TorizonOS for the STM32MP targets.

3. Preparing BSP for Build

Perform the following steps:

  1. Set up the default git user and e-mail:

    $ git config --global user.email "you@example.com" $ git config --global user.name "Your Name"
  2. Install the repo utility to the development host:

    $ mkdir ~/bin $ PATH=~/bin:$PATH $ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo
  3. Create a working directory for the Yocto build and go to it:

    $ cd ~ $ mkdir ~/yocto-workdir $ cd ~/yocto-workdir
  4. Initialize the TorizonOS Repo:

  5. Sync the repositories:

  6. Download the ST32MP2 BSP layer:

  7. Download the ST32MP2 Torizon compatibility layer:

  8. Replace the setup environment link and the Docker build link:

4. Building BSP Images

Perform the following steps:

  1. Use the Docker container provided by Toradex to setup the build environment in the work directory ~/yocto-workdir prepared in previous steps:

  2. In the docker console setup the environment for the certain STM32MP board: MACHINE=<MACHINE> source setup-environment [BUILDDIR]. Where MACHINE is one of the supported STM32MP targets: stm32mp25-eval for the STM32MP2 Evaluation kit, stm32mp25-eval for the STM32MP2 Discovery kit or stm32mp25-eval for STM32MP1 Discovery kit, BUILDDIR in the directory where to store the build files. For example:

  3. Build the TorizonOS images:

5. Understanding Build Outcome

When build has successfully completed, the following artifacts located in the $BUILDDIR/deploy/images/$MACHINE can be used to install TorizonOS to the STM32MP target board (refer to Installing TorizonOS to STM32MP Target Boards Using the STM32 Programmer Tool):

  1. arm-trusted-firmware/ - the directory with FSBL (= Trusted Firmware-A) images:

  2. fip/ - the directory with FIP (= U-Boot) images to be installed to eMMC or SD card:

  3. flashlayout_torizon-core-docker/optee/- the directory with eMMC or SD card layout to be used with the STM32_Programmer

  4. torizon-core-docker-<MACHINE>.ota-ext4 - main TorizonOS OSTree based image, including the Linux kernel images and the root file system.

For example, the following images will be deployed for STM32MP2 Evaluation kit:

  1. arm-trusted-firmware/:

    1. tf-a-stm32mp257f-ev1-usb.stm32 - FSBL to boot the STM32MP2 targets over USB for the initial installation

    2. tf-a-stm32mp257f-ev1-optee-emmc.stm32 - FSBL to be installed and boot the STM32MP2 targets from eMMC

    3. tf-a-stm32mp257f-ev1-optee-sdcard.stm32 - FSBL to be installed and boot the STM32MP2 targets from SD card

    4. metadata.bin- FSBL metadata.

  2. fip/:

    1. fip-stm32mp257f-ev1-ddr-optee-emmc.bin- required to initialize DDR

    2. fip-stm32mp257f-ev1-ddr-optee-sdcard.bin- required to initialize DDR

    3. fip-stm32mp257f-ev1-optee-emmc.bin - main bootloader image for eMMC

    4. fip-stm32mp257f-ev1-optee-sdcard.bin - main bootloader image for SD card

  3. flashlayout_torizon-core-docker/optee/:

    1. FlashLayout_emmc_stm32mp257f-ev1-optee.tsv - eMMC layout to be used with the STM32_Programmer

    2. FlashLayout_sdcard_stm32mp257f-ev1-optee.tsv - SD card layout to be used with the STM32_Programmer

  4. torizon-core-docker-stm32mp25-eval.ota-ext4 - main TorizonOS OSTree based image, including the Linux kernel images and the root file system.