We're no longer updating This wiki!!

Virtualization using Xen on ODROID-XU3/4

This page contains the step-by-step guide for virtualization using Xen on ODROID-XU3/4.

HOST-PC Environments:

  • Ubuntu 14.04 LTS Desktop
  • SD card device name assumption: /dev/sdc
  • SD card mount point assumption: /media/boot, /media/rootfs

Basic preparation

SD card or eMMC basic platform preparation:

$ wget http://odroid.in/ubuntu_14.04lts/ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz
$ unxz ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz
$ sudo dd if=ubuntu-14.04lts-server-odroid-xu3-20150725.img of=/dev/sdc bs=1M conv=fsync
$ sync

Bootloader

Bootloader must enable HYP mode to support virtualization before jump to kernel. So, it is needed to reinstall bootloader.

Install Bootloader to support HYP mode:

$ git clone https://github.com/hardkernel/u-boot.git -b odroidxu3-v2012.07
$ cd u-boot
$ make odroid_config
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- -j8
$ cd sd_fuse/hardkernel
$ sudo ./sd_fusing.sh /dev/sdc
$ sync

Changing boot.ini file for virtualization:

$ wget http://git.io/vCu3c -O boot.ini
$ sudo cp -f boot.ini /media/boot/
$ sync

Note: Please follow XU3/XU4 eMMC Bootloader Recovery wiki page to burn the bootloader to eMMC.

Xen Hypervisor

Getting the xen soruce code:

$ git clone https://github.com/bkrepo/xen.git -b odroid-xu4
$ cd xen

Build & Installation:

$ make dist-xen CROSS_COMPILE=arm-none-eabi- XEN_TARGET_ARCH=arm32 debug=y CONFIG_EARLY_PRINTK=exynos5250 -j8
$ sudo cp xen/xen /media/boot/
$ sync

Domain 0 Linux kernel

Build & Installation:

$ git clone https://github.com/bkrepo/linux-dom0.git
$ cd linux-dom0
$ make odroidxu3_xen_defconfig ARCH=arm
$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- -j8
$ sudo make modules_install ARCH=arm INSTALL_MOD_PATH=/media/rootfs/
$ cp -f arch/arm/boot/zImage arch/arm/boot/dts/exynos5422-odroidxu3.dtb /media/boot/
$ sync

Domain 0 Settings

Note

  • This step must be done on ODROID-XU3/4 (id: root, password: odroid)

Xen tools installation

Getting the xen source code:

$ git clone https://github.com/bkrepo/xen.git -b odroid-xu4
$ cd xen

Installation packages for xen tools build:

$ apt-get update
$ apt-get build-dep xen
$ apt-get install libpixman-1-dev

Building xen tools:

$ ./configure --disable-xen --disable-docs
$ make dist-tools -j4
$ make install-tools
$ update-rc.d xencommons defaults 19 18
$ update-rc.d xendomains defaults 21 20
$ update-rc.d xen-watchdog defaults 22 23
$ ldconfig

Network configuration

DHCP bridge network configuration:

$ apt-get install bridge-utils
$ vim /etc/network/interfaces.d/xenbr0
xenbr0
auto xenbr0 inet
iface xenbr0 inet dhcp
bridge_ports eth0

* If you want more information about Xen networking, then refer to this link.

Domain U Settings && Running

(On HOST-PC)

Domain U kernel build preparation:

$ wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.2.tar.xz
$ tar Jxvf linux-4.2.tar.xz
$ cd linux
$ make exynos_defconfig ARCH=arm
$ make menuconfig ARCH=arm
  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.

Patching Domain U kernel source code:

$ wget http://git.io/vCV9E -O xen_blkif.patch
$ patch -p1 < xen_blkif.patch

Build & Installation:

$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j8
$ sudo cp arch/arm/boot/zImage /media/rootfs/root/
$ sync

Creating the domain U image(Ubuntu 14.04 server):

$ sudo kpartx -v -a ubuntu-14.04lts-server-odroid-xu3-20150725.img
$ sudo dd if=/dev/mapper/loop0p2 of=domU.img

Modifiying domain U root file system

$ mkdir domU-root
$ sudo mount domU.img domU-root
$ cd domU-root
$ vi ./etc/fstab
/etc/fstab
/dev/xvda    /    ext4    errors=remount-ro    0    1
$ vi ./etc/init/console.conf
/etc/init/console.conf
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -8 38400 hvc0
$ cd ..
$ sudo umount domU-root
$ sudo cp domU.img /media/rootfs/root/
$ sync

Create the xen configuration file:

$ vi domU.cfg
domU.cfg
kernel = "/root/zImage"
memory = 256
maxmem = 256
name = "Domain U"
vcpus = 1
cpus = ['1']
serial="pty"
disk = [ 'phy:/root/domU.img,xvda,w' ]
vif = ['bridge=xenbr0']
extra = 'console=hvc0 xencons=tty root=/dev/xvda rw'
$ sudo cp domU.cfg /media/rootfs/root/
$ sync

Running virtual machine(On ODROID-XU3/4, id: 'root', passwd: 'odroid'):

# xl create -c domU.cfg

Checking the domain list.

(Type the 'CTRL + x + ]' key -> Escaping Domain U, Moving to Domain 0 console.)
root@odroid-server:~# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0   800     4     r-----     534.3
Domain U                                     1   256     1     -b----      49.9
root@odroid-server:~#

References

en/xu4_xen.txt · Last modified: 2016/05/03 17:34 by brian.kim
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0