Skip to contentSkip to conversation

CI: Improve domU handling

PATCH In review Andrew Cooper 3 participants 7 messages Jun 2, 2025 – Jun 3, 2025 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover CI: Improve domU handling

Improvements to domU kernel+initrd handling.

https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/1849446456

Andrew Cooper (2):
CI: Use bash arrays to simplfy dom0 rootfs construction
CI: Adjust how domU is packaged in dom0

 automation/scripts/qubes-x86-64.sh            | 35 +++++++++++++------
 .../scripts/xilinx-smoke-dom0-x86_64.sh       | 34 ++++++++++++------
 2 files changed, 49 insertions(+), 20 deletions(-)
Signature · 1 line
2.39.5
#1 lore raw

PATCH 1/2 CI: Use bash arrays to simplfy dom0 rootfs construction

For Qubes, this requires switching from sh to bash.

This reduces the number of times the target filename needs to be written to 1.

Expand the comment to explain the concatination constraints.

No functional change.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* Use dom0_rootfs_extra_{un,}comp arrays

---
 automation/scripts/qubes-x86-64.sh            | 18 ++++++++++++-----
 .../scripts/xilinx-smoke-dom0-x86_64.sh       | 20 ++++++++++++-------
 2 files changed, 26 insertions(+), 12 deletions(-)
automation/scripts/qubes-x86-64.sh +13 -5
index 8e86940c6eff..5ec6eff6c469 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 set -ex -o pipefail
 
@@ -22,6 +22,8 @@ domU_type="pvh"
 domU_vif="'bridge=xenbr0',"
 domU_extra_config=
 retrieve_xml=
+dom0_rootfs_extra_comp=()
+dom0_rootfs_extra_uncomp=()
 
 case "${test_variant}" in
     ### test: smoke test & smoke test PVH & smoke test HVM & smoke test PVSHIM
@@ -187,10 +189,16 @@ Kernel \r on an \m (\l)
     rm -rf rootfs
 fi
 
-# Dom0 rootfs
-cp binaries/ucode.cpio binaries/dom0-rootfs.cpio.gz
-cat binaries/rootfs.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
+# Dom0 rootfs.  The order or concatination is important; ucode wants to come
+# first, and all uncompressed must be ahead of compressed.
+dom0_rootfs_parts=(
+    binaries/ucode.cpio
+    "${dom0_rootfs_extra_uncomp[@]}"
+    binaries/rootfs.cpio.gz
+    binaries/xen-tools.cpio.gz
+    "${dom0_rootfs_extra_comp[@]}"
+)
+cat "${dom0_rootfs_parts[@]}" > binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
automation/scripts/xilinx-smoke-dom0-x86_64.sh +13 -7
index 8f02fa73bd06..45121f39400a 100755
@@ -28,6 +28,8 @@ extra = "root=/dev/ram0 console=hvc0"
 memory = 512
 '
 DOMU_CFG_EXTRA=""
+dom0_rootfs_extra_comp=()
+dom0_rootfs_extra_uncomp=()
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -71,6 +73,7 @@ do
   sleep 1
 done | argo-exec -p 28333 -d 0 -- /bin/echo
 "
+    dom0_rootfs_extra_comp+=(binaries/argo.cpio.gz)
     DOM0_CMD="
 insmod /lib/modules/\$(uname -r)/updates/xen-argo.ko
 xl -vvv create /etc/xen/domU.cfg
@@ -103,13 +106,16 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
-# Dom0 rootfs
-cp binaries/ucode.cpio binaries/dom0-rootfs.cpio.gz
-cat binaries/rootfs.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-if [[ "${TEST}" == argo ]]; then
-    cat binaries/argo.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-fi
+# Dom0 rootfs.  The order or concatination is important; ucode wants to come
+# first, and all uncompressed must be ahead of compressed.
+dom0_rootfs_parts=(
+    binaries/ucode.cpio
+    "${dom0_rootfs_extra_uncomp[@]}"
+    binaries/rootfs.cpio.gz
+    binaries/xen-tools.cpio.gz
+    "${dom0_rootfs_extra_comp[@]}"
+)
+cat "${dom0_rootfs_parts[@]}" > binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
Signature · 1 line
2.39.5
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] CI: Use bash arrays to simplfy dom0 rootfs construction

