Xen hypervisor working on RockPro64

Previously I described how I had made a start on configuring my new RockPro64 SBC to act as the new house server. My intention has been to use the Xen hypervisor to allow me to run the server as a bunch of virtual machines.

For the last couple of weeks (and aided a great deal by the time available whilst stuck at home) I have been struggling to configure the board and get Xen working. The Xen ARM project write that it should run on the RK3399 chip but I couldn’t actually find anyone else who was trying and ARM boards are notorious for all being that annoyingly bit different.

Of course progress was also hampered by the usual open source software problem of a great deal of documentation, but none of it complete, some inaccurate and much of it out of date.

However, this evening I finally cracked it and am happy to report that Xen is now booting a Gentoo based dom0 on my RockPro64. I may well have to perform the IT dance of success!

Of course there is still much to do. The boot process still requires some manual intervention and there is a problem with the serial console whereby I can see either the kernel boot process or the login prompt but not both.

In due course I will repeat the entire process (without all the blind alleys) and write a full set of instructions, but for the time being I can reveal that the following painfully derived u-boot commands are fundamental to success.

Update 27-6-20 – Small changes made to the script below to improve the display of boot messages.

ext4load mmc 1:7 $kernel_addr_r boot/xen/xen4.13-uImage
ext4load mmc 1:7 $fdt_addr_r boot/xen/rk3399-rockpro64.dtb
ext4load mmc 1:7 $ramdisk_addr_r boot/vmlinuz-xen
setenv kernel_size 0x${filesize}

fdt addr $fdt_addr_r
fdt resize

fdt set /chosen \#address-cells <1>
fdt set /chosen \#size-cells <1>

fdt mknod /chosen module@0
fdt set /chosen/module@0 compatible "multiboot,kernel" "multiboot,module"
fdt set /chosen/module@0 reg <${ramdisk_addr_r} ${kernel_size}>
fdt set /chosen/module@0 bootargs "console=hvc0 earlyprintk=xen clk_ignore_unused nomodeset rw panic=10 init=/sbin/init root=/dev/mmcblk0p7 rootfstype=ext4"
fdt set /chosen xen,xen-bootargs "console=dtuart dtuart=serial2"

bootm ${kernel_addr_r} - ${fdt_addr_r}