Xen ARM with Virtualization Extensions/ESPRESSObin

From Xen
Revision as of 15:28, 19 March 2018 by Amit (talk | contribs) (Created page with "= XEN on ESPRESSObin board = This Wiki page describes how to run XEN on ESPRESSObin board based on ARMADA 3700 SoC. == Preparing all the Images == === Building Xen Image =...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

XEN on ESPRESSObin board

This Wiki page describes how to run XEN on ESPRESSObin board based on ARMADA 3700 SoC.

Preparing all the Images

Building Xen Image

First, pull the latest xen code from:

http://xenbits.xen.org/gitweb/?p=xen.git;a=summary

Then, build the Xen Image:

# make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

To get XEN Image with early prints:

# make dist-xen XEN_TARGET_ARCH=arm64 debug=y CONFIG_EARLY_PRINTK=mvebu CROSS_COMPILE=aarch64-linux-gnu-

Finally copy xen Image to your tftp directory.

# cp xen/xen /tftpboot (assuming /tftpboot is tftp directory on host)

Building DOM0 Kernel Image

Mainline ARM64 kernel can be used as Dom0 and DomU kernel image:

To download and build Dom0 and DomU, do:

# git clone https://github.com/torvalds/linux.git
# git checkout -b Dom0_kernel origin/master
# make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig
# make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- Image

Once completed, copy arch/arm64/boot/Image to host's tftp directory.

# cp arch/arm64/boot/Image /tftpboot (assuming /tftpboot is tftp directory on host)

To build the device tree blob (DTB), do:

# make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs
# cp arch/arm64/boot/dts/armada-3720-espressobin.dtb /tftpboot (assuming /tftpboot is tftp directory on host).

Booting with U-Boot

The current approach requires tftp to download the software images to the board.

Basic IP address settings

# setenv ipaddr 10.y.y.y #This is an IP address of your board.
# setenv serverip 10.x.x.x #This is an IP address of your tftp server.
# setenv gatewayip 10.x.x.x
# setenv netmask 255.x.x.x
# ping $serverip #This should work before proceeding further.
# saveenv

Setting up Xen booting environment

# setenv xen_addr_r 0x1000000 #This is the address where Xen kernel will be copied using tftp.
# setenv kern_addr_r 0x2500000 #This is the address where DOM0 kernel will be copied using tftp.
# setenv fdt_addr_r 0x1500000 #This is the address where DOM0 dtb will be copied using tftp.
# tftp ${kern_addr_r} Image;tftp ${fdt_addr_r} armada-3720-espressobin.dtb;tftp ${xen_addr_r} xen
# setenv fdt_high 0xffffffff;fdt addr $fdt_addr_r;fdt resize
# setenv xen_bootargs console=dtuart dtuart=/soc/internal-regs@d0000000/serial@12000 dom0_mem=512M 
# setenv dom0_bootargs console=ttyMV0 console=hvc0,115200n8 earlycon=xenboot debug clk_ignore_unused root=/dev/mmcblk0p1 rw rootwait
# fdt set /chosen xen,xen-bootargs \"$xen_bootargs\";fdt resize
# fdt set /chosen xen,dom0-bootargs \"$dom0_bootargs\";fdt mknode /chosen modules
# fdt set /chosen/modules '#address-cells' <1>;fdt set /chosen/modules size-cells' <1>;fdt mknode /chosen/modules module@0
# fdt set /chosen/modules/module@0 compatible "multiboot,kernel","multiboot,module";fdt resize
# fdt set /chosen/modules/module@0 reg < $kernel_addr_r 0x1800000 >

Booting Dom0 Kernel

  • Check host's tftp directory has following files:
    • xen
    • Image
    • armada-3720-espressobin.dtb

On u-boot prompt execute:

# booti ${xen_addr_r} - ${fdt_addr_r}

This should reach to Dom0 login prompt!!

DomU

In order for DomU to boot, xen tools must be installed on Target Hardware:

Build xen tools

# git clone git://xenbits.xen.org/xen.git
# cd xen
# ./configure
# make tools
# make install

DomU Images

  • Image : Kernel Image (same DOM0 kenel Image can be used here)
  • rootfs.img : Create ext4 arm64 rootfs Image.

Booting DomU

# /etc/init.d/xencommons start
# xl create -c config.xl
   where config.xl contains
# cat config.xl 
   name = "guest-1"
   kernel = "Image"
   extra = "root=/dev/xvda rw xencons=tty console=hvc0"	
   memory = 256
   vcpus = 1
   disk = [ 'rootfs.img,raw,xvda,rw' ]

This should reach to DomU login prompt!!

Also, one can check status of running Dom0 and DomU using xl commmand:

# xl list
  Name              ID  Mem   VCPUs   State      Time(s)
  Domain-0          0   512    2      r-----      18.1
  guest-1           1   256    1      -b----       6.0


Author

  • This guide was written by Amit Singh Tomar <amittomer25@gmail.com>.