Skip to content

add Windows (WHP) cross-compilation support#122

Merged
slp merged 1 commit into
libkrun:mainfrom
lstocchi:windows
May 5, 2026
Merged

add Windows (WHP) cross-compilation support#122
slp merged 1 commit into
libkrun:mainfrom
lstocchi:windows

Conversation

@lstocchi
Copy link
Copy Markdown
Contributor

This PR introducess Windows support to generate a libkrunfw.dll for use with the Windows Hypervisor Platform (WHP).

The windows config is just a copy of config-libkrunfw_x86_64 with the addition of hyperv modules. It can be certainly optimized (i think at kvm-centric modules) but i don't plan to look at it in the next future. At least this is a first step that can be improved later.

Introduce a dedicated Windows build target (`make OS=Windows`) that
cross-compiles libkrunfw.dll for use with the Windows Hypervisor
Platform (WHP).
- Add config-libkrunfw-windows_x86_64 with Hyper-V guest enlightenments
  (CONFIG_HYPERV, CONFIG_HYPERV_TIMER, CONFIG_HYPERV_UTILS) so the
  guest kernel can leverage WHP paravirtualization.
- Make bin2cbundle.py accept an --os flag to select page alignment:
  4K for Windows (matching x86_64 WHP page granularity) and 64K
  (the original default) for Linux/macOS, avoiding InvalidGuestAddress
  errors caused by alignment mismatches.
- Update the Makefile to handle the full Windows pipeline: select the
  Windows kernel config, invoke bin2cbundle.py with the correct OS,
  and link with x86_64-w64-mingw32-gcc using the appropriate flags
  (--kill-at, --nxcompat).
- Document the Windows cross-compilation workflow in README.md.

Signed-off-by: lstocchi <lstocchi@redhat.com>
Copy link
Copy Markdown
Collaborator

@slp slp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@slp slp merged commit 7d995aa into libkrun:main May 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants