Qemu에서 ARM 버전의 Ubuntu(그래픽 지원 포함)를 사용하고 싶지만 가장 쉽게 수행하는 방법에 대한 튜토리얼을 찾는 데 문제가 있습니다. (일부 이미지를 다운로드하고 하나의 명령을 실행하여 실행하는 것을 선호합니다.) . 번거로움을 최소화하면서 이를 달성하는 방법은 무엇입니까?
답변1
이 답변에서는:https://askubuntu.com/questions/281763/is-there-any-prebuild-qemu-ubuntu-image32bit-online/1081171#1081171Ubuntu 18.04 게스트/호스트에 대한 다음 작업 설정을 설명했습니다.
- 클라우드 이미지 arm64: 시작하기 위한 가장 빠른 설정
- debootstrap arm64: 상당히 빠르지만 더 많은 이미지 사용자 정의가 가능합니다.
이러한 설정은 미리 작성된 디스크 이미지를 제공하며 설치 프로그램을 거치지 않습니다. 그것은 내가 지금까지 본 최고의 선택입니다.
다음으로 QEMU에서 arm64 서버 이미지를 실행했습니다. 그러나 이 작업은 설치 프로그램을 통해 이루어지므로 KVM이 있는 ARM 호스트에 있지 않는 한 실제로는 속도가 매우 느립니다. 설치를 완료하려면 수십 번의 상호 작용이 필요하기 때문에 이는 특히 고통스럽습니다.
다음은 Ubuntu 18.10 호스트에서 테스트된 서버 스크립트입니다.
#!/usr/bin/env bash
set -eux
# Tested on Ubuntu 18.10.
# - https://superuser.com/questions/942657/how-to-test-arm-ubuntu-under-qemu-the-easiest-way
# - https://askubuntu.com/questions/797599/how-to-run-ubuntu-16-04-arm-in-qemu
# Parameters.
# This filename may need updating, check http://cdimage.ubuntu.com/releases/18.04/release/
id=ubuntu-18.04.3-server-arm64
#id=debian-9.6.0-arm64-xfce-CD-1
img="${id}.img.qcow2"
img_snapshot="${id}.img.snapshot.qcow2"
iso="${id}.iso"
flash0="${id}-flash0.img"
flash1="${id}-flash1.img"
# Images.
if [ ! -f "$iso" ]; then
wget "http://cdimage.ubuntu.com/releases/18.04/release/${iso}"
fi
if [ ! -f "$img" ]; then
qemu-img create -f qcow2 "$img" 1T
fi
if [ ! -f "$img_snapshot" ]; then
qemu-img \
create \
-b "$img" \
-f qcow2 \
"$img_snapshot" \
;
fi
if [ ! -f "$flash0" ]; then
dd if=/dev/zero of="$flash0" bs=1M count=64
dd if=/usr/share/qemu-efi/QEMU_EFI.fd of="$flash0" conv=notrunc
fi
if [ ! -f "$flash1" ]; then
dd if=/dev/zero of="$flash1" bs=1M count=64
fi
# Run.
#
# cdrom must be scsi or else the installation fails midway with:
#
# > Detect and mount CD-ROM
# >
# > Your installation CD-ROM couldn't be mounted. This probably means
# > that the CD-ROM was not in the drive. If so you can insert it and try
# > again.
# >
# > Retry mounting the CD-ROM?
# > Your installation CD-ROM couldn't be mounted.
#
# This is because the drivers for the default virtio are not installed in the ISO,
# because in the past it was not reliable on qemu-system-aarch64.
#
# See also:
# https://bazaar.launchpad.net/~ubuntu-testcase/ubuntu-manual-tests/trunk/view/head:/testcases/image/1688_ARM64_Headless_KVM_Guest
qemu-system-aarch64 \
-cpu cortex-a57 \
-device rtl8139,netdev=net0 \
-device virtio-scsi-device \
-device scsi-cd,drive=cdrom \
-device virtio-blk-device,drive=hd0 \
-drive "file=${iso},id=cdrom,if=none,media=cdrom" \
-drive "if=none,file=${img_snapshot},id=hd0" \
-m 2G \
-machine virt \
-netdev user,id=net0 \
-nographic \
-pflash "$flash0" \
-pflash "$flash1" \
-smp 2 \
;
Raspberry Pi 에뮬레이션에 대해서는 다음도 참조하세요.https://stackoverflow.com/questions/28880833/how-to-emulate-the-raspberry-pi-2-on-qemu/45814913#45814913
amd64 데스크탑은 다음 위치에 표시됩니다.https://askubuntu.com/questions/884534/how-to-run-ubuntu-16-04-desktop-on-qemu/1046792#1046792