Last edited 2 months ago

Example of directory structure for Packages

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP25x lines


1. Article purpose[edit | edit source]

This article aims at proposing a way to organize, on the host PC, the software packages of the different Packages (Starter, Developer and Distribution) for a given release of the STM32MPU Embedded Software distribution.

The main objective of the proposed organization is to keep together the software packages corresponding to a given release because there are links between them. For example:

  • Flashing the image from the Starter Package on the board is mandatory before modifying the source code from the Developer Package. Both the image and the source code must belong to the same software release.
  • The SDK (Developer Package) and the image (Starter Package) have both been generated from the Distribution Package. A software release thus guarantees that there is no misalignment between the different software packages.
Info white.png Information
The objective of this article is to describe one organization among all the possible organizations. Feel free to organize the delivered Packages in any other way that would better match your way of working.
Info white.png Information
In practice, this article uses the release STM32MPU-Ecosystem-v5.1.0 for the STM32MPU Embedded Software distribution as an example to illustrate the proposed organization. If you are using a different release, the names of the directories and files might differ.


The directories are shown in green, while the files are in black.

2. Creating the structure[edit | edit source]

  • Create your <working directory> and assign a unique name to it (for example by including the release name):
 mkdir STM32MPU-Ecosystem-v5.1.0
 cd STM32MPU-Ecosystem-v5.1.0
Warning white.png Warning
Prefer to have a <working directory> into the root of your HOME directory or in a short path (/local or /opt for example).
Distribution package with a too long Yocto BUILDDIR path could fail at compilation step.
  • Create the first-level directories that will host the software packages delivered through the STM32MPU Embedded Software distribution release note:
 mkdir Starter-Package
 mkdir Developer-Package
 mkdir Distribution-Package
  • The resulting directory structure looks as follows:
STM32MPU-Ecosystem-v5.1.0  STM32MPU Embedded Software release
├── Developer-Package       Developer Package installation directory
├── Distribution-Package    Distribution Package installation directory
└── Starter-Package         Starter Package installation directory

Once all software packages have been installed according to the instructions given in the STM32MPU Embedded Software distribution release note, the resulting directory structure looks as follows:

STM32MPU-Ecosystem-v5.1.0                 STM32MPU Embedded Software release
├── Developer-Package                                Developer Package installation directory
│   ├── sdk                                                      SDK for OpenSTLinux distribution
│   ├── STM32Cube_FW_MP1_V1.6.0                                  STM32CubeMP1 Package
│   ├── STM32Cube_FW_MP2_V1.0.0                                  STM32CubeMP2 Package
│   ├── stm32mp1-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26  Linux kernel, U-Boot, TF-A and OP-TEE OS source code (OpenSTLinux distribution)
│   └── stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26  Linux kernel, U-Boot, TF-A and OP-TEE OS source code (OpenSTLinux distribution)
├── Distribution-Package                             Distribution Package installation directory
│   └── openstlinux-6.1-yocto-mickledore-mpu-v24.06.26           OpenSTLinux distribution (full source code and OpenEmbedded-based build framework)
└── Starter-Package                                  Starter Package installation directory
    |── stm32mp1-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26  Software image (binaries)
    └── stm32mp2-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26  Software image (binaries)

3. Focus on the Starter Package directory[edit | edit source]

The Starter-Package directory contains the software image for the STM32MPU Embedded Software distribution.

The optee boot chain is the default solution delivered by STMicroelectronics. It includes the superset of features (for example, all Flash memory devices are supported). Refer to the Boot chain overview article for details.

Flash memory partitions (e.g. rootfs, bootfs...) are explained in the STM32 MPU Flash mapping article.


