Xen ARM with Virtualization Extensions/OdroidXU: Difference between revisions
(25 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{TODO|Add page}} |
|||
== Preparing the board == |
== Preparing the board == |
||
The bootloader provided with the OdroidXU does not let Xen boot in hypervisor mode. In the Odroid forums for the XU, one is likely to see many U-Boot blobs (bl1/bl2/tzsw/u-boot) which could possibly be used to let Xen boot in hypervisor mode. To avoid multiple sources, currently a single source is provided which can be accessed from |
The bootloader provided with the OdroidXU does not let Xen boot in hypervisor mode. In the Odroid forums for the XU, one is likely to see many U-Boot blobs (bl1/bl2/tzsw/u-boot) which could possibly be used to let Xen boot in hypervisor mode. To avoid multiple sources, currently a single source is provided which can be accessed from https://github.com/suriyanr/linux-xen/tree/odroid-3.13.y/sd_fuse |
||
The sd_fusing.sh script found therein can be used to fuse the SD card or eMMC card with the required BL1/BL2/TZSW and U-Boot. |
The sd_fusing.sh script found therein can be used to fuse the SD card or eMMC card with the required BL1/BL2/TZSW and U-Boot. |
||
sd_fusing.sh /dev/mmcblk0 |
|||
Please make sure /dev/mmcblk0 is the correct device which represents the SD card or eMMC card that you will be using. |
|||
This will let XEN boot in hypervisor mode as well as set CNTFRQ through the trustzone. This is required for domUs to get the correct timer frequency. (dom0's optionally can pick it up from the device tree) |
This will let XEN boot in hypervisor mode as well as set CNTFRQ through the trustzone. This is required for domUs to get the correct timer frequency. (dom0's optionally can pick it up from the device tree) |
||
== Building XEN == |
== Building XEN == |
||
Follow [[Xen_ARMv7_with_Virtualization_Extensions#Building_Xen_on_ARM|Build Xen on ARM]] to build XEN. |
Follow [[Xen_ARMv7_with_Virtualization_Extensions#Building_Xen_on_ARM|Build Xen on ARM]] to build XEN. |
||
For more verbose debug messages from XEN, it is worthwhile to compile XEN as below: |
|||
make dist-xen XEN_TARGET_ARCH=arm32 debug=y CONFIG_EARLY_PRINTK=exynos5250 |
|||
For the moment, xen doesn't build uImage for U-Boot. You can create the image with: |
For the moment, xen doesn't build uImage for U-Boot. You can create the image with: |
||
mkimage -A arm -T kernel -a 0x80200000 -e 0x80200000 -C none -d "$xen_src/xen/xen" |
mkimage -A arm -T kernel -a 0x80200000 -e 0x80200000 -C none -d "$xen_src/xen/xen" xen4.5-uImage |
||
where ''$xen_src'' is the root directory of your xen git. |
where ''$xen_src'' is the root directory of your xen git. |
||
== Building the device tree for Xen, Linux Dom0 kernel and modules == |
|||
We will build Linux for dom0 to have a device tree to provide to Xen. |
|||
You can get a tree from [https://github.com/suriyanr/linux-xen] which contains a working configuration for the Odroid XU. |
|||
git clone -b odroid-3.13.y https://github.com/suriyanr/linux-xen.git --depth=1 |
|||
cd linux-xen |
|||
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE odroidxu_xen_defconfig |
|||
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE zImage |
|||
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE dtbs |
|||
# Note that CROSS_COMPILE has to be set appropriately or can be left unset if building natively. |
|||
The device tree used by the OdroidXU is located in arch/arm/boot/dts/exynos5410-odroidxu.dtb |
|||
# Now build the dom0 modules |
|||
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE modules |
|||
# And install them |
|||
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH=/media/suriyan/rootfs modules_install |
|||
Note that /media/suriyan/rootfs is where the rootfs of the Odroid XU is mounted in the build box. Your path might vary or you will have to mount it appropriately. |
|||
== Booting from SD/eMMC card == |
|||
Start with a distribution that you like, say xubuntu 14.04lts from http://odroid.in/ubuntu_14.04lts/ubuntu-14.04lts-xubuntu-odroid-xu-20140714.img.xz, or ArchLinuxArm if you prefer from http://archlinuxarm.org/platforms/armv7/samsung/odroid-xu. |
|||
Once you have imaged the SD card or eMMC card with your preferred distribution, please overwrite the BL1/BL2/TZSW/U-Boot as mentioned in [[Xen_ARM_with_Virtualization_Extensions/OdroidXU#Preparing_the_board]] |
|||
Both the distributions mentioned above have a VFAT partition as the first partition. We shall use this partition to populate the XEN specific images - xen4.5-uImage, zImage, exynos5410-odroidxu.dtb - under a directory called xen. This is so we avoid overwriting the files that come with the default distribution in case we want to revert back the XEN changes. |
|||
suriyan@Stealth:/media/suriyan/BOOT$ ls -l xen |
|||
... |
|||
-rw-r--r-- 1 suriyan suriyan 40467 Dec 8 14:04 exynos5410-odroidxu.dtb |
|||
-rw-r--r-- 1 suriyan suriyan 689052 Dec 8 15:15 xen4.5-uImage |
|||
-rw-r--r-- 1 suriyan suriyan 4709392 Dec 8 14:04 zImage |
|||
Note, that the file sizes that you have might be different. The purpose here is to show the directory and the names of the files therein. |
|||
Rename the original boot.ini file in the VFAT partition to boot.ini.org. Copy the boot.ini found in https://github.com/suriyanr/linux-xen/blob/odroid-3.13.y/sd_fuse/boot.ini in its place. |
|||
Note that this boot.ini assumes that the rootfs resides in /dev/mmcblk0p2. If you have planned it elsewhere please change this value in the line which looks like the below appropriately. |
|||
setenv dom0_bootargs vmalloc=256M console=hvc0 psci=enable earlyprintk debug clk_ignore_unused root=/dev/mmcblk0p2 rootwait rw drm_kms_helper.edid_firmware=edid/1920x1080.fw video=HDMI-A-1:1920x1080MR-32@60 |
|||
Now we can plug the SD/eMMC card to the OdroidXU and boot it up. |
|||
== Console login prompt == |
|||
hvc0 is used as the console by XEN. You will notice that console=hvc0 is passed as the kernel boot parameter (will be the same for domU kernel as well). |
|||
To get a login prompt for dom0/domU one has to spawn a tty on hvc0. The below steps work for 14.04* Ubuntu. |
|||
cp /etc/init/tty1.conf /etc/init/hvc0.conf |
|||
Replace tty1 with hvc0 in file /etc/init/hvc0.conf |
|||
== Building a Linux DomU Kernel == |
|||
Mainline Linux will be used for this purpose. |
|||
The options to enable for building the domU kernel is as below: |
|||
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE exynos_defconfig |
|||
make ARCH=arm menuconfig |
|||
When presented with the menu, make sure the below are enabled: |
|||
1. Kernel Features -> Xen guest support on ARM |
|||
2. Device Drivers -> Block devices -> Xen virtual block device support. |
|||
3. Device Drivers -> Network device support -> Xen network device frontend |
|||
4. Device Drivers -> Xen driver support -> Select all. |
|||
5. System Type -> ARM system type -> Allow multiple platforms to be selected. |
|||
6. System Type -> Multiple platform selection -> ARMv7 based platforms |
|||
7. System Type -> Dummy Virtual Machine. |
|||
8. Device Drivers -> Input Device support -> Miscellaneous devices -> Xen virtual keyboard and mouse support. |
|||
And build the linux kernel: |
|||
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE zImage |
|||
This zImage can then be used as a Linux domU kernel. |
|||
== Resources == |
== Resources == |
Latest revision as of 01:42, 23 January 2015
Preparing the board
The bootloader provided with the OdroidXU does not let Xen boot in hypervisor mode. In the Odroid forums for the XU, one is likely to see many U-Boot blobs (bl1/bl2/tzsw/u-boot) which could possibly be used to let Xen boot in hypervisor mode. To avoid multiple sources, currently a single source is provided which can be accessed from https://github.com/suriyanr/linux-xen/tree/odroid-3.13.y/sd_fuse
The sd_fusing.sh script found therein can be used to fuse the SD card or eMMC card with the required BL1/BL2/TZSW and U-Boot.
sd_fusing.sh /dev/mmcblk0
Please make sure /dev/mmcblk0 is the correct device which represents the SD card or eMMC card that you will be using. This will let XEN boot in hypervisor mode as well as set CNTFRQ through the trustzone. This is required for domUs to get the correct timer frequency. (dom0's optionally can pick it up from the device tree)
Building XEN
Follow Build Xen on ARM to build XEN. For more verbose debug messages from XEN, it is worthwhile to compile XEN as below:
make dist-xen XEN_TARGET_ARCH=arm32 debug=y CONFIG_EARLY_PRINTK=exynos5250
For the moment, xen doesn't build uImage for U-Boot. You can create the image with:
mkimage -A arm -T kernel -a 0x80200000 -e 0x80200000 -C none -d "$xen_src/xen/xen" xen4.5-uImage
where $xen_src is the root directory of your xen git.
Building the device tree for Xen, Linux Dom0 kernel and modules
We will build Linux for dom0 to have a device tree to provide to Xen.
You can get a tree from [1] which contains a working configuration for the Odroid XU.
git clone -b odroid-3.13.y https://github.com/suriyanr/linux-xen.git --depth=1 cd linux-xen make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE odroidxu_xen_defconfig make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE zImage make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE dtbs # Note that CROSS_COMPILE has to be set appropriately or can be left unset if building natively.
The device tree used by the OdroidXU is located in arch/arm/boot/dts/exynos5410-odroidxu.dtb
# Now build the dom0 modules make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE modules # And install them make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE INSTALL_MOD_PATH=/media/suriyan/rootfs modules_install
Note that /media/suriyan/rootfs is where the rootfs of the Odroid XU is mounted in the build box. Your path might vary or you will have to mount it appropriately.
Booting from SD/eMMC card
Start with a distribution that you like, say xubuntu 14.04lts from http://odroid.in/ubuntu_14.04lts/ubuntu-14.04lts-xubuntu-odroid-xu-20140714.img.xz, or ArchLinuxArm if you prefer from http://archlinuxarm.org/platforms/armv7/samsung/odroid-xu.
Once you have imaged the SD card or eMMC card with your preferred distribution, please overwrite the BL1/BL2/TZSW/U-Boot as mentioned in Xen_ARM_with_Virtualization_Extensions/OdroidXU#Preparing_the_board
Both the distributions mentioned above have a VFAT partition as the first partition. We shall use this partition to populate the XEN specific images - xen4.5-uImage, zImage, exynos5410-odroidxu.dtb - under a directory called xen. This is so we avoid overwriting the files that come with the default distribution in case we want to revert back the XEN changes.
suriyan@Stealth:/media/suriyan/BOOT$ ls -l xen ... -rw-r--r-- 1 suriyan suriyan 40467 Dec 8 14:04 exynos5410-odroidxu.dtb -rw-r--r-- 1 suriyan suriyan 689052 Dec 8 15:15 xen4.5-uImage -rw-r--r-- 1 suriyan suriyan 4709392 Dec 8 14:04 zImage
Note, that the file sizes that you have might be different. The purpose here is to show the directory and the names of the files therein.
Rename the original boot.ini file in the VFAT partition to boot.ini.org. Copy the boot.ini found in https://github.com/suriyanr/linux-xen/blob/odroid-3.13.y/sd_fuse/boot.ini in its place.
Note that this boot.ini assumes that the rootfs resides in /dev/mmcblk0p2. If you have planned it elsewhere please change this value in the line which looks like the below appropriately.
setenv dom0_bootargs vmalloc=256M console=hvc0 psci=enable earlyprintk debug clk_ignore_unused root=/dev/mmcblk0p2 rootwait rw drm_kms_helper.edid_firmware=edid/1920x1080.fw video=HDMI-A-1:1920x1080MR-32@60
Now we can plug the SD/eMMC card to the OdroidXU and boot it up.
Console login prompt
hvc0 is used as the console by XEN. You will notice that console=hvc0 is passed as the kernel boot parameter (will be the same for domU kernel as well).
To get a login prompt for dom0/domU one has to spawn a tty on hvc0. The below steps work for 14.04* Ubuntu.
cp /etc/init/tty1.conf /etc/init/hvc0.conf Replace tty1 with hvc0 in file /etc/init/hvc0.conf
Building a Linux DomU Kernel
Mainline Linux will be used for this purpose. The options to enable for building the domU kernel is as below:
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE exynos_defconfig make ARCH=arm menuconfig
When presented with the menu, make sure the below are enabled:
1. Kernel Features -> Xen guest support on ARM 2. Device Drivers -> Block devices -> Xen virtual block device support. 3. Device Drivers -> Network device support -> Xen network device frontend 4. Device Drivers -> Xen driver support -> Select all. 5. System Type -> ARM system type -> Allow multiple platforms to be selected. 6. System Type -> Multiple platform selection -> ARMv7 based platforms 7. System Type -> Dummy Virtual Machine. 8. Device Drivers -> Input Device support -> Miscellaneous devices -> Xen virtual keyboard and mouse support.
And build the linux kernel:
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE zImage
This zImage can then be used as a Linux domU kernel.