Xen ARM64 on 96boards HiKey
Xen is now supported upstream on the 96boards HiKey, however beware that to run Xen on HiKey you need the 96Boards UART Serial Adapter, available here. Given that the board doesn't come with an ethernet interface, a USB ethernet adapter is also recommended.
Make sure to build a version of Xen which is new enough to support PSCI 1.0, which was added during the 4.7 development window by 2831f2099b6175384817d7afd952f7918998b39a. No other special requirements are needed.
HiKey support is not upstream in Linux. The Linux tree with HiKey support provided by 96boards is on github. At the time of writing this article, 96boards.org recommends the usage of tag "96boards-hikey-15.11", which is based on Linux 3.18. However Linux 3.18 doesn't work very well on Xen on this board, I recommend using a newer branch, like android-hikey-linaro-4.1. Use this kernel config for Dom0, which is based on the default kernel config with a few options removed.
The best way to use your HiKey board is by installing your Linux rootfs on an external microSD card. HiKey comes with UEFI firmware and by default it will look into the external SD card first. For example you could dd a CentOS 7 ARM64 rootfs to the microSD. CentOS 7 supports UEFI booting which is helpful. Unfortunately changing the UEFI boot entries permanently is not easy on the HiKey at the moment, but it is possible to use Xen as bootloader or boot Linux directly using the startup.nsh UEFI script.
Copy the Linux Image file to the FAT partition on the microSD card. Then write the following lines to a file called startup.nsh:
FS0: Image console=ttyAMA3,115200 root=/dev/mmcblk1p4 rootwait rw efi=noruntime
The root device here is the one of a CentOS 7 installation. Copy xen.efi to the FAT partition on the microSD card. Write the following lines to a file called xen.cfg:
options=console=dtuart dom0_mem=512M dom0_max_vcpus=4 conswitch=x dtuart=/smb/uart@f7113000 kernel=Image console=hvc0 root=/dev/mmcblk1p4 rootwait rw
Be careful that on some device trees the uart path is /soc/uart@f7113000 instead of /smb/uart@f7113000. The next time you boot the board, type 4 to get into the UEFI shell, then if you just wait for the timeout to run out, Linux will boot by default. Otherwise if you want to boot xen, just type the ESC key, then type xen.
- The UEFI firmware on the HiKey is not able to pick up USB drives at boot, so even if you install your Linux system on a USB drive, you still need to copy the Linux and Xen binaries to the FAT partition of the SD card.
- Having a USB ethernet adapter plugged at boot crashes the kernel sometimes. If you see this problem reboot without ethernet adapter and plug it in later.
- There is no support for UHS SD cards