Mender Renesas RZ/G2LC integration issue

Hi there,

I’m in need of some help with the mender integration to my Renesa/Solidrun RZ/G2LC SOM.

I had an image with Mender and Yocto in dunfell, but after updating Yocto to scarthgap I’ve run into some problems building the integration.

I’m working without the autopatch, because it returns a fuzz error, so I’m building the same patches on my layer. The real problem comes when I create the image, it “works” but without mender.

I made sure that the patches are correctly applied, but when I start the image any of the mender parameters exist in the uboot environment. uboot.env is generated in all 0’s, as the append specifies.

The only problem I see is that the include/configs/machine.h does not have MENDER_ENV_SETTINGS defined, but if I try to patch it to include it, it breaks with an error saying that I must do it with a KCONFIG.

Can someone bring some light and guide me on where the error can be?

Hi @tonrigat,

Thanks for reaching out! Without seeing any code or messages it’s hard to tell where things go sideways. In general, the advice is to try and follow the manual u-boot integration guide at Manual U-Boot integration | Mender documentation.

If the Mender integration is not visible in the environment, then the first thing is to check if this patch (or a port of it) is applied correctly: meta-mender/meta-mender-core/recipes-bsp/u-boot/patches/0001-Generic-boot-code-for-Mender.patch at master · mendersoftware/meta-mender · GitHub

Greetz,
Josef

Hi @TheYoctoJester,

I can provide some code if needed. I already followed through the manual, but without luck. I know that my patches are applying because the env_mender.h and config_mender.h exist, and env_default.h has the veriables included (<env_mender.h> and CONFIG_MENDER_BOOTCOMMAND).

The problem comes when I built the image, that the include/generated/autoconf.h neither u-boot.cfg have any mender values on it. But u-boot.bin does have mender variables:

strings u-boot.bin | grep mender
altbootcmd=run mender_altbootcmd; run bootcmd
mender_boot_part=2
mender_boot_part_hex=2
mender_uboot_boot=mmc 0:1
mender_uboot_if=mmc
mender_uboot_dev=0
mender_boot_kernel_type=booti
mender_kernel_name=Image.gz
mender_dtb_name=rzg2lc-hummingboard.dtb
mender_pre_setup_commands=
mender_post_setup_commands=setenv bootargs "rw rootwait root=/dev/mmcblk0p${mender_boot_part}"; saveenv; printenv bootargs
mender_check_saveenv_canary=1
mender_setup=if test "${mender_saveenv_canary}" != "1"; then setenv mender_saveenv_canary 1; saveenv; fi; if test "${mender_pre_setup_commands}" != ""; then run mender_pre_setup_commands; fi; if test "${mender_systemd_machine_id}" != ""; then setenv bootargs "systemd.machine_id=${mender_systemd_machine_id} ${bootargs}"; fi; setenv mender_kernel_root /dev/mmcblk0p${mender_boot_part}; if test ${mender_boot_part} = 2; then setenv mender_boot_part_name /dev/mmcblk0p2; else setenv mender_boot_part_name /dev/mmcblk0p3; fi; setenv mender_kernel_root_name ${mender_boot_part_name}; setenv mender_uboot_root mmc 0:${mender_boot_part_hex}; setenv mender_uboot_root_name ${mender_boot_part_name}; setenv expand_bootargs "setenv bootargs \\"${bootargs}\\""; run expand_bootargs; setenv expand_bootargs; if test "${mender_post_setup_commands}" != ""; then run mender_post_setup_commands; fi
mender_altbootcmd=if test ${mender_boot_part} = 2; then setenv mender_boot_part 3; setenv mender_boot_part_hex 3; else setenv mender_boot_part 2; setenv mender_boot_part_hex 2; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_try_to_recover=if test ${upgrade_available} = 1; then reset; fi
bootcmd=run mender_setup; setenv bootargs root=${mender_kernel_root} ${bootargs}; if test "${fdt_addr_r}" != ""; then load ${mender_uboot_root} ${fdt_addr_r} /boot/${mender_dtb_name}; fi; load ${mender_uboot_root} ${kernel_addr_r} /boot/${mender_kernel_name}; ${mender_boot_kernel_type} ${kernel_addr_r} - ${fdt_addr_r}; run mender_try_to_recover

It seems that the mender commands are not included in the default environment as expected.

If you need, I can provide more code of the integration I’ve built.

Thank you!

Hi @tonrigat,

That definitely sounds strange. If you’re in the u-boot console, and reset the environment to the build-in default with env default -a, what does happen?

Greetz,
Josef

Hi @TheYoctoJester,

Resets the env to the default environment without error. The problem is that the default env does not include the mender commands. I also added some modifications to u-boot environment in the local.conf, those are ignored too.

U-boot:

=> env default -a
## Resetting to default environment
=> saveenv
Saving Environment to MMC... Writing to MMC(0)... OK
=> printenv
apply_sdio_overlay=fdt addr ${fdt_addr_r}; fdt resize ${fdt_buffer_size}; fdt apply ${fdtoverlay_addr_r};
arch=arm
baudrate=115200
board=rzg2lc
board_name=rzg2lc
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootaa64.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_efi_bootmgr=if fdt addr ${fdt_addr_r}; then bootefi bootmgr ${fdt_addr_r};else bootefi bootmgr;fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}${boot_syslinux_conf}
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_script_dhcp=boot.scr.uimg
boot_scripts=boot.scr.uimg boot.scr
boot_syslinux_conf=extlinux/extlinux.conf
boot_targets=mmc0 usb0 dhcp
bootargs=rw rootwait
bootcmd=run distro_bootcmd
bootcmd_dhcp=devtype=dhcp; run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00011:UNDI:003000;setenv bootp_arch 0xb;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_mmc0=devnum=0; run mmc_boot
bootcmd_usb0=devnum=0; run usb_boot
bootdelay=2
cpu=armv8
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
extract_overlay_mmc=imxtract ${loadaddr} mmc_overlay ${fdtoverlay_addr_r}
extract_overlay_sd=imxtract ${loadaddr} sd_overlay ${fdtoverlay_addr_r}
fdt_addr_r=0x4c000000
fdt_buffer_size=0x4000
fdt_high=0xffffffffffffffff
fdtfile=renesas/rzg2lc-hummingboard.dtb
fdtoverlay_addr_r=0x4c0f0000
initrd_high=0xffffffffffffffff
kernel_addr_r=0x48000000
kernel_comp_addr_r=0x4a000000
kernel_comp_size=0xb00000
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
load_overlay_fit=read mmc 0:0 ${loadaddr} ${overlays_fit_offset_blk} ${overlays_fit_max_size_blk}
load_sdio_overlay=run load_overlay_fit; if test "${sdio_select}" = "sd"; then run extract_overlay_sd;else run extract_overlay_mmc; fi;
loadaddr=0x58000000
mmc_boot=if mmc dev ${devnum}; then devtype=mmc; run scan_dev_for_boot_part; fi
overlays_fit_max_size_blk=0x10
overlays_fit_offset_blk=0x1800
pxefile_addr_r=0x4c200000
ramdisk_addr_r=0x4c800000
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}...; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;run boot_efi_bootmgr;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootaa64.efi; then echo Found EFI removable media binary efi/boot/bootaa64.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing...; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${boot_syslinux_conf}; then echo Found ${prefix}${boot_syslinux_conf}; run boot_extlinux; echo SCRIPT FAILED: continuing...; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done
scriptaddr=0x4c100000
sdio_toggle=gpio toggle gpio-221; gpio toggle gpio-390; mmc rescan 1
soc=rmobile
usb_boot=usb start; if usb dev ${devnum}; then devtype=usb; run scan_dev_for_boot_part; fi
vendor=solidrun

Environment size: 4280/131067 bytes

local.conf:

MENDER_UBOOT_POST_SETUP_COMMANDS = "setenv bootargs \\\"rw rootwait root=/dev/mmcblk0p\${mender_boot_part}\\\"; saveenv; printenv bootargs"

I’m trying to “force it” in to the machine config but with scarthgap requires you to create a Kconfig that I’m not sure if it’s the correct way or is just that I’m missing something.

Thanks,
Ton

Hi @tonrigat,

Ok, that definitely means that the patch carrying the Mender boot logic is not correctly applied. I personally would probably start out with devtool modify u-boot so I can see the code which actually gets built, and make my way from there. If you have a publicly visible, sanitized version of the board integration then I can also give it a spin to build - obviously not test as I don’t have the hardware.

Greetz,
Josef

Hi @TheYoctoJester,

We are trying to fix it with devtool, if any progress is made I’ll let you know. If you want to take a look at the machine repo is this:

SolidRun/meta-solidrun-arm-rzg2lc at scarthgap

