mirror of
https://github.com/Droid-VM/linux-boot-extractor.git
synced 2026-11-17 19:02:01 +00:00
entries: report a Windows install as a boot entry of its own
A Windows image has no vmlinuz, so `boot::scan` found nothing and every
command could only answer "no boot artifacts" — indistinguishable from a
Linux image whose /boot we failed to parse. A VM manager needs that
difference: there is no kernel to direct-boot, and the image can only be
started as a plain disk under UEFI firmware.
Windows is not a separate question, so it doesn't get a separate command:
it is another entry in `entries`/`boot-info`, carrying what starting it
takes (firmware, architecture, boot manager) where a Linux entry carries
kernel/initrd/cmdline. JSON entries gain `type` ("linux"/"windows") plus
`firmware`/`arch`/`loader`, null on the kind they don't apply to; the
array shape is unchanged, so existing consumers keep parsing.
An entry comes either from a config's `chainloader` item (os-prober's
dual-boot menu already declares Windows) or, when nothing declares it,
from detection. Windows keeps its system files on NTFS, which we
deliberately don't read, so detection works from the readable parts: the
boot manager on the FAT ESP — whose PE machine field also gives the guest
architecture — partition types only Windows creates, NTFS/ReFS magic,
and, for BIOS installs, Windows' MBR bootstrap together with a VBR that
chains to BOOTMGR/NTLDR.
Keeping chainloader items also fixes a silent wrong answer: they have no
kernel, so drop_stale_entries deleted them, and a `set default` pointing
at Windows fell back to the first Linux entry with no hint. On a dual-boot
image lbx now reports what GRUB would actually boot.
Supporting changes: fsys detects ntfs/exfat/refs (and still never reads
them), GPT/MBR learn the Microsoft partition types, and Partition gains a
machine-readable `type_id` so callers match on the type instead of on
`kind`'s wording. scripts/make-windows-test-image.sh builds the three
layouts — uefi, bios, dual — this was verified against.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Kh6FTGzsmY3wv9Kb8Deeah
This commit is contained in:
parent
a6013fe9bc
commit
e5950ee1f0
12 changed files with 1114 additions and 73 deletions
79
README.md
79
README.md
140
scripts/make-windows-test-image.sh
Executable file
140
scripts/make-windows-test-image.sh
Executable file
143
src/boot/mod.rs
143
src/boot/mod.rs
507
src/guest.rs
507
src/guest.rs
202
src/main.rs
202
src/main.rs
Loading…
Add table
Add a link
Reference in a new issue