Qemu usage

Hi all,

are there any howtos to build and use Qemu (kernel, modules, rootfs) available for Colibri VF61?

BR - Tom

Hi Tom, what do you mean by for Colibri VF61, do you want to run Qemu on a VF61 or do you want to run it on your desktop to emulate a VF61?

Hi Stefan,

thanks for the quick reply. I would like to emulate the VF61 on a Linux/ubuntu machine.

Hi Tom,

So far we do not have specific documentation on how to use Qemu to emulate a Colibri VF61. Also, Qemu does not exactly supports Freescale Vybrid SoC emulation (which is the SoC on the Colibri VF61 module). Qemu supports ARM reference implementations such as ARM Versatile Express (vexpress) and also some other boards. The reference implementation such as Versatile Express A9 use the same Instruction Architecture Set (ARMv7-A) as Vybrid is using, but the peripherals (e.g. Driver for USB/UART etc.) are not the same. A second option would be to use Emul8, which allows to emulate a system which is closer to the real Freescale Vybrid SoC.

a) Qemu’s supported platform ARM Versatile Express might be good enough (vexpress-a9). Our standard kernel only supports the Freescale Vybrid SoC, but it is possible to compile support for multiple devices into the same kernel. With that, you will be able to run the same Linux kernel which you use on the bare metal Colibri VF61 module also in your Qemu environment. For this kind of emulation you can use the ARM Qemu binaries which are provided by your distribution (e.g. qemu-system-arm for Ubuntu)…

You need to enable at least this Kernel configurations

CONFIG_ARCH_VEXPRESS=y
SERIAL_AMBA_PL011=y
SERIAL_AMBA_PL011_CONSOLE=y
CONFIG_MMC_ARMMMCI=y

The versatile platform does not have NAND flash emulation. We can use a root file system on a emulated block device. You can create a root file system from our standard image using the following commands

qemu-img create -f qcow2 disk.qcow2 8G
sudo modprobe nbd max_part=8
sudo qemu-nbd -c /dev/nbd0 disk.qcow2
echo -e "o\nn\np\n1\n\n\nw" | fdisk /dev/nbd0
sudo partprobe /dev/nbd0
mkfs.ext4 /dev/nbd0p1

This allows to simply mount the emulated rootfs to /mnt and copy a full rootfs:

sudo mount /dev/nbd0p1 /mnt/
sudo cp -a rootfs/* /mnt/

Make sure to unmount and disconnect the rootfs

sudo umount /dev/nbd0p1
sudo qemu-nbd -d /dev/nbd0

Now use the following command to start the emulation and boot into the Linux kernel directly:

qemu-system-arm -machine vexpress-a9 -kernel arch/arm/boot/zImage -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb -m 256 -append 'console=ttyAMA0,115200 root=/dev/mmcblk0p1' -serial stdio -drive file=disk.qcow2,if=sd

b) There is also Emul8, which is a new emulator for embedded system (see emul8.org). This emulator also has support for Vybrid, see here). I am not entierly sure about the exact state of the Vybrid support, you would have to try it out. Our partner Antmicro is the main force behind Emul8, if you are interested in this option you can contact Antmicro directly via our Partner network.

Hi @Tom, filling in on @stefan.agner’s answer, Emul8 does support Vybrid like it was announced in Toradex’ newsletter recently - if you need help running it, please reach out to us. We’re always happy to hear feedback and assist in integrating Emul8 in your workflow.

Hi Stefan,

Thanks for the instructions!
I mainly want to create a test environment. Therefor I am actually stubbing away the hardware specific implemtations (gpio/usb-hw etc) that interact with the SW modules for testing purposes. I yet started that on a generic ARMv7.
If that works, I will create some more system/integration tests in the Vybrid environment, to integrate some more driver specific tests, where it makes sense.

BR - Tom