How to compile the device tree with the Distribution Package

Revision as of 14:51, 28 March 2019 by Registered User



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 for the demo 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-custo-layer
meta-my-custo-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_stm32mpcommondemomotor = "${LAYERDIR}/conf/eula/${MACHINE}"
EULA_FILE_ST_MD5SUM_stm32mpcommondemomotor = "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_DEMO_MOTOR_BASE = "${LAYERDIR}"

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

LAYERDEPENDS_meta-my-custo-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-custo-layer/conf/machine/stm32mp1-demo.conf

Replace these lines

CUBEMX_DTB_PATH_pn-tf-a-stm32mp   = "${STM32MP_MX_BASE}/mx/${CUBEMX_PROJECT}/tf-a"
CUBEMX_DTB_PATH_pn-u-boot-stm32mp = "${STM32MP_MX_BASE}/mx/${CUBEMX_PROJECT}/u-boot"
CUBEMX_DTB_PATH_pn-linux-stm32mp  = "${STM32MP_MX_BASE}/mx/${CUBEMX_PROJECT}/kernel"
CUBEMX_DTB_PATH_pn-optee-os-stm32mp  = "${STM32MP_MX_BASE}/mx/${CUBEMX_PROJECT}/optee-os"

by these ones

CUBEMX_DTB_PATH_pn-tf-a-stm32mp   = "${STM32MP_DEMO_MOTOR_BASE}/mx/${CUBEMX_PROJECT}/tf-a"
CUBEMX_DTB_PATH_pn-u-boot-stm32mp = "${STM32MP_DEMO_MOTOR_BASE}/mx/${CUBEMX_PROJECT}/u-boot"
CUBEMX_DTB_PATH_pn-linux-stm32mp  = "${STM32MP_DEMO_MOTOR_BASE}/mx/${CUBEMX_PROJECT}/kernel"
CUBEMX_DTB_PATH_pn-optee-os-stm32mp  = "${STM32MP_DEMO_MOTOR_BASE}/mx/${CUBEMX_PROJECT}/optee-os"

Then add these lines and modify variables based on your own needs and demo naming:

# Define specific common machine name
MACHINEOVERRIDES .= ":stm32mpcommondemomotor"

# Boot Mode Choice
# =========================================================================
# boot scheme (basic or trusted or optee) 
# =========================================================================
BOOTSCHEME_LABELS = "trusted"

# Boot Device Choice
# =========================================================================
# flashlayout 
# DISCO : sdcard
# EVAL : sdcard or emmc or nand-4-256 or nor-sdcard or nor-emmc or nor-nand-4-256
# =========================================================================
# Define the config labels to use to generate flashlayout file
FLASHLAYOUT_CONFIG_LABELS = "sdcard"

# Board Type Choice
# =========================================================================
# Assign CubeMX Board DT and project name
CUBEMX_DTB = "stm32mp157c-demo-motor-ev1-mx"
CUBEMX_PROJECT = "STM32MP157C-EV1/demo-motor-ev1/DeviceTree/demo-motor-ev1"
# Define the original board devicetree : stm32mp157a-dk1 or stm32mp157c-dk2 or stm32mp157c-ev1 
CUBEMX_DT_FILE_BASE = "stm32mp157c-ev1"

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

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

2.5. Update README file[edit source]

2.6. Clean up useless content[edit source]

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