Quoted 9 lines · Andrew Cooper

For Qubes, this requires switching from sh to bash.

This reduces the number of times the target filename needs to be written to 1.

Expand the comment to explain the concatination constraints.

No functional change.

Quoted 101 lines

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* Use dom0_rootfs_extra_{un,}comp arrays

---
 automation/scripts/qubes-x86-64.sh            | 18 ++++++++++++-----
 .../scripts/xilinx-smoke-dom0-x86_64.sh       | 20 ++++++++++++-------
 2 files changed, 26 insertions(+), 12 deletions(-)
automation/scripts/qubes-x86-64.sh +13 -5
index 8e86940c6eff..5ec6eff6c469 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 set -ex -o pipefail
 
@@ -22,6 +22,8 @@ domU_type="pvh"
 domU_vif="'bridge=xenbr0',"
 domU_extra_config=
 retrieve_xml=
+dom0_rootfs_extra_comp=()
+dom0_rootfs_extra_uncomp=()
 
 case "${test_variant}" in
     ### test: smoke test & smoke test PVH & smoke test HVM & smoke test PVSHIM
@@ -187,10 +189,16 @@ Kernel \r on an \m (\l)
     rm -rf rootfs
 fi
 
-# Dom0 rootfs
-cp binaries/ucode.cpio binaries/dom0-rootfs.cpio.gz
-cat binaries/rootfs.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
+# Dom0 rootfs.  The order or concatination is important; ucode wants to come
+# first, and all uncompressed must be ahead of compressed.
+dom0_rootfs_parts=(
+    binaries/ucode.cpio
+    "${dom0_rootfs_extra_uncomp[@]}"
+    binaries/rootfs.cpio.gz
+    binaries/xen-tools.cpio.gz
+    "${dom0_rootfs_extra_comp[@]}"
+)
+cat "${dom0_rootfs_parts[@]}" > binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
automation/scripts/xilinx-smoke-dom0-x86_64.sh +13 -7
index 8f02fa73bd06..45121f39400a 100755
@@ -28,6 +28,8 @@ extra = "root=/dev/ram0 console=hvc0"
 memory = 512
 '
 DOMU_CFG_EXTRA=""
+dom0_rootfs_extra_comp=()
+dom0_rootfs_extra_uncomp=()
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -71,6 +73,7 @@ do
   sleep 1
 done | argo-exec -p 28333 -d 0 -- /bin/echo
 "
+    dom0_rootfs_extra_comp+=(binaries/argo.cpio.gz)
     DOM0_CMD="
 insmod /lib/modules/\$(uname -r)/updates/xen-argo.ko
 xl -vvv create /etc/xen/domU.cfg
@@ -103,13 +106,16 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
-# Dom0 rootfs
-cp binaries/ucode.cpio binaries/dom0-rootfs.cpio.gz
-cat binaries/rootfs.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-if [[ "${TEST}" == argo ]]; then
-    cat binaries/argo.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-fi
+# Dom0 rootfs.  The order or concatination is important; ucode wants to come
+# first, and all uncompressed must be ahead of compressed.
+dom0_rootfs_parts=(
+    binaries/ucode.cpio
+    "${dom0_rootfs_extra_uncomp[@]}"
+    binaries/rootfs.cpio.gz
+    binaries/xen-tools.cpio.gz
+    "${dom0_rootfs_extra_comp[@]}"
+)
+cat "${dom0_rootfs_parts[@]}" > binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
Signature · 1 line
2.39.5
Reviewed-by on v1 1/2
#3 lore raw

Re: [PATCH 1/2] CI: Use bash arrays to simplfy dom0 rootfs construction

In reply to Andrew Cooper
Quoted 9 lines · Andrew Cooper

