cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a custom uboot build in Yocto mickledore (UBOOT_CONFIG ?)

jamescc
Associate II

Is there any documentation or guidance on how to configure Yocto to deploy a custom u-boot image? 

I've been following https://wiki.st.com/stm32mpu/wiki/How_to_configure_U-Boot_for_your_board and https://wiki.stmicroelectronics.cn/stm32mpu/wiki/STM32MP15_U-Boot with some success, however these stop short of Yocto.

I am able to build our custom build (defconfig, device-tree, with custom source adjustments) but I'm struggling to integrate into Yocto, to complete the flow to a final SD Card image.

When I add my variant to `UBOOT_CONFIG` it builds it, but `trusted_stm32mp15` is appended and seems to be the one in the deploy folder: tmp-glibc/deploy/images/<IMAGE_NAME>/u-boot/ and tmp-glibc/deploy/images/<IMAGE_NAME>/fip

My machine.conf file has:

UBOOT_CONFIG = "viper_butcombe_beta"
UBOOT_CONFIG[viper_butcombe_beta] = "viper-innovations_butcombe-beta_defconfig,,u-boot.dtb"
 
and I see layers/meta-st/meta-st-stm32mp/conf/machine/include/st-machine-common-stm32mp.inc has the lines:
# STM32mp15
UBOOT_CONFIG:append:stm32mp15common = " ${@bb.utils.contains_any('BOOTSCHEME_LABELS', 'optee', 'trusted_stm32mp15', '', d)} "
 
UBOOT_CONFIG[trusted_stm32mp15] = "stm32mp15_defconfig,,u-boot.dtb"
 
`stm32mp15common` is in our MACHINEOVERRIDES  (should it be?) and `optee` is in our BOOTSCHEME_LABELS.  It seems I need to be doing something with these.  As we want to keep to ST's advised way of booting, presumably BOOTSCHEME_LABELS should remain unchanged.
 
Are there any example recipes where people have added a custom u-boot image?
4 REPLIES 4
Erwan SZYMANSKI
ST Employee

Hello @jamescc,
Regarding your summary, I think you made the major part of the work now !
Can you share me your machine.conf file ? Did you well checked that your UBOOT_CONFIG variable is made after the include conf/machine/include/st-machine-common-stm32mp.inc line ? Otherwise it will be overwritten by UBOOT_CONFIG = " ".

Kind regards,
Erwan

 
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks for your response.  Yes it felt like this should have been the less complex part.

Here is our `machine.conf` file.  It is nothing too elaborate at this stage.  The setting of UBOOT_CONFIG is done at the end, long after include conf/machine/include/st-machine-common-stm32mp.inc

As we are about to start the bring-up of this board, we've gone down the route of patching the existing ST uboot DK2 and EVAL board implementation for now, but ideally, I'd like to create a new u-boot board.

Thanks JamesCC

#@TYPE: Machine Butcombe development from the Alpha boards to the DK2 development
#@NAME: butcombe-dk2-alpha
#@DESCRIPTION: Configuration for STM32CubeMX generated project
#@NEEDED_BSPLAYERS: layers/meta-openembedded/meta-oe layers/meta-openembedded/meta-python layers/meta-butcombe

# Define specific common machine name
MACHINEOVERRIDES .= ":stm32mp1common:stm32mp15common"

include conf/machine/include/st-machine-common-stm32mp.inc
include conf/machine/include/st-machine-providers-stm32mp.inc

# =========================================================================
# Chip architecture
# =========================================================================
DEFAULTTUNE = "cortexa7thf-neon-vfpv4"
include conf/machine/include/arm/armv7a/tune-cortexa7.inc

# =========================================================================
# boot scheme
# =========================================================================
BOOTSCHEME_LABELS += "optee"

# =========================================================================
# boot device
# =========================================================================
# Define the boot device supported
#BOOTDEVICE_LABELS += "emmc"
#BOOTDEVICE_LABELS += "nand-4-256"
#BOOTDEVICE_LABELS += "nor-sdcard"
BOOTDEVICE_LABELS += "sdcard"

# =========================================================================
# boot device
# =========================================================================
BOOTDEVICE_LABELS ?= "SDcard"

# =========================================================================
# Machine settings
# =========================================================================
STM32MP_DEVICETREE = "${CUBEMX_DTB}"

