rauc / meta-rauc

Yocto/Open Embedded meta layer for RAUC, the embedded Linux update framework
MIT License
154 stars 87 forks source link

Yocto WIC image is not a multiple of 4096 bytes #287

Closed phishstang65 closed 9 months ago

phishstang65 commented 9 months ago

Hi - I'm using rauc with yocto (Kirkstone). The rauc updates are working great and now I want to use 'block-hash-index'.

I enabled it in my bundle recipe like this: RAUC_SLOT_rootfs[adaptive] = "block-hash-index"

However, the build fails with the following error:

| (rauc:10524): rauc-DEBUG: 20:19:27.703: bundle start
| (rauc:10524): rauc-DEBUG: 20:19:27.703: input directory: /home/developer/compulab-nxp-bsp/build-iot-gate-imx8plus/tmp/work/iot_gate_imx8plus-poky-linux/update-bundle/1.0-r0/bundle
| (rauc:10524): rauc-DEBUG: 20:19:27.703: output bundle: /home/developer/compulab-nxp-bsp/build-iot-gate-imx8plus/tmp/work/iot_gate_imx8plus-poky-linux/update-bundle/1.0-r0/build/bundle.raucb
| Failed to create bundle: Failed to generate hash index for core-image-iot-gate-imx8plus.ext4: data file size (1080342528) is not a multiple of 4096 bytes

The wic file is defined like this:

# short-description: Create SD card image with a boot partition
# long-description:
# Create an image that can be written onto a SD card using dd for use
# with i.MX SoC family
# It uses u-boot
#
# The disk layout used is:
#  - --------- -------------- --------------
# | | u-boot  |     boot     |    rootfs   |
#  - --------- -------------- --------------
# ^ ^         ^              ^
# | |         |              |
# 0 1kiB    4MiB          16MiB + rootfs + IMAGE_EXTRA_SPACE (default 10MiB)
#
part u-boot --source rawcopy --sourceparams="file=${UBOOT_BINARY}" --ondisk mmcblk --no-table --align 1
part /boot --source bootimg-partition --ondisk mmcblk --fstype=vfat --label boot --active --align 4096 --size 16
part /bootenv --ondisk mmcblk --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/bootenv --mkfs-extraopts="-i 4096 -O ^metadata_csum" --fstype=ext4 --label bootenv --fixed-size 64 --align 4096
part / --ondisk mmcblk --fstype=ext4 --label rootfs_a --fixed-size 2048 --align 4096
part / --ondisk mmcblk --fstype=ext4 --label rootfs_b --fixed-size 2048 --align 4096
bootloader --ptable msdos

The target is an i.MX8. How can I fix this? Thanks.

jluebbe commented 9 months ago

You're probably missing the alignment configuration:

IMAGE_ROOTFS_ALIGNMENT = "4"

There's also an example at https://github.com/rauc/meta-rauc-community/blob/master/meta-rauc-qemux86/recipes-core/images/core-image-minimal.bbappend

Also keep in mind that for the best results, you may need to do more to keep the differences in the ext4 image minimal (i.e. -E hash_seed=<seed>).