scripts: aarch64: replace guestmount for image modification

Replace the use of `guestmount and `guestunmount` with standard tools
(losetup, mount) to modify cloud disk image. This eliminates
dependency on guestmount which requires /dev/kvm and is not available
in MSHV root partition.

Signed-off-by: Aastha Rawat <aastharawat@microsoft.com>
This commit is contained in:
Aastha Rawat
2025-11-06 15:04:12 +00:00
committed by Bo Chen
parent e302d50b09
commit c4cce38631
3 changed files with 115 additions and 8 deletions

View File

@@ -74,10 +74,16 @@ if [ "${TEST_ARCH}" == "aarch64" ]; then
if [ ! -d "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" ]; then
mkdir -p "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR"
fi
# Mount the 'raw' image, replace the fio and umount the working folder
guestmount -a "$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_NAME" -m /dev/sda1 "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" || exit 1
cp "$WORKLOADS_DIR"/fio "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR"/usr/bin/fio
guestunmount "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR"
# Mount image partition
IMG="$WORKLOADS_DIR/$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_NAME"
# Update fio binary in the image
SRC_FIO_PATH="$WORKLOADS_DIR/fio"
DST_FIO_PATH="usr/bin/fio"
# Mount image partition, copy fio, and unmount
chmod +x "$SRC_FIO_PATH"
copy_to_image "$IMG" "$FOCAL_OS_RAW_IMAGE_UPDATE_TOOL_ROOT_DIR" "$SRC_FIO_PATH" "$DST_FIO_PATH" || exit
fi
# Prepare linux image (build from source or download pre-built)