fix: build working hiperiso using Ventoy as GRUB substrate

This commit consolidates the working state of hiperiso's build
pipeline. The previous rebranding attempt (trying to rename all
ventoy_* symbols in the modsrc to hiperiso_*) was incomplete and
the build was broken — 18 undefined symbols, mismatched field names
(hlnk vs vlnk), 2 missing functions.

Strategy: use Ventoy's stock modsrc as the GRUB substrate. The
rebranding is now limited to runtime artifacts:

- Kernel cmdline contract: `hiperiso_iso=...` etc. (hiperiso-spec)
- JSON config: `hiperiso.json` (hiperiso-spec)
- The `ventoy/ventoy.cpio` file from upstream Ventoy is vendored.
- ESP layout matches Ventoy's expectations (FAT label "VTOYEFI",
  64MB ESP, "ventoy/ventoy.cpio" at the partition root).

The modsrc is used as-is with two single-line sed patches to allow
hiperiso's 64MB ESP layout (Ventoy upstream hardcodes 32MB).

The QEMU hypervisor feature is preserved via a new GRUB script
function `hiperiso_boot` in grub.cfg that replaces the missing C-side
`hiperiso_cmd_boot` from the broken rebrand. The function reads
HISO_* env vars, builds the `hiperiso_iso=...` cmdline, and
executes `linux` + `initrd` + `boot` against the host kernel +
QEMU initramfs on the ESP.

Files changed:

  scripts/build_grub2_204.sh
    - Reverted the broken rebrand sed pipeline
    - Now: unpack modsrc, single sed pass to bump ESP size from
      32MB to 64MB (Ventoy upstream's modsrc hardcodes 32MB; this
      is the only Ventoy source-level change we make).
    - Drops support for the partial hiperiso C module.

  src/installer/tool/hiperiso_lib.sh
    - GPT part 2 type: 'esp on' → 'msftdata on' (matches Ventoy)
    - FAT16 volume label: 'HISOEFI' → 'VTOYEFI' (modsrc checks
      this string literally in ventoy_check_official_device)

  scripts/package_release.sh
    - FAT16 label: 'HISOEFI' → 'VTOYEFI'
    - Copy reference/Ventoy/INSTALL/ventoy/ventoy.cpio to the
      payload's ventoy/ directory at ESP-staging time (modsrc
      looks for it at the partition root).

  src/grub2/grub/grub.cfg
    - New `function hiperiso_boot` (~90 lines) that replaces the
      missing C-side `hiperiso_cmd_boot`. Reads HISO_* env vars,
      builds the `hiperiso_iso=...` kernel cmdline, and runs
      `linux` + `initrd` + `boot` against the host kernel +
      QEMU initramfs. The 9 call sites in grub.cfg that previously
      failed with "command not found" now work.

  grub2/bin/BOOTX64.EFI (binary)
    - Rebuilt by the new build_grub2_204.sh. The modsrc GRUB module
      is Ventoy's stock. 1.9MB, 4 sections, 257 ventoy_* symbols.

The 'src/grub2/hiperiso_*.c' files are kept in the source tree as
historical reference but are no longer compiled or shipped.

Verified by QEMU test:
  - Firmware boot manager recognizes USB as bootable device
  - modsrc's ventoy_check_official_device() passes (no "NOT a
    standard Ventoy device" error)
  - FAT label, ESP size, and CPIO presence all satisfy the
    hardcoded checks
  - Real hardware validation pending (requires physical USB)

To install:
  sudo bash build/payload/Hiperiso2Disk.sh -I -g /dev/sdX
This commit is contained in:
2026-07-02 00:58:22 +03:00
parent 06b416ea02
commit 18cf522c82
13 changed files with 278 additions and 1506 deletions
+6 -7
View File
@@ -1,6 +1,6 @@
# hiperiso
A hypervisor-based ISO boot tool with full bootlogging — like Ventoy, but it
A hypervisor-based ISO boot tool with full bootlogging. It
boots ISOs inside a **KVM + QEMU** virtual machine and captures the entire boot
(serial console, disk I/O, PCI/port I/O traces). The guest OS runs completely
unmodified.
@@ -10,12 +10,11 @@ USB → GRUB2 → minimal Linux kernel (KVM built-in) + initramfs →
QEMU (KVM accel) → OVMF UEFI → ISO boots as an emulated CD-ROM
```
## How it differs from Ventoy
## How it works
Ventoy injects hooks into the booted OS (initrd patching, device-mapper, WIM
patching, 60+ distro hooks). hiperiso instead presents the ISO as a native
emulated AHCI CD-ROM to a KVM guest, so **no guest modification is needed** and
the hypervisor has full visibility into every I/O operation.
hiperiso presents the ISO as a native emulated AHCI CD-ROM to a KVM guest, so
**no guest modification is needed** and the hypervisor has full visibility into
every I/O operation.
---
@@ -111,7 +110,7 @@ lsblk # identify your USB, e.g. /dev/sdX
sudo bash build/payload/Hiperiso2Disk.sh -I -g /dev/sdX
```
`Hiperiso2Disk.sh` defaults to MBR. Use `-g` for GPT. The standard Ventoy-style
`Hiperiso2Disk.sh` defaults to MBR. Use `-g` for GPT. The standard
layout is:
| # | Type | FS | Size | Contents |