build: add Windows build support via zig cc and GNU objcopy - #6
Open
coff33ninja wants to merge 2 commits into
Open
build: add Windows build support via zig cc and GNU objcopy#6coff33ninja wants to merge 2 commits into
coff33ninja wants to merge 2 commits into
Conversation
Three scripts port \make\ to Windows: ensure-toolchain.ps1 provisions zig, nasm, qemu and MSYS2 binutils; build.ps1 compiles with zig cc (clang) and re-labels the ELF64 kernel as an ELF32 container with \objcopy -O elf32-i386\, matching the Makefile; run.ps1 boots it in QEMU headless or with graphics. README gains the On Windows section and a fork/NO_OS attribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Windows build path alongside the macOS Makefile. These three scripts make the tree build on a stock Windows box with Zig's bundled clang (zig cc), NASM, QEMU and GNU binutils from MSYS2:
objcopy -O elf32-i386- the exact command the Makefile's$(OBJCOPY)step runs. Verified end-to-end: kernel.bin boots, formats disk.img FAT32, and persists across reboots.README: new "On Windows" section, plus a footer crediting NO_OS - the ELF-reframing ADR there is where the objcopy trick came from.
Follow-up: the QEMU boot-assertion suite also runs on Windows
test-qemurecipe:tests/qemu/lint_printf.py(the lib/kfmt.c formatter-grammar check), then all six boot-assertion cases.FABLEOS_TEST_MAKE) points at build.ps1 so thebuild-cflags:AC'97 bring-up case works with no make on the box.Verified on Windows:
lint_printfCLEAN, all 6 cases pass (the AC'97 variant build restores the tree afterwards; kernel.bin is byte-identical).Notes for the maintainer
-fno-sanitize=undefinedis required because zig's compiler_rt pulls in__ubsan_handle_*on freestanding builds.