X-LINUX-RT expansion package

Revision as of 16:34, 13 February 2023 by Registered User (→‎Modifying the Linux kernel)


Applicable for STM32MP13x lines, STM32MP15x lines

X-LINUX-RT is a STM32 MPU OpenSTLinux Expansion Package that targets real-time feature in the Linux kernel. To have a better understanding about RT Linux, please have a look to the Linux RT foundation website[1].

RT Expansion Package In STM32MPU Embedded Software.png

1. X-LINUX-RT[edit source]

Info white.png Information
This version is compatible with Yocto Project® build system Kirkstone and has been validated against the OpenSTLinux ecosystem release v4.1.0 and validated on STM32MP135F-DK More info green.png, STM32MP157x-DKx More info green.png and STM32MP157x-EV1 More info green.png boards.

1.1. Validated hardware[edit source]

As any software expansion package, the X-LINUX-RT is supported on all STM32MP1 Series and it has been validated on the following boards:

  • STM32MP157D-DK1 More info green.png
  • STM32MP157C-DK2 Warning.png and STM32MP157F-DK2 More info green.png
  • STM32MP157C-EV1 Warning.png , STM32MP157D-EV1 More info green.png and STM32MP157F-EV1 More info green.png
  • STM32MP135F-DK More info green.png

1.2. Main software modification[edit source]

1.2.1. Kernel configuration[edit source]

1.2.2. OP-TEE modification[edit source]

2. Distribution package: re-generate X-LINUX-RT OpenSTLinux distribution[edit source]

With the following procedure, the complete distribution can be re-generated by enabling the X-LINUX-RT expansion package.

2.1. Download the STM32MP1 Distribution Package[edit source]

For ecosystem release v4.1.0 :
Install the STM32MP1 Distribution Package v4.1.0.

2.2. Install X-LINUX-RT environment[edit source]

  • Clone the meta-st-x-linux-rt git repositories
 cd <Distribution Package installation directory>/layers/meta-st
 git clone https://github.com/STMicroelectronics/meta-st-x-linux-rt.git
 cd ../..
  • Source the build environment with the correct board and layer.

For STM32MP15x lines More info.png:

 DISTRO=openstlinux-weston MACHINE=stm32mp15-rt source layers/meta-st/scripts/envsetup.sh

For STM32MP13x lines More info.png:

 DISTRO=openstlinux-weston MACHINE=stm32mp13-rt source layers/meta-st/scripts/envsetup.sh

2.3. Build the image[edit source]

 bitbake st-image-weston
Info white.png Information
Note that building the image could take long time depending on the host computer performance.

2.4. Program the built image into the Flash memory[edit source]

Follow this link to see how to program the built image.


3. Developer package: build RT BSP with the SDK[edit source]

Linux RT can be built with sources provided in the OpenSTLinux BSP packages plus patches and device tree files provided in X-LINUX-RT meta layer.

3.1. Install the OpenSTLinux SDK[edit source]

The OpenSTLinux SDK contains all the basis needed for the X-LINUX-RT add-on, so it needs to be downloaded and installed: see OpenSTLinux SDK installation guide. Once done, a directory is present on your machine containing the OpenSTLinux SDK.

3.2. Download the Developer package[edit source]

The STM32MP1 Developer Package containing all the BSP source code must be downloaded and extracted. To do this, follow only the chapter 5.2 (and not the sub-chapter 5.2.x) from the page Download OpenSTLinux BSP.

Two BSP components (OP-TEE OS and Linux kernel) must be modified for RT feature.

3.3. Download X-LINUX-RT meta layer[edit source]

  • Clone the meta-st-x-linux-rt git repositorie
cd <Developer Package installation directory>/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/
git clone https://github.com/STMicroelectronics/meta-st-x-linux-rt.git

3.4. Modifying the BSP[edit source]

As written above, to enable the RT feature, two BSP components must be modified.

3.4.1. Modifying the Linux kernel[edit source]

Please follow now the sub-chapter 5.2.1 to prepare the Linux kernel.
Patches found in <Developer Package installation directory>/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/meta-st-x-linux-rt/recipes-kernel/linux/5.15/5.15.67 must also be applied.

Enter in the directory containing Linux kernel sources, then apply patches:

for p in `ls -1 <Developer Package installation directory>/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/meta-st-x-linux-rt/recipes-kernel/linux/5.15/5.15.67/*.patch`; do patch -p1 < $p; done

Apply fragments as written in the README.HOW_TO.txt helper file

Then add also the following fragments:

For STM32MP15x lines More info.png:

* arch/arm/configs/fragment-07-rt.config
* arch/arm/configs/fragment-07-rt-sysvinit.config

For STM32MP13x lines More info.png:

* arch/arm/configs/fragment-07-rt.config
* arch/arm/configs/fragment-07-rt-sysvinit.config
* arch/arm/configs/fragment-08-rt-mp13.config

The Linux kernel can now be built and deployed.

3.4.2. Modifying the OP-TEE OS[edit source]

Please follow now the sub-chapter 5.2.5 to prepare the OP-TEE OS.
Patches found in <Developer Package installation directory>/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/meta-st-x-linux-rt/recipes-security/optee/optee-os must also be applied.
Enter in the directory containing OP-TEE OS sources, then apply patches

for p in `ls -1 <Developer Package installation directory>/stm32mp1-openstlinux-6.1-yocto-mickledore-mp1-v23.06.21/sources/arm-ostl-linux-gnueabi/meta-st-x-linux-rt/recipes-security/optee/optee-os/*.patch`; do patch -p1 < $p; done

OP-TEE OS can now be built and deployed.

4. References[edit source]