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

Re: [ImageBuilder] Add config option to use separate load commands for Xen, DOM0 and DOMU binaries


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Tue, 12 Aug 2025 16:20:41 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=QoQpcmomhMlZJ7ni8ZfszVR1brwT8moNASZf/uIEUPY=; b=JnNJ/wSVA976bYydPElpgiv7ggJPD5zSxq4i5yu9Ij8P5GpouilNLujBeLoyZfn44VwKNulqqbfhL9pm0fzsBd1/amWG+DY6a/wG8gSxtIcnMcACqx/DXvT+2tMkNQCc16ZjvVaZMb6zGlQPE6JFvdm9av51cFdtz1FrJHPu9E171jv2vBoHSEEryBTSaFPoAJ1wHv1tHbfqqTOUw0f5W4Fq20nDnJKtKsH+j+p4foewVYZ04pqWV613Q1lTwnw+MrjOQTeSwb94Qp8w9syF6pElHiF5jxtT/9FCrVuRwyTr+/4gFP1gUnFn3sQcJmtVzOhUiSpj3nj//vTEibH1Eg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yLZKPDje4izDOOLiqzSUNmVIsllcVXjmhK1yR+ci22uaSFthbTUZqwotBL5euCtM0P+oTCsYKabrhZJtg64qke9Q9u0G/kYn+TCCoMMi5zkk7yAnasHrBgBB0muS4vMhVMgWFMal9d5rnZmeXm1JyiVMRdGI0LmPtv4A2xd377OvRwBrZzCdf4Xv3APbBssXIrGBVLrZLLxTonGz9Mcqg+uY3dz5R72ksuJeEpM2OOSShQifSbFM+d/+niYO/DMpD2NekVpoQrYpmPdaclfo4J5Jytk4vE1x8K00mJ+AJPo8BO+BhUwv/Ab3OzeGjSDBKAX1etOZTdnHtbL7knMhmQ==
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <michal.orzel@xxxxxxx>
  • Delivery-date: Tue, 12 Aug 2025 15:20:50 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Hi Stefano,

On 11/08/2025 22:38, Stefano Stabellini wrote:
On Wed, 6 Aug 2025, Ayan Kumar Halder wrote:
Introduce the following options :-
1. XEN_LOAD - This specifies command to load xen hypervisor binary and device
tree.
2. DOM0_LOAD - This specifies command to load Dom0 binaries.
3. DOMU_LOAD[] - This specifies command to load DomU binaries.

There can be situations where Xen, Dom0 and DomU binaries are stored in
different partitions. Thus, imagebuilder should provide a way the binaries
using different commands.

If any of the above options are not specified, LOAD_CMD is used by default.

Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@xxxxxxx>
The patch is correct and the new config options look good. Two things.

The following check should be removed or, better, modified to account
for the new options:

     if test ! "$LOAD_CMD"
     then
         echo "LOAD_CMD not set, either specify it in the config or set it with the 
-t option"
         exit 1
     fi

Thanks to this patch, it shouldn't be necessary to specify LOAD_CMD any
longer.

Actually, we should keep this check when Linux is loaded (without Xen). IOW,

@@ -1557,6 +1551,11 @@ then
 elif test "$LINUX"
 then
     os="linux"
+    if test ! "$LOAD_CMD"
+    then
+        echo "LOAD_CMD not set, either specify it in the config or set it with the -t option"
+        exit 1
+    fi
     linux_config


find_root_dev and fit are the only two remaining users of LOAD_CMD.
While I think it makes sense to keep LOAD_CMD for fit, find_root_dev
should probably use DOM0_LOAD instead.
yes.

This incremental change (untested) should work. What do you think?



diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index 9e97944..867876f 100755
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -824,10 +824,10 @@ function check_compressed_file_type()
function find_root_dev()
  {
-
-    local dev=${LOAD_CMD%:*}
+    local load_cmd=$1
+    local dev=${load_cmd%:*}
      dev=${dev##* }
-    local par=${LOAD_CMD#*:}
+    local par=${load_cmd#*:}
if [ -z "$dev" ] || [ -z "$par" ]
      then
@@ -838,10 +838,10 @@ function find_root_dev()
par=$((par + 1)) - if [[ $LOAD_CMD =~ mmc ]]
+    if [[ $load_cmd =~ mmc ]]
      then
          root_dev="/dev/mmcblk${dev}p${par}"
-    elif [[ $LOAD_CMD =~ scsi ]]
+    elif [[ $load_cmd =~ scsi ]]
      then
          # converts number to a scsi device character
          dev=$((dev + 97))
@@ -912,7 +912,7 @@ function xen_config()
          then
              DOM0_CMD="$DOM0_CMD root=/dev/ram0"
          else
-            find_root_dev
+            find_root_dev "$DOM0_LOAD"
              # $root_dev is set by find_root_dev
              DOM0_CMD="$DOM0_CMD root=$root_dev"
          fi
@@ -960,7 +960,7 @@ function linux_config()
          then
              LINUX_CMD="$LINUX_CMD root=/dev/ram0"
          else
-            find_root_dev
+            find_root_dev "$LOAD_CMD"
              # $root_dev is set by find_root_dev
              LINUX_CMD="$LINUX_CMD root=$root_dev"
          fi
Till here the change looks ok.
@@ -990,10 +990,6 @@ generate_uboot_images()
xen_file_loading()
  {
-    if test -z "$DOM0_LOAD"
-    then
-        DOM0_LOAD="$LOAD_CMD"
-    fi
This and
      if test "$DOM0_KERNEL"
      then
          check_compressed_file_type $DOM0_KERNEL "executable\|uImage"
@@ -1065,11 +1061,6 @@ xen_file_loading()
          generate_uboot_images
      fi
- if test -z "${XEN_LOAD}"
-    then
-        XEN_LOAD="$LOAD_CMD"
-    fi
-

this, I have a concern about moving the changes out of xen_file_loading()

In xen_file_loading(), we set DOM0_LOAD, XEN_LOAD and DOMU_LOAD[i]. With this change, we set DOM0_LOAD , XEN_LOAD at the beginning of the script and DOMU_LOAD[i] in the function. This looks a bit odd to me.

Further DOM0_LOAD and XEN_LOAD should be set only when "$XEN" is set.

I can leave the change as it is in the current patch or I can move them to xen_config().

Please let me know your thoughts.

I have sent "[ImageBuilder v2] Add config option to use separate load commands for Xen, DOM0 and DOMU binaries" so that it becomes a bit clear.

- Ayan

      kernel_addr=$memaddr
      kernel_path=$XEN
      load_file "$XEN" "host_kernel" "$XEN_LOAD"
@@ -1518,12 +1509,22 @@ then
      FIT="${UBOOT_SOURCE%.source}.fit"
  fi
-if test ! "$LOAD_CMD"
+if test ! "$LOAD_CMD" && ! test "$XEN_LOAD"
  then
      echo "LOAD_CMD not set, either specify it in the config or set it with the -t 
option"
      exit 1
  fi
+if test -z "$DOM0_LOAD"
+then
+    DOM0_LOAD="$LOAD_CMD"
+fi
+
+if test -z "${XEN_LOAD}"
+then
+    XEN_LOAD="$LOAD_CMD"
+fi
+
  if test ! "$BOOT_CMD"
  then
      BOOT_CMD="booti"



 


Rackspace

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