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 <jpiotrowski@microsoft.com>
This commit is contained in:
Jeremi Piotrowski 2024-04-11 13:44:50 +00:00
parent 2b7ea39ce2
commit 21f4a50dfd
4 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -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" \

View File

@ -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}" <<EOF
tee -a "${pygrub}" "${pvgrub}" >/dev/null <<EOF
type = "pvh"
builder = "generic"
name = "${VM_NAME}"
memory = "${vm_mem}"

View File

@ -5,4 +5,4 @@ BOOTSTRAP_USE="${BOOTSTRAP_USE} -pax_kernel -xtpax"
USE="-pax_kernel -urandom -xtpax"
# Enable our assorted Grub targets
GRUB_PLATFORMS="efi-64 pc xen"
GRUB_PLATFORMS="efi-64 pc xen-pvh"