记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。
 
0

QEMU模板ARM环境

发表者:admin分类:云计算容器2020-12-23 12:14:41 阅读[763]

QEMU ARM guest support

QEMU模板ARM环境与支持硬件开发板

QEMU has generally good support for ARM guests. It has support for nearly fifty different machines. The reason we support so many is that ARM hardware is much more widely varying than x86 hardware. ARM CPUs are generally built into "system-on-chip" (SoC) designs created by many different companies with different devices, and these SoCs are then built into machines which can vary still further even if they use the same SoC. Even with fifty boards QEMU does not cover more than a small fraction of the ARM hardware ecosystem.

Because ARM systems differ so much and in fundamental ways, typically operating system or firmware images intended to run on one machine will not run at all on any other. This is often surprising for new users who are used to the x86 world where every system looks like a standard PC. (Once the kernel has booted, most userspace software cares much less about the detail of the hardware.)

The situation for 64-bit ARM is fairly similar, except that we don't implement so many different machines.

As well as the more common "A-profile" CPUs (which have MMUs and will run Linux) we also support the Cortex-M3 and Cortex-M4 "M-profile" CPUs (which are microcontrollers used in very embedded boards. We only have two boards which use the M-profile CPU at the moment: "lm3s811evb" and "lm3s6965evb" (which are both TI Stellaris evaluation boards).

Guidelines for choosing a QEMU machine

Accurate emulation of existing hardware

If you have a complete system image already that works on hardware and you want to boot with QEMU, check whether QEMU lists that machine in its '-machine help' output.

If it does, that's the best place to start. If it doesn't then unfortunately you're out of luck: your image won't boot on QEMU.

If it's a Linux image and you're mostly interested in the userspace software, then you may be able to extract the filesystem and use that with a different kernel which boots on a system QEMU does emulate.

Generic ARM system emulation with the virt machine

If you don't care about reproducing the idiosyncrasies of a particular bit of hardware, such as small amount of RAM, no PCI or other hard disk, etc., and just want to run Linux, the best option is to use:

-M virt

virt is a platform which doesn't correspond to any real hardware and is designed for use in virtual machines.

It supports PCI, virtio, recent CPUs and large amounts of RAM.

See this tutorial for information on getting 32-bit ARM Debian Linux running on the "virt" board.

For 64-bit ARM "virt" is also the best choice, and there's a tutorial for 64-bit ARM Debian Linux setup too.

The "versatilepb" machine has also often been used as a general-purpose Linux target in the past; its disadvantage is that it has a very old CPU and only 256MB of RAM, but it does at least have PCI and SCSI. You can find a description of how to install Debian on it here (the author of that tutorial has also provided some prebuilt images). You're probably better off using "virt" though.

Guest kernel configuration for the virt machine

The 'defconfig' for Linux arm and arm64 should include the right device drivers for virtio and the PCI controller; some older kernel versions, especially for 32-bit Arm, did not have everything enabled by default. If you're not seeing PCI devices that you expect, then check that your guest config has:

CONFIG_PCI=y
CONFIG_VIRTIO_PCI=y
CONFIG_PCI_HOST_GENERIC=y

virt machine graphics

Graphics is also available, but unlike x86 there is no default display device enabled: you should select on from the Display devices section of "-device ?". One good option is to use:

-device virtio-gpu-pci

and enable the following Linux kernel options (as well as the generic "virtio PCI for the virt machine" options listed earlier):

CONFIG_DRM=y
CONFIG_DRM_VIRTIO_GPU=y

Also, for some reason, the SDL graphic window does not open under certain circumstances as of v2.12, so you might need to use another method such as VNC:

-vnc :0

and then connect to it with:

vinagre :5900

Example for using the canon-a1100 machine

There is no Linux support for the canon-a1100 machine - you have to use a special firmware here like "barebox". To build a barebox image, download a tarball from https://www.barebox.org/download/ and then compile it like this:

tar -xjf barebox-....tar.bz2
cd barebox-...
cp ./arch/arm/configs/canon-a1100_defconfig .config
make CROSS_PREFIX=arm-linux-gnu- ARCH=arm CC=arm-linux-gnu-gcc \
 LD=arm-linux-gnu-ld OBJCOPY=arm-linux-gnu-objcopy olddefconfig
make CROSS_PREFIX=arm-linux-gnu- ARCH=arm CC=arm-linux-gnu-gcc \
 LD=arm-linux-gnu-ld OBJCOPY=arm-linux-gnu-objcopy -j8

Then you can run the image like this:

qemu-system-arm -M canon-a1100 -serial stdio -display none -bios barebox.canon-a1100.bin

Supported Machines

Supported in qemu-system-arm

MachineDescription
akitaSharp SL-C1000 (Akita) PDA (PXA270)
ast2500-evbAspeed AST2500 EVB (ARM1176)
borzoiSharp SL-C3100 (Borzoi) PDA (PXA270)
canon-a1100Canon PowerShot A1100 IS
cheetahPalm Tungsten|E aka. Cheetah PDA (OMAP310)
collieSharp SL-5500 (Collie) PDA (SA-1110)
connexGumstix Connex (PXA255)
cubieboardcubietech cubieboard
highbankCalxeda Highbank (ECX-1000)
imx25-pdkARM i.MX25 PDK board (ARM926)
integratorcpARM Integrator/CP (ARM926EJ-S)
kzmARM KZM Emulation Baseboard (ARM1136)
lm3s6965evbStellaris LM3S6965EVB
lm3s811evbStellaris LM3S811EVB
mainstoneMainstone II (PXA27x)
midwayCalxeda Midway (ECX-2000)
musicpalMarvell 88w8618 / MusicPal (ARM926EJ-S)
n800Nokia N800 tablet aka. RX-34 (OMAP2420)
n810Nokia N810 tablet aka. RX-44 (OMAP2420)
netduino2Netduino 2 Machine
noneempty machine
nuriSamsung NURI board (Exynos4210)
palmetto-bmcOpenPOWER Palmetto BMC (ARM926EJ-S)
raspi2Raspberry Pi 2
realview-ebARM RealView Emulation Baseboard (ARM926EJ-S)
realview-eb-mpcoreARM RealView Emulation Baseboard (ARM11MPCore)
realview-pb-a8ARM RealView Platform Baseboard for Cortex-A8
realview-pbx-a9ARM RealView Platform Baseboard Explore for Cortex-A9
sabreliteFreescale i.MX6 Quad SABRE Lite Board (Cortex A9)
smdkc210Samsung SMDKC210 board (Exynos4210)
spitzSharp SL-C3000 (Spitz) PDA (PXA270)
sx1Siemens SX1 (OMAP310) V2
sx1-v1Siemens SX1 (OMAP310) V1
terrierSharp SL-C3200 (Terrier) PDA (PXA270)
tosaSharp SL-6000 (Tosa) PDA (PXA255)
verdexGumstix Verdex (PXA270)
versatileabARM Versatile/AB (ARM926EJ-S)
versatilepbARM Versatile/PB (ARM926EJ-S)
vexpress-a15ARM Versatile Express for Cortex-A15
vexpress-a9ARM Versatile Express for Cortex-A9
virt-2.6QEMU 2.6 ARM Virtual Machine
virt-2.7QEMU 2.7 ARM Virtual Machine
virtQEMU 2.8 ARM Virtual Machine (alias of virt-2.8)
virt-2.8QEMU 2.8 ARM Virtual Machine
xilinx-zynq-a9Xilinx Zynq Platform Baseboard for Cortex-A9
z2Zipit Z2 (PXA27x)


Supported in qemu-system-aarch64

MachineDescription
akitaSharp SL-C1000 (Akita) PDA (PXA270)
ast2500-evbAspeed AST2500 EVB (ARM1176)
borzoiSharp SL-C3100 (Borzoi) PDA (PXA270)
canon-a1100Canon PowerShot A1100 IS
cheetahPalm Tungsten|E aka. Cheetah PDA (OMAP310)
collieSharp SL-5500 (Collie) PDA (SA-1110)
connexGumstix Connex (PXA255)
cubieboardcubietech cubieboard
highbankCalxeda Highbank (ECX-1000)
imx25-pdkARM i.MX25 PDK board (ARM926)
integratorcpARM Integrator/CP (ARM926EJ-S)
kzmARM KZM Emulation Baseboard (ARM1136)
lm3s6965evbStellaris LM3S6965EVB
lm3s811evbStellaris LM3S811EVB
mainstoneMainstone II (PXA27x)
midwayCalxeda Midway (ECX-2000)
musicpalMarvell 88w8618 / MusicPal (ARM926EJ-S)
n800Nokia N800 tablet aka. RX-34 (OMAP2420)
n810Nokia N810 tablet aka. RX-44 (OMAP2420)
netduino2Netduino 2 Machine
noneempty machine
nuriSamsung NURI board (Exynos4210)
palmetto-bmcOpenPOWER Palmetto BMC (ARM926EJ-S)
raspi2Raspberry Pi 2
realview-ebARM RealView Emulation Baseboard (ARM926EJ-S)
realview-eb-mpcoreARM RealView Emulation Baseboard (ARM11MPCore)
realview-pb-a8ARM RealView Platform Baseboard for Cortex-A8
realview-pbx-a9ARM RealView Platform Baseboard Explore for Cortex-A9
sabreliteFreescale i.MX6 Quad SABRE Lite Board (Cortex A9)
smdkc210Samsung SMDKC210 board (Exynos4210)
spitzSharp SL-C3000 (Spitz) PDA (PXA270)
sx1Siemens SX1 (OMAP310) V2
sx1-v1Siemens SX1 (OMAP310) V1
terrierSharp SL-C3200 (Terrier) PDA (PXA270)
tosaSharp SL-6000 (Tosa) PDA (PXA255)
verdexGumstix Verdex (PXA270)
versatileabARM Versatile/AB (ARM926EJ-S)
versatilepbARM Versatile/PB (ARM926EJ-S)
vexpress-a15ARM Versatile Express for Cortex-A15
vexpress-a9ARM Versatile Express for Cortex-A9
virt-2.6QEMU 2.6 ARM Virtual Machine
virt-2.7QEMU 2.7 ARM Virtual Machine
virtQEMU 2.8 ARM Virtual Machine (alias of virt-2.8)
virt-2.8QEMU 2.8 ARM Virtual Machine
xilinx-zynq-a9Xilinx Zynq Platform Baseboard for Cortex-A9
xlnx-ep108Xilinx ZynqMP EP108 board
xlnx-zcu102Xilinx ZynqMP ZCU102 board
z2Zipit Z2 (PXA27x)

Tips

To see a printout of all the supported machines use:

 qemu-system-arm -M help

or

 qemu-system-aarch64 -M help

Build Directions

 ./configure --target-list=arm-softmmu,aarch64-softmmu && make

Suggested command-lines

Using virtio-mmio (and the virt machine)

 qemu-system-aarch64 -m <memory size> -M virt -drive if=none,file=<hard drive file name>,id=hd0 \
   -device virtio-blk-device,drive=hd0 -netdev type=tap,id=net0 -device virtio-net-device,netdev=net0

However for more featureful guests it's recommended to use discoverable buses. So for example the same as above but now using a PCI bus on which sits a SCSI controller with a blockdevice and networks card (using userspace networking this time). The transport is still virtio

 qemu-system-aarch64 -m <memory size> -M virt -device virtio-scsi-pci \
   -device scsi-hd,drive=hd0 -blockdev node-name=hd0,filename=<hard drive file name> \
   -netdev user,id=unet -device virtio-net-pci,netdev=unet

A similar command line can be used for qemu-system-arm as long as the kernel supports the VIRTIO, GENERIC_PCI and SCSI_VIRTIO features.

Picture

Open Source Media Center running in QEMU
Open Source Media Center running in Raspberry Pi target of QEMU



转载请标明出处【QEMU模板ARM环境】。

《www.micoder.cc》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论