Stm32mp1 Yocto Kirkstone issues

Hi all.
I am trying to add mender to my costume build of Kirkstone Openstliunux .
I changed the meta-mender-community to work with my Kirkstone build and everything is looks ok except the image i build for the eMMC:
my stm32mp-gptimg.bbclass not creating the fip-a image with the UUID that metadata.bin has. what I need to add so the uuid of fip-a partition will be like in metadata.bin?

INFO:    PSCI Power Domain Map:
INFO:      Domain Node : Level 1, parent_node -1, State ON (0x0)
INFO:      Domain Node : Level 0, parent_node 0, State ON (0x0)
INFO:      CPU Node : MPID 0x0, parent_node 0, State ON (0x0)
INFO:      CPU Node : MPID 0xffffffff, parent_node 0, State OFF (0x2)
NOTICE:  CPU: STM32MP153AAA Rev.B
NOTICE:  Model: STMicroelectronics custom STM32CubeMX board - openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15
INFO:    PMIC version = 0x21
INFO:    Reset reason (0x54):
INFO:      System reset generated by MPU (MPSYSRST)
INFO:    FCONF: Reading TB_FW firmware configuration file from: 0x2ffe2000
INFO:    FCONF: Reading firmware configuration information for: stm32mp_io
INFO:    Using EMMC
INFO:      Instance 1
INFO:    Boot used partition fsbl1
NOTICE:  BL2: v2.6-stm32mp1-r1.0(debug):v2.6-dirty
NOTICE:  BL2: Built : 13:14:26, Nov 23 2021
ERROR:   Unable to find the partition with the uuid mentioned in metadata
PANIC at PC : 0x2ffeca83

Exception mode=0x00000016 at: 0x2ffeca83

and the second problem that the do_image_gptimg cannot find bootfs.image_gptimg.env :

Couldn't get bitbake variable from ~/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/build-openstlinuxcv-stm32mp1-ground4-mx/tmp-glibc/work/stm32mp1_ground4_mx-ostl-linux-gnueabi/st-image-minimal/1.0-r0/bootfs.image_gptimg.env.

The build actually didn’t make .env bootfs file and i have no clue why.


here my bbclass: 

inherit image_types

# It is not possible to specify this using MENDER_IMAGE_BOOTLOADER_FILE/OFFSET,
# instead we use an append to "gptimg" to embed the bootloader

# STM32MP requires the disk image to be GPT for it to find the bootloader

IMAGE_CMD:gptimg:append:stcommon() {
    # Remove file generated by mender-part-images.bbclass
    rm "$wks"

    cat >> "$wks" <<EOF

part metadata1 --source rawcopy --fsoptions "noauto" --part-name=metadata1 --sourceparams="file=${DEPLOY_DIR_IMAGE}/arm-trusted-firmware/metadata.bin" --ondisk mmcblk --part-type 0x8301 --fixed-size 512K --align 480
part metadata2 --source rawcopy --fsoptions "noauto" --part-name=metadata2 --sourceparams="file=${DEPLOY_DIR_IMAGE}/arm-trusted-firmware/metadata.bin" --ondisk mmcblk --part-type 0x8301 --fixed-size 512K 
part fip-a  --source rawcopy --fstype=ext4 --fsoptions "noauto" --part-name=fip-a --sourceparams="file=${DEPLOY_DIR_IMAGE}/fip/fip-stm32mp153a-ground4-mx-trusted.bin" --ondisk mmcblk --part-type 0x8301 --fixed-size 4096K
part fip-b  --source rawcopy --fstype=ext4 --fsoptions "noauto" --part-name=fip-b --sourceparams="file=${DEPLOY_DIR_IMAGE}/fip/fip-stm32mp153a-ground4-mx-trusted.bin" --ondisk mmcblk --part-type 0x8301 --fixed-size 4096K

part u-boot-env --source rawcopy --part-name=u-boot-env --sourceparams="file=${WORKDIR}/uboot.env" --ondisk "$ondisk_dev" --align $boot_env_align_kb --no-table
part --source rootfs --rootfs-dir ${WORKDIR}/bootfs.${BB_CURRENTTASK} --ondisk "$ondisk_dev" --fstype=vfat --label boot --align $alignment_kb --fixed-size ${MENDER_BOOT_PART_SIZE_MB} --active $boot_part_params
part --source rootfs --ondisk "$ondisk_dev" --fstype=${ARTIFACTIMG_FSTYPE} --label primary --align $alignment_kb --fixed-size ${MENDER_CALC_ROOTFS_SIZE}k $exclude_path_options
part --source rootfs --ondisk "$ondisk_dev" --fstype=${ARTIFACTIMG_FSTYPE} --label secondary --align $alignment_kb --fixed-size ${MENDER_CALC_ROOTFS_SIZE}k $exclude_path_options
part --source rootfs --rootfs-dir ${IMAGE_ROOTFS}/data --ondisk "$ondisk_dev" --fstype=${ARTIFACTIMG_FSTYPE} --label data --align $alignment_kb --fixed-size ${MENDER_DATA_PART_SIZE_MB}
bootloader --ptable gpt
EOF

    echo "### Contents of STM32MP1 wks file ###"
    cat "$wks"
    echo "### End of contents of STM32MP1 wks file ###"

    # Call WIC
    outimgname="${IMGDEPLOYDIR}/${IMAGE_NAME}.$suffix"
    wicout="${IMGDEPLOYDIR}/${IMAGE_NAME}-$suffix"
    BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$wicout/" ${WIC_CREATE_EXTRA_ARGS}
    mv "$wicout/$(basename "${wks%.wks}")"*.direct "$outimgname"
}

Tnx.

Ok so I figured out how to set the right UUID on wic image build :

part fip-a  --source rawcopy --fstype=ext4 --fsoptions "noauto" --part-name=fip-a --sourceparams="file=${DEPLOY_DIR_IMAGE}/fip/fip-stm32mp153a-ground4-mx-trusted.bin" --ondisk mmcblk --part-type 19d5df83-11b0-457b-be2c-7559c13142a5 --uuid="4FD84C93-54EF-463F-A7EF-AE25FF887087" --fixed-size 4096K

this uuid are always the same for for fip according to stm32mp15 wiki .
now I have the problem of the bootfs.image_gptimg.env file.

Hi @SergeyMich,

Glad to hear you’re making progress! While looking at it, the base situation is not clear to me. You mention meta-mender-community, but as far as I can tell there is nothing STM32 related in there. So are you using a forked version? Or did you create board support in your personal version? If so, is it public somewhere?

Greetz,
Josef

Hi, I am using my version that I migrated from dunfell forked version.

for now I trying to make it work on my personal git but I will push PR when it will work.

Ok, I see. This has never been contributed back to us, so we obviously don’t know anything about it yet. Will have a look and see if I can spot something. Is your fork accessible too, so I don’t have to also forward, and probably run into both similar and different problems?

Greetz, Josef

I‘m looking at it now, but will take some time to set up (and build).

Can you please share the layers and configuration that you are using, or some form of setup instructions? I find puzzle pieces here and there, but feel like missing something.

Greetz,
Josef

here is my layers:

bitbake-layers show-layers
NOTE: Starting bitbake server...
NOTE: Started PRServer with DBfile: /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/build-openstlinuxcv-stm32mp1-ground4-mx/cache/prserv.sqlite3, Address: 127.0.0.1:45159, PID: 321299
layer                 path                                      priority
==========================================================================
meta-st-stm32mp-addons  /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-fabric/meta-st-stm32mp-addons  7
meta-python           /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-python  5
meta-oe               /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-oe  5
meta-gnome            /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-gnome  5
meta-initramfs        /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-initramfs  5
meta-multimedia       /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-multimedia  5
meta-networking       /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-networking  5
meta-webserver        /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-webserver  5
meta-filesystems      /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-filesystems  5
meta-perl             /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-openembedded/meta-perl  5
meta-st-stm32mp       /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-st-stm32mp  6
meta-qt5              /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-qt5  7
meta-mender-core      /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-mender/meta-mender-core  6
meta-mender-st-stm32mp  /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-fabric/meta-mender-st-stm32mp  5
meta-st-openstlinux   /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-st-openstlinux  5
meta-st-openstlinux-cv  /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-fabric/meta-st-openstlinux-cv  7
meta-mt9v034          /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-fabric/meta-mt9v034  7
meta-wl18xx-layer     /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-fabric/meta-wl18xx-layer  7
meta-csr              /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-fabric/meta-csr  6
meta-quectel-em05     /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-st/meta-fabric/meta-quectel-em05  7
meta-ros2-foxy        /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-ros/meta-ros2-foxy  12
meta-ros-common       /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-ros/meta-ros-common  10
meta-ros2             /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/meta-ros/meta-ros2  11
meta                  /home/sergey/yoctoWorkspace/openstlinux-5.15-yocto-kirkstone-mp1-v22.06.15/layers/openembedded-core/meta  5

this is my custom build but I just walked through the integration on mender hub:

its should be very similar to my build i just have some different dts files and apps .

Hi @SergeyMich

I’m really sorry, but all my tries to even set up a build failed at various stages. If you can prepare a reproducer (e.g. concise information which layers, their repos and revisions, plus all necessary configuration) then I’m happy to try again, but at the moment I just have to stop.

Greets

Hi @TheYoctoJester ,
I think I making progress. I"ll push commit if it will be successful.
But didn’t understand what fails your build you did everything according the link?

@SergeyMich

  • when trying to follow the original link, it is supposed to build for the thud release, which totally falls over on a recent Linux
  • bumping all layers to dunfell gets me into a parsing error
  • trying to set up fresh for either dunfell or kirkstone falls over because the repo manifest are either not there or faulty.

So taking just the original board integration post feels very hard to reproduce, at least to me. Plus you mentioned having a number of layers integrated which were nowhere mentioned. Taking all that together means that sorting the integration layer out is only one part, we’ll also need to make it usable. And in order to help with that I need to be able to at least build it myself :wink:

Greetz,
Josef

I mean to take my repo
add it to regular build from STM32mp1 wiki
change the Mender layers (meta-mender-core and meta-mender-st-stm32mp) paths in bblayers according your build and then use the “Setup build environment” from original board integration post:
1 . Initialize the build environment:
. meta-mender-st-stm32mp/scripts/stm32mp-setup-mender.sh
2. You can edit the conf/local.conf file to provide your Mender server configuration
3. Building the image:
bitbake st-image-core

try this way

Hi @SergeyMich

Thanks, basing off the OpenSTLinux wiki was the missing part for me. Build proceeding at the moment, will report back.

Greetz,
Josef

@SergeyMich

Somewhat getting closer. But trying to build the described setup for the stm32mp15-disco-MACHINE gives me

ERROR: u-boot-stm32mp-v2021.10-stm32mp-r1-r0 do_configure: U-Boot configuration  stm32mp15_defconfig has setting:
CONFIG_SYS_MMC_ENV_DEV=0
but Mender expects:
CONFIG_SYS_MMC_ENV_DEV=1

So guess either the machine is wrong, or I’m stimm missing something.

EDIT: is the stm32mp153a-ground4-mx.dtb a custom device tree of yours?

Greetz,
Josef

Great!
I forgot that I changed some configs for my custom board:
MENDER_UBOOT_STORAGE_DEVICE = “1” → in local.conf should be 0 for the basic machine.
And yes “stm32mp153a-ground4-mx.dtb” its my custom bord device tree
Also you need to check the PARTS to be the same order as in “meta-mender-st-stm32mp/classes/stm32mp-gptimg.bbclass”
i think according my PR its need to be:

MENDER_BOOT_PART = "${MENDER_STORAGE_DEVICE_BASE}5"
MENDER_ROOTFS_PART_A = "${MENDER_STORAGE_DEVICE_BASE}6"
MENDER_ROOTFS_PART_B = "${MENDER_STORAGE_DEVICE_BASE}7"

I will change to the basic configs when I finish.
I think tomorrow I will finish .
tnx for the help

OK, build proceeding.

We obviously have to make the base setup work for the publicly available MACHINE. Do I take it right that this is stm32mp15-disco?

MACHINE ?= “stm32mp1-disco” is set on the meta-mender-community for thud and dunfell that I have seen. so I think it right.

Ok it’s works for me! :partying_face:
I pushed the changes and I changed all the configs to the basic ones so it will work with the original integration post.

2 Likes

Hi,
I am working on the stm32mp157f-dk2 trying to integrate mender. Thanks for the great progress!
Did you push your latest changes to your pull request?
I managed to build but I see that the fsbl parts are missing from the stm32mp-gptimg.bbclass?

Br,
Herman