Last active
July 14, 2024 21:05
-
-
Save lanefu/8f8d6ce28e8774a98f229eb9d8ecd2b3 to your computer and use it in GitHub Desktop.
script to import arm vm images to libvirt with virt-install
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DEFAULT_IMAGE=armbian_24.5.0-trunk_Uefi-arm64_bookworm_edge_6.8.9.img.raw | |
DEFAULT_MEM=2048 | |
DEFAULT_CPU=2 | |
IMAGE_FORMAT=raw | |
IMAGE_DIR=/mnt/zfs/cheapo/images | |
MACHINE_DIR=/mnt/zfs/cheapo/machines | |
VM_NAME=${1} | |
VM_IMAGE=${DEFAULT_IMAGE} | |
VM_MEM=${2:-$DEFAULT_MEM} | |
VM_CPU=${3:-$DEFAULT_CPU} | |
FINAL_VM_PATH="${MACHINE_DIR}/${VM_NAME}.img.raw" | |
cp -v "${IMAGE_DIR}/${VM_IMAGE}" "${FINAL_VM_PATH}" | |
virt-install \ | |
--machine=virt \ | |
--arch=aarch64 \ | |
--boot uefi,firmware.feature0.name=secure-boot,firmware.feature0.enabled=no \ | |
--name=${VM_NAME} \ | |
--virt-type=kvm \ | |
--boot hd \ | |
--network=default,model=virtio \ | |
--disk path=${FINAL_VM_PATH},format=${IMAGE_FORMAT},device=disk,bus=virtio,cache=none \ | |
--memory=${VM_MEM} \ | |
--vcpu=${VM_CPU} \ | |
--os-variant debiantesting \ | |
--import \ | |
--check all=off | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment