Xen 4.12.2

https://wiki.xenproject.org/wiki/Xen_on_ARM_and_Yocto

https://xilinx-wiki.atlassian.net/wiki/spaces/A/pages/1696137838/Building+Xen+Hypervisor+through+Yocto+Flow

https://dornerworks.com/blog/including-custom-executables-and-libraries-in-your-embedded-linux-image-with-yocto/


OBS: You need to set the /bin path (that contains all binaries) into the PATH env variable:

export PATH+=":~/<path_to_workfolder>/poky/bitbake/bin"
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/home/sargx/.local/share/JetBrains/Toolbox/scripts

Here is the output of the build process:

We only care about the two bin images A and B, where A stands for the “Linux Kernel for DOM0” and B stands for the “Xen Image”.

sudo qemu-system-aarch64 -D ./qemu-log.txt -machine virt,gic_version=3 -machine virtualization=true -cpu cortex-a57 -machine type=virt -m 4096 -smp 4 -bios u-boot.bin -device loader,file=xen-qemuarm64,force-raw=on,addr=0x49000000 -device loader,file=dom0-kernel.bin,addr=0x47000000 -device loader,file=vmlinuz-lts,addr=0x53000000 -device loader,file=virt-gicv3.dtb,addr=0x44000000 -device loader,file=dom0.rootfs.cpio.gz,addr=0x41809342 -device loader,file=rootfs.cpio.gz,addr=0x58000000 -nographic -no-reboot -chardev socket,id=qemu-monitor,host=localhost,port=7777,server,nowait,telnet -mon qemu-monitor,mode=readline > /dev/stdout

This is my final note:

printf "%x\n" `stat -c "%s" vmlinuz-lts`
0x80dc38
 
printf "%x\n" `stat -c "%s" dom0-kernel.bin`
0xe9fa00
 
printf "%x\n" `stat -c "%s" xen-qemuarm64`
0xd0550
 
printf "%x\n" `stat -c "%s" dom0.rootfs.cpio.gz`
0x27f6cbe
 
printf "%x\n" `stat -c "%s" rootfs.cpio.gz`
0x11af01
 
printf "%x\n" `stat -c "%s" virt-gicv3.dtb`
0x1efa
 
---------------------------------------------------------
 
DOM0-ROOTFS  = 0x41809342 ---------- 0x44000000
DEVICE-TREE  = 0x44000000 ---------- 0x44001EFA
DOM0-KERNEL  = 0x47000000 ---------- 0x47E9FA00
XEN-KERNEL   = 0x49000000 ---------- 0x490D0550
DOMU-KERNEL  = 0x53000000 ---------- 0x5380DC38
DOMU-ROOTFS  = 0x58000000 ---------- 0x5811AF01
 
---------------------------------------------------------
 
sudo qemu-system-aarch64 -D ./qemu-log.txt -machine virt,gic_version=3 -machine virtualization=true -cpu cortex-a57 -machine type=virt -m 4096 -smp 4 -bios u-boot.bin -device loader,file=xen-qemuarm64,force-raw=on,addr=0x49000000 -device loader,file=dom0-kernel.bin,addr=0x47000000 -device loader,file=vmlinuz-lts,addr=0x53000000 -device loader,file=virt-gicv3.dtb,addr=0x44000000 -device loader,file=dom0.rootfs.cpio.gz,addr=0x41809342 -device loader,file=rootfs.cpio.gz,addr=0x58000000 -nographic -no-reboot -chardev socket,id=qemu-monitor,host=localhost,port=7777,server,nowait,telnet -mon qemu-monitor,mode=readline > /dev/stdout
 
---------------------------------------------------------
 
fdt addr 0x44000000
 
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 "xen,linux-zimage" "xen,multiboot-module"
fdt set /chosen/module@0 reg <0x47000000 0xe9fa00>
fdt set /chosen/module@0 bootargs "rw root=/dev/ram rdinit=/sbin/init   earlyprintk=serial,ttyAMA0 console=hvc0 earlycon=xenboot"
 
fdt resize
 
fdt mknod /chosen module@1
 
