Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
en:xu4_xen [2015/10/16 12:30] brian.kim |
en:xu4_xen [2016/04/21 13:23] brian.kim [Xen tools installation] |
||
---|---|---|---|
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 13: | Line 13: | ||
$ 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> | ||
Line 31: | Line 31: | ||
</code> | </code> | ||
- | Changing boot.ini file for virtualization: | + | Changing [[http://git.io/vCu3c|boot.ini]] file for virtualization: |
<code> | <code> | ||
$ wget http://git.io/vCu3c -O boot.ini | $ wget http://git.io/vCu3c -O boot.ini | ||
Line 38: | Line 38: | ||
</code> | </code> | ||
- | [[https://gist.githubusercontent.com/bkrepo/154f493941b661a35866/raw/301d129443bcadbef04cd15207c99702d705c3fa/boot.ini|boot.ini]]: | + | ===== Xen Hypervisor ===== |
+ | Getting the xen soruce code: | ||
<code> | <code> | ||
- | ODROIDXU-UBOOT-CONFIG | + | $ git clone https://github.com/bkrepo/xen.git -b odroid-xu4 |
- | # source by kenken> http://forum.odroid.com/viewtopic.php?f=98&t=6643#p64051 | + | $ cd xen |
- | setenv dtb_addr_r 0x42000000 | + | </code> |
- | setenv dtb_path /exynos5422-odroidxu3.dtb | + | |
- | setenv kernel_addr_r 0x60000000 | + | Build & Installation: |
- | setenv kernel_path /zImage | + | <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> | ||
- | setenv xen_addr_r 0x50000000 | + | ===== Domain 0 Linux kernel ===== |
- | setenv xen_path /xen | + | 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> | ||
- | # use the A7s for dom0 and pin them to it | + | ===== Domain 0 Settings ===== |
- | setenv xen_bootargs sync_console console=dtuart dtuart=/serial@12C20000 dom0_mem=800M dom0_max_vcpus=4 dom0_vcpus_pin | + | <WRAP left round tip 70%> |
+ | **Note** | ||
+ | * This step must be done on **ODROID-XU3/4** (id: //root//, password: //odroid//) | ||
+ | </WRAP> | ||
- | # edid/1280x720.bin | + | ==== Xen tools installation==== |
- | #setenv dom0_bootargs console=hvc0 earlyprintk debug clk_ignore_unused psci=enable root=/dev/mmcblk0p2 rootwait rw drm_kms_helper.edid_firmware=edid/1280x720.bin | + | Getting the xen source code: |
+ | <code> | ||
+ | $ git clone https://github.com/bkrepo/xen.git -b odroid-xu4 | ||
+ | $ cd xen | ||
+ | </code> | ||
- | # edid/1920x1080.bin | + | Installation packages for xen tools build: |
- | setenv dom0_bootargs console=hvc0 earlyprintk debug clk_ignore_unused psci=enable root=/dev/mmcblk0p2 rootwait rw | + | <code> |
+ | $ apt-get update | ||
+ | $ apt-get build-dep xen | ||
+ | $ apt-get install libpixman-1-dev | ||
+ | </code> | ||
- | ## Load the different components | + | Building xen tools: |
- | setenv dev "mmc 0:1" | + | <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> | ||
- | # Load Linux in memory | + | ==== Network configuration ==== |
- | fatload $dev $kernel_addr_r $kernel_path | + | DHCP bridge network configuration: |
- | setenv kernel_size 0x$filesize | + | <code> |
+ | $ apt-get install bridge-utils | ||
+ | $ vim /etc/network/interfaces.d/xenbr0.cfg | ||
+ | </code> | ||
+ | <code - xenbr0.cfg> | ||
+ | auto xenbr0 inet | ||
+ | iface xenbr0 inet dhcp | ||
+ | bridge_ports eth0 | ||
+ | </code> | ||
- | # Load Xen in memory | + | * //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. ]]// |
- | fatload $dev $xen_addr_r $xen_path | + | |
- | # Load the device tree in memory | + | ===== Domain U Settings && Running ===== |
- | fatload $dev $dtb_addr_r $dtb_path | + | **(On HOST-PC)** |
- | ## Fixup the device tree | + | Domain U kernel build preparation: |
- | # Be sure U-boot is using our FDT | + | <code> |
- | fdt addr $dtb_addr_r | + | $ 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. | ||
- | # Resize the FDT just in case | + | Patching Domain U kernel source code: |
- | fdt resize | + | <code> |
+ | $ wget http://git.io/vCV9E -O xen_blkif.patch | ||
+ | $ patch -p1 < xen_blkif.patch | ||
+ | </code> | ||
- | # Set Xen arguments based on $xen_bootargs | + | Build & Installation: |
- | fdt set /chosen xen,xen-bootargs \"$xen_bootargs\" | + | <code> |
+ | $ make ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage -j8 | ||
+ | $ sudo cp arch/arm/boot/zImage /media/rootfs/root/ | ||
+ | $ sync | ||
+ | </code> | ||
- | # Set Dom0 arguments based on $dom0_bootargs | + | Creating the [[http://odroid.in/ubuntu_14.04lts/ubuntu-14.04lts-server-odroid-xu3-20150725.img.xz|domain U image(Ubuntu 14.04 server)]]: |
- | fdt set /chosen xen,dom0-bootargs \"$dom0_bootargs\" | + | <code> |
+ | $ sudo kpartx -v -a ubuntu-14.04lts-server-odroid-xu3-20150725.img | ||
+ | $ sudo dd if=/dev/mapper/loop0p2 of=domU.img | ||
+ | </code> | ||
- | # Create modules node | + | Modifiying domain U root file system |
- | fdt mknode /chosen modules | + | <code> |
- | fdt set /chosen/modules '#address-cells' <1> | + | $ mkdir domU-root |
- | fdt set /chosen/modules '#size-cells' <1> | + | $ 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> | ||
- | # Create node for the linux located at $kernel_addr_r | + | <code> |
- | fdt mknode /chosen/modules module@0 | + | $ vi ./etc/init/console.conf |
- | fdt set /chosen/modules/module@0 compatible xen,linux-zimage xen,multiboot-module | + | </code> |
- | fdt set /chosen/modules/module@0 reg <$kernel_addr_r $kernel_size> | + | <code - /etc/init/console.conf> |
- | fdt print /chosen | + | start on stopped rc RUNLEVEL=[2345] |
+ | stop on runlevel [!2345] | ||
- | ## Boot Xen | + | respawn |
- | bootz $xen_addr_r - $dtb_addr_r | + | 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 xen.cfg | ||
</code> | </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]] |