[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


  • To: Xenia Ragiadakou <burzalodowa@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Thu, 23 Jun 2022 11:01:37 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=QchqiwzMhFPp3iADoHJex6tyQYZPXj1IG5hE14D1wWE=; b=RFWL+GOxoKi8YMWBnID6HjIvqV4Wx7pllkRNMhijw4pvzQ6FNeVry0ub9e40H+UZSOgoCBjx3n9XCMWtkahcWG0AR1g6uf//4eNCd4JL34/tzbmj5GPEMQA09lUggBxHnYntYZvAmnfEi2djGkRxopYXs8epCs0/nyoKF/ss7EX2C1MtEAXB1XWk01K2E/YMobWEIl+M4SuIa091sADoXiWVG9Swqy5H1QGuM8mQVZr5siAlonPHNK9wvd00ck8qNRs+nVr3FWFHXkJI7bd6K616l5HMvZFQRmiuDTRh7pfjB0c3krGgfh0o+cXBRBJaD4BTNp66QMDc9sWvViFOLQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BAUdodlVXEMz28ush/AUBB2qdeafSHPKTqUcJIl7nKIzCP5uGxWCrVsbR8HURgt17L9kGHDuHkCbuIcq9eoXN91fDmonlLkQoGuVMGqvUT35vHSmPhU7wZFyAZt8hzfuCL3BE9fceqvro4Pbpf9biugpwkL7TWwRvLO1CjEIOTtLcXgdagSSN1s0XXtxdvnZp1Nu9zmluJ9kLckLGS7h4QGVeMHDyOhizT5UKYYRoOf0Z8rEfKe9wSwR9pzZtrSlPdTwPWRzrnP/J2psN21ts5rhrV5nvJl4+BLerM2EK5CfES/AwX4m9LfxN4t+aWQZd72JqVvPULLcRbE9+NgvPg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: viryaos-discuss@xxxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 23 Jun 2022 10:08:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

(Resending mail, as the previous delivery failed)

On 21/06/2022 11:57, Ayan Kumar Halder wrote:
Hi Xenia,

Thanks for the change. It looks good.

Some points :-

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.

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.

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®.