...
Note |
---|
NOTE: This means that any images built will NOT have the rootFS in the Image that is built by PetaLinux. This means you will need to edit any scripts or configuration that expects the rootFS to be included. This includes the Xen configs mentioned later. |
You can still use the prebuilt Image file which does still include the rootFS to boot DomU.
We also want to edit the device tree to build in the extra Xen related configs.
Edit this file
Code Block |
---|
|
project-spec/meta-user/recipes-bsp/device-tree/files/system-user.dtsi |
and add this line: /include/ "xen.dtsi".
It should look like this for harware:
Code Block |
---|
|
/include/ "system-conf.dtsi"
/include/ "xen.dtsi"
/ { }; |
or like this for QEMU:
Code Block |
---|
|
/include/ "system-conf.dtsi"
/include/ "xen.dtsi"
/ {
cpus {
cpu@1 {
device_type = "none";
};
cpu@2 {
device_type = "none";
};
cpu@3 {
device_type = "none";
};
};
}; |
NOTE: There is a bug on QEMU where the CPUs running in SMP sometimes cause hangs. To avoid this we only tell Xen about a single CPU.
Also edit this file:
Code Block |
---|
|
project-spec/meta-user/recipes-bsp/device-tree/device-tree.bbappend |
and add this line to it: file://xen.dtsi.
The file should look like this:
Code Block |
---|
|
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://system-user.dtsi"
SRC_URI += "file://xen.dtsi"
|
Then run petaliux-build:
Code Block |
---|
|
$ petalinux-build |
TFTP Booting Xen and Dom0
Run Xen dom0 on QEMU
To use the prebuilt Xen run:
Code Block |
---|
|
$ petalinux-boot --qemu --prebuilt 2 --qemu-args "-net nic -net nic -net nic -net nic -net user,tftp=pre-built/linux/xen" |
To use the Xen you built yourself run:
Code Block |
---|
|
$ petalinux-boot --qemu --u-boot --qemu-args "-net nic -net nic -net nic -net nic -net user,tftp=images/linux" |
Run Xen dom0 on HW
To use the prebuilt Xen on hardware:
Code Block |
---|
|
$ petalinux-boot --jtag --prebuilt 2 |
To use the Xen you built yourself run:
Code Block |
---|
|
$ petalinux-boot --jtag --u-boot |
You should eventually see something similar to this, when you do press any key to stop the autoboot.
Code Block |
---|
|
Hit any key to stop autoboot: |
If u-boot wasn't able to get an IP address from the DHCP server you may need to manually set the serverip (it's typically 10.0.2.2 for QEMU):
Code Block |
---|
|
u-boot> setenv serverip 10.0.2.2
u-boot> setenv serverip 10.0.2.15 |
Now to download and boot Xen, if running on QEMU, use xen-qemu.dtb otherwise use xen.dtb. Example:
TFTPing Xen using ImageBuilder
ImageBuilder is a set of Open Source community scripts to automatically configure a Xen system with Dom0 and multiple Dom0-less VMs for booting. ImageBuilder can generate a U-Boot script that loads all of the binaries automatically and boot the full system quickly. ImageBuilder is available here. The main script is scripts/uboot-script-gen and its usage is described in details on the Xen Project wikipage.
Petalinux prebuilt binaries can be used in a config file as follows for uboot-script-gen:
Code Block |
---|
|
MEMORY_START="0x0"
MEMORY_END="0x80000000"
DEVICE_TREE="xen.dtb"
XEN="xen"
DOM0_KERNEL="xen-Image"
DOM0_RAMDISK="xen-rootfs.cpio.gz"
NUM_DOMUS=0
UBOOT_SOURCE="boot.source"
UBOOT_SCRIPT="boot.scr" |
Now uboot-script-gen can be used to generate boot.scr:
Code Block |
---|
|
$ bash ./scripts/uboot-script-gen -c config -d . -t tftp |
Boot the system with the following uboot command (assuming the tftp serverip is 10.0.2.2, which is typically the value for QEMU):
Code Block |
---|
|
u-boot> setenv serverip 10.0.2.2
u-boot> tftpb 0xC00000 boot.scr; source 0xC00000 |
The Xen and Dom0 command line are generated by uboot-script-gen. If you would like to change anything, for instance increase the dom0 memory allocation, it is always possible by editing boot.source. Simply do the following:
- edit boot.source, change dom0_mem to dom0_mem=2G
- regenerate boot.scr with the following command: mkimage -A arm64 -T script -C none -a 0xC00000 -e 0xC00000 -d boot.source boot.scr
...