[OE-core] Creating 'wic' image

Maciej Borzęcki maciej.borzecki at rndity.com
Mon Nov 14 16:42:15 UTC 2016


On Mon, Nov 14, 2016 at 4:23 PM, Mike Looijmans <mike.looijmans at topic.nl> wrote:
> In order to make life easier for people, I was looking into creating images
> with the "wic" tool.
>
> There's just one big piece of documentation lacking: What's the format it
> wants my rootfs and boot files?
> http://www.yoctoproject.org/docs/2.2/mega-manual/mega-manual.html

I agree that wic is not exactly user-friendly, even after going through
the documentation.

There is no 'special 'format for rootfs or boot files. All that wic does
is assemble a disk image with partitions specified in kickstart file.
Partitions are created by source plugins (scripts/lib/wic/plugins/source
in poky tree).

Currently, you'll find the following files there (I'll comment on the
ones I use[d]):

- bootimg-efi.py

- bootimg-partition.py

  Creates a partition of given --fstype and populates it with files
  listed in IMAGE_BOOT_FILES. The files must exist in DEPLOY_DIR_IMAGE.
  For instance, you can use this plugin to prepare a boot partition for
  BeagleBone Black, copying over MLO and u-boot.img. Alternatively you
  could also prepare a boot partition for Raspberry Pi, copying over
  Broadcom files and kernel image. See
  https://www.yoctoproject.org/docs/current/mega-manual/mega-manual.html#var-IMAGE_BOOT_FILES
  https://git.yoctoproject.org/cgit/cgit.cgi/meta-raspberrypi/tree/conf/machine/include/rpi-base.inc#n55
  https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf/machine/beaglebone.conf#n42

- bootimg-pcbios.py

- fsimage.py

  This one can be used if you happen to have a filesystem image ready.
  We actually use it in Mender because currently, wic lacks the ability
  to specify a fixed size of a partition (a patch series adding that was
  posted).

  The way it works, you are assumed to have a file system image ready
  upfront and then just specify it like this in kickstart:

    part / --source fsimage --sourceparams=file=<path> --ondisk
mmcblk0 --label primary

- isoimage-isohybrid.py

  For all I know, this one requires syslinux.

- rawcopy.py

  rawcopy puts a verbatim copy of a file inside the disk image,
  basically covers a use case when, for instance, you need to place a
  bootloader at a specific offset. Minor quirks:
  - you are not able to explicitly specify offset, hence commonly used
    with --align,
  - it's usually undesirable to have a partition table entry for this
    partition, hence often used with --no-table

- rootfs_pcbios_ext.py

- rootfs.py

  Creates a partition image with contents of rootfs of a particular
  image (if -e was used) or some directory (not necessarily the actualy
  rootfs). The file system to use is determined by --fstype.

>
> Basically I want an SD card with a FAT boot partition and an ext4 rootfs,
> and "sdimage-bootpart" is pretty close to that.

The 'sdimage-bootpart' image is actually used by beaglebone (as defined
in meta-yocto-bsp). Machine config sets this:

  WKS_FILE = "sdimage-bootpart.wks"

See
https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf/machine/beaglebone.conf#n21
for reference


>
> Without "wic", I build a tar of the rootfs and copy the boot files using a
> bit of shell scripting.
>
> Adding "wic" to IMAGE_FSTYPES just results in an error that I should set
> WKS_FILE but I have no clue as to what file that should point to.

>
> Running wic manually just results in more missing variables that I can't
> find what to specify in them...

Another thing that is not obvious is that wic will not cause bitbake to
build native tools that may be required when building in image. The user
is expected to figure out by themselves.

https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta-yocto-bsp/conf/machine/beaglebone.conf#n23


Hope that helps.

Cheers,
-- 
Maciej Borzecki
RnDity



More information about the Openembedded-core mailing list