summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com>2023-07-27 17:22:29 -0600
committerBruce Ashfield <bruce.ashfield@gmail.com>2023-08-01 14:41:45 -0400
commit7332b594729085c5cd74fdad516ff977578017fc (patch)
tree27fb5c3f081dde9f48460d45fa8bcd6e83b110f6
parentc9b65ee0e53cba999b8061b72039f108187b9600 (diff)
downloadmeta-virtualization-7332b594729085c5cd74fdad516ff977578017fc.tar.gz
recipes-bsp: Add u-boot-xlnx scripts for Xen support
Add new boot.cmd.xen to u-boot-xlnx-scr bbappend to enable Xen support for ZynqMP and Versal devices. User can enable xen u-boot script by adding below variable from configuration file. BOOTMODE = "xen" This u-boot script also supports to configure below Xen params from configuration file params variable assignment ------ ------------------- duart XEN_SERIAL_CONSOLES = "serial0" dom0_mem DOM0_MEM = "1500M" dom0_max_vcpus DOM0_MAX_VCPUS = "1" extra params XEN_CMDLINE_APPEND = "loglvl=all" Signed-off-by: Sandeep Gundlupet Raju <sandeep.gundlupet-raju@amd.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r--dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr.bbappend2
-rw-r--r--dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.xen80
-rw-r--r--dynamic-layers/xilinx/recipes-bsp/u-boot/xen-boot-cmd.inc38
3 files changed, 120 insertions, 0 deletions
diff --git a/dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr.bbappend b/dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr.bbappend
new file mode 100644
index 00000000..ae847cbc
--- /dev/null
+++ b/dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr.bbappend
@@ -0,0 +1,2 @@
1# Include xen-boot-cmd.inc only if xen distro features is enabled.
2include ${@bb.utils.contains('DISTRO_FEATURES', 'xen', 'xen-boot-cmd.inc', '', d)}
diff --git a/dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.xen b/dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.xen
new file mode 100644
index 00000000..25e5842c
--- /dev/null
+++ b/dynamic-layers/xilinx/recipes-bsp/u-boot/u-boot-xlnx-scr/boot.cmd.xen
@@ -0,0 +1,80 @@
1# This is a boot script for U-Boot with Xen parameters used by yocto machine
2# configuration file.
3# Generate boot.scr:
4# mkimage -c none -A arm -T script -d boot.cmd.xen boot.scr
5#
6################
7xen_name=@@XEN_IMAGE_NAME@@
8kernel_name=@@KERNEL_IMAGE@@
9rootfs_name=@@RAMDISK_IMAGE@@
10@@PRE_BOOTENV@@
11
12for boot_target in ${boot_targets};
13do
14 echo "Trying to load boot images from ${boot_target}"
15 if test "${boot_target}" = "jtag" ; then
16 tftpboot @@KERNEL_LOAD_ADDRESS@@ ${kernel_name}
17 setenv kernel_size 0x$filesize;
18 tftpboot @@RAMDISK_IMAGE_ADDRESS@@ ${rootfs_name}
19 setenv ramdisk_size 0x$filesize;
20 tftpboot @@XEN_LOAD_ADDRESS@@ ${xen_name}
21 tftpboot @@DEVICETREE_ADDRESS@@ system.dtb
22 fi
23 if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1" || test "${boot_target}" = "usb0" || test "${boot_target}" = "usb1"; then
24 if test "${boot_target}" = "mmc0" || test "${boot_target}" = "mmc1"; then
25 setenv bootdev mmcblk${devnum}p
26 fi
27 if test "${boot_target}" = "usb0" || test "${boot_target}" = "usb1"; then
28 setenv bootdev sda
29 fi
30 echo "Checking for /${xen_name}"
31 if test -e ${devtype} ${devnum}:${distro_bootpart} /${xen_name}; then
32 echo "Loading ${xen_name}";
33 fatload ${devtype} ${devnum}:${distro_bootpart} @@XEN_LOAD_ADDRESS@@ ${xen_name};
34 fi
35 echo "Checking for /${kernel_name}"
36 if test -e ${devtype} ${devnum}:${distro_bootpart} /${kernel_name}; then
37 echo "Loading ${kernel_name}";
38 fatload ${devtype} ${devnum}:${distro_bootpart} @@KERNEL_LOAD_ADDRESS@@ ${kernel_name};
39 setenv kernel_size 0x$filesize;
40 fi
41 echo "Checking for /system.dtb"
42 if test -e ${devtype} ${devnum}:${distro_bootpart} /system.dtb; then
43 echo "Loading system.dtb";
44 fatload ${devtype} ${devnum}:${distro_bootpart} @@DEVICETREE_ADDRESS@@ system.dtb;
45 fi
46 echo "Checking for /${rootfs_name}"
47 if test -e ${devtype} ${devnum}:${distro_bootpart} /${rootfs_name} && test "${skip_ramdisk}" != "yes"; then
48 echo "Loading ${rootfs_name}";
49 fatload ${devtype} ${devnum}:${distro_bootpart} @@RAMDISK_IMAGE_ADDRESS@@ ${rootfs_name};
50 setenv ramdisk_size 0x$filesize;
51 fi
52 fi
53 fdt addr @@DEVICETREE_ADDRESS@@
54 fdt resize 0x1000
55 fdt get value bootargs /chosen bootargs
56 fdt set /chosen \#address-cells <0x2>
57 fdt set /chosen \#size-cells <0x2>
58 setenv xen_bootargs "console=dtuart dtuart=@@XEN_SERIAL_CONSOLES@@ dom0_mem=@@DOM0_MEM@@ dom0_max_vcpus=@@DOM0_MAX_VCPUS@@ bootscrub=0 vwfi=native @@XEN_CMDLINE_APPEND@@"
59 fdt set /chosen xen,xen-bootargs \"${xen_bootargs}\"
60
61 # Check that env $ramdisk_size is 0 or not.
62 if test -n ${ramdisk_size}; then
63 fdt mknod /chosen dom0-ramdisk
64 fdt set /chosen/dom0-ramdisk compatible "xen,linux-initrd" "xen,multiboot-module" "multiboot,module"
65 fdt set /chosen/dom0-ramdisk reg <0x0 @@RAMDISK_IMAGE_ADDRESS@@ 0x0 ${ramdisk_size}>
66 setenv rootfs_param @@KERNEL_ROOT_RAMDISK@@
67 else
68 setenv rootfs_param @@KERNEL_ROOT_SD@@
69 fi
70
71 fdt mknod /chosen dom0
72 fdt set /chosen/dom0 compatible "xen,linux-zimage" "xen,multiboot-module" "multiboot,module"
73 fdt set /chosen/dom0 reg <0x0 @@KERNEL_LOAD_ADDRESS@@ 0x0 ${kernel_size}>
74 setenv dom0_bootargs "console=hvc0 earlycon=xen earlyprintk=xen clk_ignore_unused ${rootfs_param}"
75 fdt set /chosen xen,dom0-bootargs \"${dom0_bootargs}\"
76
77 setenv fdt_high 0xffffffffffffffff
78
79 @@KERNEL_BOOTCMD@@ @@XEN_LOAD_ADDRESS@@ - @@DEVICETREE_ADDRESS@@
80done
diff --git a/dynamic-layers/xilinx/recipes-bsp/u-boot/xen-boot-cmd.inc b/dynamic-layers/xilinx/recipes-bsp/u-boot/xen-boot-cmd.inc
new file mode 100644
index 00000000..38f6f267
--- /dev/null
+++ b/dynamic-layers/xilinx/recipes-bsp/u-boot/xen-boot-cmd.inc
@@ -0,0 +1,38 @@
1FILESEXTRAPATHS:append := ":${THISDIR}/u-boot-xlnx-scr"
2
3SRC_URI += "file://boot.cmd.xen"
4
5# Image offsets for Xen boot
6KERNEL_OFFSET:zynqmp ?= "0xE00000"
7KERNEL_OFFSET:versal ?= "0xE00000"
8
9DEVICETREE_OFFSET:zynqmp ?= "0xC000000"
10DEVICETREE_OFFSET:versal ?= "0xC000000"
11
12RAMDISK_OFFSET:zynqmp ?= "0x2400000"
13RAMDISK_OFFSET:versal ?= "0x2400000"
14
15XEN_OFFSET:zynqmp ?= "0xBA00000"
16XEN_OFFSET:versal ?= "0xBA00000"
17XEN_LOAD_ADDRESS ?= "${@append_baseaddr(d,d.getVar('XEN_OFFSET'))}"
18
19# If dom0-ramdisk is used for Xen boot then set RAMDISK image to cpio.gz
20XEN_IMAGE_NAME ?= "xen"
21RAMDISK_IMAGE = "rootfs.cpio.gz"
22
23# Set the amount of memory for dom0 depending on total available memory size(DDR).
24DOM0_MEM ?= "1500M"
25
26# Specify which UART console Xen should use. You can sepecify the devicetree
27# alias or full path to a node in the devicetree
28# XEN_SERIAL_CONSOLES ?= "serial0" or XEN_SERIAL_CONSOLES ?= "/axi/serial@ff000000"
29XEN_SERIAL_CONSOLES ?= "serial0"
30
31# Specify additional Xen paramaters which will be appended to xen-bootargs
32# This can alos be used for debugging purposes.
33# Examples: XEN_CMDLINE_APPEND ?= "sched=credit loglvl=all guest_loglvl=debug"
34XEN_CMDLINE_APPEND ?= ""
35
36# Specify the max number of vcpus for dom0
37# Example usage: DOM0_MAX_VCPUS = "2" or DOM0_MAX_VCPUS = "2-4"
38DOM0_MAX_VCPUS ?= "1"