# WIC and Mender

**URL:** <https://hub.mender.io/t/wic-and-mender/4213>\
**Category:** General Discussions\
**Tags:** yocto, tinkerboard, wic\
**Created:** [October 21, 2021, 6:54am UTC](https://hub.mender.io/t/wic-and-mender/4213 "2021-10-21T06:54:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SebSauer](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/sebsauer/32/1486_2.png) [@SebSauer](https://hub.mender.io/u/SebSauer)\
**Post date:** [October 21, 2021, 6:54am UTC](https://hub.mender.io/t/wic-and-mender/4213/1 "2021-10-21T06:54:32Z")

</div>

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

**tinker-board-s.con**

```auto
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**

```auto
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**

```auto
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?**

```auto
| 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

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [October 22, 2021, 6:56am UTC](https://hub.mender.io/t/wic-and-mender/4213/2 "2021-10-22T06:56:22Z")

</div>

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](https://docs.mender.io/system-updates-yocto-project/build-for-demo#configuring-the-build).

If you need to customize the partitions, check out [`MENDER_EXTRA_PARTS`](https://docs.mender.io/system-updates-yocto-project/variables#mender_extra_parts).
