Difference between revisions of "Xen ARM with Virtualization Extensions/OMAP5432 uEVM"

From Xen
(2.1 Build Xen hypervisor)
(2.2 Build Linux Dom0 kernel)
Line 24: Line 24:
   
 
== 2.2 Build Linux Dom0 kernel ==
 
== 2.2 Build Linux Dom0 kernel ==
  +
  +
Get the linux kernel source from upstream:
  +
  +
<pre>
  +
# git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
  +
</pre>
  +
  +
Use the default ‘omap2plus' as the base config:
  +
  +
<pre>
  +
# make omap2plus_defconfig ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  +
</pre>
  +
  +
Before adding the XEN related kernel configs, disable old omap SoCs support by unselecting the TI OMAP2/3/4 in the ‘System Type’ section of kernel configuration menus (by running ‘make menuconfig ARCH=arm’).
  +
  +
Adding the following config entries in .config and run ‘make olddefconfig ARCH=arm’:
  +
  +
<pre>
  +
CONFIG_XEN_DOM0=y
  +
CONFIG_XEN=y
  +
CONFIG_XEN_BLKDEV_FRONTEND=y
  +
CONFIG_XEN_BLKDEV_BACKEND=y
  +
CONFIG_XEN_NETDEV_FRONTEND=y
  +
CONFIG_XEN_NETDEV_BACKEND=y
  +
CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
  +
CONFIG_HVC_XEN=y
  +
CONFIG_HVC_XEN_FRONTEND=y
  +
CONFIG_XEN_DEV_EVTCHN=y
  +
CONFIG_XEN_BACKEND=y
  +
CONFIG_XENFS=y
  +
CONFIG_XEN_COMPAT_XENFS=y
  +
CONFIG_XEN_SYS_HYPERVISOR=y
  +
CONFIG_XEN_XENBUS_FRONTEND=y
  +
CONFIG_XEN_GNTDEV=y
  +
CONFIG_XEN_GRANT_DEV_ALLOC=y
  +
CONFIG_XEN_PRIVCMD=y
  +
</pre>
  +
  +
OMAP kernel still uses hwmod to describe its on-chip hardware blocks. Thus, we need to disable
  +
the UART3 used by Xen serial console by directly modifying the kernel source. Besides, there are
  +
also other modules that are disabled in DT while enabled in hwmod. Here is a hack to bypass the problem.
  +
  +
<pre>
  +
diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
  +
index 8923172..bf7d988 100644
  +
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
  +
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
  +
@@ -2425,7 +2425,9 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
  +
&omap54xx_mpu__mpu_private,
  +
&omap54xx_l4_wkup__counter_32k,
  +
&omap54xx_l4_cfg__dma_system,
  +
+#if 0
  +
&omap54xx_l4_abe__dmic,
  +
+#endif
  +
&omap54xx_l4_cfg__mmu_dsp,
  +
&omap54xx_mpu__emif1,
  +
&omap54xx_mpu__emif2,
  +
@@ -2445,9 +2447,11 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
  +
&omap54xx_l3_main_2__mmu_ipu,
  +
&omap54xx_l4_wkup__kbd,
  +
&omap54xx_l4_cfg__mailbox,
  +
+#if 0
  +
&omap54xx_l4_abe__mcbsp1,
  +
&omap54xx_l4_abe__mcbsp2,
  +
&omap54xx_l4_abe__mcbsp3,
  +
+#endif
  +
&omap54xx_l4_abe__mcpdm,
  +
&omap54xx_l4_per__mcspi1,
  +
&omap54xx_l4_per__mcspi2,
  +
@@ -2456,8 +2460,10 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
  +
&omap54xx_l4_per__mmc1,
  +
&omap54xx_l4_per__mmc2,
  +
&omap54xx_l4_per__mmc3,
  +
+#if 0
  +
&omap54xx_l4_per__mmc4,
  +
&omap54xx_l4_per__mmc5,
  +
+#endif
  +
&omap54xx_l4_cfg__mpu,
  +
&omap54xx_l4_cfg__spinlock,
  +
&omap54xx_l4_cfg__ocp2scp1,
  +
@@ -2474,7 +2480,9 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
  +
&omap54xx_l4_per__timer11,
  +
&omap54xx_l4_per__uart1,
  +
&omap54xx_l4_per__uart2,
  +
+#if 0
  +
&omap54xx_l4_per__uart3,
  +
+#endif
  +
&omap54xx_l4_per__uart4,
  +
&omap54xx_l4_per__uart5,
  +
&omap54xx_l4_per__uart6,
  +