For Qubes, this requires switching from sh to bash.

This reduces the number of times the target filename needs to be written to 1.

Expand the comment to explain the concatination constraints.

No functional change.

With typo below fixed:

Quoted 33 lines

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* Use dom0_rootfs_extra_{un,}comp arrays

---
 automation/scripts/qubes-x86-64.sh            | 18 ++++++++++++-----
 .../scripts/xilinx-smoke-dom0-x86_64.sh       | 20 ++++++++++++-------
 2 files changed, 26 insertions(+), 12 deletions(-)
automation/scripts/qubes-x86-64.sh +3 -1
index 8e86940c6eff..5ec6eff6c469 100755
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 set -ex -o pipefail
 
@@ -22,6 +22,8 @@ domU_type="pvh"
 domU_vif="'bridge=xenbr0',"
 domU_extra_config=
 retrieve_xml=
+dom0_rootfs_extra_comp=()
+dom0_rootfs_extra_uncomp=()
 
 case "${test_variant}" in
     ### test: smoke test & smoke test PVH & smoke test HVM & smoke test PVSHIM

automation/scripts/qubes-x86-64.sh Kernel \r on an \m (\l) · line 192

Quoted 8 lines
automation/scripts/qubes-x86-64.sh +1 -4
@@ -187,10 +189,16 @@ Kernel \r on an \m (\l)
     rm -rf rootfs
 fi
 
-# Dom0 rootfs
-cp binaries/ucode.cpio binaries/dom0-rootfs.cpio.gz
-cat binaries/rootfs.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
+# Dom0 rootfs.  The order or concatination is important; ucode wants to come

of

Quoted 60 lines
automation/scripts/qubes-x86-64.sh +9 -0
+# first, and all uncompressed must be ahead of compressed.
+dom0_rootfs_parts=(
+    binaries/ucode.cpio
+    "${dom0_rootfs_extra_uncomp[@]}"
+    binaries/rootfs.cpio.gz
+    binaries/xen-tools.cpio.gz
+    "${dom0_rootfs_extra_comp[@]}"
+)
+cat "${dom0_rootfs_parts[@]}" > binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
automation/scripts/xilinx-smoke-dom0-x86_64.sh +13 -7
index 8f02fa73bd06..45121f39400a 100755
@@ -28,6 +28,8 @@ extra = "root=/dev/ram0 console=hvc0"
 memory = 512
 '
 DOMU_CFG_EXTRA=""
+dom0_rootfs_extra_comp=()
+dom0_rootfs_extra_uncomp=()
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -71,6 +73,7 @@ do
   sleep 1
 done | argo-exec -p 28333 -d 0 -- /bin/echo
 "
+    dom0_rootfs_extra_comp+=(binaries/argo.cpio.gz)
     DOM0_CMD="
 insmod /lib/modules/\$(uname -r)/updates/xen-argo.ko
 xl -vvv create /etc/xen/domU.cfg
@@ -103,13 +106,16 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
-# Dom0 rootfs
-cp binaries/ucode.cpio binaries/dom0-rootfs.cpio.gz
-cat binaries/rootfs.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-cat binaries/xen-tools.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-if [[ "${TEST}" == argo ]]; then
-    cat binaries/argo.cpio.gz >> binaries/dom0-rootfs.cpio.gz
-fi
+# Dom0 rootfs.  The order or concatination is important; ucode wants to come
+# first, and all uncompressed must be ahead of compressed.
+dom0_rootfs_parts=(
+    binaries/ucode.cpio
+    "${dom0_rootfs_extra_uncomp[@]}"
+    binaries/rootfs.cpio.gz
+    binaries/xen-tools.cpio.gz
+    "${dom0_rootfs_extra_comp[@]}"
+)
+cat "${dom0_rootfs_parts[@]}" > binaries/dom0-rootfs.cpio.gz
 
 # test-local configuration
 mkdir -p rootfs
Signature · 1 line
2.39.5
Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
#4 lore raw

