sudo apt-get install qemu-efi
자동 스크립트
vi uefi_cloud_image.sh
#!/usr/bin/env bash
set -eux
#sudo apt-get install cloud-image-utils qemu-system-arm qemu-efi
# 이미지 다운로드.
img=ubuntu-18.04-server-cloudimg-arm64.img
if [ ! -f "$img" ]; then
wget "https://cloud-images.ubuntu.com/releases/18.04/release/${img}"
qemu-img resize "$img" +60G
fi
# 암호 설정.
user_data=user-data.img
if [ ! -f "$user_data" ]; then
cat >user-data <<EOF
#cloud-config
password: totoro
chpasswd: { expire: False }
ssh_pwauth: True
EOF
cloud-localds "$user_data" user-data
# EFI 사용:
# https://wiki.ubuntu.com/ARM64/QEMU
dd if=/dev/zero of=flash0.img bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
dd if=/dev/zero of=flash1.img bs=1M count=64
fi
qemu-system-aarch64 \
-M virt \
-cpu cortex-a57 \
-device rtl8139,netdev=net0 \
-m 4096 \
-netdev user,id=net0 \
-nographic \
-smp 4 \
-drive "if=none,file=${img},id=hd0" \
-device virtio-blk-device,drive=hd0 \
-drive "file=${user_data},format=raw" \
-pflash flash0.img \
-pflash flash1.img \
;
login: ubuntu
pw:totoro
댓글 없음:
댓글 쓰기