From Xvisor-x86 Wiki
Jump to: navigation, search

Required Packages

Before we can build any of the sources, there are a list of programs and libraries we would need to be installed on the build machine. Below is the list of the packages. Based on the Linux distribution you are using, install them accordingly.

 gcc-multilib git-all cscope iasl cgdb xorriso libncurses5-dev m4 flex bison autoconf expect qemu-system-x86 qemu-utils

Source and Build

First, you will need to make a sandbox where you can play with Xvisor. Create a directory named sandbox. We will refer this path and directory as SANDBOX.


Fetch the sources with:

  git clone --recursive

By the above command, we have pulled Xvisor-x86 sources but the default branch master has been pulled out. All the bleeding edge work is present in branch x86-next. Let's pull that branch with command mentioned below:

  git checkout --track -b x86-next origin/x86-next

Build Xvisor

In Xvisor source tree, do following:

  1. make ARCH=x86 x86_64_generic-defconfig
  2. make

This will create a file vmm.bin in build directory.

Guest binaries

Coreboot and FILO

Fetch the sources:

 git clone
 git submodule update --init --checkout
 cd coreboot/payloads
 git clone

Before we can build coreboot, it requires its own toolchain to be compiled. To compile that do the following:

 make crossgcc

This is going to take a while. It will build cross toolchain for x86, ARM, MIPS etc in addition to fetching sources of GCC, GDB, and other libraries.

FILO is a payload that coreboot will boot. Coreboot doesn't provide direct functionality of booting an OS. That's the job of FILO.

Build FILO

Before we can build FILO, we will need a patch for FILO. This patch adds support of Virtio layer and a Virtio block device. The patch can be downloaded from here. If its unavailable, please drop a mail to Himanshu Chauhan.

You can apply the above patch with git apply command.

Now to build FILO, goto FILO directory and do a menuconfig.

   make menuconfig

For this menuconfig, first the configuration of libpayload is generated. A sample configuration can be found in Xvisor source tree at tests/x86/bios/configs/filo.lib.config. After that configuration of FILO will be generated. A sample configuration of FILO is present at tests/x86/bios/configs/filo.config.

After configurtion just do


This will generate filo.elf. Copy this file in coreboot base directory, i.e. SANDBOX/coreboot/

Build Coreboot

Coreboot is also build the same way. First you need to do menuconfig and then make. The sample configuration file for coreboot can be found at tests/x86/bios/configs/coreboot.config. This will generate coreboot.rom.

NOTE: The main thing to know here is that size of coreboot.rom is 512KB. Otherwise it won't boot.

Linux Kernel

You can download the stable release from Linux Kernel site or you can choose to clone Linus' tree directly.


You can either download a stable from download location. Or at the same page you will find instructions to fetch source from their GIT repository.

Bootable ISO

Create a directory named xvisor-iso. This will contain the binaries required to boot Xvisor. Do the following to create the directory and required sub-directories under it:

  mkdir -p xvisor-iso/boot/grub

Copy the Xvisor binary:

  cp SANDBOX/xvisor-x86_64/build/vmm.bin SANDBOX/xvisor-iso/boot/

Create a grub configuration file SANDBOX/xvisor-iso/boot/grub/grub.cfg. Copy and paste the below text in this file:

   set timeout=15
   set default=0
   menuentry "Xvisor x86_64" {
       multiboot /boot/vmm.bin earlyprint=vga

Now create the ISO:

   grub-mkrescue -o bootable.iso xvisor-iso/

bootable.iso will be used to boot.

Hard Disk Image

Create a Qemu hard disk image, 32MB file should be enough. Also create one partition inside this hard drive using fdisk.

   qemu-img create -f raw xvisor-hd.disk 32M
   fdisk xvisor-hd.disk

You can use default options that fdisk gives you. After this setup a loopback device for this hard disk image and create a filesystem on the partition you created.

   sudo losetup /dev/loop0 xvisor-hd.disk -o 1048576
   sudo mkfs.vfat /dev/loop0
   sudo losetup -d /dev/loop0

Before we mount this new hard disk image, its recommended to compile lomount binary. lomount helps in easy mounting of disk images.

   gcc -o lomount xvisor-x86_64/tests/x86/lomount.c

Create a mount point for this hard disk image:

   mkdir xmount

Now mount the drive and copy the required files:

   sudo lomount -t vfat -diskimage xvisor-hd.disk -partition 1 ./xmount
   sudo cp coreboot/build/coreboot.rom ./xmount/
   sudo cp xvisor-x86_64/tests/x86/guest_init.cmd ./xmount/
   sudo umount ./xmount

The drive is now ready.

Running the setup

The setup is now ready. It can be run using the following command:

 qemu-system-x86_64 -cpu qemu64,+svm,vendor=AuthenticAMD -cdrom bootable.iso -hda xvisor-hd.disk -m 1024M -boot d -s -serial stdio