[PATCH 3/3] CI: Adjust how domU is packaged in dom0

Andrew Cooper posted 3 patches 5 months, 1 week ago
There is a newer version of this series
[PATCH 3/3] CI: Adjust how domU is packaged in dom0
Posted by Andrew Cooper 5 months, 1 week ago
Package domU in /root for dom0 and insert into the uncompressed part of dom0's
rootfs, rather than recompressing it as part of the overlay.

For Qubes, this avoids putting the domU kernel in dom0's rootfs for tests
which aren't going to boot a guest.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/scripts/qubes-x86-64.sh            | 20 +++++++++++++------
 .../scripts/xilinx-smoke-dom0-x86_64.sh       | 16 +++++++++++----
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 1dd3f48b3d29..17a37134f46a 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -154,8 +154,8 @@ esac
 domU_config="
 type = '${domU_type}'
 name = 'domU'
-kernel = '/boot/vmlinuz'
-ramdisk = '/boot/initrd-domU'
+kernel = '/root/vmlinuz-domU'
+ramdisk = '/root/initrd-domU'
 cmdline = 'root=/dev/ram0 console=hvc0'
 memory = 512
 vif = [ ${domU_vif} ]
@@ -185,12 +185,24 @@ Kernel \r on an \m (\l)
     find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
     cd ..
     rm -rf rootfs
+
+    # Package domU kernel+rootfs in /root for dom0 (uncompressed)
+    mkdir -p rootfs/root
+    cd rootfs
+    cp ../binaries/bzImage root/vmlinuz-domU
+    cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
+    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+    cd ..
+    rm -rf rootfs
 fi
 
 # Dom0 rootfs.  The order or concatination is important; ucode wants to come
 # first, and all uncompressed must be ahead of compressed.
 parts=(
     binaries/ucode.cpio
+)
+[ -n "$domU_check" ] && parts+=(binaries/domU-in-dom0.cpio)
+parts+=(
     binaries/rootfs.cpio.gz
     binaries/xen-tools.cpio.gz
 )
@@ -238,10 +250,6 @@ mkdir -p etc/default
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
-cp ../binaries/bzImage boot/vmlinuz
-if [ -n "$domU_check" ]; then
-    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
-fi
 find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 0fbabb41054a..29817ff81d0a 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -22,8 +22,8 @@ DOMU_CMD=""
 DOMU_CFG='
 type = "pvh"
 name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
+kernel = "/root/vmlinuz-domU"
+ramdisk = "/root/initrd-domU"
 extra = "root=/dev/ram0 console=hvc0"
 memory = 512
 '
@@ -103,10 +103,20 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
+# Package domU kernel+rootfs in /root for dom0 (uncompressed)
+mkdir -p rootfs/root
+cd rootfs
+cp ../binaries/bzImage root/vmlinuz-domU
+cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
+find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+cd ..
+rm -rf rootfs
+
 # Dom0 rootfs.  The order or concatination is important; ucode wants to come
 # first, and all uncompressed must be ahead of compressed.
 parts=(
     binaries/ucode.cpio
+    binaries/domU-in-dom0.cpio
     binaries/rootfs.cpio.gz
     binaries/xen-tools.cpio.gz
 )
@@ -127,8 +137,6 @@ echo "${DOMU_CFG}${DOMU_CFG_EXTRA}" > etc/xen/domU.cfg
 echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
 echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
 mkdir -p var/log/xen/console
-cp ../binaries/bzImage boot/vmlinuz
-cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
 find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
-- 
2.39.5


