foreword
-
When debugging RT-Thread bsp recently
qemu-virt64-aarch64
, I encountered a problem that the network equipment could not be used, and finally confirmed that theapt install
installed qemuqemu-system-aarch64
version used by the current ubuntu 20.04 system is too low. -
The network device in RT-Thread
qemu-virt64-aarch64
needs a newer qemuqemu-virt64-aarch64
version
environment
-
win10 64位 VMware Workstation Pro 16
-
ubuntu 20.04
-
gcc:
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
, install with ubuntu 20.04 apt install
download qemu
-
clone using git
git clone https://github.com/qemu/qemu.git
-
The current latest qemu version contains some sub-warehouses, so you need to update the git submodule,
git submodule update --init --force --recursive
compile qemu-system-aarch64
-
You can only compile
qemu-system-aarch64
, which is faster and the compiled directory will be smaller -
Before compiling, you need to install some software package dependencies, the main one is glib-2.0, the installation command
sudo apt-get install libglib2.0-dev
-
The command to compile
qemu-system-aarch64
is as follows: -
First, create a build directory in the external directory of the qemu code, such as qemu_build, and then enter the qemu_build directory
# qemu 代码目录的外部创建
mkdir qemu_build
# 进入 qemu_build 目录
cd qemu_build
# 执行 configure
../qemu/configure --prefix=/home/zhangsz/tools/qemu8 --enable-virtfs --enable-slirp --target-list=aarch64-softmmu
# 可以使用 make 或者 ninja 进行编译
ninja -j12
# 可以使用 ninja 或者 make install 进行安装到 prefix 目录(如果指定)
ninja install
-
instruction manual
-
../qemu/configure
: under the qemu source code pathconfigure
-
--prefix=/home/zhangsz/tools/qemu8
Specify the installation directory, if not specified, it will be installed in the system directory, you can view it after configurationprefix
-
--enable-virtfs
: Turn on the virtfs option, -
--enable-slirp
: enable network carduser
option -
--target-list=aarch64-softmmu
: Only compile is specified hereqemu-system-aarch64
, without this option, all platforms will be compiled -
Compilation: make or ninja, multi-threaded compilation is recommended, the speed is faster
-
To install install : you can use
ninja install
ormake install
Platforms supported by qemu
configs/targets/
You can view the directory under the qemu source code directory
View compiled products
- After make install or ninja install, the product is as follows:
- Currently compiled version:
$ ./qemu-system-aarch64 --version
QEMU emulator version 8.0.50 (v8.0.0-2304-g408015a97d-dirty)
Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers
- Currently supported virtual appliances
$ ./qemu-system-aarch64 -M ?
Supported machines are:
akita Sharp SL-C1000 (Akita) PDA (PXA270)
ast1030-evb Aspeed AST1030 MiniBMC (Cortex-M4)
ast2500-evb Aspeed AST2500 EVB (ARM1176)
ast2600-evb Aspeed AST2600 EVB (Cortex-A7)
bletchley-bmc Facebook Bletchley BMC (Cortex-A7)
borzoi Sharp SL-C3100 (Borzoi) PDA (PXA270)
bpim2u Bananapi M2U (Cortex-A7)
canon-a1100 Canon PowerShot A1100 IS (ARM946)
cheetah Palm Tungsten|E aka. Cheetah PDA (OMAP310)
collie Sharp SL-5500 (Collie) PDA (SA-1110)
connex Gumstix Connex (PXA255)
cubieboard cubietech cubieboard (Cortex-A8)
emcraft-sf2 SmartFusion2 SOM kit from Emcraft (M2S010)
fby35-bmc Facebook fby35 BMC (Cortex-A7)
fby35 Meta Platforms fby35
fp5280g2-bmc Inspur FP5280G2 BMC (ARM1176)
fuji-bmc Facebook Fuji BMC (Cortex-A7)
g220a-bmc Bytedance G220A BMC (ARM1176)
highbank Calxeda Highbank (ECX-1000)
imx25-pdk ARM i.MX25 PDK board (ARM926)
integratorcp ARM Integrator/CP (ARM926EJ-S)
kudo-bmc Kudo BMC (Cortex-A9)
kzm ARM KZM Emulation Baseboard (ARM1136)
lm3s6965evb Stellaris LM3S6965EVB (Cortex-M3)
lm3s811evb Stellaris LM3S811EVB (Cortex-M3)
mainstone Mainstone II (PXA27x)
mcimx6ul-evk Freescale i.MX6UL Evaluation Kit (Cortex-A7)
mcimx7d-sabre Freescale i.MX7 DUAL SABRE (Cortex-A7)
microbit BBC micro:bit (Cortex-M0)
midway Calxeda Midway (ECX-2000)
mori-bmc Mori BMC (Cortex-A9)
mps2-an385 ARM MPS2 with AN385 FPGA image for Cortex-M3
mps2-an386 ARM MPS2 with AN386 FPGA image for Cortex-M4
mps2-an500 ARM MPS2 with AN500 FPGA image for Cortex-M7
mps2-an505 ARM MPS2 with AN505 FPGA image for Cortex-M33
mps2-an511 ARM MPS2 with AN511 DesignStart FPGA image for Cortex-M3
mps2-an521 ARM MPS2 with AN521 FPGA image for dual Cortex-M33
mps3-an524 ARM MPS3 with AN524 FPGA image for dual Cortex-M33
mps3-an547 ARM MPS3 with AN547 FPGA image for Cortex-M55
musca-a ARM Musca-A board (dual Cortex-M33)
musca-b1 ARM Musca-B1 board (dual Cortex-M33)
musicpal Marvell 88w8618 / MusicPal (ARM926EJ-S)
n800 Nokia N800 tablet aka. RX-34 (OMAP2420)
n810 Nokia N810 tablet aka. RX-44 (OMAP2420)
netduino2 Netduino 2 Machine (Cortex-M3)
netduinoplus2 Netduino Plus 2 Machine (Cortex-M4)
none empty machine
npcm750-evb Nuvoton NPCM750 Evaluation Board (Cortex-A9)
nuri Samsung NURI board (Exynos4210)
olimex-stm32-h405 Olimex STM32-H405 (Cortex-M4)
orangepi-pc Orange Pi PC (Cortex-A7)
palmetto-bmc OpenPOWER Palmetto BMC (ARM926EJ-S)
qcom-dc-scm-v1-bmc Qualcomm DC-SCM V1 BMC (Cortex A7)
qcom-firework-bmc Qualcomm DC-SCM V1/Firework BMC (Cortex A7)
quanta-gbs-bmc Quanta GBS (Cortex-A9)
quanta-gsj Quanta GSJ (Cortex-A9)
quanta-q71l-bmc Quanta-Q71l BMC (ARM926EJ-S)
rainier-bmc IBM Rainier BMC (Cortex-A7)
raspi0 Raspberry Pi Zero (revision 1.2)
raspi1ap Raspberry Pi A+ (revision 1.1)
raspi2b Raspberry Pi 2B (revision 1.1)
raspi3ap Raspberry Pi 3A+ (revision 1.0)
raspi3b Raspberry Pi 3B (revision 1.2)
realview-eb ARM RealView Emulation Baseboard (ARM926EJ-S)
realview-eb-mpcore ARM RealView Emulation Baseboard (ARM11MPCore)
realview-pb-a8 ARM RealView Platform Baseboard for Cortex-A8
realview-pbx-a9 ARM RealView Platform Baseboard Explore for Cortex-A9
romulus-bmc OpenPOWER Romulus BMC (ARM1176)
sabrelite Freescale i.MX6 Quad SABRE Lite Board (Cortex-A9)
sbsa-ref QEMU 'SBSA Reference' ARM Virtual Machine
smdkc210 Samsung SMDKC210 board (Exynos4210)
sonorapass-bmc OCP SonoraPass BMC (ARM1176)
spitz Sharp SL-C3000 (Spitz) PDA (PXA270)
stm32vldiscovery ST STM32VLDISCOVERY (Cortex-M3)
supermicro-x11spi-bmc Supermicro X11 SPI BMC (ARM1176)
supermicrox11-bmc Supermicro X11 BMC (ARM926EJ-S)
sx1 Siemens SX1 (OMAP310) V2
sx1-v1 Siemens SX1 (OMAP310) V1
tacoma-bmc OpenPOWER Tacoma BMC (Cortex-A7)
terrier Sharp SL-C3200 (Terrier) PDA (PXA270)
tiogapass-bmc Facebook Tiogapass BMC (ARM1176)
tosa Sharp SL-6000 (Tosa) PDA (PXA255)
verdex Gumstix Verdex Pro XL6P COMs (PXA270)
versatileab ARM Versatile/AB (ARM926EJ-S)
versatilepb ARM Versatile/PB (ARM926EJ-S)
vexpress-a15 ARM Versatile Express for Cortex-A15
vexpress-a9 ARM Versatile Express for Cortex-A9
virt-2.10 QEMU 2.10 ARM Virtual Machine
virt-2.11 QEMU 2.11 ARM Virtual Machine
virt-2.12 QEMU 2.12 ARM Virtual Machine
virt-2.6 QEMU 2.6 ARM Virtual Machine
virt-2.7 QEMU 2.7 ARM Virtual Machine
virt-2.8 QEMU 2.8 ARM Virtual Machine
virt-2.9 QEMU 2.9 ARM Virtual Machine
virt-3.0 QEMU 3.0 ARM Virtual Machine
virt-3.1 QEMU 3.1 ARM Virtual Machine
virt-4.0 QEMU 4.0 ARM Virtual Machine
virt-4.1 QEMU 4.1 ARM Virtual Machine
virt-4.2 QEMU 4.2 ARM Virtual Machine
virt-5.0 QEMU 5.0 ARM Virtual Machine
virt-5.1 QEMU 5.1 ARM Virtual Machine
virt-5.2 QEMU 5.2 ARM Virtual Machine
virt-6.0 QEMU 6.0 ARM Virtual Machine
virt-6.1 QEMU 6.1 ARM Virtual Machine
virt-6.2 QEMU 6.2 ARM Virtual Machine
virt-7.0 QEMU 7.0 ARM Virtual Machine
virt-7.1 QEMU 7.1 ARM Virtual Machine
virt-7.2 QEMU 7.2 ARM Virtual Machine
virt-8.0 QEMU 8.0 ARM Virtual Machine
virt QEMU 8.1 ARM Virtual Machine (alias of virt-8.1)
virt-8.1 QEMU 8.1 ARM Virtual Machine
witherspoon-bmc OpenPOWER Witherspoon BMC (ARM1176)
xilinx-zynq-a9 Xilinx Zynq Platform Baseboard for Cortex-A9
xlnx-versal-virt Xilinx Versal Virtual development board
xlnx-zcu102 Xilinx ZynqMP ZCU102 board with 4xA53s and 2xR5Fs based on the value of smp
yosemitev2-bmc Facebook YosemiteV2 BMC (ARM1176)
z2 Zipit Z2 (PXA27x)
Instructions
-
You can modify the environment variables of the system to make it
qemu-system-aarch64
take effect -
Modify
/etc/profile
,sudo vim /etc/profile
, and finally addqemu-system-aarch64
the installation path of qemuexport PATH=$PATH:/home/zhangsz/tools/qemu8/bin
- Then execute it
source /etc/profile
, it will take effect, and then execute it directlyqemu-system-aarch64
, without the full path
summary
-
qemu-system-aarch64
This article mainly records how to use the qemu source code to compile a newer version -
The current version of qemu installed by default apt install on ubuntu 20.04 is relatively low. You can try to manually compile qemu and upgrade the version of qemu
-
To compile other platforms, for example
qemu-system-arm
, only need to change the compilation configuration:--target-list=arm-softmmu
# 执行 configure
../qemu/configure --prefix=/home/zhangsz/tools/qemu8 --enable-virtfs --enable-slirp --target-list=arm-softmmu