[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Viryaos-discuss] [ImageBuilder] [PATCH 1/2] uboot-script-gen: Skip dom0 instead of exiting if DOM0_KERNEL is not set



On 6/23/22 13:01, Ayan Kumar Halder wrote:
(Resending mail, as the previous delivery failed)

On 21/06/2022 11:57, Ayan Kumar Halder wrote:
1. In README.md, please mention in 'DOM0_KERNEL' description that it is an optional parameter. When user does not provide this, it generates a dom0less configuration.

Sure. This patch has been already merged upstream so I will do with a follow-on patch.


2. In uboot-script-gen, please provide a check like this :-

if test -z "$DOM0_KERNEL"

then

    if test "DOM0_MEM" || "DOM0_VCPUS" || "DOM0_COLORS" || "DOM0_CMD" || "DOM0_RAMDISK" || "DOM0_ROOTFS"

    then

        echo "For Domoless configuration, "DOM0_MEM" || "DOM0_VCPUS" || "DOM0_COLORS" || "DOM0_CMD" || "DOM0_RAMDISK" || "DOM0_ROOTFS" should not be defined

        exit 1

    fi

fi

The reason is that user should not be allowed to provide with an incorrect configuration.

Sure. I will do with a follow-on patch.

3. Please test the patch for both dom0 and dom0less. The reason being such a change might break something. :)

- Ayan

On 19/06/2022 13:43, Xenia Ragiadakou wrote:
When the parameter DOM0_KERNEL is not specified and NUM_DOMUS is not 0,
instead of failing the script, just skip any dom0 specific setup.
This way the script can be used to boot XEN in dom0less mode.

Signed-off-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>
---
  scripts/uboot-script-gen | 60 ++++++++++++++++++++++++++++------------
  1 file changed, 43 insertions(+), 17 deletions(-)

diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index 455b4c0..bdc8a6b 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -168,10 +168,15 @@ function xen_device_tree_editing()
      dt_set "/chosen" "#address-cells" "hex" "0x2"
      dt_set "/chosen" "#size-cells" "hex" "0x2"
      dt_set "/chosen" "xen,xen-bootargs" "str" "$XEN_CMD"
-    dt_mknode "/chosen" "dom0"
-    dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" -    dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)"
-    dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD"
+
+    if test "$DOM0_KERNEL"
+    then
+        dt_mknode "/chosen" "dom0"
+        dt_set "/chosen/dom0" "compatible" "str_a" "xen,linux-zimage xen,multiboot-module multiboot,module" +        dt_set "/chosen/dom0" "reg" "hex" "0x0 $dom0_kernel_addr 0x0 $(printf "0x%x" $dom0_kernel_size)"
+        dt_set "/chosen" "xen,dom0-bootargs" "str" "$DOM0_CMD"
+    fi
+
      if test "$DOM0_RAMDISK" && test $ramdisk_addr != "-"
      then
          dt_mknode "/chosen" "dom0-ramdisk"
@@ -203,7 +208,10 @@ function xen_device_tree_editing()
              add_device_tree_static_mem "/chosen/domU$i" "${DOMU_STATIC_MEM[$i]}"
          fi
          dt_set "/chosen/domU$i" "vpl011" "hex" "0x1"
-        dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled"
+        if test "$DOM0_KERNEL"
+        then
+            dt_set "/chosen/domU$i" "xen,enhanced" "str" "enabled"
+        fi
            if test "${DOMU_COLORS[$i]}"
          then
@@ -433,6 +441,19 @@ function xen_config()
              DOM0_CMD="$DOM0_CMD root=$root_dev"
          fi
      fi
+    if test -z "$DOM0_KERNEL"
+    then
+        if test "$NUM_DOMUS" -eq "0"
+        then
+            echo "Neither dom0 or domUs are specified, exiting."
+            exit 1
+        fi
+        echo "Dom0 kernel is not specified, continue with dom0less setup."
+        unset DOM0_RAMDISK
+        # Remove dom0 specific parameters from the XEN command line.
+        local params=($XEN_CMD)
+        XEN_CMD="${params[@]/dom0*/}"
+    fi
      i=0
      while test $i -lt $NUM_DOMUS
      do
@@ -490,11 +511,13 @@ generate_uboot_images()
    xen_file_loading()
  {
-    check_compressed_file_type $DOM0_KERNEL "executable"
-    dom0_kernel_addr=$memaddr
-    load_file $DOM0_KERNEL "dom0_linux"
-    dom0_kernel_size=$filesize
-
+    if test "$DOM0_KERNEL"
+    then
+        check_compressed_file_type $DOM0_KERNEL "executable"
+        dom0_kernel_addr=$memaddr
+        load_file $DOM0_KERNEL "dom0_linux"
+        dom0_kernel_size=$filesize
+    fi
      if test "$DOM0_RAMDISK"
      then
          check_compressed_file_type $DOM0_RAMDISK "cpio archive"
@@ -597,14 +620,16 @@ bitstream_load_and_config()
    create_its_file_xen()
  {
-    if test "$ramdisk_addr" != "-"
+    if test "$DOM0_KERNEL"
      then
-        load_files="\"dom0_linux\", \"dom0_ramdisk\""
-    else
-        load_files="\"dom0_linux\""
-    fi
-    # xen below
-    cat >> "$its_file" <<- EOF
+        if test "$ramdisk_addr" != "-"
+        then
+            load_files="\"dom0_linux\", \"dom0_ramdisk\""
+        else
+            load_files="\"dom0_linux\""
+        fi
+        # xen below
+        cat >> "$its_file" <<- EOF
          dom0_linux {
              description = "dom0 linux kernel binary";
              data = /incbin/("$DOM0_KERNEL");
@@ -616,6 +641,7 @@ create_its_file_xen()
              $fit_algo
          };
      EOF
+    fi
      # domUs
      i=0
      while test $i -lt $NUM_DOMUS



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.