Win11 uses QEMU to configure Loongson 3A5000 virtual environment

01 Download resources

Resources used in this experiment:

Open source simulator qemu download address, qemu-w64-setup-20230822.exe
loongarch firmware download: QEMU_EFI_8.0.fd
Loongarch basic image download: archlinux-loong64.iso

qemu is installed in D:\install\qemu:

D:\install\qemu>dir | findstr "qemu-system-loongarch"
2023-08-23 02:05 10,648,816 qemu-system-loongarch64.exe
2023-08-23 02:00 10,648,816 qemu-system-loongarch64w.exe

More download resources:

Firmware download address
Peking University download mirror
QEMU_EFI_7.1.fd
QEMU_EFI_7.2.fd
QEMU_EFI_8.0.fd
Documentation:
README.html
README.txt

Use the installed virtual machine file (can be loaded and started directly with qemu-system-loongarch64):
archlinux-xfce4-2023.05.10-loong64.qcow2.zst
archlinux-minimal-2023.05.10-loong64.qcow2.zst
archlinux-mate-2023.05.10-loong64.qcow2.zst

Loongson image download address suitable for qemu

02 Installation steps

The installation process is more convenient with the latest QEMU_EFI_8.0.fd. The basic default options are fine.

02.01 Generate virtual machine files

:: Create directory
mkdir e:\work\202309\loongarch & & cd e:\work\202309\loongarch
:: Generate image disk file, qemu is installed in the d:\install\qemu directory
d:\install\qemu\qemu-img create -f qcow2 archlinux-loongarch001.qcow2 2048G
::The running results are as follows
:: Formatting 'archlinux-loongarch001.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=2199023255552 lazy_refcounts=off refcount_bits=16

02.02 Installing the system

02.02.01 Start the virtual machine

Firmware directory: E:\work\202309\loongarch\QEMU_EFI_8.0.fd
The virtual machine file generated previously: E:\work\202309\loongarch\archlinux-loongarch001.qcow2
Image file: E:\tools\os\loong64\archlinux-loong64.iso
Current working directory: E:\work\202309\loongarch

d:\install\qemu\qemu-system-loongarch64 ^
    -m 8G ^
    -cpu la464-loongarch-cpu ^
    -machinevirt^
    -smp 4^
    -bios E:\work\202309\loongarch\QEMU_EFI_8.0.fd ^
    -serial stdio ^
    -device virtio-gpu-pci ^
    -net nic -net user ^
    -device nec-usb-xhci,id=xhci,addr=0x1b ^
    -device usb-tablet,id=tablet,bus=xhci.0,port=1 ^
    -device usb-kbd,id=keyboard,bus=xhci.0,port=2 ^
    -hda E:\work\202309\loongarch\archlinux-loongarch001.qcow2 ^
    -cdrom E:\tools\os\loong64\archlinux-loong64.iso ^
    -boot once=d

After startup, the following interface appears, select the default item *Arch Linux install medium (loong64,UEFI)

After pressing Enter, you will enter the following interface. After a short wait, you will enter the configuration interface.

02.02.02 Set configuration items

Enter the configuration interface

Here we focus on configuring disk, root password, user account, audio, network, time zone

Disk




After saving, you can select the disk configuration again to see the specific information to ensure that it has been allocated successfully.

Login account
After changing the root password, remember to create a commonly used user for yourself (for example: user01). After setting the password, remember to set sudo to True.

Audio: Pulseaudio
Network: Copy the network configuration from the ISO to the installation
Time zone: Asia/Shanghai

Click Install and then Enter to start the installation

02.02.03 arch-chroot

This step is very important.

The default installation process will automatically prompt arch-chroot .

If there is no such process, manual configuration is required. Please refer to: Configuring Loongson New World Environment using QEMU

Basic Information:

cat /proc/cpuinfo

uname -a
cat /proc/version
cat /etc/issue
g++ --version

03 Install other software

Install the software using sudo pacman -Sy

sudo pacman -Sy base linux linux-firmware base-devel sudo zsh fish grub efibootmgr xfce4 xfce4-goodies lightdm lightdm-gtk-greeter noto-fonts-cjk noto-fonts-emoji btrfs-progs xfsprogs dosfstools exfatprogs f2fs-tools xfsprogs networkmanager nano fcitx5 fcitx5-configtool fcitx5-chinese-addons neofetch vim git curl wget
# After setting the default startup service, start it again to enter the xfce4 graphical startup interface.
systemctl enable lightdm.service
systemctl enable NetworkManager.service

Run the following command to enter the graphical interface

d:\install\qemu\qemu-system-loongarch64 ^
    -m 8G ^
    -cpu la464-loongarch-cpu ^
    -machinevirt^
    -smp 4^
    -bios E:\work\202309\loongarch\QEMU_EFI_8.0.fd ^
    -serial stdio ^
    -device virtio-gpu-pci ^
    -net nic -net user ^
    -device nec-usb-xhci,id=xhci,addr=0x1b ^
    -device usb-tablet,id=tablet,bus=xhci.0,port=1 ^
    -device usb-kbd,id=keyboard,bus=xhci.0,port=2 ^
    -hda E:\work\202309\loongarch\archlinux-loongarch001.qcow2

After entering the password and pressing Enter, enter the graphical interface.

You can input normally,but the mouse focus is slightly shifted.

03 Reference materials

Use QEMU to configure Loongson New World environment
Loongson Loongarch Experiment (2) – Use qemu to simulate the Loongarch machine on the x86_64 host
Loongson Open Source Community