Re: [PATCH 3/3] CI: Adjust how domU is packaged in dom0
Posted by Stefano Stabellini 5 months ago
On Thu, 22 May 2025, Andrew Cooper wrote:
> Package domU in /root for dom0 and insert into the uncompressed part of dom0's
> rootfs, rather than recompressing it as part of the overlay.
> 
> For Qubes, this avoids putting the domU kernel in dom0's rootfs for tests
> which aren't going to boot a guest.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
>  automation/scripts/qubes-x86-64.sh            | 20 +++++++++++++------
>  .../scripts/xilinx-smoke-dom0-x86_64.sh       | 16 +++++++++++----
>  2 files changed, 26 insertions(+), 10 deletions(-)
> 
> diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
> index 1dd3f48b3d29..17a37134f46a 100755
> --- a/automation/scripts/qubes-x86-64.sh
> +++ b/automation/scripts/qubes-x86-64.sh
> @@ -154,8 +154,8 @@ esac
>  domU_config="
>  type = '${domU_type}'
>  name = 'domU'
> -kernel = '/boot/vmlinuz'
> -ramdisk = '/boot/initrd-domU'
> +kernel = '/root/vmlinuz-domU'
> +ramdisk = '/root/initrd-domU'
>  cmdline = 'root=/dev/ram0 console=hvc0'
>  memory = 512
>  vif = [ ${domU_vif} ]
> @@ -185,12 +185,24 @@ Kernel \r on an \m (\l)
>      find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
>      cd ..
>      rm -rf rootfs
> +
> +    # Package domU kernel+rootfs in /root for dom0 (uncompressed)
> +    mkdir -p rootfs/root
> +    cd rootfs
> +    cp ../binaries/bzImage root/vmlinuz-domU
> +    cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
> +    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
> +    cd ..
> +    rm -rf rootfs
>  fi
>  
>  # Dom0 rootfs.  The order or concatination is important; ucode wants to come
>  # first, and all uncompressed must be ahead of compressed.
>  parts=(
>      binaries/ucode.cpio
> +)
> +[ -n "$domU_check" ] && parts+=(binaries/domU-in-dom0.cpio)

This is a NIT but I have been trying to avoid this format in favor of

if [ -n "$domU_check" ]
then
    parts+=(binaries/domU-in-dom0.cpio)
fi

for readibility.


I can see the patch is correct. It adds a bit of complexity in exchange
for a small improvement. I am not sure if the trade off is worth it, but
I'll ack it anyway.

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

I can change the style of the check on commit


> +parts+=(
>      binaries/rootfs.cpio.gz
>      binaries/xen-tools.cpio.gz
>  )
> @@ -238,10 +250,6 @@ mkdir -p etc/default
>  echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
>  echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
>  mkdir -p var/log/xen/console
> -cp ../binaries/bzImage boot/vmlinuz
> -if [ -n "$domU_check" ]; then
> -    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
> -fi
>  find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
>  cd ..
>  
> diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
> index 0fbabb41054a..29817ff81d0a 100755
> --- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
> +++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
> @@ -22,8 +22,8 @@ DOMU_CMD=""
>  DOMU_CFG='
>  type = "pvh"
>  name = "domU"
> -kernel = "/boot/vmlinuz"
> -ramdisk = "/boot/initrd-domU"
> +kernel = "/root/vmlinuz-domU"
> +ramdisk = "/root/initrd-domU"
>  extra = "root=/dev/ram0 console=hvc0"
>  memory = 512
>  '
> @@ -103,10 +103,20 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
>  cd ..
>  rm -rf rootfs
>  
> +# Package domU kernel+rootfs in /root for dom0 (uncompressed)
> +mkdir -p rootfs/root
> +cd rootfs
> +cp ../binaries/bzImage root/vmlinuz-domU
> +cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
> +find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
> +cd ..
> +rm -rf rootfs
> +
>  # Dom0 rootfs.  The order or concatination is important; ucode wants to come
>  # first, and all uncompressed must be ahead of compressed.
>  parts=(
>      binaries/ucode.cpio
> +    binaries/domU-in-dom0.cpio
>      binaries/rootfs.cpio.gz
>      binaries/xen-tools.cpio.gz
>  )
> @@ -127,8 +137,6 @@ echo "${DOMU_CFG}${DOMU_CFG_EXTRA}" > etc/xen/domU.cfg
>  echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
>  echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
>  mkdir -p var/log/xen/console
> -cp ../binaries/bzImage boot/vmlinuz
> -cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
>  find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
>  cd ..
>  
> -- 
> 2.39.5
> 
Re: [PATCH 3/3] CI: Adjust how domU is packaged in dom0
Posted by Andrew Cooper 5 months ago
On 28/05/2025 1:30 am, Stefano Stabellini wrote:
> On Thu, 22 May 2025, Andrew Cooper wrote:
>> diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
>> index 1dd3f48b3d29..17a37134f46a 100755
>> --- a/automation/scripts/qubes-x86-64.sh
>> +++ b/automation/scripts/qubes-x86-64.sh
>> @@ -185,12 +185,24 @@ Kernel \r on an \m (\l)
>>      find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
>>      cd ..
>>      rm -rf rootfs
>> +
>> +    # Package domU kernel+rootfs in /root for dom0 (uncompressed)
>> +    mkdir -p rootfs/root
>> +    cd rootfs
>> +    cp ../binaries/bzImage root/vmlinuz-domU
>> +    cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
>> +    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
>> +    cd ..
>> +    rm -rf rootfs
>>  fi
>>  
>>  # Dom0 rootfs.  The order or concatination is important; ucode wants to come
>>  # first, and all uncompressed must be ahead of compressed.
>>  parts=(
>>      binaries/ucode.cpio
>> +)
>> +[ -n "$domU_check" ] && parts+=(binaries/domU-in-dom0.cpio)
> This is a NIT but I have been trying to avoid this format in favor of
>
> if [ -n "$domU_check" ]
> then
>     parts+=(binaries/domU-in-dom0.cpio)
> fi
>
> for readibility.

