Difference between revisions of "Xen ARM with Virtualization Extensions/Arndale"

From Xen
(Building Xen and Linux)
 
(45 intermediate revisions by 8 users not shown)
Line 1: Line 1:
The work for Xen on the Arndale Development board is on his way. So don't expect to have a usable dom0 yet.
+
The Arndale board is now supported in Xen upstream.
   
== Building Xen and Linux ==
+
== Preparing the board ==
 
The bootloader provided with the Arndale does not let Xen boot in hypervisor mode, so we will use the u-boot provided by Linaro.
 
The bootloader provided with the Arndale does not let Xen boot in hypervisor mode, so we will use the u-boot provided by Linaro.
   
 
Follow the step on the [https://wiki.linaro.org/Boards/Arndale/Setup/PXEBoot Linaro wiki], to build and install u-boot.
 
Follow the step on the [https://wiki.linaro.org/Boards/Arndale/Setup/PXEBoot Linaro wiki], to build and install u-boot.
   
  +
== Building Xen and Linux Dom0 ==
To Build, get the source tree from the [http://xenbits.xen.org/gitweb/?p=people/aperard/xen-arm.git;a=summary repo], which contain branches (last one is exynos5250-2013-03-22) with patches to get serial and other device working on the board.
 
   
  +
First, we will build Linux for dom0 to have a device tree to provide to Xen.
git clone --branch exynos5250-2013-03-22 git://xenbits.xen.org/people/aperard/xen-arm.git
 
  +
  +
You can get a tree from [http://git.linaro.org/kernel/linux-linaro-tracking.git linaro] which contains a working configuration for the Arndale.
  +
  +
git clone -b linux-linaro git://git.linaro.org/kernel/linux-linaro-tracking.git linux
  +
cd linux
  +
ARCH=arm scripts/kconfig/merge_config.sh linaro/configs/linaro-base.conf linaro/configs/distribution.conf\
  +
linaro/configs/kvm-host.conf linaro/configs/xen.conf linaro/configs/arndale.conf linaro/configs/lt-arndale.conf
  +
make ARCH=arm zImage
  +
make ARCH=arm dtbs
  +
  +
The device tree used by the Arndale board is located in arch/arm/boot/dts/exynos5250-arndale.dtb
   
 
Then, [[Xen_ARMv7_with_Virtualization_Extensions#Building_Xen_on_ARM|Build Xen on ARM]].
 
Then, [[Xen_ARMv7_with_Virtualization_Extensions#Building_Xen_on_ARM|Build Xen on ARM]].
   
  +
For the moment, xen doesn't build uImage for U-Boot. You can create the image with:
Next step is to build Linux. So far, the development have been done using the Linux tree from Linaro, [https://wiki.linaro.org/Boards/Arndale/Setup/EnterpriseUbuntuServer#Build.2C_burn_uImage_and_dtb building linux]. Just make sure to "git checkout lue_arndale_3.7" and have those config options in .config:
 
  +
mkimage -A arm -T kernel -a 0x80200000 -e 0x80200000 -C none -d "$xen_src/xen/xen" xen-uImage
CONFIG_XEN=y
 
  +
CONFIG_XEN_DOM0=y
 
  +
where ''$xen_src'' is the root directory of your xen git. Note that before commit [http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=47d1a51480ad0f602d747e460d619436c907deea 47d1a51] (xen: arm: make zImage the default target which we install) it was necessary to use <tt>$xen_src/xen/xen.bin</tt> instead.
CONFIG_HVC_DRIVER=y
 
  +
CONFIG_HVC_IRQ=y
 
  +
== Booting Xen and Dom0 ==
CONFIG_HVC_XEN=y
 
  +
Also, multi CPU does not work yet with Xen on ARM, so make sure to remove:
 
  +
To boot Xen and Dom0, you can use:
CONFIG_SMP=n
 
  +
* PXE: it's easier for development but you need a computer which act as a server;
  +
* copy binary on the SD card: when you don't have network on your board.
  +
  +
Once you have chosen the boot method, you can start to follow steps in the next sections.
  +
When you have finished to configure your board, you can:
  +
* Save the U-Boot configuration with '''saveenv''' command. The next time you want to reboot your board, you won't have to reconfigure U-Boot.
  +
* Boot with '''boot''' command.
  +
  +
=== Booting via PXE ===
  +
  +
The following [http://xenbits.xen.org/people/julieng/load-xen-tftp.scr.txt script] allow U-boot to download everything via tftp and boot xen.
  +
  +
* Setup the [https://wiki.linaro.org/Boards/Arndale/Setup/PXEBoot PXE Server]
  +
* Copy ''xen-uImage'', the ''zImage'' (rename in ''linux-zImage''), ''exynos5250-arndale.dtb'' in ''/tftpboot/''
  +
* Copy the script in ''/tftpboot''
  +
wget http://xenbits.xen.org/people/julieng/load-xen-tftp.scr.txt
  +
mkimage -T script -C none -d load-xen-tftp.scr.txt /tftpboot/load-xen-tftp.img
  +
* At U-Boot prompt, on your board, you need to set the following variable:
  +
setenv ipaddr 10.y.y.y
  +
setenv serverip 10.x.x.x
  +
setenv usbethaddr 00:zz:zz:zz:zz:zz
  +
setenv ethaddr 00:zz:zz:zz:zz:zz
  +
setenv xen_addr_r 0x50000000
  +
setenv kernel_addr_r 0x60000000
  +
setenv dtb_addr_r 0x42000000
  +
setenv script_addr_r 0x40080000
  +
setenv xen_path /xen-uImage
  +
setenv kernel_path /linux-zImage
  +
setenv dtb_path /exynos5250-arndale.dtb
  +
setenv bootcmd 'tftpboot $script_addr_r /load-xen-tftp.img; source $script_addr_r'
  +
setenv xen_bootargs 'sync_console console=dtuart dtuart=/serial@12C20000'
  +
setenv dom0_bootargs 'console=hvc0 ignore_loglevel psci=enable clk_ignore_unused root=/dev/mmcblk1p3'
  +
with:
  +
* '''10.y.y.y''' the ip addr of the board
  +
* '''10.x.x.x''' the ip of a tftp server (or PXE server).
  +
* '''00:zz:zz:zz:zz:zz''' the MAC address of the board. You can generate it with the following
  +
** shell command:
  +
bash -c 'printf "00:16:3e:%02x:%02x:%02x\n" $(( $RANDOM % 256 )) $(( $RANDOM % 256 )) $(( $RANDOM % 256 ))'
  +
** website: [http://www.hellion.org.uk/cgi-bin/randmac.pl www.hellion.org.uk/cgi-bin/randmac.pl]
  +
  +
=== Booting directly on the SD card ===
  +
{{Info|The instruction are not yet update to support the latest Xen }}
  +
* Copy xen-uImage and the zImage the root directory of you SD card.
  +
* At U-Boot prompt, on your board, you need to set the following variable:
  +
setenv kernel_addr_r 0x60000000
  +
setenv xen_addr_r 0x50000000
  +
setenv bootcmd_load_linux_mmc 'ext2load mmc 1:0 $kernel_addr_r /zImage'
  +
setenv boot_xen_mmc 'run bootcmd_load_linux_mmc; ext2load mmc 1:0 $xen_addr_r /xen-uImage; bootm $xen_addr_r -'
  +
setenv bootcmd 'run boot_xen_mmc'
  +
  +
We assume the SD card has only 1 partition with '''ext2''' filesystem.
  +
  +
* execute the boot command with the following command:
  +
boot
  +
  +
====Alternate SD approach based on Linaro pre-built image for Arndale 5250====
  +
  +
{{Info|This is a work in progress, comments welcome}}
  +
On your host development machine, install [[https://releases.linaro.org/14.03/ubuntu/arndale Linaro prebuilt]] to a uSD card (assuming it mounts at /dev/sdb, see linaro instructions for more detail):
  +
$ wget https://releases.linaro.org/14.03/ubuntu/arndale/arndale-saucy_server_20140323-616.img.gz
  +
$ gunzip < arndale-saucy_server_20140323-616.img.gz | sudo dd bs=64k of=/dev/sdb
  +
  +
Copy your compiled xen-uImage, linux-zImage, and exynos5250-arndale.dtb all to the boot partition on the uSD card. Copy the contents of xen/dist/install to the rootfs partition. Unmount the uSD from your host development machine, insert it in the Arndale.
  +
  +
Start minicom on host development machine, connected to the Arndale via a serial cable:
  +
$ sudo minicom
  +
  +
Power on Arndale, press reset, watch the minicom console, and hit “enter” to interrupt U-Boot to get the u-Boot prompt. Enter the following into the minicom console. The saveenv stores the environment variables, so you won't have to repeat those the next time around.
  +
setenv xen_addr_r 0x50000000
  +
setenv kernel_addr_r 0x60000000
  +
setenv dtb_addr_r 0x42000000
  +
setenv xen_bootargs 'sync_console console=dtuart dtuart=/serial@12C20000 dom0_mem=512M'
  +
setenv dom0_bootargs 'console=hvc0 ignore_loglevel psci=enable clk_ignore_unused root=/dev/mmcblk1p3'
  +
saveenv
  +
fatload mmc 0:2 $kernel_addr_r linux-zImage
  +
fatload mmc 0:2 $xen_addr_r xen-uImage
  +
fatload mmc 0:2 $dtb_addr_r exynos5250-arndale.dtb
  +
fdt addr $dtb_addr_r
  +
fdt resize
  +
fdt set /chosen xen,xen-bootargs \"$xen_bootargs\"
  +
fdt set /chosen xen,dom0-bootargs \"$dom0_bootargs\"
  +
fdt mknode /chosen modules
  +
fdt set /chosen/modules '#address-cells' <1>
  +
fdt set /chosen/modules '#size-cells' <1>
  +
fdt mknode /chosen/modules module@0
  +
fdt set /chosen/modules/module@0 compatible xen,linux-zimage xen,multiboot-module
  +
fdt set /chosen/modules/module@0 reg <$kernel_addr_r 0x00a00000>
  +
bootm $xen_addr_r - $dtb_addr_r
   
 
== Resources ==
 
== Resources ==
 
* Information about the Arndale board development: [http://www.arndaleboard.org/wiki/index.php/WiKi www.arndaleboard.org/wiki/index.php/WiKi].
 
* Information about the Arndale board development: [http://www.arndaleboard.org/wiki/index.php/WiKi www.arndaleboard.org/wiki/index.php/WiKi].
 
* Linaro page about the Arndale board: [https://wiki.linaro.org/Boards/Arndale/Setup/PXEBoot wiki.linaro.org/Boards/Arndale/Setup/PXEBoot]
 
* Linaro page about the Arndale board: [https://wiki.linaro.org/Boards/Arndale/Setup/PXEBoot wiki.linaro.org/Boards/Arndale/Setup/PXEBoot]
  +
* Alternate SD approach based on Linaro pre-built image (more detailed): [http://www.episodic.cc/2014/06/booting-linux-in-xens-dom0-on-arndale.html Booting Linux in Xen's Dom0 on Arndale Exynos 5250]
   
 
[[Category:XenARM]]
 
[[Category:XenARM]]
 
[[Category:Developers]]
 
[[Category:Developers]]
  +
[[Category:Xen 4.3]]
  +
[[Category:Xen 4.4]]
  +
[[Category:Xen 4.5]]

Latest revision as of 14:17, 22 December 2014

The Arndale board is now supported in Xen upstream.

Preparing the board

The bootloader provided with the Arndale does not let Xen boot in hypervisor mode, so we will use the u-boot provided by Linaro.

Follow the step on the Linaro wiki, to build and install u-boot.

Building Xen and Linux Dom0

First, we will build Linux for dom0 to have a device tree to provide to Xen.

You can get a tree from linaro which contains a working configuration for the Arndale.

 git clone -b linux-linaro git://git.linaro.org/kernel/linux-linaro-tracking.git linux
 cd linux
 ARCH=arm scripts/kconfig/merge_config.sh linaro/configs/linaro-base.conf linaro/configs/distribution.conf\
          linaro/configs/kvm-host.conf linaro/configs/xen.conf linaro/configs/arndale.conf linaro/configs/lt-arndale.conf
 make ARCH=arm zImage
 make ARCH=arm dtbs

The device tree used by the Arndale board is located in arch/arm/boot/dts/exynos5250-arndale.dtb

Then, Build Xen on ARM.

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" xen-uImage 

where $xen_src is the root directory of your xen git. Note that before commit 47d1a51 (xen: arm: make zImage the default target which we install) it was necessary to use $xen_src/xen/xen.bin instead.

Booting Xen and Dom0

To boot Xen and Dom0, you can use:

  • PXE: it's easier for development but you need a computer which act as a server;
  • copy binary on the SD card: when you don't have network on your board.

Once you have chosen the boot method, you can start to follow steps in the next sections. When you have finished to configure your board, you can:

  • Save the U-Boot configuration with saveenv command. The next time you want to reboot your board, you won't have to reconfigure U-Boot.
  • Boot with boot command.

Booting via PXE

The following script allow U-boot to download everything via tftp and boot xen.

  • Setup the PXE Server
  • Copy xen-uImage, the zImage (rename in linux-zImage), exynos5250-arndale.dtb in /tftpboot/
  • Copy the script in /tftpboot
 wget http://xenbits.xen.org/people/julieng/load-xen-tftp.scr.txt
 mkimage -T script -C none -d load-xen-tftp.scr.txt /tftpboot/load-xen-tftp.img
  • At U-Boot prompt, on your board, you need to set the following variable:
 setenv ipaddr 10.y.y.y
 setenv serverip 10.x.x.x
 setenv usbethaddr 00:zz:zz:zz:zz:zz
 setenv ethaddr 00:zz:zz:zz:zz:zz
 setenv xen_addr_r 0x50000000
 setenv kernel_addr_r 0x60000000
 setenv dtb_addr_r 0x42000000
 setenv script_addr_r 0x40080000
 setenv xen_path /xen-uImage
 setenv kernel_path /linux-zImage
 setenv dtb_path /exynos5250-arndale.dtb
 setenv bootcmd 'tftpboot $script_addr_r /load-xen-tftp.img; source $script_addr_r'
 setenv xen_bootargs 'sync_console console=dtuart dtuart=/serial@12C20000'
 setenv dom0_bootargs 'console=hvc0 ignore_loglevel psci=enable clk_ignore_unused root=/dev/mmcblk1p3'

with:

  • 10.y.y.y the ip addr of the board
  • 10.x.x.x the ip of a tftp server (or PXE server).
  • 00:zz:zz:zz:zz:zz the MAC address of the board. You can generate it with the following
    • shell command:
 bash -c 'printf "00:16:3e:%02x:%02x:%02x\n" $(( $RANDOM % 256 )) $(( $RANDOM % 256 )) $(( $RANDOM % 256 ))'

Booting directly on the SD card

Icon Info.png The instruction are not yet update to support the latest Xen
  • Copy xen-uImage and the zImage the root directory of you SD card.
  • At U-Boot prompt, on your board, you need to set the following variable:
 setenv kernel_addr_r 0x60000000
 setenv xen_addr_r 0x50000000
 setenv bootcmd_load_linux_mmc 'ext2load mmc 1:0 $kernel_addr_r /zImage'
 setenv boot_xen_mmc 'run bootcmd_load_linux_mmc; ext2load mmc 1:0 $xen_addr_r /xen-uImage; bootm $xen_addr_r -'
 setenv bootcmd 'run boot_xen_mmc'

We assume the SD card has only 1 partition with ext2 filesystem.

  • execute the boot command with the following command:
 boot

Alternate SD approach based on Linaro pre-built image for Arndale 5250

Icon Info.png This is a work in progress, comments welcome

On your host development machine, install [Linaro prebuilt] to a uSD card (assuming it mounts at /dev/sdb, see linaro instructions for more detail):

 $ wget https://releases.linaro.org/14.03/ubuntu/arndale/arndale-saucy_server_20140323-616.img.gz
 $ gunzip < arndale-saucy_server_20140323-616.img.gz | sudo dd bs=64k of=/dev/sdb

Copy your compiled xen-uImage, linux-zImage, and exynos5250-arndale.dtb all to the boot partition on the uSD card. Copy the contents of xen/dist/install to the rootfs partition. Unmount the uSD from your host development machine, insert it in the Arndale.

Start minicom on host development machine, connected to the Arndale via a serial cable:

 $ sudo minicom

Power on Arndale, press reset, watch the minicom console, and hit “enter” to interrupt U-Boot to get the u-Boot prompt. Enter the following into the minicom console. The saveenv stores the environment variables, so you won't have to repeat those the next time around.

 setenv xen_addr_r 0x50000000
 setenv kernel_addr_r 0x60000000
 setenv dtb_addr_r 0x42000000
 setenv xen_bootargs 'sync_console console=dtuart dtuart=/serial@12C20000 dom0_mem=512M'
 setenv dom0_bootargs 'console=hvc0 ignore_loglevel psci=enable clk_ignore_unused root=/dev/mmcblk1p3'
 saveenv
 fatload mmc 0:2 $kernel_addr_r linux-zImage
 fatload mmc 0:2 $xen_addr_r xen-uImage
 fatload mmc 0:2 $dtb_addr_r exynos5250-arndale.dtb
 fdt addr $dtb_addr_r
 fdt resize
 fdt set /chosen xen,xen-bootargs \"$xen_bootargs\"
 fdt set /chosen xen,dom0-bootargs \"$dom0_bootargs\"
 fdt mknode /chosen modules
 fdt set /chosen/modules '#address-cells' <1>
 fdt set /chosen/modules '#size-cells' <1>   
 fdt mknode /chosen/modules module@0                                                                        
 fdt set /chosen/modules/module@0 compatible xen,linux-zimage xen,multiboot-module                          
 fdt set /chosen/modules/module@0 reg <$kernel_addr_r 0x00a00000>                                             
 bootm $xen_addr_r - $dtb_addr_r

Resources