</pre>
  +
  +
Build the kernel:
  +
  +
<pre>
  +
# make zImage ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
  +
</pre>
   
 
== 2.3 Build FDT ==
 
== 2.3 Build FDT ==

Revision as of 14:41, 29 April 2014

The OMAP5432 uEVM board is now supported in Xen upstream.

1. Prepare U-boot

Xen hypervisor requires to be booted in HYP mode by the bootloader. Make sure that the U-boot you use would keep staying in HYP mode when switching the control to Xen.

2. Build Xen and Linux Dom0

2.1 Build Xen hypervisor

Build Xen:

# git clone git://xenbits.xen.org/xen.git
# cd xen
# make dist-xen XEN_TARGET_ARCH=arm32 CROSS_COMPILE=arm-linux-gnueabihf- CONFIG_EARLY_PRINTK=omap5432

Create uImage for Xen:

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

2.2 Build Linux Dom0 kernel

Get the linux kernel source from upstream:

 # git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Use the default ‘omap2plus' as the base config:

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

Before adding the XEN related kernel configs, disable old omap SoCs support by unselecting the TI OMAP2/3/4 in the ‘System Type’ section of kernel configuration menus (by running ‘make menuconfig ARCH=arm’).

Adding the following config entries in .config and run ‘make olddefconfig ARCH=arm’:

CONFIG_XEN_DOM0=y
CONFIG_XEN=y
CONFIG_XEN_BLKDEV_FRONTEND=y
CONFIG_XEN_BLKDEV_BACKEND=y
CONFIG_XEN_NETDEV_FRONTEND=y
CONFIG_XEN_NETDEV_BACKEND=y
CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y
CONFIG_HVC_XEN=y
CONFIG_HVC_XEN_FRONTEND=y
CONFIG_XEN_DEV_EVTCHN=y
CONFIG_XEN_BACKEND=y
CONFIG_XENFS=y
CONFIG_XEN_COMPAT_XENFS=y
CONFIG_XEN_SYS_HYPERVISOR=y
CONFIG_XEN_XENBUS_FRONTEND=y
CONFIG_XEN_GNTDEV=y
CONFIG_XEN_GRANT_DEV_ALLOC=y
CONFIG_XEN_PRIVCMD=y

OMAP kernel still uses hwmod to describe its on-chip hardware blocks. Thus, we need to disable the UART3 used by Xen serial console by directly modifying the kernel source. Besides, there are also other modules that are disabled in DT while enabled in hwmod. Here is a hack to bypass the problem.

diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 8923172..bf7d988 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -2425,7 +2425,9 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_mpu__mpu_private,
        &omap54xx_l4_wkup__counter_32k,
        &omap54xx_l4_cfg__dma_system,
+#if 0
        &omap54xx_l4_abe__dmic,
+#endif
        &omap54xx_l4_cfg__mmu_dsp,
        &omap54xx_mpu__emif1,
        &omap54xx_mpu__emif2,
@@ -2445,9 +2447,11 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l3_main_2__mmu_ipu,
        &omap54xx_l4_wkup__kbd,
        &omap54xx_l4_cfg__mailbox,
+#if 0
        &omap54xx_l4_abe__mcbsp1,
        &omap54xx_l4_abe__mcbsp2,
        &omap54xx_l4_abe__mcbsp3,
+#endif
        &omap54xx_l4_abe__mcpdm,
        &omap54xx_l4_per__mcspi1,
        &omap54xx_l4_per__mcspi2,
@@ -2456,8 +2460,10 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l4_per__mmc1,
        &omap54xx_l4_per__mmc2,
        &omap54xx_l4_per__mmc3,
+#if 0
        &omap54xx_l4_per__mmc4,
        &omap54xx_l4_per__mmc5,
+#endif
        &omap54xx_l4_cfg__mpu,
        &omap54xx_l4_cfg__spinlock,
        &omap54xx_l4_cfg__ocp2scp1,
@@ -2474,7 +2480,9 @@ static struct omap_hwmod_ocp_if *omap54xx_hwmod_ocp_ifs[] __initdata = {
        &omap54xx_l4_per__timer11,
        &omap54xx_l4_per__uart1,
        &omap54xx_l4_per__uart2,
+#if 0
        &omap54xx_l4_per__uart3,
+#endif
        &omap54xx_l4_per__uart4,
        &omap54xx_l4_per__uart5,
        &omap54xx_l4_per__uart6,

Build the kernel:

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

2.3 Build FDT

2.4 All together

3. Boot Xen and Dom0