Skip to content

Draft: WIC image containing FNG System and Yocto

Dmitry Petrov requested to merge wic-multiconf-fngs-and-yocto into kirkstone

This is the new version proof-of-concept for [YT-159] FNG System: Create optional wic image containing FNG System and Yocto.

Preface

  • a month ago the initial version of mechanism how to build a WIC image with Yocto and FNG System inside was developed. This solution supported only particular configuration and had a few limitations with several options how to approach;
  • after review, SECO identified several new problems (related to build errors/failures) which were not reproduced on our side before (https://secogroup.atlassian.net/browse/YT-159?focusedCommentId=46633)

Description of the changes in the new MR

Unfortunately, the reported problems, were overlooked by me, as my local build was contaminated with previous build artifacts. After a performed a clean build from scratch, the problems reported by SECO were easily reproduced:

  • there was a dependency problem in seconorth-wic-part-scheme-1.bbclass indeed. The errors are gone after I fixed do_image_wic[mcdepends] line;

[Jonas] I would also prefer to put those files needed to exchange data between tasks into the deploy dir, next to the generated images. I’m not sure if this works in multiconfig the same way as without. Is that the reason that you put it to the TOPDIR?

  • also I reworked the way to exchange data between tasks, now predefined variables (FNGSYSTEM_DEPLOY, FNGSYSTEM_IMG_TAR) are used instead of JSON file.

I also fixed a previously known problem with incorrect DISTRO_VERSION for FNG System image, when a FNG System is built using multiconfig (as a dependency of WIC). Incorrect information was placed to /etc/os-release in that case: kirkstone-23.0-15-gXXXXXXX instead of fngsystem-50.0-13-gXXXXXXX. Fixed this problem by adding the following line for each multiconfig:

MANIFEST_VERSION := "${@git_describe(d.getVar("BSPDIR") + "/.repo/manifests", d.getVar("DISTRO"))}"

Summary

The difference with the previous implementation (https://secogroup.atlassian.net/browse/YT-159?focusedCommentId=46376):

  • build errors are fixed;
  • got rid of JSON file to exchange data between tasks;
  • fixed a problem with incorrect DISTRO_VERSION;
  • both MBR and GPT partition table types are supported now;
  • added service to resize last partition to fit disk size;
  • added service to run fnginstall-postinstallation script on first boot;
  • added A/B partitioning layout;
  • removed hardcoded values from wic plugins. Generation of linuximage is moved to uuu scripts.

So, following limitations still exist:

  • only partition scheme 1 is supported;
  • only i.MX6 boards are supported (tested on SANTVEND v1.3);

Second part of this MR: meta-seconorth-machine!591

Usage note

  • Configure multiconfig build
  • Inherit seconorth-wic-part-scheme-1 bbclass in your local.conf:
    INHERIT += "seconorth-wic-part-scheme-1"
  • (optional): select GUID partition table in your local.conf:
    PART_TABLE_TYPE = "gpt"
  • (optional): select A/B partitions layout in your local.conf:
    AB_PARTITIONING = "true"
  • Execute a bitbake command to build WIC image:
    bitbake mc:seconorth-wayland:seconorth-image-minimal

Just for the reference, the full log of build commands is as follows:

mkdir -p ~/yocto-seco-ne && cd ~/yocto-seco-ne
repo init -u https://git.seco.com/seco-ne/yocto/manifest.git -b kirkstone
repo sync --no-clone-bundle
pushd sources/meta-seconorth-distro/
git checkout wic-multiconf-fngs-and-yocto
popd
pushd sources/meta-seconorth-machine/
git checkout uuu-install-wic-update
popd

MACHINE=seco-mx6 DISTRO=seconorth-wayland MULTICONFIG=true source ./setup-environment build-mx6
echo 'INHERIT += " seconorth-wic-part-scheme-1 "' >> conf/local.conf
bitbake mc:seconorth-wayland:seconorth-image-minimal

The resulted WIC image can be found in tmp-seconorth-wayland/deploy/images/seco-mx6/ folder — a file with .wic.gz file extension.

Installation of WIC image

  • Copy build artifacts from tmp-seconorth-wayland/deploy/images/seco-mx6/ to linux host.
  • Extract WIC from archive:
    gzip -d <image_name>.wic.gz
  • To start installation process, run on the Linux host the following script as root:
    sudo ./flash-mx6-wic.sh <image_name>.wic
  • Connect Linux host and iMX device via USB OTG port and boot the iMX board in recovery mode (USB Serial Downloader).
  • After installation is complete, poweroff the board and boot it again in normal mode.
Edited by Dmitry Petrov

Merge request reports