PATCH 2/2 CI: Adjust how domU is packaged in dom0

In reply to Andrew Cooper

Package domU 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.

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* Rebase over dom0_rootfs_extra_{un,}comp changes
* Move back into boot. There seem to be objections to having it in root.

---
 automation/scripts/qubes-x86-64.sh             | 17 ++++++++++++-----
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 14 +++++++++++---
 2 files changed, 23 insertions(+), 8 deletions(-)
automation/scripts/qubes-x86-64.sh +12 -5
index 5ec6eff6c469..d9ecc569c956 100755
@@ -156,7 +156,7 @@ esac
 domU_config="
 type = '${domU_type}'
 name = 'domU'
-kernel = '/boot/vmlinuz'
+kernel = '/boot/vmlinuz-domU'
 ramdisk = '/boot/initrd-domU'
 cmdline = 'root=/dev/ram0 console=hvc0'
 memory = 512
@@ -187,6 +187,17 @@ 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 /boot for dom0 (uncompressed)
+    mkdir -p rootfs/boot
+    cd rootfs
+    cp ../binaries/bzImage boot/vmlinuz-domU
+    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+    cd ..
+    rm -rf rootfs
+
+    dom0_rootfs_extra_uncomp+=(binaries/domU-in-dom0.cpio)
 fi
 
 # Dom0 rootfs.  The order or concatination is important; ucode wants to come
@@ -241,10 +252,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 ..
 
automation/scripts/xilinx-smoke-dom0-x86_64.sh +11 -3
index 45121f39400a..8981aee5d4f2 100755
@@ -22,7 +22,7 @@ DOMU_CMD=""
 DOMU_CFG='
 type = "pvh"
 name = "domU"
-kernel = "/boot/vmlinuz"
+kernel = "/boot/vmlinuz-domU"
 ramdisk = "/boot/initrd-domU"
 extra = "root=/dev/ram0 console=hvc0"
 memory = 512
