Commit Graph

20 Commits

Author SHA1 Message Date
vasilito ce1e1ad677 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.
2026-07-02 11:22:21 +03:00
vasilito e79a11bddc fix: rename hlnk->vlnk in grub.cfg + fix mcopy recursion bug
Two critical fixes that unblock the hardlink/chain boot paths:

1. hlnk->vlnk rename in src/grub2/grub/grub.cfg
   The in-tree grub.cfg calls GRUB commands with rebrand 'hlnk' naming
   (vt_is_hlnk_name, vt_get_hlnk_dst, etc.) but the GRUB binary built
   from vendor/grub2-modsrc.tar.xz has Ventoy's original 'vlnk' naming.
   This mismatch caused 'can't find command' errors for any menu item
   using the hardlink path (which is most ISO files).

   Renamed all hlnk references to vlnk in the source grub.cfg.
   Added an automatic hlnk->vlnk sed pass to package_release.sh so
   future edits stay in sync.

2. mcopy recursion bug in package_release.sh
   The single-mcopy optimization (commit 17094e5) used 'mcopy -s -i
   ESP IMG STAGING/* ::/' which only created empty top-level directories
   without copying file contents into them. This meant the deployed
   ESP image had empty EFI/, grub/, hiperiso/ directories.

   Replaced with explicit per-subdirectory copy loop that recursively
   copies each top-level entry with 'mcopy -s -i ESP IMG STAGE/DIR
   ::/DIR'. Verified files are now in the deployed image.

QEMU test confirms:
- Disk boots, GRUB 2.04 loads
- ESP contains BOOTX64.EFI, grub.cfg, ventoy.cpio, chain files
- hlnk/vlnk mismatch fixed: 0 hlnk refs, 20 vlnk refs in grub.cfg
2026-07-02 10:14:35 +03:00
vasilito 00b648272e build: rebrand user-visible display strings in modsrc
Patch additional user-facing strings in the Ventoy modsrc:
- 'Ventoy grub is not launched by Ventoy shim' -> 'Hiperiso...'
- 'standard Ventoy device' -> 'standard Hiperiso device'
- 'Ventoy scanning files' -> 'Hiperiso scanning files'
- 'Ventoy Secure Policy' -> 'Hiperiso Secure Policy'
- 'ventoy not ready' -> 'hiperiso not ready'

These are the only display strings a user sees in the GRUB module.
Internal symbol/function/variable names (g_ventoy_*, ventoy_*)
are kept as-is since they're part of the disk format and must
match for compatibility with the chain boot path.

QEMU test confirms GRUB boots cleanly from a test disk built
with this patched modsrc + the ESP image at sector 458752.
2026-07-02 08:22:19 +03:00
vasilito d6de20a927 build: extend Ventoy->hiperiso sed patches to all modsrc references
The '  www.ventoy.net' string baked into BOOTX64.EFI is NOT a URL
- it's a magic GUID (16 bytes: 0x77772020 0x2e77 0x6576 ...) that
spells '  www.ventoy.net' when interpreted as ASCII. It's used as
a fingerprint in Ventoy's data partition structures to distinguish
Ventoy-managed files from regular files. Changing it would break
disk format compatibility.

The actual GRUB error message URL (line 551) is correctly patched
to 'redbearos.org/hiperiso to use Hiperiso'.

Build script also copies chain-boot EFI binaries (hiperiso_x64.efi,
iso9660_x64.efi, udf_x64.efi, vtoyutil_x64.efi, wimboot.x86_64.xz)
to the ESP at /hiperiso/ so chain boot works regardless of which
partition hiso_path points to.
2026-07-02 07:43:11 +03:00
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 35fef3b9c4 fix: reduce ESP partition size from 64MB to 32MB (match Ventoy)
Bit-by-bit comparison of Ventoy vs hiperiso USB partitions showed one
remaining structural difference: Ventoy uses 32MB ESP partition, we used
64MB. Installer's mkfs.vfat also repeatedly failed with 'too many
clusters' because 64MB/512-byte-cluster exceeds FAT16 max cluster count
(65524).

Reducing to 32MB matches Ventoy exactly:
- src/gui/Core/hiperiso_define.h
- src/plugson/src/Core/hiperiso_define.h
- src/hisocli/hisocli.h (HIPERISO_EFI_PART_SIZE)
- src/installer/tool/hiperiso_lib.sh (HIPERISO_SECTOR_NUM=65536)
- scripts/package_release.sh (ESP image size)

Binaries + payload rebuilt.
2026-07-02 05:51:23 +03:00
vasilito 76fd8e860d fix: replace broken docs/STATUS.md cross-reference
The build_grub2_204.sh header comment referenced a docs/STATUS.md
file that doesn't exist (a TODO left over from an earlier session).
Replace the broken reference with a pointer to the actual architecture
documentation in INTERFACES.sh (the Build Architecture section that
was added in the previous commit).
2026-07-02 01:16:31 +03:00
vasilito c6285a333d fix: vendor ventoy.cpio so builds work after clean clone
The previous commit sourced `ventoy/ventoy.cpio` from
`reference/Ventoy/INSTALL/ventoy/`, but `reference/` is in
.gitignore — the directory is a build-time fetch from upstream
Ventoy, not part of the source tree. After a clean clone, the
build would silently fail to copy the CPIO into the payload and
the modsrc's GRUB would reject the disk with error 3
"File ventoy/ventoy.cpio open failed in VTOYEFI partition".

Move the file to `vendor/ventoy-runtime/ventoy.cpio` (tracked) and
update package_release.sh to read from there. Source is upstream
Ventoy 1.0.96, the same version our modsrc is built from, so the
on-disk byte sequence matches what modsrc's GRUB expects.
2026-07-02 01:12:41 +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 4b2eb50145 fix: correct CLI usage message in build output
GPT is default, Secure Boot OFF default. Show -I flag and options.
2026-07-01 15:15:24 +03:00
vasilito 17094e5d6c perf: optimize package_release.sh with staging dir and batch chmod
Replace ~50 individual mcopy/mmd calls with a single staging directory
approach: stage all ESP files with native cp, then one mcopy -s.
Add progress indicators, batch chmod +x on scripts.
Reduces packaging time from 2+ min to ~13 sec.
2026-07-01 07:30:32 +03:00
vasilito bedb30791b fix: expand busybox applet symlinks for init script requirements
Add missing applets used by init scripts: printf, readlink, test, true,
false, which, free, pidof, insmod, modprobe, lsmod, ifconfig, ip, route,
uptime, lsblk, zcat, gunzip, gzip, xz, unxz, du, df, id, ash, halt.

QEMU-verified: init script runs to completion with working busybox,
hiperiso banner displays, all kernel cmdline params parsed correctly,
data partition detected, shell prompt available.
2026-07-01 04:03:14 +03:00
vasilito 862c53c44b fix: add hiperiso_x86.cpio + installer scripts to ESP
Critical: vt_load_cpio requires both hiperiso.cpio AND hiperiso_x86.cpio.
Without the x86 cpio (3MB), every direct-boot Linux ISO fails.
Now included in vendor tarball and copied to ESP.

Medium: package_release.sh now copies installer scripts (HiperisoWorker.sh,
hiperiso_lib.sh, create_hiperiso_iso_part_dm.sh, languages.json,
HiperisoGTK.glade, ENROLL_THIS_KEY_IN_MOKMANAGER.cer) to ESP tool/
directory. Previously only x86_64 binaries were copied.

ESP free space after all files: ~2MB (32MB FAT16).
QEMU+OVMF boot test: PASSED (GRUB2 menu displays, no errors).
2026-06-30 23:23:14 +03:00
vasilito 9836bd0f38 feat: Secure Boot support + hiperiso-branded background
- Add mmx64.efi (MOK Manager) to EFI/BOOT/ for Secure Boot enrollment
- Add ENROLL_THIS_KEY_IN_MOKMANAGER.cer to tool/ for key enrollment
- Replace Ventoy background.png with hiperiso-branded one (dark navy
  background, green 'hiperiso' title, 'Hypervisor ISO Boot Tool' subtitle)
- Verified via QEMU+OVMF boot test: GRUB2 boots, passes all validation
  checks, shows hiperiso menu with correct branding, zero Ventoy refs
2026-06-30 22:41:11 +03:00
vasilito 4e56b47cf6 fix: prefer grub2/bin/BOOTX64.EFI over stale staging copy
package_release.sh was reading from build/staging/efi/BOOTX64.EFI
which was a stale copy from before the vlnk→hlnk rename and GUID fix.
Now checks grub2/bin/BOOTX64.EFI first (the actual build script output).
2026-06-30 22:24:04 +03:00
vasilito f596ecd111 feat: add Ventoy-derived support files for direct boot path
Include pre-built x64 support binaries needed for Ventoy-compatible
direct ISO boot:
- hiperiso_x64.efi: standalone chain-loader EFI app
- hiperiso.cpio, vtloopex.cpio, hiperiso_unix.cpio: initrd injection
- iso9660_x64.efi, udf_x64.efi: standalone filesystem drivers
- vtoyutil_x64.efi: utility driver
- vtoyjump64.exe, common_bcd.xz, common_bootmgr.xz: Windows PE boot
- wimboot.x86_64.xz, memdisk, ipxe.krn: legacy boot helpers
- dragonfly.mfs.xz: DragonFly BSD support
- 7z/, imdisk/: Windows runtime tools

All files are Ventoy-derived binaries (not rebuilt from source).
Standalone EFI app confirmed safe: receives data via command line
params (env_param, mem:), not via VENTOY_GUID.

Disk image: 32MB FAT16, 6MB free after all files added.
2026-06-30 22:20:18 +03:00
vasilito c71ff93c6b fix: add vlnk→hlnk sed rules and GUID hex fix to build scripts
build_grub2_204.sh: Add vlnk/VLNK/Vlnk→hlnk/HLNK/Hlnk sed rules for
build-time transformation. Add targeted sed rule to replace VENTOY_GUID
hex values (0x77772020,0x2e77,0x6576,...) with HIPERISO_GUID values
(0x65706968,0x6972,0x6f73,...) so the binary GUID no longer spells
'www.ventoy.net' in memory.

build_gui_all.sh: Fix vlnk.c→hlnk.c reference in GUI build.
2026-06-30 19:54:07 +03:00
vasilito 759ccf30dd fix: GUI build and web asset renaming
Qt5 .pro file:
- Replace hardcoded /home/panda/ paths with $$PWD-relative paths
- All SOURCES/HEADERS/FORMS/INCLUDEPATH use $$PWD for shadow build safety
- Fixes qmake path resolution from any working directory

QT source content:
- Rename Ventoy2DiskWindow → Hiperiso2DiskWindow (class, UI, translation context)
- Rename VTOY_* macros → HISO_* (JSON_FMT, DEVICE_USB, EFI_PART_BYTES)
- Rename vtoydata → hisodata (struct field)
- Zero Ventoy/ventoy/VTOY/vtoy references remain in QT source

Plugson www and assets/webui:
- Rename all ventoy/vtoy → hiperiso/hiso in HTML, JS, CSS
- Fix critical AJAX endpoint mismatch: /vtoy/json → /hiso/json
  (C backend already used /hiso/json, JS was stale)

Build artifacts cleanup:
- Remove stale QT/build/ and .pro.user from git
- Add to .gitignore

Verified: Full build_gui_all.sh succeeds — Qt5 (199K), GTK3 (383K),
WebUI (247K), Plugson (245K), hisocli (52K), hisolnk (18K)
2026-06-30 15:59:38 +03:00
vasilito 025ae2701c refactor: make hiperiso fully standalone — zero Ventoy dependency
Vendor all previously external dependencies into the hiperiso repo:

Vendored:
- vendor/grub2-modsrc.tar.xz (364K) — GRUB2 build overlay, with dead
  compression files (huffman, lzx, xpress, miniz) removed from both
  the tarball and Makefile.core.def
- vendor/grub-i386-pc/ — BIOS boot images (boot.img, core.img, .lst)
- vendor/tool-x86_64/ — pre-built utility binaries (ash, hexdump,
  mkexfatfs, mount.exfat-fuse, xzcat)
- assets/ — languages.json, HiperisoGTK.glade, WebUI (renamed)
- src/gui/ — full GUI source tree (Qt5, GTK3, Web, Core, Libs)
- src/plugson/ — full Plugson web config tool source
- src/hisolnk/ — Vlnk tool source (renamed)

Dead code removed:
- src/grub2/huffman.c, huffman.h, lzx.c, lzx.h, xpress.c, xpress.h,
  miniz.c, miniz.h, wimboot.h — WIM/injection compression (~3700 lines)
- hiperiso_gzip_compress() stubbed (never called in hypervisor path)
- lzx_decompress(), xca_decompress() stubbed (WIM decompression)

Build scripts updated:
- build_grub2_204.sh: uses vendor/grub2-modsrc.tar.xz
- package_release.sh: uses vendor/ and assets/ paths
- build_gui_all.sh: uses src/gui/, src/plugson/, src/hisolnk/
- fork_ventoy.sh: removed (one-time fork complete)

Verified: GRUB2 BOOTX64.EFI builds clean (1.8M, 275 hiperiso symbols)
Zero reference/Ventoy/ references remain in any build script.
2026-06-30 15:40:05 +03:00
vasilito fb121de75d Add build scripts: build_all, build_grub2, build_gui, build_initramfs, etc. 2026-06-30 14:30:39 +03:00