banner
云野阁

云野阁

闲云野鹤,八方逍遥

Installing ARM Virtual Machine on Windows 10 (x86_64) using QEMU

Basic Environment#

System: Windows 10

Hardware: Dual Network Cards (This article uses two wireless network cards)

Required Software: QEMU, tap-windows

Required Firmware: QEMU_EFI.fd

ARM Image: openEuler-22.03-LTS-SP4-aarch64-dvd.iso

Environment Preparation#

  1. Go to the QEMU official website https://qemu.weilnetz.de/, download the exe program, the one used in this article is qemu-w64-setup-20240903.exe, and follow the prompts to install. (The latest version does not require environment variable configuration)

Open the command prompt and enter qemu-system-aarch64 -version, if you see its detailed version number, the installation is successful.

QEMU emulator version 9.1.0 (v9.1.0-12064-gc658eebf44)

Copyright (c) 2003-2024 Fabrice Bellard and the QEMU Project developers

1

  1. Download the QEMU_EFI.fd firmware, download link: https://releases.linaro.org/components/kernel/uefi-linaro/16.02/release/qemu64/.

2

  1. Download the ARM image, go to the OpenEuler official website, find and download the openEuler-22.03-LTS-SP4-aarch64-dvd.iso image in the image repository list.

3

  1. Install tap-windows, after installation, a network card named TAP-Windows Adapter V9 will appear in the local network adapter, and rename it to tap0. (The network card will be in a disconnected state right after installation)

4

  1. Share the local wireless network card (named WLAN 1 in this article) network. Right-click the properties of the local wireless network card (WLAN 1), in the WLAN properties - Sharing, share the network with tap0. As shown below.

5

Installation Process#

  1. Place QEMU_EFI.fd and openEuler-22.03-LTS-SP4-aarch64-dvd.iso image in the same folder, and open the command prompt in that folder.

  2. Enter the command to create a virtual disk file for the virtual machine.

qemu-img.exe create -f qcow2 "F:\arm-os-test\openeuler.qcow2" 60G
  • qemu-img.exe: Calls QEMU's image management tool.

  • create: The command used to create a new disk image file.

  • -f qcow2: Specifies that the file format to be created is QCOW2, which supports compression and snapshots.

  • "F:\arm-os-test\openeuler.qcow2": Specifies the file path and name of the virtual hard disk.

  • 60G: Sets the size of the virtual hard disk to 60 GB.

After executing the command, a disk file named openeuler.qcow2 will be generated in that folder.

  1. Execute the command to install openEuler.
 qemu-system-aarch64.exe -m 8192 -cpu cortex-a72 -smp 4,sockets=2,cores=2 -M virt -bios "F:\arm-os-test\QEMU_EFI.fd" -net nic -net tap,ifname=tap0 -device VGA -device nec-usb-xhci -device usb-mouse -device usb-kbd -drive if=none,file="F:\arm-os-test\openeuler.qcow2",id=hd0 -device virtio-blk-device,drive=hd0 -drive if=none,file="F:\arm-os-test\openEuler-22.03-LTS-SP4-aarch64-dvd.iso",id=cdrom,media=cdrom -device virtio-scsi-device -device scsi-cd,drive=cdrom
  • qemu-system-aarch64.exe: Starts the QEMU emulator for the AArch64 architecture.

  • -m 8192: Allocates 8 GB of memory to the virtual machine.

  • -cpu cortex-a72: Specifies the use of the Cortex-A72 CPU model.

  • -smp 4,sockets=2,cores=2: Configures 4 CPU cores, divided into 2 sockets, with 2 cores per socket.

  • -M virt: Uses the "virt" machine type, suitable for virtualization.

  • -bios "F:\arm-os-test\QEMU_EFI.fd": Specifies the EFI BIOS file.

  • -net nic -net tap,ifname=tap0: Sets the network, using NIC and tap interfaces.

  • -device VGA: Adds a VGA display device.

  • -device nec-usb-xhci: Adds a USB controller.

  • -device usb-mouse -device usb-kbd: Adds USB mouse and keyboard devices.

  • -drive if=none,file="F:\arm-os-test\openeuler.qcow2",id=hd0 -device virtio-blk-device,drive=hd0: Configures a VirtIO block device as the main disk.

  • -drive if=none,file="F:\arm-os-test\openEuler-22.03-LTS-SP4-aarch64-dvd.iso",id=cdrom,media=cdrom: Sets the CD-ROM drive using the specified ISO.

  • -device virtio-scsi-device -device scsi-cd,drive=cdrom: Adds a SCSI controller and connects the CD-ROM drive.

After executing the command, follow the prompts in the system installation interface to configure and install the system.

Connecting to the Internet#

  1. After the system installation is complete, check the IP address in the properties of the tap0 network card, change the IP address to one in the same subnet as the host, and set the DNS and gateway to be the same as the host. Execute the command to start the system.
qemu-system-aarch64.exe -m 8192 -cpu cortex-a72 -smp 4,sockets=2,cores=2 -M virt -bios "F:\arm-os-test\QEMU_EFI.fd" -net nic -net tap,ifname=tap0 -device VGA -device nec-usb-xhci -device usb-mouse -device usb-kbd -drive if=none,file="F:\arm-os-test\openeuler.qcow2",id=hd0 -device virtio-blk-device,drive=hd0

The startup command is obtained by removing the ISO mount part from the installation command.

6

  1. Configure the system IP address. Use the address of the tap0 network card as the gateway, and after configuration and enabling, use the SSH tool to connect.

7

If there is a failure in testing network connectivity, perform the following operations:

1. Cancel the network sharing of the wireless network card

2. Reshare the network

3. Start the virtual machine

  1. Test the network connectivity, and you should be able to access the network successfully.

8

At this point, the installed ARM architecture virtual machine can access the network normally, but the services published cannot be accessed from the local host. That is, the virtual machine can access the internet but cannot access the local host.

Local Host Connectivity to Virtual Machine Services#

To successfully access the services published in the virtual machine, a new wireless network card (named WLAN 2 in this article) needs to be used to bridge with tap0.

  1. Connect both wireless network cards to the same network, in Control Panel - Network Connections, hold down Ctrl, select the tap0 and WLAN 2 network cards, right-click and select bridge to create a bridge.

9

When both tap0 and WLAN 2 show "Enabled, Bridged", and the bridge shows the connected wireless network name, both the local host and the virtual machine can ping each other's addresses. (At this point, the local host's IP should use the one assigned by WLAN)

  1. Right-click to view the bridge properties, in the Internet Protocol Version 4 (TCP/IPv4) Properties, you can see that the gateway address is the same as the local machine.

10

  1. Change the gateway of the virtual machine to the corresponding gateway address, shut down the virtual machine, and restart the virtual machine using the command.

If both the virtual machine and the local host can ping the internet and can ping each other, then the local host can normally access the services published by the virtual machine.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.