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

From Xen
(Build Linux and Device Tree)
Line 1: Line 1:
  +
[WIP]
  +
 
This Wiki describes how to run Xen on Renesas Stout board with R-Car H2 SoC.
 
This Wiki describes how to run Xen on Renesas Stout board with R-Car H2 SoC.
   

Revision as of 18:47, 17 May 2019

[WIP]

This Wiki describes how to run Xen on Renesas Stout board with R-Car H2 SoC.

Main information how to deal with Stout board are located at: https://elinux.org/R-Car/Boards/Yocto https://elinux.org/R-Car/Boards/Stout

Prepare U-boot

Get U-Boot sources

Clone sources from upstream and checkout on commit 425c0a43fbbec36571f6a03b530695b8b16a841d “Prepare v2019.01-rc3”:

git clone git://git.denx.de/u-boot.git
cd u-boot
git checkout 425c0a43fbbec36571f6a03b530695b8b16a841d -b stout_uboot

Apply additional patches

Apply the following patch series (PSCI support for r8a7790 SoC): http://u-boot.10912.n7.nabble.com/PATCH-0-3-PSCI-support-for-r8a7790-SoC-Lager-Stout-boards-td357352.html

Configure U-Boot

export CROSS_COMPILE=<path_to_gcc>
make stout_defconfig
make menuconfig

Set maximum supported CPUs for PSCI to 8:

    ARM architecture  --->
        [*] Enable support for booting in non-secure mode
            (8) Maximum supported CPUs for PSCI

Build U-Boot

make

Copy resulting images to tftp directory for the future flashing:

sudo cp u-boot.img <path_to_tftp_dir>/
sudo cp spl/u-boot-spl.bin <path_to_tftp_dir>/

Prepare Xen

Get Xen sources

Clone sources from upstream and checkout on commit ca135a4863ffeedca451651835fcd9aef6c872ff “xen/arm: Add early printk support for SCIFA compatible UARTs”:

git clone git://xenbits.xenproject.org/xen.git
cd xen
git checkout ca135a4863ffeedca451651835fcd9aef6c872ff -b stout_xen

Apply additional patches

Apply the following small patch series (Support of handling nodes with “interrupts-extended” property): https://www.mail-archive.com/xen-devel@lists.xenproject.org/msg44364.html

Please note, if you can’t apply that patch series to Xen for some reason, then you should apply the following patch to Linux when preparing it (to not use “interrupts-extended” property for ARCH timer node): "0003-r8a7790.dtsi-temp-Use-interrupt-parent-interrupts-fo.patch"

Configure Xen

export CROSS_COMPILE=<path_to_gcc>
XEN_TARGET_ARCH=arm32 ./configure
cd xen
make menuconfig XEN_TARGET_ARCH=arm32 

Enable debugging option:

    Debugging Options  --->
        [*] Developer Checks

Build Xen

With earlyprintk support:

cd ../
make xen XEN_TARGET_ARCH=arm32 debug=y CONFIG_EARLY_PRINTK=scif,0xe6c40000,A

- or -

Without earlyprintk support:

cd ../
make xen XEN_TARGET_ARCH=arm32 debug=y

Make Xen uImage:

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

Build xenpolicy:

make -C tools/flask/policy

Copy resulting images to micro SD card (prepared beforehand):

sudo cp xen-uImage <path_to_sd_card_partition>/boot/
sudo cp tools/flask/policy/xenpolicy* <path_to_sd_card_partition>/boot/xenpolicy

Prepare Linux and Device Tree

Get Linux sources

Clone sources from upstream and checkout on v5.1 tag:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
git checkout v5.1 -b stout_linux

Apply additional patches

Apply the following patch (to not initialize CNTVOFF/counter module): https://marc.info/?l=linux-kernel&m=155808712932351&w=2

Apply the following patches from [1], which add Host Device Tree and Dom0 defconfig needed to run Xen:

0001-ARM-dts-stout-Add-host-device-tree-to-be-able-to-run.patch
0002-ARM-shmobile-defconfig-Add-new-defconfig-to-be-able-.patch

Apply the following patch from [1] (to not use “interrupts-extended” property for ARCH timer node) if needed:

0003-r8a7790.dtsi-temp-Use-interrupt-parent-interrupts-fo.patch

Configure Linux

export CROSS_COMPILE=<path_to_gcc>
make ARCH=arm shmobile_dom0_defconfig

Build Linux and Device Tree

LOADADDR=0x48000000 make ARCH=arm uImage dtbs

Copy resulting images to SD card (prepared beforehand):

sudo cp arch/arm/boot/dts/r8a7790-stout-host.dtb <path_to_sd_card_partition>/boot/
sudo cp arch/arm/boot/uImage <path_to_sd_card_partition>/boot/

Run images

Flash U-Boot

Flash U-Boot according to the instruction described here: https://elinux.org/R-Car/Boards/U-Boot-Gen2#Flashing_U-Boot Please note, you need to setup TFTP for this purpose.

Setup U-Boot environment

Setup U-Boot environment to boot system via SD card. This is done using U-Boot CLI:

env default -f -a
setenv dtb_load_mmc 'ext4load mmc 0:1 0x70f00000 /boot/r8a7790-stout-host.dtb'
setenv xen_load_mmc 'ext4load mmc 0:1 0x70007fc0 /boot/xen-uImage'
setenv kernel_load_mmc 'ext4load mmc 0:1 0x72000000 /boot/uImage'
setenv xenpolicy_load_mmc 'ext4load mmc 0:1 0x74000000 /boot/xenpolicy'
setenv bootcmd_xen_mmc 'run dtb_load_mmc; run xen_load_mmc; run kernel_load_mmc; run xenpolicy_load_mmc; bootm 0x70007fc0 - 0x70f00000'
setenv bootargs
setenv bootcmd 'run bootcmd_xen_mmc'
saveenv

After rebooting the board the system (Xen + Dom0) will be started automatically if everything was done correctly.