This is a weird one, because the (relevant) readability is the
components of parts, and it's easier to scan without the extra blank
lines.  Nevertheless, ...

>
>
> I can see the patch is correct. It adds a bit of complexity in exchange
> for a small improvement. I am not sure if the trade off is worth it, but
> I'll ack it anyway.

... see the thread on the previous patch.  This was the RFC "I'd like to
find a nicer way of doing it", and Anthony has made a suggestion which I
need to experiment with.

> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Thanks, but do you have any input on the /boot vs /root question on the
other part of the thread?

~Andrew

Re: [PATCH 3/3] CI: Adjust how domU is packaged in dom0
Posted by Stefano Stabellini 5 months ago
On Wed, 28 May 2025, Andrew Cooper wrote:
> On 28/05/2025 1:30 am, Stefano Stabellini wrote:
> > On Thu, 22 May 2025, Andrew Cooper wrote:
> >> diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
> >> index 1dd3f48b3d29..17a37134f46a 100755
> >> --- a/automation/scripts/qubes-x86-64.sh
> >> +++ b/automation/scripts/qubes-x86-64.sh
> >> @@ -185,12 +185,24 @@ Kernel \r on an \m (\l)
> >>      find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
> >>      cd ..
> >>      rm -rf rootfs
> >> +
> >> +    # Package domU kernel+rootfs in /root for dom0 (uncompressed)
> >> +    mkdir -p rootfs/root
> >> +    cd rootfs
> >> +    cp ../binaries/bzImage root/vmlinuz-domU
> >> +    cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
> >> +    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
> >> +    cd ..
> >> +    rm -rf rootfs
> >>  fi
> >>  
> >>  # Dom0 rootfs.  The order or concatination is important; ucode wants to come
> >>  # first, and all uncompressed must be ahead of compressed.
> >>  parts=(
> >>      binaries/ucode.cpio
> >> +)
> >> +[ -n "$domU_check" ] && parts+=(binaries/domU-in-dom0.cpio)
> > This is a NIT but I have been trying to avoid this format in favor of
> >
> > if [ -n "$domU_check" ]
> > then
> >     parts+=(binaries/domU-in-dom0.cpio)
> > fi
> >
> > for readibility.
> 
> This is a weird one, because the (relevant) readability is the
> components of parts, and it's easier to scan without the extra blank
> lines.  Nevertheless, ...
> 
> >
> >
> > I can see the patch is correct. It adds a bit of complexity in exchange
> > for a small improvement. I am not sure if the trade off is worth it, but
> > I'll ack it anyway.
> 
> ... see the thread on the previous patch.  This was the RFC "I'd like to
> find a nicer way of doing it", and Anthony has made a suggestion which I
> need to experiment with.

OK


> > Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> Thanks, but do you have any input on the /boot vs /root question on the
> other part of the thread?

I saw it. I don't have a strong opinion either way. Technically /boot is
correct but then things gets mixed up with Dom0 kernel and ramdisk.
/root allows it to be more clearly separated so I am OK with it.
Re: [PATCH 3/3] CI: Adjust how domU is packaged in dom0
Posted by Marek Marczykowski-Górecki 5 months ago
On Thu, May 22, 2025 at 06:36:40PM +0100, Andrew Cooper wrote:
> Package domU in /root for dom0 and insert into the uncompressed part of dom0's
> rootfs, rather than recompressing it as part of the overlay.

