We're no longer updating This wiki!!

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:xu4_xen [2015/10/16 11:29]
brian.kim created
en:xu4_xen [2016/05/03 17:34] (current)
brian.kim [Domain U Settings && Running]
Line 1: Line 1:
 ====== Virtualization using Xen on ODROID-XU3/​4 ====== ====== Virtualization using Xen on ODROID-XU3/​4 ======
-This page contains the step-by-step guide for 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://​** **//HOST-PC Environments://​**
Line 9: Line 9:
  
 ===== Basic preparation ===== ===== Basic preparation =====
-SD card or eMMC basic platform preparation+SD card or eMMC basic platform preparation:
 <​code>​ <​code>​
 $ wget http://​odroid.in/​ubuntu_14.04lts/​ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz $ 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 $ unxz ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz
-$ sudo dd if=ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz of=/dev/sdc bs=1M conv=fsync+$ sudo dd if=ubuntu-14.04lts-server-odroid-xu3-20150725.img of=/dev/sdc bs=1M conv=fsync
 $ sync $ sync
 </​code>​ </​code>​
  
 +===== 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:
 +<​code>​
 +$ 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
 +</​code>​
 +
 +Changing [[http://​git.io/​vCu3c|boot.ini]] file for virtualization:​
 +<​code>​
 +$ wget http://​git.io/​vCu3c -O boot.ini
 +$ sudo cp -f boot.ini /​media/​boot/​
 +$ sync
 +</​code>​
 +
 +<WRAP left round important 100%>
 +Note: Please follow [[http://​odroid.com/​dokuwiki/​doku.php?​id=en:​emmc_recovery_xu3|XU3/​XU4 eMMC Bootloader Recovery wiki page]] to burn the bootloader to eMMC. 
 +</​WRAP>​
 +===== Xen Hypervisor =====
 +Getting the xen soruce code:
 +<​code>​
 +$ git clone https://​github.com/​bkrepo/​xen.git -b odroid-xu4
 +$ cd xen
 +</​code>​
 +
 +Build & Installation:​
 +<​code>​
 +$ 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
 +</​code>​
 +
 +===== Domain 0 Linux kernel =====
 +Build & Installation:​
 +<​code>​
 +$ 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
 +</​code>​
 +
 +===== Domain 0 Settings =====
 +<WRAP left round tip 70%>
 + ​**Note**
 +  * This step must be done on **ODROID-XU3/​4** (id: //root//, password: //odroid//)
 +</​WRAP>​
 +
 +==== Xen tools installation====
 +Getting the xen source code:
 +<​code>​
 +$ git clone https://​github.com/​bkrepo/​xen.git -b odroid-xu4
 +$ cd xen
 +</​code>​
 +
 +Installation packages for xen tools build:
 +<​code>​
 +$ apt-get update
 +$ apt-get build-dep xen
 +$ apt-get install libpixman-1-dev
 +</​code>​
 +
 +Building xen tools:
 +<​code>​
 +$ ./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
 +</​code>​
 +
 +==== Network configuration ====
 +DHCP bridge network configuration:​
 +<​code>​
 +$ apt-get install bridge-utils
 +$ vim /​etc/​network/​interfaces.d/​xenbr0
 +</​code>​
 +<code - xenbr0>
 +auto xenbr0 inet
 +iface xenbr0 inet dhcp
 +bridge_ports eth0
 +</​code>​
 +
 +* //If you want more information about Xen networking, then refer to [[http://​wiki.xenproject.org/​wiki/​Network_Configuration_Examples_(Xen_4.1%2B)|this link. ]]//
 +
 +===== Domain U Settings && Running =====
 +**(On HOST-PC)**
 +
 +Domain U kernel build preparation:​
 +<​code>​
 +$ 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
 +</​code>​
 +  - Kernel Features -> Xen guest support on ARM
 +  - Device Drivers -> Block devices -> Xen virtual block device support.
 +  - Device Drivers -> Network device support -> Xen network device frontend
 +  - Device Drivers -> Xen driver support -> Select all.
 +  - System Type -> ARM system type -> Allow multiple platforms to be selected.
 +  - System Type -> Multiple platform selection -> ARMv7 based platforms
 +  - System Type -> Dummy Virtual Machine.
 +  - Device Drivers -> Input Device support -> Miscellaneous devices -> Xen virtual keyboard and mouse support.
 +
 +Patching Domain U kernel source code:
 +<​code>​
 +$ wget http://​git.io/​vCV9E -O xen_blkif.patch
 +$ patch -p1 < xen_blkif.patch
 +</​code>​
 +
 +Build & Installation:​
 +<​code>​
 +$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j8
 +$ sudo cp arch/​arm/​boot/​zImage /​media/​rootfs/​root/​
 +$ sync
 +</​code>​
 +
 +Creating the [[http://​odroid.in/​ubuntu_14.04lts/​ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz|domain U image(Ubuntu 14.04 server)]]:
 +<​code>​
 +$ sudo kpartx -v -a ubuntu-14.04lts-server-odroid-xu3-20150725.img
 +$ sudo dd if=/​dev/​mapper/​loop0p2 of=domU.img
 +</​code>​
 +
 +Modifiying domain U root file system
 +<​code>​
 +$ mkdir domU-root
 +$ sudo mount domU.img domU-root
 +$ cd domU-root
 +$ vi ./etc/fstab
 +</​code>​
 +<code - /​etc/​fstab>​
 +/​dev/​xvda ​   /    ext4    errors=remount-ro ​   0    1
 +</​code>​
 +
 +<​code>​
 +$ vi ./​etc/​init/​console.conf
 +</​code>​
 +<code - /​etc/​init/​console.conf>​
 +start on stopped rc RUNLEVEL=[2345]
 +stop on runlevel [!2345]
 +
 +respawn
 +exec /sbin/getty -8 38400 hvc0
 +</​code>​
 +
 +<​code>​
 +$ cd ..
 +$ sudo umount domU-root
 +$ sudo cp domU.img /​media/​rootfs/​root/​
 +$ sync
 +</​code>​
 +
 +Create the xen configuration file:
 +<​code>​
 +$ vi domU.cfg
 +</​code>​
 +<code - 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'
 +</​code>​
 +<​code>​
 +$ sudo cp domU.cfg /​media/​rootfs/​root/​
 +$ sync
 +</​code>​
 +
 +Running virtual machine(**On ODROID-XU3/​4**,​ id: '​root',​ passwd: '​odroid'​):​
 +<​code>​
 +# xl create -c domU.cfg
 +</​code>​
 +
 +Checking the domain list.
 +<​code>​
 +(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:​~#​
 +</​code>​
 +===== References =====
 +  * [[http://​forum.odroid.com/​viewtopic.php?​f=98&​t=6643|Related Topic in ODROID Forum]]
 +  * [[http://​wiki.xenproject.org/​wiki/​Xen_ARM_with_Virtualization_Extensions/​OdroidXU|Xen ARM with Virtualization Extensions/​OdroidXU]]
 +  * [[https://​github.com/​cypresskr/​xen|cypresskr'​s xen repository]]
 +  * [[https://​github.com/​suriyanr/​linux-xen/​tree/​odroidxu3-3.10.y|suriyanr'​s domain 0 linux kernel repository]]
en/xu4_xen.1444964366.txt.gz ยท Last modified: 2015/10/16 11:29 by brian.kim
CC Attribution-Share Alike 3.0 Unported
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0