# =========================================================================
# Machine features (default for stm32mp1 like)
# =========================================================================
MACHINE_FEATURES += "splashscreen"
MACHINE_FEATURES += "watchdog"
MACHINE_FEATURES += "${@'gpu' if d.getVar('ACCEPT_EULA_'+d.getVar('MACHINE')) == '1' else ''}"
MACHINE_FEATURES += "m4copro"

# =========================================================================
# Device Storage
# =========================================================================
# Enable the board device storage support with CUBEMX_DTB according to BOOTDEVICE_LABELS
DEVICE_BOARD_ENABLE:NAND    += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${CUBEMX_DTB}', '', d)}"
DEVICE_BOARD_ENABLE:NOR     += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard' , '${CUBEMX_DTB}', '', d)}"
DEVICE_BOARD_ENABLE:EMMC    += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', '${CUBEMX_DTB}', '', d)}"
DEVICE_BOARD_ENABLE:SDCARD  += "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', '${CUBEMX_DTB}', '', d)}"

# =========================================================================
# Flashlayout
# =========================================================================
# Set the FLASHLAYOUT_TYPE_LABELS to CUBEMX_DTB according to BOOTDEVICE_LABELS
FLASHLAYOUT_TYPE_LABELS:emmc        = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'emmc', '${CUBEMX_DTB}', '', d)}"
FLASHLAYOUT_TYPE_LABELS:nand-4-256  = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nand-4-256', '${CUBEMX_DTB}', '', d)}"
FLASHLAYOUT_TYPE_LABELS:nor-sdcard  = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'nor-sdcard' , '${CUBEMX_DTB}', '', d)}"
FLASHLAYOUT_TYPE_LABELS:sdcard      = "${@bb.utils.contains('BOOTDEVICE_LABELS', 'sdcard', '${CUBEMX_DTB}', '', d)}"

# Specific settings for 'extensible' and 'deleteall' configurations
FLASHLAYOUT_CONFIG_LABELS:deleteall = "cubemx"
FLASHLAYOUT_TYPE_LABELS:deleteall:cubemx = "${CUBEMX_DTB}"
FLASHLAYOUT_TYPE_LABELS:extensible = "${CUBEMX_DTB}"

# =========================================================================
# CubeMX extra config
# =========================================================================
ENABLE_CUBEMX_DTB ?= "1"

###########################################################################
#
# User machine customization sections
#
###########################################################################

# Boot Scheme
# =========================================================================
#BOOTSCHEME_LABELS += "optee"
# (set above)

# Support Feature Choice
# =========================================================================
# Define the features to enable on board

# Specific firmwares and kernel modules configuration
# =========================================================================
# Set the list of kernel module to be auto-loaded during boot
KERNEL_MODULE_AUTOLOAD += ""

# CubeMX Project Config
# =========================================================================
# Assign CubeMX Board devicetree and project path name
CUBEMX_DTB = "stm32mp157d-butcombe-beta-mx"
CUBEMX_PROJECT ?= "${TOPDIR}/../layers/meta-butcombe/device-tree/butcombe-beta"

#Indicate which STM32MP package are used: 'A', 'C', 'D' or 'F'  A:No Crypt C:Crypt D:no Crypt, Performance, F:Crypt, Performance
CUBEMX_SOC_PACKAGE = 'D'

# Indicate the size of DDR available on BOARD: 512 or 1024 (size in MB unit)
CUBEMX_BOARD_DDR_SIZE = "512"

# Indicate if you like to disable the DVFS which are activated by default
#CUBEMX_SOC_DVFS_OFF = "0"

# U-Boot config
UBOOT_CONFIG = "viper_butcombe_beta"
UBOOT_CONFIG[viper_butcombe_beta] = "viper-innovations_butcombe-beta_defconfig,,u-boot.dtb"

 

Hi @jamescc ,
Sorry for the delay, I was some days off.

Regarding recipes process, I ask myself if the root cause is not the MACHINEOVERRIDES statement. Because I think that whatever you do with the UBOOT_CONFIG after, it will still take the first config appended that is trusted_stm32mp15 (but this is a pure theory by reading the recipe).

Is it possible for you to make a test without this overriding statement ?

Kind regards,
Erwan.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks for your response; we will return to this after our board bring-up (which has taken our attention right now).