Starter-Package
└── stm32mp{1,2}-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26 
    └── images
        └── stm32mp{1,2}
            ├── flashlayout_st-image-weston                                 Flash layout files (description of the partitions) for the supported Flash devices and boards
            │   ├── deleteall
            │   │   └── [...]
            │   ├── extensible
            │   │   ├── FlashLayout_sdcard_stm32mp*-extensible.tsv     Flash layout file for microSD card with no userfs partition but a rootfs partition extended to sdcard size (recommended setup for package repository service)
            │   │   └── [...]
            │   ├── optee
            │   │   ├── FlashLayout_emmc_stm32mp*-optee.tsv            Flash layout file for eMMC and op-tee boot chain, with OP-TEE OS
            │   │   ├── FlashLayout_sdcard_stm32mp*-optee.tsv          Flash layout file for microSD card and op-tee boot chain, with OP-TEE OS
            │   │   └── [...]
            ├── fip
            │   ├── fip-<board>-<boot-type>.bin             Image to flash            
            ├── arm-trusted-firmware
            │   ├── tf-a-<board>-<boot-type>.stm32          Intermediate tf-a binary used to build fip image
            ├── u-boot
            │   ├── u-boot-nodtb-soc.bin                    Intermediate tf-a binary used to build fip image
            │   ├── u-boot-<board>-<boot-type>.dtb          Intermediate tf-a dtb used to build fip image
            ├── optee
            │   ├── tee-header_v2-<board>.bin
            ​│   ├── tee-pageable_v2--<board>.bin
           ​ │   ├── tee-pager_v2--<board>.bin
            ├── kernel
            │   ├── vmlinux                                 vmlinux copied in bootfs partition
            ├── scripts
            │   └── create_sdcard_from_flashlayout.sh
            ├── st-image-bootfs-openstlinux-weston-stm32mp{1,2}.ext4            Binary for bootfs partition
            ├── st-image-bootfs-openstlinux-weston-stm32mp{1,2}.manifest
            ├── st-image-userfs-openstlinux-weston-stm32mp{1,2}.ext4            Binary for userfs partition
            ├── st-image-userfs-openstlinux-weston-stm32mp{1,2}.manifest
            ├── st-image-vendorfs-openstlinux-weston-stm32mp{1,2}.ext4          Binary for vendorfs partition
            ├── st-image-weston-openstlinux-weston-stm32mp{1,2}.ext4            Binary for rootfs partition
            ├── st-image-weston-openstlinux-weston-stm32mp{1,2}.license
            ├── st-image-weston-openstlinux-weston-stm32mp{1,2}-license_content.html
            ├── st-image-weston-openstlinux-weston-stm32mp{1,2}.manifest
            └── [...]

4. Focus on the Developer Package directory[edit | edit source]

The Developer-Package directory contains:

  • The source code for the following OpenSTLinux software packages (development for Arm® Cortex®-A processor):
    • Linux® kernel
    • GCnano driver
    • U-Boot
    • TF-A
    • OP-TEE OS
  • The debug symbol files for Linux kernel, U-Boot, TF-A and OP-TEE OS
  • The SDK (for cross-development on an host PC)
  • The STM32Cube MPU Package (developed for Arm® Cortex®-M processor)


Developer-Package
├── SDK                                                               SDK for OpenSTLinux distribution: details in Standard SDK directory structure article
│   ├── st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26.sh  
│   ├── [...]
│   ├── st-image-weston-openstlinux-weston-stm32mp2-x86_64-toolchain-4.2.4-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26.sh  
│   └── [...]
├── STM32Cube_FW_MP1_V1.6.0             STM32CubeMP1 Package: details in STM32CubeMP15 Package content article
│   ├── Drivers
│   │   ├── BSP                         BSP drivers for the supported STM32MPU boards
│   │   │   └── [...]
│   │   ├── CMSIS
│   │   │   └── [...]
│   │   └── STM32MP1xx_HAL_Driver       HAL drivers for the supported STM32MPU devices
│   │       └── [...]
│   ├── _htmresc
│   │   └── [...]
│   ├── License.md                      License types for the components
│   ├── Middlewares                     Middlewares used by the examples and applications
│   │   └── [...]
│   ├── package.xml
│   ├── Projects
│   │   ├── STM32CubeProjectsList.html  List of examples and applications for STM32CubeMP1 Package
│   │   ├── STM32MP157F-DK2             Set of examples and applications → STM32MP157F-DK2
│   │   │   └── [...]
│   │   └── STM32MP157F-EV1             Set of examples and applications → STM32MP157F-EV1
│   │       └── [...]
│   ├── Readme.md
│   ├── Release_Notes.html              Release note for STM32CubeMP1 Package
│   └── Utilities
│       └── [...]
├── STM32Cube_FW_MP2_V1.0.0             STM32CubeMP2 Package: details in STM32CubeMP2 Package content article
    └── [...]
