Dual Linux – QEMU

Introduction

The below tutorial outlines how to run two instances of virtualized Linux on quad core Cortex-A9 ARM Versatile Express platform simulated by Qemu, using the pre-built binaries.

Demonstration details

  • The following demo is for Versatile Express platform simulated by Qemu.
  • We will run two instances of virtualized Linux kernels, parallely, over the Codezero hypervisor.
  • Linux#0 will boot using the NFS filesystem over Core0 and Linux#1 will boot using the initramfs filesystem over Core1.

Downloading the pre-built binaries

Download binaries from here. It contains the following files

  • linux-rootfs.tar.gz – Linux filesystem tarball
  • final.elf – ELF file containing Codezero, Linux#0, Linux#1 kernels and initramfs to be used by Linux#1
  • qemu.tar.bz2 – Tarball containing Qemu binaries, having support for Versatile Express platform

Setting up the demo

Extract the Linux filesystem on host

$ mkdir -p /opt/projects/fs
$ sudo tar -xvf linux-rootfs.tar.gz

Export NFS -check Setting up NFS section for details.

Extract the Qemu tarball at some convenient location.

To capture boot logs and shell consoles of Linux#0, start a netconsole on host with following command

$ nc -u -l 4555

To capture boot logs and shell consoles of Linux#1, start a netconsole on host with following command

$ nc -u -l 4556

Issue the following command to run Codezero and virtualized Linux in Qemu

$ ./qemu/bin/qemu-system-arm -kernel final.elf -M realview-vx-a9 \
            -cpu cortex-a9 -m 900 -smp 2 -serial udp::4555 -serial udp::4556

Setting up NFS

Install NFS server modules on host

$ sudo apt-get install nfs-kernel-server

Export NFS by appending the following entry in /etc/exports

/opt/projects/fs/rootfs *(rw,nohide,insecure,no_subtree_check,async,no_root_squash,fsid=12345)

Restart the NFS server

$ sudo /etc/init.d/nfs-kernel-server restart

Known issues

  • The boot may be slow. We are using the platform simulation and that too of quad core platform. As Qemu runs all cores serially, hence the slow speed.

Building from sources

Check the Building from Source for Versatile Express page for instructions on building Codezero and Android kernels from the sources.

Screenshot

Comments are closed.