Operations 10 min read

How to Auto-Setup an openEuler QEMU VM with ARM64 Cross-Compilation

This guide walks you through using an automated script to download dependencies, build QEMU 4.1.1, compile the Linux 4.19.1 kernel and BusyBox for ARM64, and install openEuler 1.0 in a virtual machine, including optional GDB debugging and snapshot tips.

Huawei Cloud Developer Alliance
Huawei Cloud Developer Alliance
Huawei Cloud Developer Alliance
How to Auto-Setup an openEuler QEMU VM with ARM64 Cross-Compilation

1. Setting up the openEuler VM Environment

The provided script automates the creation of a QEMU-based openEuler development environment. It downloads and installs required dependencies, fetches and builds QEMU 4.1.1 and BusyBox 1.25.1, and sets up an ARM64 cross‑compilation toolchain for Linux kernel 4.19.1, enabling kernel debugging with GDB.

Environment preparation: use Ubuntu 18.04 in VMware 15.1.0 or VirtualBox 6.1, allocating at least 120 GB disk space and 2 GB RAM.

Script repository: https://gitee.com/luo_yu_zhe/openEulerInstallation . Before running, replace the download source with a domestic mirror (see reference [3]).

A. Script execution flow

sudo ./prepare.sh
source ~/.bashrc
sudo ./build.sh

– installs the ARM64 toolchain, compiles the kernel, BusyBox, and builds the root filesystem. sudo ./start-qemu.sh – launches QEMU without GDB. sudo ./start-qemu-gdb.sh – launches QEMU with GDB; in a second terminal run aarch64-linux-gnu-gdb, connect to localhost:1234, then type c to continue.

B. prepare.sh functionality

Downloads and extracts the 64‑bit ARM cross‑compiler, QEMU‑4.1.1, and the openEuler image, then installs required packages via apt install. It checks for existing archives to avoid redundant downloads.

C. build.sh functionality

Compiles Linux kernel 4.19.1 and BusyBox 1.25.1, then creates a root filesystem. Versions and architecture can be adjusted via parameters at the script header.

D. QEMU start scripts

start-qemu.sh

– normal QEMU launch. start-qemu-gdb.sh – launch with GDB support. start-euleros.sh – boot the openEuler ISO using QEMU.

Common QEMU options (selected examples): -hda file, -hdb file, -hdc file, -hdd file – attach up to four hard‑disk images. -append cmdline – pass a kernel command line (e.g., root=/dev/hda). -M machine – specify the emulated machine. -cdrom file – use a CD‑ROM image. -boot [a|c|d] – choose boot device (floppy, hard‑disk, CD). -snapshot – write changes to a temporary file instead of the disk image. -m megs – set virtual memory size (default 128 M). -smp n – emulate an SMP system with n CPUs. -nographic – disable graphical output and use the console for I/O.

2. openEuler System Installation

After sudo ./prepare.sh, run sudo ./start_euleros.sh, which executes:

qemu-system-aarch64 -machine virt -cpu cortex-a57 -m 1024 -bios ./QEMU_EFI.fd -cdrom openEuler-1.0-aarch64-dvd.iso -hda ./qemu_Euler.img -serial stdio

QEMU loads the openEuler ISO and starts the installer. Choose the "test media" installation mode, then configure the highlighted options ([!]): installation destination, root password, and user password.

Installation steps (illustrated with screenshots):

Select "Use text mode".

Set the root password.

Choose the installation destination (disk size and partitioning method) – both VMware and VirtualBox screenshots are provided.

Create a user account (enter b to finish configuration).

Complete the installation and log in with the created credentials.

After installation, the system behaves like a regular Linux environment. Because the VM must be re‑installed each run, it is recommended to create a snapshot after a successful setup.

References:

[1] https://github.com/xianjimli/qemu-arm-linux.git

[2] https://blog.csdn.net/ustc_dylan/article/details/5385691

[3] https://blog.csdn.net/qq_35451572/article/details/79516563

AutomationLinux kernelvirtualizationARM64QEMUcross-compilationopenEuler
Huawei Cloud Developer Alliance
Written by

Huawei Cloud Developer Alliance

The Huawei Cloud Developer Alliance creates a tech sharing platform for developers and partners, gathering Huawei Cloud product knowledge, event updates, expert talks, and more. Together we continuously innovate to build the cloud foundation of an intelligent world.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.