OSD32MP15x Boot failure on custom hardware after manual OpenSTLinux 3.0.0 build

Hello everyone,

I am developing custom software for a project using the OSD32MP157F/C SiP and am encountering issues when trying to boot on my custom hardware.

I would appreciate some guidance on the correct procedure.

Initially, I attempted to follow the official Octavo GitHub tutorial, but I was unsuccessful due to a persistent build failure related to the libiio library. I then found a potential fix for the libiio issue on this forum, but unfortunately, it did not resolve the problem for me.

Finally, I switched to a manual build process by unpacking the OpenSTLinux 3.0.0 source files (https://www.st.com/en/embedded-software/stm32mp1dev.html)( MP1-DEV-SRC and MP1-DEV-x86 in version menu 3.0.0) and using the minimalconfig (https://octavosystems.com/files/osd32mp15x_minimalconfig/) intended for the OSD32MP1-BRK board. This manual build was successful, and I correctly generated the .dtb, uImage, and the necessary files for TFA and U-Boot. I made script for process optimization and I can share it here.

To verify my manual build, I tested the artifacts on an OSD32MP1-BRK board. I successfully booted the board by only replacing the existing .dtb file and uImage in the system with my newly generated one. This confirms that my build artifacts (kernel, u-boot, etc.) are functional, at least in the BRK environment.

As a further test, I also tried to manually modify the .dts file and recompile it. I was able to successfully enable an LED, but this manual change caused a kernel failure during boot on the BRK board.

My main goal is to run this build on my custom hardware. I have taken the .dtb file from my manual build and adapted it to match my custom board’s schematic that is based on brk schematic.

However, when I try to boot my custom board with this modified image and DTB, the system fails to boot. I have also tried using several different SD cards to ensure it is not a media issue, but the result remains the same.

I am looking for guidance on the correct procedure to deploy these manually built artifacts (TFA, U-Boot, Kernel, DTB) from an OpenSTLinux 3.0.0 build to new custom hardware.

Specifically, I need to know if modifying the device tree (.dtb) file is the only step required, or if I also need to reconfigure/rebuild U-Boot or TFA when migrating from the OSD32MP1-BRK reference to my custom hardware.

I would also appreciate any insights, into the likely cause of the failure and the recommended next steps for debugging.

Thank you in advance for your help.

Nenad,

Depending on how different the boot configuration is of your custom board, you may need to recompile the bootloaders (TF-A, U-boot) in addition to changing kernel device tree. Please take a look at this application note: https://octavosystems.com/app_notes/stm32mp1-cubemx-tutorial-for-osd32mp15x/ for detailed procedure to compile all elements for a custom board based on OpenSTLinux v3.

I would also recommend verifying that there is no hardware fault on the custom board while booting. To use the same image as the BRK, you will need the following configuration on the custom baord:

  1. Power input configuration. Please review https://octavosystems.com/app_notes/osd32mp1-power-system-overview/ for verifiable configuration that is needed for OSD32MP1.
  2. boot mode configuration (for SD card boot, boot mode setting is 0b101)
  3. Pins used for SD card boot (pins need to match SDMMC1 interface pins used in OSD32MP1-BRK)
  4. SD Card Detect(SDDET signal on OSD32MP1-BRK) should be connected to PG7 and needs to be active LOW.

Please post your boot log if any on that the device outputs on UART4 interface. The log will tell us exactly where the boot is failing.

Please let me know how it goes or if you have any questions.

Best,
Neeraj

Hello Neraaj,

Thank you for your reply.

The problem was that I was indeed using UART8 on PE1 and PE0 outputs in my hardware, while the BRK board uses UART4. Even after defining this in the CubeMX minimal .ioc config and generating the .dts files for TF-A, UART4 remained defined in the aliases section, but UART8 was missing:

aliases {
	serial0 = &uart4;
	serial1 = &usart3;
	serial2 = &uart7;
	serial3 = &usart2;
};

chosen {
	stdout-path = "serial0:115200n8";
};

After manually changing uart4 to uart8 in the generated files, everything worked well regarding the bootloaders!

The next issue I’m encountering is with the kernel booting. I am currently using the BRK image from Octavo’s site and I am manually changing the .dtb, the uImage, and the extlinux.conf files to run the OS on my custom hardware.

TF-A and U-Boot are now working correctly, but the kernel does not start.

This brings me to my original question: How should the newly generated files (bootloaders/kernel) be flashed onto the SD card correctly? I suspect I might be missing a critical step or modifying the base image incorrectly - I followed steps from this page: STM32MP1 CubeMX Tutorial for OSD32MP15x | Octavo Systems.

There is list of files available after execution of script:

~/workdir/stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31/images/stm32mp157f-osd32mp157f-512m-baa_minimalconfig$ ls
fip-stm32mp157f-osd32mp157f-512m-baa_minimalconfig-mx-trusted.bin
lib 
stm32mp157f-osd32mp157f-512m-baa_minimalconfig-mx.dtb
tf-a-stm32mp157f-osd32mp157f-512m-baa_minimalconfig-mx.stm32
uImage

I believe using the correct method to create all necessary partitions on SDcard (FSBL, FIP, BootFS, RootFS) from scratch will resolve this kernel failure, or I’m wrong… Please help :slight_smile:

Thank you in advance for your support.
Best regards,
Nenad

P.S. There is the script I made for creating the files:

#!/bin/bash

# OSD32MP15xx Custom Image Build Script
# Based on STM32MP1 OpenSTLinux 5.10 Dunfell ecosystem v3.0.0
# In one folder place source and sdk files for openstlinux-5.10-dunfell-mp1-21-03-31 and directory with cubemx minimal config
# Download Source files for SDK and Source from this page https://www.st.com/en/embedded-software/stm32mp1dev.html by selecting MP1-DEV-SRC and  MP1-DEV-x86 in version 3.0.0.
# before use just update names of the folders
# This script is tested on Ubuntu 20.04
set -e  # Exit on any error

# Configuration variables
WORK_DIR="/home/nenad/workdir"
SOURCE_DIR="stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31"
SDK_SCRIPT="st-image-weston-openstlinux-weston-stm32mp1-x86_64-toolchain-3.1-openstlinux-5.10-dunfell-mp1-21-03-31.sh"
IMAGE_DIR="$SOURCE_DIR/images/stm32mp157f-osd32mp157f-512m-baa_minimalconfig"
DEVICE_TREE="stm32mp157f-osd32mp157f-512m-baa_minimalconfig-mx"

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

print_step() {
    echo -e "${GREEN}[STEP]${NC} $1"
}

print_warning() {
    echo -e "${YELLOW}[WARNING]${NC} $1"
}

print_error() {
    echo -e "${RED}[ERROR]${NC} $1"
}

# Check if running on Ubuntu 20.04
check_os() {
    if [ ! -f /etc/os-release ]; then
        print_error "Cannot determine OS version"
        exit 1
    fi
    
    . /etc/os-release
    if [ "$ID" != "ubuntu" ] || [ "$VERSION_ID" != "20.04" ]; then
        print_warning "This script is designed for Ubuntu 20.04. Current OS: $ID $VERSION_ID"
        read -p "Continue anyway? (y/n): " -n 1 -r
        echo
        if [[ ! $REPLY =~ ^[Yy]$ ]]; then
            exit 1
        fi
    fi
}

# Check if file exists
check_file() {
    if [ ! -f "$1" ]; then
        print_error "File not found: $1"
        print_error "Please download the required files first"
        exit 1
    fi
}

# Check if directory exists
check_dir() {
    if [ ! -d "$1" ]; then
        print_error "Directory not found: $1"
        print_error "Please ensure the previous steps completed successfully"
        exit 1
    fi
}

# Step 1: Install prerequisites
install_prerequisites() {
    print_step "Installing prerequisites..."
    sudo apt-get update
    sudo apt-get install -y libncurses5-dev libncursesw5-dev libyaml-dev \
        u-boot-tools make gcc libssl-dev build-essential \
        gcc-arm-linux-gnueabi bison flex
}

# Step 2: Install SDK
install_sdk() {
    print_step "Installing SDK..."
    cd "$WORK_DIR"
    
    check_file "SDK-x86_64-stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31.tar.xz"
    
    print_step "Extracting SDK..."
    tar xvf SDK-x86_64-stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31.tar.xz
    
    print_step "Installing SDK..."
    chmod +x "$SOURCE_DIR/sdk/$SDK_SCRIPT"
    "./$SOURCE_DIR/sdk/$SDK_SCRIPT" -d SDK
    
    print_step "Sourcing SDK environment..."
    source SDK/environment-setup-cortexa7t2hf-neon-vfpv4-ostl-linux-gnueabi
}

# Step 2.2: Unpack sources and prepare images directory
prepare_sources() {
    print_step "Preparing sources and images directory..."
    cd "$WORK_DIR"
    
    check_file "SOURCES-stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31.tar.xz"
    
    print_step "Extracting sources..."
    tar xvf SOURCES-stm32mp1-openstlinux-5.10-dunfell-mp1-21-03-31.tar.xz
    
    print_step "Creating images directory..."
    mkdir -p "$IMAGE_DIR"
}

# Step 3: Build TF-A
build_tfa() {
    print_step "Building TF-A..."
    
    local tf_a_dir="$WORK_DIR/$SOURCE_DIR/sources/arm-ostl-linux-gnueabi/tf-a-stm32mp-2.4.r1-r0"
    local tf_a_archive="$tf_a_dir/tf-a-stm32mp-2.4.r1-r0.tar.gz"
    
    check_dir "$tf_a_dir"
    check_file "$tf_a_archive"
    
    cd "$tf_a_dir"
    
    print_step "Extracting TF-A sources..."
    tar xvf tf-a-stm32mp-2.4.r1-r0.tar.gz
    
    cd tf-a-stm32mp-2.4.r1/
    
    # Apply patches
    print_step "Applying TF-A patches..."
    for p in ../*.patch; do
        if [ -f "$p" ]; then
            echo "Applying patch: $p"
            patch -p1 < "$p"
        fi
    done
    
    # Copy CubeMX-generated TF-A DTS files
    local cubemx_tfa_dir="$WORK_DIR/OSD32MP15x_MinimalConfig/OSD32MP157F-512M-BAA_MinimalConfig/CA7/DeviceTree/OSD32MP157F-512M-BAA_MinimalConfig/tf-a"
    if [ -d "$cubemx_tfa_dir" ]; then
        print_step "Copying CubeMX TF-A DTS files..."
        cp "$cubemx_tfa_dir"/* fdts/
    else
        print_warning "CubeMX-generated TF-A DTS files not found at: $cubemx_tfa_dir"
        print_warning "Please ensure they are in the correct location."
    fi
    
    print_step "Building TF-A..."
    export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts
    make -f ../Makefile.sdk TF_A_DEVICETREE="$DEVICE_TREE" FIP_CONFIG="trusted" FIP_BL32_CONF="tfa," TF_A_CONFIG="trusted sdcard" DEPLOYDIR="$FIP_DEPLOYDIR_ROOT/arm-trusted-firmware" stm32
    
    print_step "Copying TF-A artifacts..."
    cp ../build/sdcard/tf-a-"$DEVICE_TREE".stm32 "$WORK_DIR/$IMAGE_DIR/"
    
    cd "$WORK_DIR"
}

# Step 4: Build U-Boot
build_uboot() {
    print_step "Building U-Boot..."
    
    local uboot_dir="$WORK_DIR/$SOURCE_DIR/sources/arm-ostl-linux-gnueabi/u-boot-stm32mp-2020.10.r1-r0"
    local uboot_archive="$uboot_dir/u-boot-stm32mp-2020.10.r1-r0.tar.gz"
    
    check_dir "$uboot_dir"
    check_file "$uboot_archive"
    
    cd "$uboot_dir"
    
    print_step "Extracting U-Boot sources..."
    tar xfz u-boot-stm32mp-2020.10.r1-r0.tar.gz
    
    cd u-boot-stm32mp-2020.10.r1/
    
    # Apply patches
    print_step "Applying U-Boot patches..."
    for p in ../*.patch; do
        if [ -f "$p" ]; then
            echo "Applying patch: $p"
            patch -p1 < "$p"
        fi
    done
    
    # Copy CubeMX-generated U-Boot DTS files
    local cubemx_uboot_dir="$WORK_DIR/OSD32MP15x_MinimalConfig/OSD32MP157F-512M-BAA_MinimalConfig/CA7/DeviceTree/OSD32MP157F-512M-BAA_MinimalConfig/u-boot"
    if [ -d "$cubemx_uboot_dir" ]; then
        print_step "Copying CubeMX U-Boot DTS files..."
        cp "$cubemx_uboot_dir"/*.dts arch/arm/dts/
        cp "$cubemx_uboot_dir"/*.dtsi arch/arm/dts/
    else
        print_warning "CubeMX-generated U-Boot DTS files not found at: $cubemx_uboot_dir"
        print_warning "Please ensure they are in the correct location."
    fi
    
    print_warning "Please ensure your DTB is included in arch/arm/dts/Makefile"
    print_warning "Add '$DEVICE_TREE.dtb \\' to the dtb list"
    print_warning "Edit the file: $PWD/arch/arm/dts/Makefile"
    read -p "Press Enter to continue after modifying the Makefile..."
    
    print_step "Building U-Boot..."
    export FIP_DEPLOYDIR_ROOT=$PWD/../../FIP_artifacts
    make -f ../Makefile.sdk all UBOOT_CONFIG=trusted UBOOT_DEFCONFIG=stm32mp15_trusted_defconfig UBOOT_BINARY=uboot.dtb FIP_CONFIG="trusted" FIP_BL32_CONF="tfa," DEVICE_TREE="$DEVICE_TREE"
    
    print_step "Copying U-Boot artifacts..."
    cp ../../FIP_artifacts/fip/fip-"$DEVICE_TREE"-trusted.bin "$WORK_DIR/$IMAGE_DIR/"
    
    cd "$WORK_DIR"
}

# Step 5: Build Linux kernel
build_kernel() {
    print_step "Building Linux kernel..."
    
    local kernel_dir="$WORK_DIR/$SOURCE_DIR/sources/arm-ostl-linux-gnueabi/linux-stm32mp-5.10.10-r0"
    local kernel_archive="$kernel_dir/linux-5.10.10.tar.xz"
    
    check_dir "$kernel_dir"
    check_file "$kernel_archive"
    
    cd "$kernel_dir"
    
    print_step "Extracting kernel sources..."
    tar xfJ linux-5.10.10.tar.xz
    
    cd linux-5.10.10
    
    # Apply patches
    print_step "Applying kernel patches..."
    for p in ../*.patch; do
        if [ -f "$p" ]; then
            echo "Applying patch: $p"
            patch -p1 < "$p"
        fi
    done
    
    # Copy CubeMX-generated Linux DTS files
    local cubemx_kernel_dir="$WORK_DIR/OSD32MP15x_MinimalConfig/OSD32MP157F-512M-BAA_MinimalConfig/CA7/DeviceTree/OSD32MP157F-512M-BAA_MinimalConfig/kernel"
    if [ -d "$cubemx_kernel_dir" ]; then
        print_step "Copying CubeMX kernel DTS files..."
        cp "$cubemx_kernel_dir"/*.dts arch/arm/boot/dts/
       #cp "$cubemx_kernel_dir"/*.dtsi arch/arm/boot/dts/
    else
        print_warning "CubeMX-generated Linux DTS files not found at: $cubemx_kernel_dir"
        print_warning "Please ensure they are in the correct location."
    fi
    
    mkdir -p ../build
    
    # Configure kernel
    print_step "Configuring kernel..."
    make ARCH=arm O="$PWD/../build" multi_v7_defconfig
    
    # Apply fragment configs if they exist
    for f in ../fragment*.config; do
        if [ -f "$f" ]; then
            print_step "Applying fragment config: $f"
            scripts/kconfig/merge_config.sh -m -r -O "$PWD/../build" "$PWD/../build/.config" "$f"
        fi
    done
    
    yes '' | make ARCH=arm oldconfig O="$PWD/../build"
    
    print_warning "Please ensure your DTB is included in arch/arm/boot/dts/Makefile"
    print_warning "Add '$DEVICE_TREE.dtb \\' to the dtb list"
    print_warning "Edit the file: $PWD/arch/arm/boot/dts/Makefile"
    read -p "Press Enter to continue after modifying the Makefile..."
    
    # Build kernel
    print_step "Building kernel..."
    make ARCH=arm uImage vmlinux dtbs LOADADDR=0xC2000040 O="$PWD/../build"
    make ARCH=arm modules O="$PWD/../build"
    make ARCH=arm INSTALL_MOD_PATH="$PWD/../build/install_artifact" modules_install O="$PWD/../build"
    
    # Copy build artifacts
    print_step "Copying kernel artifacts..."
    cp ../build/arch/arm/boot/uImage "$WORK_DIR/$IMAGE_DIR/"
    cp ../build/arch/arm/boot/dts/"$DEVICE_TREE".dtb "$WORK_DIR/$IMAGE_DIR/"
    cp -r ../build/install_artifact/* "$WORK_DIR/$IMAGE_DIR/"
    
    # Remove unnecessary symlinks
    rm -f "$WORK_DIR/$IMAGE_DIR/lib/modules/5.10.10/source" \
          "$WORK_DIR/$IMAGE_DIR/lib/modules/5.10.10/build"
    
    cd "$WORK_DIR"
}


main() {
    echo "OSD32MP15xx Custom Image Build Script"
    echo "====================================="
    
    check_os
    
    # Create work directory if it doesn't exist
    mkdir -p "$WORK_DIR"
    cd "$WORK_DIR"
    
    # Execute steps
    install_prerequisites
    install_sdk
    prepare_sources
    build_tfa
    build_uboot
    build_kernel
    
    print_step "Build completed! Images are located in: $WORK_DIR/$IMAGE_DIR"
    
    
    print_step "All done!"
}

main "$@"

Nenad,

Can you post the console log output? Is u-boot loading the kernel successfully?

The recommendation for making a properly formatted SD card would be to:

  • Program an SD card with BRK/RED image (v3.0)
  • Eject and re-insert the SD card into host system. This should bring up all the partitions of the SD card.
  • Use ‘dd’ command to update the specific partition of the bootlaoder
  • rootfs can be mounted on the host system to update kernel/device tree binary.

Please also take a look at https://github.com/octavosystems/osd32mp1-build-tools/blob/master/Makefile for good reference on building an image - the Makefile is part of the Debian SDK: https://github.com/octavosystems/osd32mp1-debian you can use to customize your images.

Best,
Neeraj

Dear Neeraj,

I will check links you provided, thank you very much!
The system restarts every 30sec. There are console log output:

CPU: STM32MP157F?? Rev.Z
Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.10-dunfell-mp1-21-03-31
Board: stm32mp1 in trusted mode (st,stm32mp157f-osd32mp157f-512m-baa_minimalconfig-mx)
DRAM:  512 MiB
Clocks:
- MPU : 800 MHz
- MCU : 208.878 MHz
- AXI : 200 MHz
- PER : 0 MHz
- DDR : 400 MHz
WDT:   Started with servicing (32s timeout)
NAND:  0 MiB
MMC:   STM32 SD/MMC: 0
Loading Environment from MMC... OK
In:    serial
Out:   serial
Err:   serial
invalid MAC address in OTP 00:00:00:00:00:00
Net:   No ethernet found.
Hit any key to stop autoboot:  0
Boot over mmc0!
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:4...
Found /extlinux/extlinux.conf
Retrieving file: /extlinux/extlinux.conf
214 bytes read in 19 ms (10.7 KiB/s)
1:      CustomOSD32MP157F
Retrieving file: /uImage
9921088 bytes read in 491 ms (19.3 MiB/s)
append: root=/dev/mmcblk0p6 rootwait rw console=ttySTM0,115200n8 earlycon
Retrieving file: /stm32mp157f-osd32mp157f-512m-baa_minimalconfig-mx.dtb
53980 bytes read in 21 ms (2.5 MiB/s)
## Booting kernel from Legacy Image at c2000000 ...
   Image Name:   Linux-5.10.10
   Created:      2025-11-25  13:44:45 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    9921024 Bytes = 9.5 MiB
   Load Address: c2000040
   Entry Point:  c2000040
   Verifying Checksum ... OK
## Flattened Device Tree blob at c4000000
   Booting using the fdt blob at 0xc4000000
   XIP Kernel Image
   Loading Device Tree to cffef000, end cffff2db ... OK

Starting kernel ...

Best,
Nenad.

Nenad,

Do you have UART4 setup in the kernel device tree as the console output?

The board restarting every 30 sec indicates that the watchdog timer is expiring. Please review:

  • Kernel device tree settings for DDR mapping, PMIC and console setup
  • Which kernel version you are loading - for v3.0 it should be 5.10 kernel

Just to remove variables, I would start with v3 image for BRK/RED available on their web pages and modify TF-A/u-boot binaries + kernel device tree keeping everything else the same.

Best,
Neeraj