└── stm32mp{1,2}-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26     Source code for OpenSTLinux distribution
    ├── images
    │   └── stm32mp1                                Debug symbol files installation directory
    │       ├── tf-a-bl2-optee.elf                  Debug symbol file for TF-A, with OP-TEE OS → boot firmware stage
    │       ├── u-boot-stm32mp157a-dk1-optee.elf    Debug symbol file for U-Boot, with OP-TEE OS → STM32MP157A-DK1
    │       ├── u-boot-stm32mp157f-dk2-optee.elf    Debug symbol file for U-Boot, with OP-TEE OS → STM32MP157F-DK2
    │       ├── u-boot-stm32mp157f-ev1-optee.elf    Debug symbol file for U-Boot, with OP-TEE OS → STM32MP157F-EV1
    │       ├── vmlinux                             Debug symbol file for Linux kernel
    │       └── [...]
    └── sources
        └── arm-ostl-linux-gnueabi
            ├── FIP_artifacts
            ├── fip/                     fip images of Stater Package
            ├── arm-trusted-firmware/    intermediate tf-a binaries from Stater Package (needed to build any fip image
            ├── optee/                   intermediate optee binaries from Stater Package (needed to build any fip image
            └── u-boot/                  intermediate u-boot binaries from Stater Package (needed to build any fip image
            ├── linux-6.1.82
            │   ├── [*].patch            ST patches for Linux kernel
            │   ├── fragment-[*].config  ST configuration fragments for Linux kernel
            │   ├── linux-6.1.82        Linux kernel source code directory
            │   ├── linux-6.1.82.tar.xz
            │   ├── README.HOW_TO.txt    Helper file for Linux kernel management: reference for Linux kernel build
            │   └── series
            ├── gcnano-driver-stm32mp-6.4.15-stm32mp1-r1-r0
            │   ├── gcnano-driver-stm32mp-6.4.15-stm32mp1-r1-r0         GCnano kernel module source code directory
            │   ├── gcnano-driver-stm32mp-6.4.15-stm32mp1-r1-r0.tar.xz
            │   └── README.HOW_TO.txt                                      Helper file for GCnano kernel module management: reference for GCnano kernel module build
            ├── optee-os-stm32mp-3.19.0-stm32mp-r2-r0             OP-TEE OS installation directory
            │   ├── [*].patch                                      ST patches for OP-TEE OS
            │   ├── optee-os-stm32mp-3.19.0-stm32mp-r2-r0.tar.xz
            │   ├── Makefile.sdk                                   Makefile for the OP-TEE OS compilation
            │   ├── optee-os-stm32mp-3.19.0-stm32mp-r2-r0         OP-TEE OS source code directory
            │   ├── README.HOW_TO.txt                              Helper file for OP-TEE OS management: reference for OP-TEE OS build
            │   └── series
            ├── tf-a-stm32mp-v2.8.15-stm32mp-r2-r0           TF-A installation directory
            │   ├── [*].patch                              ST patches for TF-A
            │   ├── tf-a-stm32mp-v2.8.15-stm32mp-r2-r0       TF-A source code directory
            │   ├── Makefile.sdk                           Makefile for the TF-A compilation
            │   ├── README.HOW_TO.txt                      Helper file for TF-A management: reference for TF-A build
            │   ├── series
            │   └── tf-a-stm32mp-v2.8.15-stm32mp-r2-r0.tar.xz
            └── u-boot-stm32mp-v2022.10-stm32mp-r2-r0               U-Boot installation directory
                ├── [*].patch                                       ST patches for U-Boot
                ├── Makefile.sdk                                    Makefile for the U-Boot compilation
                ├── README.HOW_TO.txt                               Helper file for U-Boot management: reference for U-Boot build
                ├── series
                ├── u-boot-stm32mp-v2022.10-stm32mp-r2-r0           U-Boot source code directory
                └── u-boot-stm32mp-v2022.10-stm32mp-r2-r0.tar.xz

Appendix A shows the structure of the Linux kernel, U-Boot, TF-A and OP-TEE OS installation directories after these software packages have been built.

5. Focus on the Distribution Package directory[edit | edit source]

The Distribution-Package directory contains all the OpenEmbedded layers required to get the source code of any STM32MPU Embedded Software component, as well as a build framework based on OpenEmbedded.


STM32MPU-Ecosystem-v5.1.0
└── Distribution-Package  OpenSTLinux distribution
    └── layers
        ├── meta-openembedded  Collection of layers for the OpenEmbedded-Core universe (OpenEmbedded standard)
        │   └── [...]
        ├── meta-qt5           QT5 layer for OpenEmbedded (standard)
        │   └── [...]
        ├── meta-st
        │   ├── meta-st-openstlinux                   STMicroelectronics layer that contains the settings of the frameworks and images for the OpenSTLinux distribution
        │   │   ├── recipes-st
        │   │   │   ├── images
        │   │   │   │   ├── st-image-core.bb          Core image for OpenSTLinux distribution
        │   │   │   │   └── st-image-weston.bb        Weston image with basic Wayland support for OpenSTLinux distribution: recommended setup
        │   │   │   └── packagegroups
        │   │   │       └── [...]
        │   │   └── [...]
        │   ├── meta-st-stm32mp                   STMicroelectronics layer that contains the description of the BSP for the STM32 MPU devices
        │   │   ├── recipes-bsp
        │   │   │   ├── alsa                      Recipes for ALSA control configuration
        │   │   │   │   └── [...]
        │   │   │   ├── drivers                   Recipes for Vivante GCNANO GPU kernel drivers
        │   │   │   │   └── [...]
        │   │   │   ├── trusted-firmware-a        Recipes for TF-A
        │   │   │   │   └── [...]
        │   │   │   └── u-boot                    Recipes for U-Boot
        │   │   │       └── [...]
        │   │   ├── recipes-extended
        │   │   │   ├── m4projects                Recipes for STM32Cube MPU Package within the OpenSTLinux distribution
        │   │   │   │   └── [...]
        │   │   │   └── [...]
        │   │   ├── recipes-graphics
        │   │   │   ├── gcnano-userland           Recipes for Vivante libraries OpenGL ES, OpenVG and EGL (multi backend)
        │   │   │   │   └── [...]
        │   │   │   └── [...]
        │   │   ├── recipes-kernel
        │   │   │   └── linux                     Recipes for Linux kernel
        │   │   │       └── [...]
        │   │   │   └── linux-firmware            Recipes for Linux firmwares (example, Bluetooth firmware)
        │   │   │       └── [...]
        │   │   ├── recipes-st
        │   │   │   └── images
        │   │   │       ├── st-image-bootfs.bb    Recipes for the bootfs partition binary
        │   │   │       ├── st-image-userfs.bb    Recipes for the userfs partition binary
        │   │   │       └── st-image-vendorfs.bb  Recipes for the vendorfs partition binary
        │   │   └── [...]
        │   ├── meta-st-stm32mp-addons  STMicroelectronics layer that helps managing the STM32CubeMX integration
        │       └── [...]
        │   └── scripts
        │       ├── envsetup.sh         Environment setup script for Distribution Package
        │       └── [...]
        ├── meta-timesys       Timesys layer for OpenEmbedded (standard)
        │   └── [...]
        └── openembedded-core  Core metadata for current versions of OpenEmbedded (standard)
            └── [...]

Appendix B shows the structure of the build directory.

6. Appendix A: directory structure after build (Developer Package)[edit | edit source]

Provided you have followed the recommendations of the README.HOW_TO.txt helper files to build the Linux kernel, the U-Boot and the TF-A, then the following new directories and files contain the build outputs.


Developer-Package
├── stm32mp{1,2}-openstlinux-6.1-yocto-mickledore-mpu-v24.06.26  Source code for OpenSTLinux distribution
│   └── sources
│       └── arm-ostl-linux-gnueabi
│           ├── FIP_artifacts                  FIP images to flash
│           │   ├── fip/                               FIP images to flash, need to edit tsv file to point on that fip images
│           │   ├── arm-trusted-firmware/              Intermediate binaries of tf-a required to build fip images
│           │   ├── u-boot/                            Intermediate binaries of u-boot required to build fip images
│           │   ├── optee/                             Intermediate binaries of  optee required to build fip images
│           ├── linux-6.1.82
│           │   ├── build                               Linux kernel build directory
│           │   │   ├── install_artifact
│           │   │   │   ├── lib
│           │   │   │   │   └── modules
│           │   │   │   │       └── X.Y.Z
│           │   │   │   │           └── [...]           Kernel modules hierarchy (*.ko files)
│           │   │   │   └── boot
│           │   │   │       ├── stm32mp[*].dtb  Linux kernel device tree blob files for bootfs partition
│           │   │   │       ├── uImage                  Linux kernel binary image file (with U-Boot wrapper) for bootfs partition
│           │   │   │       └── [...]
│           │   │   ├── vmlinux                         Debug symbol file for Linux kernel
│           │   │   └── [...]
│           │   └── [...]
│           ├── optee-os-stm32mp-3.19.0-stm32mp-r2-r0                                           OP-TEE OS installation directory
│           │   ├── build                                                           OP-TEE OS build directory
│           │   │   ├── tee-[header/pageable/pager]_v2-stm32mp[*].stm32  Binaries for OP-TEE OS runtime services
│           │   │   └── [...]
│           │   └── [...]
│           ├──tf-a-stm32mp-v2.8.15-stm32mp-r2-r0                             TF-A installation directory
│           │   ├── build                                       TF-A build directory
│           │   │   ├── optee                                   TF-A, with OP-TEE OS
│           │   │   │   ├── tf-a-bl2-optee.elf                  Debug symbol file for TF-A, with OP-TEE OS → boot firmware stage
│           │   │   │   ├── tf-a-stm32mp[*].stm32    TF-A binary for FSBL partition, with OP-TEE OS
│           │   │   │   └── [...]
│           │   └── [...]
│           └── u-boot-stm32mp-v2022.10-stm32mp-r2-r0                       U-Boot installation directory
│               └── [...]

7. Appendix B: directory structure after build (Distribution Package)[edit | edit source]

Provided you have followed the build method explained in OpenSTLinux distribution, then the following new directories contain the build outputs.

As long as you did not modify the source code:

  • the files in STPurple are the same as the ones available in the Starter Package: flash layout, binaries for bootfs, rootfs, userfs and vendorfs partitions
  • the files in grey are the same as the ones available in the Starter and Developer Packages: binaries for FSBL and SSBL partitions, and for OP-TEE OS runtime services
  • the files in orange are the same as the ones available in the Developer Package: Linux kernel image and device tree blobs, and debug symbol files


/[...]/build-openstlinuxweston-stm32mp{1,2}/tmp-glibc/deploy  Yocto BUILDDIR
├── images
│   └── stm32mp1 
│       ├── flashlayout_st-image-weston/optee                                 Flash layout files (description of the partitions) for the supported flash devices
│       │   ├── FlashLayout_sdcard_stm32mp[*].tsv             Flash layout file for SDcard and optee boot chain, with OP-TEE OS
│       │   ├── ...
│       │   ├── FlashLayout_emmc_stm32mp[*].tsv              Flash layout file for eMMC and optee boot chain, with OP-TEE OS → STM32MP157F-EV1
│       │   └── [...]
│       ├── scripts
│       │   └── create_sdcard_from_flashlayout.sh
│       ├── st-image-bootfs-openstlinux-weston-stm32mp{1,2}.ext4            Binary for bootfs partition
│       ├── st-image-userfs-openstlinux-weston-stm32mp{1,2}.ext4            Binary for userfs partition
│       ├── st-image-vendorfs-openstlinux-weston-stm32mp{1,2}.ext4          Binary for vendorfs partition
│       ├── st-image-weston-openstlinux-weston-stm32mp{1,2}.ext4            Binary for rootfs partition
│       ├── fip/                                                        FIP images flashed according flashlayout selected
│       ├── uImage                                                      Linux kernel binary image file (with U-Boot wrapper) for bootfs partition
│       ├── vmlinux                                                     Debug symbol file for Linux kernel
│       └── [...]
└── [...]