It doesn't really need moving to /root to achieve this, no? The
domU-in-dom0.cpio can very well contain boot/* files.

> For Qubes, this avoids putting the domU kernel in dom0's rootfs for tests
> which aren't going to boot a guest.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Anthony PERARD <anthony.perard@vates.tech>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Michal Orzel <michal.orzel@amd.com>
> CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
>  automation/scripts/qubes-x86-64.sh            | 20 +++++++++++++------
>  .../scripts/xilinx-smoke-dom0-x86_64.sh       | 16 +++++++++++----
>  2 files changed, 26 insertions(+), 10 deletions(-)
> 
> diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
> index 1dd3f48b3d29..17a37134f46a 100755
> --- a/automation/scripts/qubes-x86-64.sh
> +++ b/automation/scripts/qubes-x86-64.sh
> @@ -154,8 +154,8 @@ esac
>  domU_config="
>  type = '${domU_type}'
>  name = 'domU'
> -kernel = '/boot/vmlinuz'
> -ramdisk = '/boot/initrd-domU'
> +kernel = '/root/vmlinuz-domU'
> +ramdisk = '/root/initrd-domU'
>  cmdline = 'root=/dev/ram0 console=hvc0'
>  memory = 512
>  vif = [ ${domU_vif} ]
> @@ -185,12 +185,24 @@ Kernel \r on an \m (\l)
>      find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
>      cd ..
>      rm -rf rootfs
> +
> +    # Package domU kernel+rootfs in /root for dom0 (uncompressed)
> +    mkdir -p rootfs/root
> +    cd rootfs
> +    cp ../binaries/bzImage root/vmlinuz-domU
> +    cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
> +    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
> +    cd ..
> +    rm -rf rootfs
>  fi
>  
>  # Dom0 rootfs.  The order or concatination is important; ucode wants to come
>  # first, and all uncompressed must be ahead of compressed.
>  parts=(
>      binaries/ucode.cpio
> +)
> +[ -n "$domU_check" ] && parts+=(binaries/domU-in-dom0.cpio)
> +parts+=(
>      binaries/rootfs.cpio.gz
>      binaries/xen-tools.cpio.gz
>  )
> @@ -238,10 +250,6 @@ mkdir -p etc/default
>  echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
>  echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
>  mkdir -p var/log/xen/console
> -cp ../binaries/bzImage boot/vmlinuz
> -if [ -n "$domU_check" ]; then
> -    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
> -fi
>  find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
>  cd ..
>  
> diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
> index 0fbabb41054a..29817ff81d0a 100755
> --- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
> +++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
> @@ -22,8 +22,8 @@ DOMU_CMD=""
>  DOMU_CFG='
>  type = "pvh"
>  name = "domU"
> -kernel = "/boot/vmlinuz"
> -ramdisk = "/boot/initrd-domU"
> +kernel = "/root/vmlinuz-domU"
> +ramdisk = "/root/initrd-domU"
>  extra = "root=/dev/ram0 console=hvc0"
>  memory = 512
>  '
> @@ -103,10 +103,20 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
>  cd ..
>  rm -rf rootfs
>  
> +# Package domU kernel+rootfs in /root for dom0 (uncompressed)
> +mkdir -p rootfs/root
> +cd rootfs
> +cp ../binaries/bzImage root/vmlinuz-domU
> +cp ../binaries/domU-rootfs.cpio.gz root/initrd-domU
> +find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
> +cd ..
> +rm -rf rootfs
> +
>  # Dom0 rootfs.  The order or concatination is important; ucode wants to come
>  # first, and all uncompressed must be ahead of compressed.
>  parts=(
>      binaries/ucode.cpio
> +    binaries/domU-in-dom0.cpio
>      binaries/rootfs.cpio.gz
>      binaries/xen-tools.cpio.gz
>  )
> @@ -127,8 +137,6 @@ echo "${DOMU_CFG}${DOMU_CFG_EXTRA}" > etc/xen/domU.cfg
>  echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
>  echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
>  mkdir -p var/log/xen/console
> -cp ../binaries/bzImage boot/vmlinuz
> -cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
>  find . | cpio -H newc -o | gzip >> ../binaries/dom0-rootfs.cpio.gz
>  cd ..
>  
> -- 
> 2.39.5
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
Re: [PATCH 3/3] CI: Adjust how domU is packaged in dom0
Posted by Andrew Cooper 5 months ago
On 27/05/2025 2:55 pm, Marek Marczykowski-Górecki wrote:
> On Thu, May 22, 2025 at 06:36:40PM +0100, Andrew Cooper wrote:
>> Package domU in /root for dom0 and insert into the uncompressed part of dom0's
>> rootfs, rather than recompressing it as part of the overlay.
> It doesn't really need moving to /root to achieve this, no? The
> domU-in-dom0.cpio can very well contain boot/* files.

Yes, but is /boot really an appropriate place to be putting test artefacts?

~Andrew