QEMU Emulation for X86 64bit
Overview
The X86_64 QEMU board configuration is used to emulate the x86 architecture running in 64-bit long mode.
It uses the same emulated q35 machine as QEMU Emulation for X86, adding a
second CPU for SMP testing and an emulated Intel PCH SMBus controller. The
qemu_x86_64/atom/nokpti variant runs the same configuration with kernel
page table isolation disabled.
Hardware
Supported Features
The qemu_x86_64 board supports the hardware features listed below.
- on-chip / on-board
- Feature integrated in the SoC / present on the board.
- 2 / 2
-
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files. -
vnd,foo -
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.
qemu_x86_64/atom target
On-target memory for this board target: 32 MiB of RAM, 4 MiB of Flash.
Type |
Location |
Description |
Compatible |
|---|---|---|---|
CPU |
on-chip |
Generic x86-64 qemu CPU2 |
|
CAN |
on-board |
Kvaser PCIcan1 |
|
Display |
on-board |
QEMU RAM framebuffer display device1 |
|
Ethernet |
on-board |
Intel E1000 Ethernet controller1 |
|
Firmware |
on-board |
QEMU fw_cfg (I/O port transport)1 |
|
Input |
on-board |
VIRTIO Input device1 |
|
Interrupt controller |
on-chip |
Intel I/O Advanced Programmable Interrupt Controller (APIC)1 |
|
on-chip |
Local Advanced Programmable Interrupt Controller (APIC)1 |
||
Multi-Function Device |
on-chip |
Motorola MC146818 MFD1 |
|
MTD |
on-board |
Flash node2 |
|
PCIe |
on-board |
Generic PCIe host controller1 |
|
RTC |
on-chip |
Motorola MC146818 compatible Real Timer Clock1 |
|
Serial controller |
on-chip |
ns16550 UART2 |
|
SMbus |
on-board |
Intel Platform Controller Hub SMBus1 |
|
Timer |
on-chip |
HPET (High-Precision Event Timer)1 |
|
Virtio |
on-board |
VIRTIO over PCI1 |
Programming and Debugging
The qemu_x86_64 board supports the runners and associated west commands listed below.
| flash | debug | debugserver | |
|---|---|---|---|
| qemu | ✅ (default) | ✅ (default) | ✅ |
Applications for the qemu_x86_64 board configuration can be built and run
in the usual way for emulated boards (see Building an Application and
Run an Application for more details).
Flashing
While this board is emulated and you can’t “flash” it, you can use this configuration to run basic Zephyr applications and kernel tests in the QEMU emulated environment. For example, with the Basic Synchronization sample:
# From the root of the zephyr repository
west build -b qemu_x86_64 samples/synchronization
west build -t run
Exit QEMU by pressing CTRL+A x.
UEFI Boot
The qemu_x86_64 platform also supports the UEFI bootable method to run
Zephyr applications and kernel tests, but you need to set up some environment
configurations as follows:
Please install uefi-run in your system environment according to this reference link https://github.com/Richard-W/uefi-run. Note that uefi-run from snapstore may not work because of strict snap confinements. The preferred method is installing with cargo.
Please install OVMF in your system environment according to this reference link https://github.com/tianocore/tianocore.github.io/wiki/OVMF. The easiest way is to install a special
ovmfpackage found in many distros. For example, use the following command in Ubuntu:sudo apt install ovmfSet system environment variable OVMF_FD_PATH, for example:
export OVMF_FD_PATH=/usr/share/OVMF/OVMF_CODE.fd
Now you can build application, for example UEFI boot test sample found under tests/boot/uefi:
# From the root of the zephyr repository
west build -b qemu_x86_64 tests/boot/uefi
west build -t run
This will build an image with the uefi boot test app, boot it on qemu_x86_64 using UEFI, and display the following console output:
UEFI Interactive Shell v2.2
EDK II
UEFI v2.70 (EDK II, 0x00010000)
Mapping table
FS0: Alias(s):F0a:;BLK0:
PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
BLK1: Alias(s):
PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)
Press ESC in 1 seconds to skip startup.nsh or any other key to continue.
Starting UEFI application...
*** Zephyr EFI Loader ***
Zeroing 524544 bytes of memory at 0x105000
Copying 32768 data bytes to 0x1000 from image offset
Copying 20480 data bytes to 0x100000 from image offset 32768
Copying 540416 data bytes to 0x185100 from image offset 53248
Jumping to Entry Point: 0x112b (48 31 c0 48 31 d2 48)
*** Booting Zephyr OS build zephyr-v2.6.0-1472-g61810ec36d28 ***
Hello World! qemu_x86_64
Exit QEMU by pressing CTRL+A x.
Debugging
Refer to the detailed overview about Application Debugging.
Networking
The board supports SLIP networking over an emulated serial port
(CONFIG_NET_SLIP_TAP=y). The detailed setup is described in
Networking with QEMU.
It is also possible to use the QEMU built-in Ethernet adapter to connect to the host system. This is faster than using SLIP and is also the preferred way. See Networking with QEMU Ethernet for details.