How to compile the device tree with the Distribution Package

Revision as of 12:59, 8 April 2019 by Registered User (→‎Create the machine for your demo)



1. Introduction[edit source]

This article is reserved to Yocto experts or at least people who have already practiced with the Yocto environmment.

This section describes all steps to create and configure a layer for demo with DeviceTree files coming from STM32CubeMX tool and to add and configure a machine that is similar to those that the OpenSTLinux Distribution Package already supports.
Mainly the machine delivered inside the existing STM32MP BSP layer 'addons'.
For reminder this addons layer is deployed here in our delivery : <path of OpenSTLinux distribution delivery>/layers/meta-st/meta-st-stm32mp-addons/

2. Create a new open embedded layer for your demo[edit source]

First you need to create a new layer, take a look at the latest How to create a new open embedded layer

After the creation you will have here <path of OpenSTLinux distribution delivery>/layers/meta-st/:


$ tree meta-my-demo-layer
meta-my-demo-layer
├── conf
│   └── layer.conf
├── COPYING.MIT
├── README
└── recipes-example
    └── example
        └── example.bb

3 directories, 4 files

2.1. Update layer.conf file[edit source]

Open layer.conf file and add the lines below for the licenses, the demo layer path and the dependency with the STM32MP BSP layer 'addons' :

EULA_FILE_ST_stm32mpmydemo = "${LAYERDIR}/conf/eula/${MACHINE}"
EULA_FILE_ST_MD5SUM_stm32mpmydemo = "8b505090fb679839cefbcc784afe8ce9"

#Inform bitbake for adding another location to search for licenses
LICENSE_PATH += "${LAYERDIR}/files/licenses"

# Set a variable to get the STM32MP MX BSP location
STM32MP_MY_DEMO_BASE = "${LAYERDIR}"

# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
LAYERVERSION_meta-my-demo-layer = "1"

LAYERDEPENDS_meta-my-demo-layer = "stm-st-stm32mp-mx"


2.2. Create the machine for your demo[edit source]

  • Copy the machine delivered inside the existing STM32MP BSP layer 'addons' into your layer for demo
$ cp <path of OpenSTLinux distribution delivery>/layers/meta-st/meta-st-stm32mp-addons/conf/machine/stm32mp1-mx.conf <path of OpenSTLinux distribution delivery>/layers/meta-st/meta-my-demo-layer/conf/machine/stm32mp1-demo.conf
  • Open stm32mp1-demo.conf and update this line with the highlighted part :
  1. @NEEDED_BSPLAYERS: layers/meta-openembedded/meta-oe layers/meta-openembedded/meta-python layers/meta-st/meta-st-stm32mp-addons
  • Replace STM32MP_MX_BASE by STM32MP_MY_DEMO_BASE
  • Add this line :
# Define specific common machine name
MACHINEOVERRIDES .= ":stm32mpmydemo"

* Uncomment variables to configure yours own Boot Mode Choice, Boot Device Choice,  Board Type Choice, DeviceTree files and path 


2.3. Associate EULA with the new demo machine[edit source]

Copy the eula folder delivered inside the existing STM32MP BSP layer 'addons' into your layer for demo

$ cp -rf <path of OpenSTLinux distribution delivery>/layers/meta-st/meta-st-stm32mp-addons/conf/eula/ <path of OpenSTLinux distribution delivery>/layers/meta-st/meta-my-demo-layer/conf/.

And replace the existing symbolic link with your machine for demo

$ rm stm32mp1-mx
$ ln -s ST_EULA_SLA stm32mp1-demo

2.4. Move DeviceTree files and project coming from STM32CubeMX tool[edit source]

The principle is that the user generates devicetree files from the STM32CubeMX tool for the targetted demo.

Warning white.png Warning
Most of the time, generated devicetree files, mainly user sections, must be reworked by end user for compilation and functional purpose, each demo is delivered with an Application Note which will describe changes applied on STM32CubeMX devicetree files

Then these files are moved inside “mx” folder created into your demo layer  : <path of OpenSTLinux distribution delivery>/layers/meta-st/meta-my-demo-layer/mx/

sub-folders are created and populated with generated devicetree files :

mx/${CUBEMX_PROJECT}/kernel
mx/${CUBEMX_PROJECT}/u-boot
mx/${CUBEMX_PROJECT}/tf-a
mx/${CUBEMX_PROJECT}/optee-os

With CUBEMX_PROJECT which is equal to the value defined inside the machine for the demo.

2.5. Update README file[edit source]

Please update the README with the needed information for building and executing the demo

2.6. Clean up useless content[edit source]

You can delete the content of recipes-example folder created by create-layer command

3. Add specific recipes and content necessary for your demo[edit source]

More add-on component examples:

  • recipes for installing distro-specific configuration files
  • any image recipes specific to user distribution
  • a psplash append file for a branded splash screen
  • any other append files to make custom changes

Some other added components (*bb) are more specific: images, system services, ... (non-exhaustive list shown below):

  • recipes-core for psplash screen, systemd services
  • recipes-samples for example images

...