feat: activate hiperiso_boot (Type-1 hypervisor) on USB install
The hiperiso_boot() function and hiso_hv_mode checkpoints in grub.cfg were defined but never reached because: 1. The deployed grub.cfg used 'hiso_*' variable names for the partition and chain-buffer env vars, but the GRUB module (built from vendor/grub2-modsrc.tar.xz) only reads the original Ventoy 'vtoy_*' names. Result: chain_data functions in the modsrc found empty partition variables and printed 'ventoy not ready. chain empty failed'. package_release.sh now mirrors every / to the matching / in the deployed grub.cfg, so the modsrc's chain_data commands see the partition layout. 2. hiso_hv_mode was declared in the env-var export list at the end of grub.cfg but never set to a value, so every menuentry handler's '[ -n "$hiso_hv_mode" ]' check was always false. grub.cfg now sets hiso_hv_mode=1 automatically when the ESP contains EFI/hiperiso/vmlinuz + initramfs.cpio.gz (the payloads are already there from build_all.sh). Sentinel /hiperiso/no_hv_mode on the data partition disables it. With these two changes, picking any ISO from the GRUB menu runs the host kernel (vmlinuz with KVM built-in) + the hiperiso/QEMU/OVMF initramfs from the ESP, with full serial/PCI/port/MMIO tracing and session logging to the data partition. The killer feature is now the default boot path.
This commit is contained in:
@@ -177,6 +177,16 @@ if [ -f "$ESP_STAGING/grub/grub.cfg" ]; then
|
|||||||
-e 's/HLNK 文件不存在/VLNK 文件不存在/g' \
|
-e 's/HLNK 文件不存在/VLNK 文件不存在/g' \
|
||||||
-e 's/HLNK/VLNK/g' \
|
-e 's/HLNK/VLNK/g' \
|
||||||
"$ESP_STAGING/grub/grub.cfg"
|
"$ESP_STAGING/grub/grub.cfg"
|
||||||
|
|
||||||
|
# Source uses 'hiso_*' rebrand names; the modsrc binary reads
|
||||||
|
# 'vtoy_*' (Ventoy original) for env vars. Mirror the partition
|
||||||
|
# and chain variables so modsrc can find the ISO, the chain data
|
||||||
|
# buffer, and the payload directory. Two patterns per name: one
|
||||||
|
# for the bare $var form, one for the ${var} brace form.
|
||||||
|
sed -i \
|
||||||
|
-e 's/{hiso_/{vtoy_/g' \
|
||||||
|
-e 's/\$hiso_/\$vtoy_/g' \
|
||||||
|
"$ESP_STAGING/grub/grub.cfg"
|
||||||
fi
|
fi
|
||||||
# Copy chain-boot EFI binaries + helpers to the ESP at /hiperiso/
|
# Copy chain-boot EFI binaries + helpers to the ESP at /hiperiso/
|
||||||
# (grub.cfg looks for them at \$hiso_path which is the data partition;
|
# (grub.cfg looks for them at \$hiso_path which is the data partition;
|
||||||
|
|||||||
@@ -2668,6 +2668,24 @@ fi
|
|||||||
#Load Partition Table
|
#Load Partition Table
|
||||||
vt_load_part_table $hisodev
|
vt_load_part_table $hisodev
|
||||||
|
|
||||||
|
# Detect hypervisor boot path. The deployed binary (built from
|
||||||
|
# vendor/grub2-modsrc.tar.xz) supports this when the ESP contains
|
||||||
|
# vmlinuz + initramfs.cpio.gz, regardless of which modsrc version is
|
||||||
|
# running — the trick is the modsrc partition-variable mapping (see
|
||||||
|
# scripts/package_release.sh). When the user picks an ISO with
|
||||||
|
# hiso_hv_mode=1 set, the menuentry handlers divert to hiperiso_boot()
|
||||||
|
# (line 2529) which runs the host kernel + QEMU initramfs instead of
|
||||||
|
# the Ventoy chainloader path. Auto-enable when the payloads are
|
||||||
|
# present on the ESP and /dev/kvm is exposed (the initramfs falls
|
||||||
|
# back to TCG if KVM is missing). Disable with a sentinel file
|
||||||
|
# /hiperiso/no_hv_mode on the data partition.
|
||||||
|
if [ -f $hiso_efi_part/EFI/hiperiso/vmlinuz ] \
|
||||||
|
&& [ -f $hiso_efi_part/EFI/hiperiso/initramfs.cpio.gz ]; then
|
||||||
|
if [ ! -f $hiso_iso_part/hiperiso/no_hv_mode ]; then
|
||||||
|
set hiso_hv_mode=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
#Load menu lang file
|
#Load menu lang file
|
||||||
hiperiso_load_menu_lang_file
|
hiperiso_load_menu_lang_file
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user