fdt set /chosen/module@1 compatible "xen,linux-initrd" "xen,multiboot-module"
fdt set /chosen/module@1 reg <0x41809342 0x27f6cbe>
 
fdt mknod /chosen domU1
 
fdt set /chosen/domU1 compatible "xen,domain"
fdt set /chosen/domU1 \#address-cells <1>
fdt set /chosen/domU1 \#size-cells <1>
fdt set /chosen/domU1 \cpus <1>
fdt set /chosen/domU1 \memory <0 548576>
fdt set /chosen/domU1 vpl011
 
fdt mknod /chosen/domU1 module@0
 
fdt set /chosen/domU1/module@0 compatible "multiboot,kernel" "multiboot,module"
fdt set /chosen/domU1/module@0 reg <0x53000000 0x80dc38>
fdt set /chosen/domU1/module@0 bootargs "rw root=/dev/ram rdinit=/sbin/init console=ttyAMA0"
 
fdt mknod /chosen/domU1 module@1
 
fdt set /chosen/domU1/module@1 compatible "multiboot,ramdisk" "multiboot,module"
fdt set /chosen/domU1/module@1 reg <0x58000000 0x11af01>
 
booti 0x49000000 - 0x44000000

The device tree:

/dts-v1/;
 
/ {
	interrupt-parent = <0x8005>;
	#size-cells = <0x02>;
	#address-cells = <0x02>;
	compatible = "linux,dummy-virt";
 
	psci {
		migrate = <0xc4000005>;
		cpu_on = <0xc4000003>;
		cpu_off = <0x84000002>;
		cpu_suspend = <0xc4000001>;
		method = "smc";
		compatible = "arm,psci-0.2\0arm,psci";
	};
 
	memory@40000000 {
		reg = <0x00 0x40000000 0x01 0x00>;
		device_type = "memory";
	};
 
	platform@c000000 {
		interrupt-parent = <0x8005>;
		ranges = <0x00 0x00 0xc000000 0x2000000>;
		#address-cells = <0x01>;
		#size-cells = <0x01>;
		compatible = "qemu,platform\0simple-bus";
	};
 
	fw-cfg@9020000 {
		dma-coherent;
		reg = <0x00 0x9020000 0x00 0x18>;
		compatible = "qemu,fw-cfg-mmio";
	};
 
	virtio_mmio@a000000 {
		dma-coherent;
		interrupts = <0x00 0x10 0x01>;
		reg = <0x00 0xa000000 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a000200 {
		dma-coherent;
		interrupts = <0x00 0x11 0x01>;
		reg = <0x00 0xa000200 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a000400 {
		dma-coherent;
		interrupts = <0x00 0x12 0x01>;
		reg = <0x00 0xa000400 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a000600 {
		dma-coherent;
		interrupts = <0x00 0x13 0x01>;
		reg = <0x00 0xa000600 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a000800 {
		dma-coherent;
		interrupts = <0x00 0x14 0x01>;
		reg = <0x00 0xa000800 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a000a00 {
		dma-coherent;
		interrupts = <0x00 0x15 0x01>;
		reg = <0x00 0xa000a00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a000c00 {
		dma-coherent;
		interrupts = <0x00 0x16 0x01>;
		reg = <0x00 0xa000c00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a000e00 {
		dma-coherent;
		interrupts = <0x00 0x17 0x01>;
		reg = <0x00 0xa000e00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001000 {
		dma-coherent;
		interrupts = <0x00 0x18 0x01>;
		reg = <0x00 0xa001000 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001200 {
		dma-coherent;
		interrupts = <0x00 0x19 0x01>;
		reg = <0x00 0xa001200 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001400 {
		dma-coherent;
		interrupts = <0x00 0x1a 0x01>;
		reg = <0x00 0xa001400 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001600 {
		dma-coherent;
		interrupts = <0x00 0x1b 0x01>;
		reg = <0x00 0xa001600 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001800 {
		dma-coherent;
		interrupts = <0x00 0x1c 0x01>;
		reg = <0x00 0xa001800 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001a00 {
		dma-coherent;
		interrupts = <0x00 0x1d 0x01>;
		reg = <0x00 0xa001a00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001c00 {
		dma-coherent;
		interrupts = <0x00 0x1e 0x01>;
		reg = <0x00 0xa001c00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a001e00 {
		dma-coherent;
		interrupts = <0x00 0x1f 0x01>;
		reg = <0x00 0xa001e00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002000 {
		dma-coherent;
		interrupts = <0x00 0x20 0x01>;
		reg = <0x00 0xa002000 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002200 {
		dma-coherent;
		interrupts = <0x00 0x21 0x01>;
		reg = <0x00 0xa002200 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002400 {
		dma-coherent;
		interrupts = <0x00 0x22 0x01>;
		reg = <0x00 0xa002400 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002600 {
		dma-coherent;
		interrupts = <0x00 0x23 0x01>;
		reg = <0x00 0xa002600 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002800 {
		dma-coherent;
		interrupts = <0x00 0x24 0x01>;
		reg = <0x00 0xa002800 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002a00 {
		dma-coherent;
		interrupts = <0x00 0x25 0x01>;
		reg = <0x00 0xa002a00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002c00 {
		dma-coherent;
		interrupts = <0x00 0x26 0x01>;
		reg = <0x00 0xa002c00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a002e00 {
		dma-coherent;
		interrupts = <0x00 0x27 0x01>;
		reg = <0x00 0xa002e00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003000 {
		dma-coherent;
		interrupts = <0x00 0x28 0x01>;
		reg = <0x00 0xa003000 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003200 {
		dma-coherent;
		interrupts = <0x00 0x29 0x01>;
		reg = <0x00 0xa003200 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003400 {
		dma-coherent;
		interrupts = <0x00 0x2a 0x01>;
		reg = <0x00 0xa003400 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003600 {
		dma-coherent;
		interrupts = <0x00 0x2b 0x01>;
		reg = <0x00 0xa003600 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003800 {
		dma-coherent;
		interrupts = <0x00 0x2c 0x01>;
		reg = <0x00 0xa003800 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003a00 {
		dma-coherent;
		interrupts = <0x00 0x2d 0x01>;
		reg = <0x00 0xa003a00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003c00 {
		dma-coherent;
		interrupts = <0x00 0x2e 0x01>;
		reg = <0x00 0xa003c00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	virtio_mmio@a003e00 {
		dma-coherent;
		interrupts = <0x00 0x2f 0x01>;
		reg = <0x00 0xa003e00 0x00 0x200>;
		compatible = "virtio,mmio";
	};
 
	gpio-keys {
		#address-cells = <0x01>;
		#size-cells = <0x00>;
		compatible = "gpio-keys";
 
		poweroff {
			gpios = <0x8007 0x03 0x00>;
			linux,code = <0x74>;
			label = "GPIO Key Poweroff";
		};
	};
 
	pl061@9030000 {
		phandle = <0x8007>;
		clock-names = "apb_pclk";
		clocks = <0x8000>;
		interrupts = <0x00 0x07 0x04>;
		gpio-controller;
		#gpio-cells = <0x02>;
		compatible = "arm,pl061\0arm,primecell";
		reg = <0x00 0x9030000 0x00 0x1000>;
	};
 
	pcie@10000000 {
		interrupt-map-mask = <0x1800 0x00 0x00 0x07>;
		interrupt-map = <0x00 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x03 0x04 0x00 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x04 0x04 0x00 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x05 0x04 0x00 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x06 0x04 0x800 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x04 0x04 0x800 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x05 0x04 0x800 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x06 0x04 0x800 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x03 0x04 0x1000 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x05 0x04 0x1000 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x06 0x04 0x1000 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x03 0x04 0x1000 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x04 0x04 0x1800 0x00 0x00 0x01 0x8005 0x00 0x00 0x00 0x06 0x04 0x1800 0x00 0x00 0x02 0x8005 0x00 0x00 0x00 0x03 0x04 0x1800 0x00 0x00 0x03 0x8005 0x00 0x00 0x00 0x04 0x04 0x1800 0x00 0x00 0x04 0x8005 0x00 0x00 0x00 0x05 0x04>;
		#interrupt-cells = <0x01>;
		ranges = <0x1000000 0x00 0x00 0x00 0x3eff0000 0x00 0x10000 0x2000000 0x00 0x10000000 0x00 0x10000000 0x00 0x2eff0000 0x3000000 0x80 0x00 0x80 0x00 0x80 0x00>;
		reg = <0x40 0x10000000 0x00 0x10000000>;
		msi-parent = <0x8006>;
		dma-coherent;
		bus-range = <0x00 0xff>;
		linux,pci-domain = <0x00>;
		#size-cells = <0x02>;
		#address-cells = <0x03>;
		device_type = "pci";
		compatible = "pci-host-ecam-generic";
	};
 
	pl031@9010000 {
		clock-names = "apb_pclk";
		clocks = <0x8000>;
		interrupts = <0x00 0x02 0x04>;
		reg = <0x00 0x9010000 0x00 0x1000>;
		compatible = "arm,pl031\0arm,primecell";
	};
 
	pl011@9000000 {
		clock-names = "uartclk\0apb_pclk";
		clocks = <0x8000 0x8000>;
		interrupts = <0x00 0x01 0x04>;
		reg = <0x00 0x9000000 0x00 0x1000>;
		compatible = "arm,pl011\0arm,primecell";
	};
 
	pmu {
		interrupts = <0x01 0x07 0x04>;
		compatible = "arm,armv8-pmuv3";
	};
 
	intc@8000000 {
		phandle = <0x8005>;
		interrupts = <0x01 0x09 0x04>;
		reg = <0x00 0x8000000 0x00 0x10000 0x00 0x80a0000 0x00 0xf60000>;
		#redistributor-regions = <0x01>;
		compatible = "arm,gic-v3";
		ranges;
		#size-cells = <0x02>;
		#address-cells = <0x02>;
		interrupt-controller;
		#interrupt-cells = <0x03>;
 
		its@8080000 {
			phandle = <0x8006>;
			reg = <0x00 0x8080000 0x00 0x20000>;
			msi-controller;
			compatible = "arm,gic-v3-its";
		};
	};
 
	flash@0 {
		bank-width = <0x04>;
		reg = <0x00 0x00 0x00 0x4000000 0x00 0x4000000 0x00 0x4000000>;
		compatible = "cfi-flash";
	};
 
	cpus {
		#size-cells = <0x00>;
		#address-cells = <0x01>;
 
		cpu-map {
 
			socket0 {
 
				cluster0 {
 
					core0 {
						cpu = <0x8004>;
					};
 
					core1 {
						cpu = <0x8003>;
					};
 
					core2 {
						cpu = <0x8002>;
					};
 
					core3 {
						cpu = <0x8001>;
					};
				};
			};
		};
 
		cpu@0 {
			phandle = <0x8004>;
			reg = <0x00>;
			enable-method = "psci";
			compatible = "arm,cortex-a57";
			device_type = "cpu";
		};
 
		cpu@1 {
			phandle = <0x8003>;
			reg = <0x01>;
			enable-method = "psci";
			compatible = "arm,cortex-a57";
			device_type = "cpu";
		};
 
		cpu@2 {
			phandle = <0x8002>;
			reg = <0x02>;
			enable-method = "psci";
			compatible = "arm,cortex-a57";
			device_type = "cpu";
		};
 
		cpu@3 {
			phandle = <0x8001>;
			reg = <0x03>;
			enable-method = "psci";
			compatible = "arm,cortex-a57";
			device_type = "cpu";
		};
	};
 
	timer {
		interrupts = <0x01 0x0d 0x04 0x01 0x0e 0x04 0x01 0x0b 0x04 0x01 0x0a 0x04>;
		always-on;
		compatible = "arm,armv8-timer\0arm,armv7-timer";
	};
 
	apb-pclk {
		phandle = <0x8000>;
		clock-output-names = "clk24mhz";
		clock-frequency = <0x16e3600>;
		#clock-cells = <0x00>;
		compatible = "fixed-clock";
	};
 
	chosen {
		stdout-path = "/pl011@9000000";
		kaslr-seed = <0xdf56bde5 0xff6d9214>;
	};
};

🌱 Back to Garden