Commit Graph

4 Commits

Author SHA1 Message Date
vasilito 9089553607 fix: revert GRUB2 modsrc partition size back to 65536 (32MB)
The build_grub2_204.sh script was patching Ventoy's modsrc from 65536
to 131072 sectors (bumping expected ESP size from 32MB to 64MB). After
reducing our ESP size to 32MB to match Ventoy exactly, this patch now
needs to be reversed (131072 -> 65536) so the GRUB2 layout check accepts
our 32MB ESP.

Built GRUB2 EFI binary with corrected checks. Reinstalled payload.
2026-07-02 06:13:03 +03:00
vasilito 18cf522c82 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
2026-07-02 00:58:22 +03:00
vasilito f78f08f557 fix: set HIPERISO_VERSION to 1.0.0 and rebuild BOOTX64.EFI
grub.cfg still carried Ventoy-derived 1.1.16. Rebuilt BOOTX64.EFI
includes the new 131072-sector partition constants.
2026-07-01 07:23:07 +03:00
vasilito ce5fa09a95 fix: GPT partition notation + double-parentheses in hiperiso_boot
Two critical bugs prevented the hypervisor boot path from working:

1. GRUB2 EFI requires explicit gpt/msdos prefix in partition names.
   The shorthand (hd0,2) does NOT resolve for GPT disks. Fixed by
   having vt_load_part_table set hiso_iso_part/hiso_efi_part with
   correct notation based on detected partition table type.

2. hiperiso_boot C function wrapped $hiso_efi_part in extra parens:
   ($hiso_efi_part) expanded to ((hd0,gpt2)) which GRUB2 parsed as
   device name (hd0,gpt2) with literal parens. Fixed by using
   ${hiso_efi_part} without wrapping.

QEMU-verified: kernel boots, loads initramfs, runs /init with all
hiperiso_* parameters correctly passed through kernel cmdline.
2026-07-01 01:23:37 +03:00