@@ -106,10 +106,20 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
+# Package domU kernel+rootfs in /boot for dom0 (uncompressed)
+mkdir -p rootfs/boot
+cd rootfs
+cp ../binaries/bzImage boot/vmlinuz-domU
+cp ../binaries/domU-rootfs.cpio.gz boot/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.
 dom0_rootfs_parts=(
     binaries/ucode.cpio
+    binaries/domU-in-dom0.cpio
     "${dom0_rootfs_extra_uncomp[@]}"
     binaries/rootfs.cpio.gz
     binaries/xen-tools.cpio.gz
@@ -131,8 +141,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 ..
 
Signature · 1 line
2.39.5
Reviewed-by on v1 2/2
#5 lore raw

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

Quoted 7 lines · Andrew Cooper

Package domU 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.

Quoted 102 lines

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* Rebase over dom0_rootfs_extra_{un,}comp changes
* Move back into boot. There seem to be objections to having it in root.

---
 automation/scripts/qubes-x86-64.sh             | 17 ++++++++++++-----
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 14 +++++++++++---
 2 files changed, 23 insertions(+), 8 deletions(-)
automation/scripts/qubes-x86-64.sh +12 -5
index 5ec6eff6c469..d9ecc569c956 100755
@@ -156,7 +156,7 @@ esac
 domU_config="
 type = '${domU_type}'
 name = 'domU'
-kernel = '/boot/vmlinuz'
+kernel = '/boot/vmlinuz-domU'
 ramdisk = '/boot/initrd-domU'
 cmdline = 'root=/dev/ram0 console=hvc0'
 memory = 512
@@ -187,6 +187,17 @@ 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 /boot for dom0 (uncompressed)
+    mkdir -p rootfs/boot
+    cd rootfs
+    cp ../binaries/bzImage boot/vmlinuz-domU
+    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+    cd ..
+    rm -rf rootfs
+
+    dom0_rootfs_extra_uncomp+=(binaries/domU-in-dom0.cpio)
 fi
 
 # Dom0 rootfs.  The order or concatination is important; ucode wants to come
@@ -241,10 +252,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 ..
 
automation/scripts/xilinx-smoke-dom0-x86_64.sh +11 -3
index 45121f39400a..8981aee5d4f2 100755
@@ -22,7 +22,7 @@ DOMU_CMD=""
 DOMU_CFG='
 type = "pvh"
 name = "domU"
-kernel = "/boot/vmlinuz"
+kernel = "/boot/vmlinuz-domU"
 ramdisk = "/boot/initrd-domU"
 extra = "root=/dev/ram0 console=hvc0"
 memory = 512
@@ -106,10 +106,20 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
+# Package domU kernel+rootfs in /boot for dom0 (uncompressed)
+mkdir -p rootfs/boot
+cd rootfs
+cp ../binaries/bzImage boot/vmlinuz-domU
+cp ../binaries/domU-rootfs.cpio.gz boot/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.
 dom0_rootfs_parts=(
     binaries/ucode.cpio
+    binaries/domU-in-dom0.cpio
     "${dom0_rootfs_extra_uncomp[@]}"
     binaries/rootfs.cpio.gz
     binaries/xen-tools.cpio.gz
@@ -131,8 +141,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 ..
 
Signature · 1 line
2.39.5
Reviewed-by on v1 2/2
#6 lore raw

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

In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper

Package domU 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.

Quoted 102 lines

---
CC: Anthony PERARD <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

v2:
* Rebase over dom0_rootfs_extra_{un,}comp changes
* Move back into boot. There seem to be objections to having it in root.

---
 automation/scripts/qubes-x86-64.sh             | 17 ++++++++++++-----
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 14 +++++++++++---
 2 files changed, 23 insertions(+), 8 deletions(-)
automation/scripts/qubes-x86-64.sh +12 -5
index 5ec6eff6c469..d9ecc569c956 100755
@@ -156,7 +156,7 @@ esac
 domU_config="
 type = '${domU_type}'
 name = 'domU'
-kernel = '/boot/vmlinuz'
+kernel = '/boot/vmlinuz-domU'
 ramdisk = '/boot/initrd-domU'
 cmdline = 'root=/dev/ram0 console=hvc0'
 memory = 512
@@ -187,6 +187,17 @@ 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 /boot for dom0 (uncompressed)
+    mkdir -p rootfs/boot
+    cd rootfs
+    cp ../binaries/bzImage boot/vmlinuz-domU
+    cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+    find . | cpio -H newc -o > ../binaries/domU-in-dom0.cpio
+    cd ..
+    rm -rf rootfs
+
+    dom0_rootfs_extra_uncomp+=(binaries/domU-in-dom0.cpio)
 fi
 
 # Dom0 rootfs.  The order or concatination is important; ucode wants to come
@@ -241,10 +252,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 ..
 
automation/scripts/xilinx-smoke-dom0-x86_64.sh +11 -3
index 45121f39400a..8981aee5d4f2 100755
@@ -22,7 +22,7 @@ DOMU_CMD=""
 DOMU_CFG='
 type = "pvh"
 name = "domU"
-kernel = "/boot/vmlinuz"
+kernel = "/boot/vmlinuz-domU"
 ramdisk = "/boot/initrd-domU"
 extra = "root=/dev/ram0 console=hvc0"
 memory = 512
@@ -106,10 +106,20 @@ find . | cpio -H newc -o | gzip >> ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
 
+# Package domU kernel+rootfs in /boot for dom0 (uncompressed)
+mkdir -p rootfs/boot
+cd rootfs
+cp ../binaries/bzImage boot/vmlinuz-domU
+cp ../binaries/domU-rootfs.cpio.gz boot/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.
 dom0_rootfs_parts=(
     binaries/ucode.cpio
+    binaries/domU-in-dom0.cpio
     "${dom0_rootfs_extra_uncomp[@]}"
     binaries/rootfs.cpio.gz
     binaries/xen-tools.cpio.gz
@@ -131,8 +141,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 ..
 
Signature · 1 line
2.39.5
Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab