From 21f4a50dfd00cafa8cf2d56961d95ef32e1cb5d7 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Thu, 11 Apr 2024 13:44:50 +0000 Subject: [PATCH] Switch to xen-pvh grub implementation Our Xen configs don't currently work because xen grub uses a special code path in grub that does not support zstd compressed kernels. We switched kernel compression to zstd two years ago. The only grub xen config that supports this is xen-pvh. Switch our grub xen to the pvh and adapt configs to run domU in PVH mode. With this change the pygrub config works. Signed-off-by: Jeremi Piotrowski --- build_library/build_image_util.sh | 2 +- build_library/grub_install.sh | 5 +++-- build_library/vm_image_util.sh | 4 ++-- .../coreos-overlay/profiles/coreos/amd64/make.defaults | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build_library/build_image_util.sh b/build_library/build_image_util.sh index c2863b7bd1..9616420e49 100755 --- a/build_library/build_image_util.sh +++ b/build_library/build_image_util.sh @@ -857,7 +857,7 @@ EOF # This script must mount the ESP partition differently, so run it after unmount if [[ "${install_grub}" -eq 1 ]]; then local target - local target_list="i386-pc x86_64-efi x86_64-xen" + local target_list="i386-pc x86_64-efi i386-xen_pvh" if [[ ${BOARD} == "arm64-usr" ]]; then target_list="arm64-efi" fi diff --git a/build_library/grub_install.sh b/build_library/grub_install.sh index db83d614a1..53c3ba129f 100755 --- a/build_library/grub_install.sh +++ b/build_library/grub_install.sh @@ -64,7 +64,7 @@ case "${FLAGS_target}" in CORE_NAME="core.efi" SBAT_ARG=( --sbat "${BOARD_ROOT}/usr/share/grub/sbat.csv" ) ;; - x86_64-xen) + i386-xen_pvh) CORE_NAME="core.elf" ;; arm64-efi) @@ -234,9 +234,10 @@ case "${FLAGS_target}" in "${FLAGS_copy_shim}" fi ;; - x86_64-xen) + i386-xen_pvh) info "Installing default x86_64 Xen bootloader." sudo mkdir -p "${ESP_DIR}/xen" "${ESP_DIR}/boot/grub" + # keep the pvboot name for chainloading? sudo cp "${ESP_DIR}/${GRUB_DIR}/${CORE_NAME}" \ "${ESP_DIR}/xen/pvboot-x86_64.elf" sudo cp "${BUILD_LIBRARY_DIR}/menu.lst" \ diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index 60b93706dd..7e37c088b5 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -1004,9 +1004,9 @@ _write_xl_conf() { echo 'extra = "(hd0,0)/boot/grub/menu.lst"' >> "${pvgrub}" # The rest is the same - tee -a "${pygrub}" >> "${pvgrub}" </dev/null <