And this is the class we are using, that is a adapted version of mender’s one:

python() {
    deprecated_vars = ['SDIMG_DATA_PART_DIR', 'SDIMG_DATA_PART_SIZE_MB',
                       'SDIMG_BOOT_PART_SIZE_MB', 'SDIMG_PARTITION_ALIGNMENT_MB']
    for varname in deprecated_vars:
        cur = d.getVar(varname, True)
        if cur:
            newvarname = varname.replace('SDIMG_', 'MENDER_')
            bb.fatal('Detected use of deprecated var %s, please replace it with %s in your setup' % (varname, newvarname))
}
inherit image
inherit image_types
inherit mender-helpers
inherit mender-part-images
################################################################################
# Block storage
################################################################################
salicru_image() {
    suffix="$1"
    ptable_type="$2"
    boot_part_params="$3"
    set -ex
    mkdir -p "${WORKDIR}"
    if ${@bb.utils.contains('MENDER_FEATURES', 'mender-uboot', 'true', 'false', d)}; then
        # Copy the files to embed in the WIC image into ${WORKDIR} for exclusive access
        install -m 0644 "${DEPLOY_DIR_IMAGE}/uboot.env" "${WORKDIR}/"
    fi
    ondisk_dev="$(basename "${MENDER_STORAGE_DEVICE}")"
    wks="${WORKDIR}/mender-$suffix.wks"
    rm -f "$wks"
    if [ -n "${MENDER_IMAGE_BOOTLOADER_FILE}" ]; then
        # Copy the files to embed in the WIC image into ${WORKDIR} for exclusive access
        install -m 0644 "${DEPLOY_DIR_IMAGE}/${MENDER_IMAGE_BOOTLOADER_FILE}" "${WORKDIR}/"
        if [ $(expr ${MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET} % 2) -ne 0 ]; then
            # wic doesn't support fractions of kiB, so we need to do some tricks
            # when we are at an odd sector: Create a new bootloader file that
            # lacks the first 512 bytes, write that at the next even sector,
            # which coincides with a whole kiB, and then write the missing
            # sector manually afterwards.
            bootloader_sector=$(expr ${MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET} + 1)
            bootloader_file=${WORKDIR}/${MENDER_IMAGE_BOOTLOADER_FILE}-partial
            dd if=${WORKDIR}/${MENDER_IMAGE_BOOTLOADER_FILE} of=$bootloader_file skip=1
        else
            bootloader_sector=${MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET}
            bootloader_file=${WORKDIR}/${MENDER_IMAGE_BOOTLOADER_FILE}
        fi
        bootloader_align_kb=$(expr $(expr $bootloader_sector \* 512) / 1024)
        bootloader_size=$(stat -c '%s' "$bootloader_file")
        bootloader_end=$(expr $bootloader_align_kb \* 1024 + $bootloader_size)
        if [ $(expr $bootloader_end / 512) -gt ${MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET} ]; then
            bberror "Size of bootloader specified in MENDER_IMAGE_BOOTLOADER_FILE" \
                    "exceeds MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET, which is" \
                    "reserved for U-Boot environment storage. Please raise it" \
                    "manually."
        fi
        install -m 0644 "${DEPLOY_DIR_IMAGE}/${SPL_BOOTLOADER_FILE}" "${WORKDIR}/"
        install -m 0644 "${DEPLOY_DIR_IMAGE}/bl2_bp_esd-${MACHINE}.bin" "${WORKDIR}/"
        bootloader_file_mbr=${WORKDIR}/${SPL_BOOTLOADER_FILE}
        bootloader_align_mbr=${SPL_BOOTLOADER_ALIGN}
        cat >> "$wks" <<EOF
# embed bootloader
part bootparam --source rawcopy --sourceparams="file=bl2_bp_esd-${MACHINE}.bin" --ondisk "$ondisk_dev" --no-table --offset 1s
part --source rawcopy --sourceparams="file=$bootloader_file" --ondisk "$ondisk_dev" --align $bootloader_align_kb --no-table
#Manually added fip
part --source rawcopy --sourceparams="file=$bootloader_file_mbr" --ondisk "$ondisk_dev" --align ${SPL_BOOTLOADER_ALIGN} --no-table
part overlays --source rawcopy --sourceparams="file=overlays-${MACHINE}.itb" --ondisk "$ondisk_dev" --no-table --offset 6144s
EOF
    fi
    if ${@bb.utils.contains('MENDER_FEATURES', 'mender-uboot', 'true', 'false', d)} && [ -n "${MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET}" ]; then
        boot_env_align_kb=$(expr ${MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET} / 1024)
        cat >> "$wks" <<EOF
part --source rawcopy --sourceparams="file=${WORKDIR}/uboot.env" --ondisk "$ondisk_dev" --offset $boot_env_align_kb --no-table
EOF
    fi
    if [ $(expr ${MENDER_PARTITION_ALIGNMENT} % 1024 || true) -ne 0 ]; then
        bbfatal "MENDER_PARTITION_ALIGNMENT must be KiB aligned when using partition table."
    fi
    alignment_kb=$(expr ${MENDER_PARTITION_ALIGNMENT} / 1024)
    # Used for all Linux filesystem partitions.
    if [ "$ptable_type" = "gpt" ]; then
        part_type_params="--part-type 0FC63DAF-8483-4772-8E79-3D69D8477DE4"
    else
        part_type_params=
    fi
    # remove leading and trailing spaces
    IMAGE_BOOT_FILES_STRIPPED=$(echo "${IMAGE_BOOT_FILES}" | sed -r 's/(^\s*)|(\s*$)//g')
    if [ "${MENDER_BOOT_PART_SIZE_MB}" -ne "0" ]; then
        mender_merge_bootfs_and_image_boot_files
        cat >> "$wks" <<EOF
part --source rawcopy --sourceparams="file=${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.bootimg" --ondisk "$ondisk_dev" --label boot --align $alignment_kb --fixed-size ${MENDER_BOOT_PART_SIZE_MB} --active $boot_part_params
EOF
    elif [ -n "$IMAGE_BOOT_FILES_STRIPPED" ]; then
        bbwarn "MENDER_BOOT_PART_SIZE_MB is set to zero, but IMAGE_BOOT_FILES is not empty. The files are being omitted from the image."
    fi
    # By default the inactive partition filesystem is empty to allow for more efficient compression.
    # A full filesystem is populated if one of the following applies
    # - ARTIFACTIMG_FSTYPE is squashfs, because it doesn not allow empty partitions.
    # - the "mender-prepopulate-inactive-partition" MENDER_FEATURE is enabled
    if [ "${ARTIFACTIMG_FSTYPE}" = "squashfs" ] || ${@bb.utils.contains('MENDER_FEATURES', 'mender-prepopulate-inactive-partition', 'true', 'false', d)}; then
        part2_content="--source rawcopy --sourceparams=\"file=${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${ARTIFACTIMG_FSTYPE}\""
    else
        part2_content=
    fi
    cat >> "$wks" <<EOF
part --source rawcopy --sourceparams="file=${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${ARTIFACTIMG_FSTYPE}" --ondisk "$ondisk_dev" --align $alignment_kb --fixed-size ${MENDER_CALC_ROOTFS_SIZE}k $part_type_params
part $part2_content --ondisk "$ondisk_dev" --fstype=${ARTIFACTIMG_FSTYPE} --align $alignment_kb --fixed-size ${MENDER_CALC_ROOTFS_SIZE}k $part_type_params
EOF
    if [ "${MENDER_SWAP_PART_SIZE_MB}" -ne "0" ]; then
        cat >> "$wks" <<EOF
part swap --ondisk "$ondisk_dev" --fstype=swap --label swap --align $alignment_kb --size ${MENDER_SWAP_PART_SIZE_MB}
EOF
    fi
    cat >> "$wks" <<EOF
part --source rawcopy --sourceparams="file=${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.dataimg" --ondisk "$ondisk_dev" --align $alignment_kb --fixed-size ${MENDER_DATA_PART_SIZE_MB} $part_type_params
EOF
    # added extra partitions if exists
    cat >> "$wks" <<EOF
${@get_extra_parts_wks(d)}
EOF
    cat >> "$wks" <<EOF
bootloader --ptable $ptable_type
EOF
    echo "### Contents of wks file ###"
    cat "$wks"
    echo "### End of contents of 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}
    # look to see if the user specifies a custom imager
    IMAGER=direct
    eval set -- "${WIC_CREATE_EXTRA_ARGS} --"
    while [ 1 ]; do
            case "$1" in
                    --imager|-i)
                            shift
                            IMAGER=$1
                            ;;
                    --)
                            shift
                            break
                            ;;
            esac
            shift
    done
    mv "$wicout/$(basename "${wks%.wks}")"*.${IMAGER} "$outimgname"
    if [ -n "${MENDER_IMAGE_BOOTLOADER_FILE}" ] && [ ${MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET} -ne $bootloader_sector ]; then
        # We need to write the first sector of the bootloader. See comment above
        # where bootloader_sector is set.
        dd if=${WORKDIR}/${MENDER_IMAGE_BOOTLOADER_FILE} of="$outimgname" seek=${MENDER_IMAGE_BOOTLOADER_BOOTSECTOR_OFFSET} count=1 conv=notrunc
    fi
    if [ -n "${MENDER_MBR_BOOTLOADER_FILE}" ]; then
        dd if="${DEPLOY_DIR_IMAGE}/${MENDER_MBR_BOOTLOADER_FILE}" of="$outimgname" bs=${MENDER_MBR_BOOTLOADER_LENGTH} count=1 conv=notrunc
    fi
    rm -rf "$wicout/"
    # Pad the image up to the alignment. This matters mostly for the emulator,
    # which uses the file size to determine the size of the storage device,
    # which must be a multiple of its device block size. However, it might be
    # beneficial for real storage media as well, to make sure the final sector
    # is cleared out when flashing the image. May increase image size slightly,
    # but should compress well!
    alignment=${MENDER_PARTITION_ALIGNMENT}
    pad_size=$(expr \( $(stat -c %s "$outimgname") + $alignment - 1 \) / $alignment \* $alignment)
    truncate -s $pad_size "$outimgname"
    # If we padded above, and the partition table type is GPT, we need to
    # relocate the trailing backup header to the new end to avoid warnings.
    if [ "$ptable_type" = "gpt" ]; then
        sgdisk -e "$outimgname"
    fi
    if [ "$ptable_type" = "msdos" ]; then
        # Fix partition entry types for MBR style partition table.
        (
            echo t                                  # Partition type
            echo ${MENDER_ROOTFS_PART_A_NUMBER}     # Number of partition
            echo 83                                 # "Linux filesystem" type
            echo t                                  # Partition type
            echo ${MENDER_ROOTFS_PART_B_NUMBER}     # Number of partition
            echo 83                                 # "Linux filesystem" type
            echo t                                  # Partition type
            echo ${MENDER_DATA_PART_NUMBER}         # Number of partition
            echo 83                                 # "Linux filesystem" type
            echo w                                  # Save and exit
        ) | fdisk ${outimgname}
    fi
    if ${@bb.utils.contains('MENDER_FEATURES', 'mender-partuuid', 'true', 'false', d)}; then
        if [ "$ptable_type" = "gpt" ]; then
            # Set Fixed PARTUUID for all devices
            sgdisk -u ${MENDER_BOOT_PART_NUMBER}:${@mender_get_partuuid_from_device(d, '${MENDER_BOOT_PART}')} "$outimgname"
            sgdisk -u ${MENDER_ROOTFS_PART_A_NUMBER}:${@mender_get_partuuid_from_device(d, '${MENDER_ROOTFS_PART_A}')} "$outimgname"
            sgdisk -u ${MENDER_ROOTFS_PART_B_NUMBER}:${@mender_get_partuuid_from_device(d, '${MENDER_ROOTFS_PART_B}')} "$outimgname"
            sgdisk -u ${MENDER_DATA_PART_NUMBER}:${@mender_get_partuuid_from_device(d, '${MENDER_DATA_PART}')} "$outimgname"
            # check if we have extra parts and setup uuid for those partitions
            local ext_partitions="${@get_extra_parts_partition_to_uuid(d)}"
            for part in ${ext_partitions}; do
                sgdisk -u ${part} "$outimgname"
            done
        else
            diskIdent=$(echo ${@mender_get_partuuid_from_device(d, '${MENDER_ROOTFS_PART_A}')} | cut -d- -f1)
            # For MBR Set the Disk Identifier.  Drives follow the pattern of <Disk Identifier>-<Part Number>
            (
                echo x                              # Enter expert mode
                echo i                              # Set disk identifier
                echo 0x${diskIdent}                 # Identifier
                echo r                              # Exit expert mode
                echo w                              # Write changes
            ) | fdisk ${outimgname}
        fi
    fi
}
IMAGE_CMD:sdimg() {
    salicru_image sdimg msdos

The u-boot_%.bbappend is just adding the mender patches without the fuzz.

Thank you very much.
Ton