On Tue, 5 Oct 2021 15:16:48 +0300 Paul Sokolovsky Paul.Sokolovsky@linaro.org wrote:
Hello,
Looking thru notes from the last meeting, I see that Bill noted a need to manually resize a Xilinx SD card image after the build as "pain point". I looked into it, and found a workaround on how to build an image of proper size right away:
--- a/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass +++ b/meta-xilinx-bsp/classes/image-types-xilinx-qemu.bbclass @@ -6,5 +6,5 @@ # 512K). CONVERSIONTYPES_append = " qemu-sd" -CONVERSION_CMD_qemu-sd = "cp ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd; truncate -s %512K ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd" +CONVERSION_CMD_qemu-sd = "cp ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd; truncate -s %256M ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.qemu-sd" CONVERSION_DEPENDS_qemu-sd = "coreutils-native"
[]
A check has been introduced in QEMU to see if image size is power of 2.
So, I assume it's a recent addition to Xilinx QEMU, though I didn't check the sources.
Actually, that's upstream QEMU feature: https://github.com/qemu/qemu/commit/a9bcedd15a5834ca9ae6c3a97933e85ac7edbd36 . So, to properly fix it, we'd need to throw in some Python code to the .bbclass (unless you know a generally available command to adjust file size like that, "truncate" doesn't seem to do that).