eclipse-leda / leda-distro

Eclipse Leda provides a Yocto-based build setup for SDV.EDGE components
https://eclipse-leda.github.io/leda/
Apache License 2.0
14 stars 8 forks source link

Partition sizes are not multiple of 4096 byte for Rauc block-hash-index #63

Open OlavHerbst opened 1 year ago

OlavHerbst commented 1 year ago

Describe the bug Partition sizes must be aligned to 4K. Rauc needs for faster installation of bundles with block-hash-indexes partition sizes that are multiples of 4096 bytes. Bitbake has variable IMAGE_ROOTFS_ALIGNMENT = "4" for this, which must be set for minimal, full and rescue images. But images sizes can differ and are not always dividable by 4096.

To Reproduce Steps to reproduce the behaviour:

  1. Build distro for one of the machines, e.g. Qemu-arm64
  2. Run Qemu out of eclipse-leda-qemu-arm64.tar.xz.zip (Image-qemuarm64.bin, sdv-image-all-qemuarm64.wic.qcow2)
  3. In Qemu install with Rauc the rescue image out of same file, which should succeed (same content and size as in wic, e.g.
    rauc install .../sdv-rauc-bundle-rescue-qemuarm64.raucb
  4. journal shows a warning log message of Rauc that the size is not a multiple of 4K:
    journalctl -u rauc
    ...
    Updating /dev/vda3 with /run/rauc/bundle/sdv-image-rescue-qemuarm64.ext4
    Continuing after adaptive mode error: failed to open target slot hash index for rescue.0: data file size (**167528448**) is not a multiple of 4096 bytes
    ...

    Installation takes longer than expected.

  5. Compare image size out of manifest
    rauc info  .../sdv-rauc-bundle-rescue-qemuarm64.raucb
    ... 163258368   / 4096 = 39858.0

    with partition size

    fdisk -l
    ...
    /dev/vda3   323584  650787  327204 159.8M Linux filesystem   (650787-323584+1)*512=**167528448**, /4096=40900**.5**
    /dev/vda4   655360 1728575 1073216   524M Linux filesystem   partition for full image  ... =134152.0
    /dev/vda5  1736704 2678527  941824 459.9M Linux filesystem   partition for minimal image  ... = 117728.0

In the wic file sdv-image-all-qemuarm64.wic.qcow2 you can directly check the partition sizes (7-Zip):

"2.rescue.img"    **167528448**       / 4096 =   40900**.5**  size not ok
"3.root_a.img"    549486592       / 4096 = 134152.0  partition size for full image ok
"4.root_b.img"    482213888      / 4096 = 117728.0   partition size for minimal image ok

The full-image and minimal-image sizes are in the bundle manifests ok, but also differ from partition sizes:

rauc info sdv-rauc-bundle-full.raucb
   size: 494252032 / 4096 = 120667.0  ok
rauc info sdv-rauc-bundle-minimal.raucb 
  size: 426606592 / 4096 = 104152.0  ok

In eclipse-leda-raspberrypi.tar.xz.zip in sdv-image-all-raspberrypi4-64.wic the partitions for full and minimal image violate the 4K-rule:

"2.rescue.img"    201457664      / 4096  = 49184.0
"3.root_a.img"    533480448       / 4096 = 130244.25 !!!
"4.root_b.img"    466212864       / 4096 = 113821.5   !!!

Expected behaviour The size of partitions for rescue.img, root_a.img and root_b.img must be multiple of 4096 to guarantee fast block-hash-index Rauc bundle installations.

Screenshots / Logfiles

Leda Version (please complete the following information):