Difference between revisions of "Xen ARM with Virtualization Extensions/ESPRESSObin"

From Xen
(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 =...")
 
(Remove the (redundant) generic Xen/ARM instructions, just keep the board specific bits. Link to the (still) required UART driver patch.)
Line 1: Line 1:
  +
The [http://espressobin.net/ EspressoBin] is a single board computer with a Marvell Armada 3720 SoC, driven by two Cortex-A53 cores (64-bit ARMv8). In comparison to other SBCs it is I/O oriented, with three Gb-Ethernet ports, a SATA port and a mini-PCIe slot. Unfortunately it has no SMMU. There is a 1GB and a 2G DRAM version.
= XEN on ESPRESSObin board =
 
This Wiki page describes how to run XEN on ESPRESSObin board based on ARMADA 3700 SoC.
 
   
  +
The board is well supported in mainline Linux, most peripherals works well since Linux v4.12. The arm64 Linux defconfig enables support for both the SoC and Xen. The device tree name is <code>armada-3720-espressobin.dtb</code>.
== Preparing all the Images ==
 
   
=== Building Xen Image ===
+
== Xen support ==
  +
The SoC features a non-standard UART, there is a [https://lists.xen.org/archives/html/xen-devel/2018-03/msg01969.html patch] for a Xen UART driver on the list.
First, pull the latest xen code from:
 
http://xenbits.xen.org/gitweb/?p=xen.git;a=summary
 
   
  +
With that patch applied, the [https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#Building_Xen_on_ARM standard] compilation instructions work fine. When support for Xen earlyprintk is required, add <code>CONFIG_EARLY_PRINTK=mvebu</code> to your build command line. The resulting image will only work on that SoC then.
Then, build the Xen Image:
 
# make dist-xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-
 
   
  +
== Booting Xen ==
To get XEN Image with early prints:
 
  +
The board comes with a usable U-Boot in SPI flash, so it boots without any SD card inserted or without the need to supply a special firmware image. You can load Xen from SD card, USB or via TFTP. If in doubt, use the following load addresses:
# make dist-xen XEN_TARGET_ARCH=arm64 debug=y CONFIG_EARLY_PRINTK=mvebu CROSS_COMPILE=aarch64-linux-gnu-
 
  +
Marvell>> setenv xen_addr_r 0x0
  +
Marvell>> setenv fdt_addr_r 0x780000
  +
Marvell>> setenv kernel_addr_r 0x800000
  +
Marvell>> setenv ramdisk_addr_r 0x4000000
   
  +
Load the Xen image, the .dtb file, the Dom0 kernel and optionally an initrd image file to the respective locations (via fatload, ext4load or via tftpboot). Then setup the Xen device tree node:
Finally copy xen Image to your tftp directory.
 
  +
Marvell>> fdt addr $fdt_addr_r
# cp xen/xen /tftpboot (assuming /tftpboot is tftp directory on host)
 
  +
Marvell>> fdt resize
  +
Marvell>> fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=serial0 dom0_mem=384M"
  +
Marvell>> fdt set /chosen \#address-cells <1>
  +
Marvell>> fdt set /chosen \#size-cells <1>
  +
Marvell>> fdt mknod /chosen module@0
  +
Marvell>> fdt resize
  +
Marvell>> fdt set /chosen/module@0 compatible "xen,linux-zimage" "xen,multiboot-module"
  +
Marvell>> fdt set /chosen/module@0 reg <$kernel_addr_r 0x1800000>
  +
Marvell>> setenv bootargs "console=hvc0 ro root=/dev/mmcblk0p2 clk_ignore_unused rootwait earlycon=xenboot"
  +
Adjust the Linux command line and the Dom0 memory size to your needs. Finally boot Xen:
  +
Marvell>> booti $xen_addr_r - $fdt_addr_r
  +
Although the shipped U-Boot does not support the "source" command, you can store those commands in the environment and save it with "saveenv".
   
  +
For general usage instructions please refer to the generic [[Xen ARM with Virtualization Extensions]] page.
=== Building DOM0 Kernel Image ===
 
   
  +
----
Mainline ARM64 kernel can be used as Dom0 and DomU kernel image:
 
  +
The initial EspressoBin Xen support and this wiki page were created by Amit Singh Tomar <amittomer25@gmail.com>.
 
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>.
 
   
 
[[Category:XenARM]]
 
[[Category:XenARM]]

Revision as of 00:32, 30 March 2018

The EspressoBin is a single board computer with a Marvell Armada 3720 SoC, driven by two Cortex-A53 cores (64-bit ARMv8). In comparison to other SBCs it is I/O oriented, with three Gb-Ethernet ports, a SATA port and a mini-PCIe slot. Unfortunately it has no SMMU. There is a 1GB and a 2G DRAM version.

The board is well supported in mainline Linux, most peripherals works well since Linux v4.12. The arm64 Linux defconfig enables support for both the SoC and Xen. The device tree name is armada-3720-espressobin.dtb.

Xen support

The SoC features a non-standard UART, there is a patch for a Xen UART driver on the list.

With that patch applied, the standard compilation instructions work fine. When support for Xen earlyprintk is required, add CONFIG_EARLY_PRINTK=mvebu to your build command line. The resulting image will only work on that SoC then.

Booting Xen

The board comes with a usable U-Boot in SPI flash, so it boots without any SD card inserted or without the need to supply a special firmware image. You can load Xen from SD card, USB or via TFTP. If in doubt, use the following load addresses:

Marvell>> setenv xen_addr_r 0x0
Marvell>> setenv fdt_addr_r 0x780000
Marvell>> setenv kernel_addr_r 0x800000
Marvell>> setenv ramdisk_addr_r 0x4000000

Load the Xen image, the .dtb file, the Dom0 kernel and optionally an initrd image file to the respective locations (via fatload, ext4load or via tftpboot). Then setup the Xen device tree node:

Marvell>> fdt addr $fdt_addr_r
Marvell>> fdt resize
Marvell>> fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=serial0 dom0_mem=384M"
Marvell>> fdt set /chosen \#address-cells <1>
Marvell>> fdt set /chosen \#size-cells <1>
Marvell>> fdt mknod /chosen module@0
Marvell>> fdt resize
Marvell>> fdt set /chosen/module@0 compatible "xen,linux-zimage" "xen,multiboot-module"
Marvell>> fdt set /chosen/module@0 reg <$kernel_addr_r 0x1800000>
Marvell>> setenv bootargs "console=hvc0 ro root=/dev/mmcblk0p2 clk_ignore_unused rootwait earlycon=xenboot"

Adjust the Linux command line and the Dom0 memory size to your needs. Finally boot Xen:

Marvell>> booti $xen_addr_r - $fdt_addr_r

Although the shipped U-Boot does not support the "source" command, you can store those commands in the environment and save it with "saveenv".

For general usage instructions please refer to the generic Xen ARM with Virtualization Extensions page.


The initial EspressoBin Xen support and this wiki page were created by Amit Singh Tomar <amittomer25@gmail.com>.