Xen ARM with Virtualization Extensions/Lager

From Xen
Revision as of 12:37, 20 October 2015 by MaxF (talk | contribs) (First explanations for Preparring the Device Tree)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The Lager board based on Renesas R-Car H2 SoC is now supported in Xen upstream.

Prepare U-boot

Get u-boot sources

Clone sources from: git://git.denx.de/u-boot.git Checkout on commit, hash: f7ca1f7, net: sh-eth: Add cache writeback control after setting bit of DMA descriptor

Apply additional patches

Download archive with needed patches (renesas_uboot_patches.tar) from: [1]

Apply patches from renesas_uboot_patches.tar

Build u-boot

Build u-boot with "lager_xen_defconfig" configuration:

# make lager_xen_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

Flash u-boot

Flash u-boot to QSPI as described in Start-Up Guide fot Renesas Lager board.

Check u-boot environment variables

bootcmd=tftp 0x70007fc0 xen-uImage;tftp 0x70f00000 uImage-r8a7790-lager.dtb;tftp 0x72000000 zImage-uImage;tftp 0x74000000 xenpolicy;bootm 0x70007fc0 – 0x70f00000

or just reset the configuration:

env default -a -f
env set baudrate 38400
env set ethaddr 2e:09:0a:00:6d:c9
env set ipaddr
env set serverip
env set gatewayip
env set netmask
env set dnsip
env set dnsip2
env set hostname lager
env set bootargs console=ttySC6,38400
env set bootcmd tftp 0x70007fc0 xen-uImage\;tftp 0x70f00000 uImage-r8a7790-lager.dtb\;tftp 0x72000000 zImage-uImage\;tftp 0x74000000 xenpolicy\;bootm 0x70007fc0 - 0x70f00000
env save; reset


  • xen-uImage – Xen image
  • uImage-r8a7790-lager.dtb – device tree blob
  • zImage-uImage – Dom0 kernel image
  • xenpolicy – Xen policy binary

Prepare Xen

Get Xen source

Clone sources from upstream: git://xenbits.xen.org/xen.git

Checkout on branch: stable-4.5 , and apply three patches from [xen-devel]: http://markmail.org/message/houjwx7vima3a53i

- OR -

Checkout on branch: stable-4.6 , where the above patches are already committed.

Configure Xen

# XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y XSM_ENABLE=y CONFIG_EARLY_PRINTK=lager ./configure

Build Xen

Build Xen with command with earlyprintk support:

# make xen XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y XSM_ENABLE=y CONFIG_EARLY_PRINTK=lager

Build Xen with command without earlyprintk support:

# make xen XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- debug=y XSM_ENABLE=y

Make uImage for Xen

Make uImage for Xen with command:

# mkimage -A arm -C none -T kernel -a 0x90000000 -e 0x90000000 -n "XEN" -d xen/xen xen-uImage

Build xenpolicy

Build xenpolicy binary:

# make -C tools/flask/policy

Prepare Dom0 / Device Tree

This might be close to a working solution:

Get a LAGER board Device Tree for re-basing from:

# git clone git://xenbits.xen.org/people/ianc/device-tree-rebasing.git
# cd device-tree-rebasing

Add Xen-specifics, for example via a new DTS file ( src/arm/r8a7790-lager-xen.dts ) that includes the existing one for the LAGER board:

 * Device Tree Source for the R-CarH2 LAGER board
 * Adding Xen4.6 configuration to boot some Linux as Dom0

#include "r8a7790-lager.dts"

/ {
	chosen {

		/* bootargs are present and used for native Linux without Xen, see
		 * http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=docs/misc/arm/device-tree/booting.txt
		xen,xen-bootargs = "console=dtuart dom0_mem=1G";

		/* Dom0 kernel */
		xen,dom0-bootargs = "console=hvc0 vmalloc=384M video=HDMI-A-1:1920x1080-32@60 ip= root=/dev/nfs rw nfsroot= rootwait clk_ignore_unused";

		modules {
			#address-cells = <1>;
			#size-cells = <1>;

			module@0x72000000 {
				compatible = "multiboot,kernel", "multiboot,module";
				/* reg = <0x72000000 0x2fd158>; */

			/* XSM Xen Security Policy */
			module@0x74000000 {
				compatible = "xen,xsm-policy", "multiboot,module";
				/* reg = <0x74000000 0x2559>; */

	/* add required 'ranges;' to all PCI devices */
	pci0: pci@ee090000 {
		usb@0,1 {
			#address-cells = <3>;
			#size-cells = <2>;
		usb@0,2 {
			#address-cells = <3>;
			#size-cells = <2>;
	pci2: pci@ee0d0000 {
		usb@0,1 {
			#address-cells = <3>;
			#size-cells = <2>;
		usb@0,2 {
			#address-cells = <3>;
			#size-cells = <2>;

Before giving the device tree to U-Boot, convert the DTS into a DTB:

# make src/arm/r8a7790-lager-xen.dtb

Please note that the Makefile does not know about DTB-include dependencies!

(TBD: Prepare Dom0)

Prepare other domains