WIC and Mender

Hello all,
I’m currently trying to build a Yocto build using WIC and integrating Mender.

tinker-board-s.con

require conf/machine/include/rk3288.inc

KERNEL_DEVICETREE = "rk3288-tinker-s.dtb"
UBOOT_MACHINE = "tinker-s-rk3288_defconfig"

RK_BOOT_DEVICE ?= "mmcblk1"

WKS_FILE ?= "tinker-board.wks"
IMAGE_FSTYPES += "wic wic.bmap"

WKS_FILE_DEPENDS ?= " \
    mtools-native \
    dosfstools-native \
    virtual/bootloader \
    virtual/kernel \
    "
IMAGE_BOOT_FILES ?= "\
    ${KERNEL_IMAGETYPE} \
    ${KERNEL_DEVICETREE} \
    "

rk3288-boot.wks

part loader1    --align 32     --size 4000K            --ondisk ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=idbloader.img"
part reserved1  --align 4032   --size 64K              --ondisk ${RK_BOOT_DEVICE}
part reserved2  --align 4096   --size 4096K            --ondisk ${RK_BOOT_DEVICE}
part loader2    --align 8192   --size 4096K            --ondisk ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=u-boot.bin"
part atf        --align 12288  --size 4096K            --ondisk ${RK_BOOT_DEVICE}
part /boot      --align 16384  --size=114688K --active --ondisk ${RK_BOOT_DEVICE} --source bootimg-partition --fstype=vfat --label boot --sourceparams="loader=u-boot"

local.conf

MENDER_ARTIFACT_NAME = "TestDevice"
INHERIT += "mender-full"

DISTRO_FEATURES_append = " systemd"
VIRTUAL-RUNTIME_init_manager = "systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED = "sysvinit"
VIRTUAL-RUNTIME_initscripts = ""

MENDER_STORAGE_DEVICE = "/dev/mmcblk1"
MENDER_STORAGE_DEVICE_BASE= "/dev/mmcblk1p"
MENDER_STORAGE_TOTAL_SIZE_MB = "2048"

# Use partition uuids rather than device and partition numbers
MENDER_ENABLE_PARTUUID="n"

# Partition used as the boot partition (match the wic /boot)
MENDER_BOOT_PART="${MENDER_STORAGE_DEVICE_BASE}6"

# Partition used as the first (A) rootfs partition. (create new root ?)
MENDER_ROOTFS_PART_A="${MENDER_STORAGE_DEVICE_BASE}8"

# Partition used as the first (B) rootfs partition. 
MENDER_ROOTFS_PART_B="${MENDER_STORAGE_DEVICE_BASE}9"

# Partition used as the persistent data partition. (create new /data)
MENDER_DATA_PART="${MENDER_STORAGE_DEVICE_BASE}7"


# 1GB Data =  Root-Part -> 1GB
MENDER_DATA_PART_SIZE_MB = "1024"

IMAGE_INSTALL_append = " kernel-image kernel-devicetree"


# Do not really need a boot part and files in it,
# but we need to satisfy a dependency that the sdimg format has.
IMAGE_BOOT_FILES = "zImage"

# controls Mender features ...
MENDER_FEATURES_ENABLE_append = " mender-image-sd"
MENDER_FEATURES_DISABLE_append = " mender-image-uefi"

First question: Am I correct in assuming that Mender and Wic work at all ?

Am I correct in assuming that Mender creates the root (A/B) and the /data partition - shouldn’t it also create the boot ? (Normally yes) // Isn’t that in conflict with WIC creating this ?

Second question: I’m running into the error here, any idea?

| DEBUG: Python function extend_recipe_sysroot finished
[3916] DEBUG: Executing shell function do_image_wic
[3917]INFO: Creating image(s)...
[3918]|
[3919]| WARNING: cannot expand variable RK_BOOT_DEVICE
[3920]| WARNING: cannot expand variable RK_BOOT_DEVICE
[3921]| WARNING: cannot expand variable RK_BOOT_DEVICE
[3922]| WARNING: cannot expand variable RK_BOOT_DEVICE
[3923]| WARNING: cannot expand variable RK_BOOT_DEVICE
[3924]| WARNING: cannot expand variable RK_BOOT_DEVICE
[3925]| WARNING: cannot expand variable RK_BOOT_DEVICE
[3926]| ERROR: _exec_cmd: export PATH=/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/player/1.0-r0/recipe-sysroot-native/sbin:/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/player/1.0-r0/recipe-sysroot-native/usr/sbin:/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/player/1.0-r0/recipe-sysroot-native/usr/bin:/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/player/1.0-r0/recipe-sysroot-native/bin:/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/hosttools:$PATH;parted -s /opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/player/1.0-r0/tmp-wic/tinker-board-202110201329-${RK_BOOT_DEVICE}.direct mklabel gpt returned '1' instead of 0
[3927]| output: Error: Could not stat device /opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/player/1.0-r0/tmp-wic/tinker-board-202110201329-.direct - No such file or directory.
[3928]|
[3929]| WARNING: exit code 1 from a shell command.
[3930]| ERROR: Execution of '/opt/tinkerboard-runner/XEzD-GrN/0/scs/tinker-board-yocto/build/tmp/work/tinker_board_s-poky-linux-gnueabi/player/1.0-r0/temp/run.do_image_wic.24580' failed with exit code 1
[3931]NOTE: recipe player-1.0-r0: task do_image_wic: Failed

Thanks already Sebastian

Mender does not work with the wic FSTYPE, I believe, although Mender also uses the wic tool. You need to use either the sdimg or uefiimg FSTYPE, depending on whether you are building with U-Boot or GRUB. More information about the basic build here.

If you need to customize the partitions, check out MENDER_EXTRA_PARTS.

1 Like