build: a nix shell, because the loader is the one thing gcc cannot build
make falls back to the GNU toolchain when clang is absent, and that works for the kernel. It does not work for the UEFI loader: BOOTX64.EFI is PE/COFF and wants clang plus lld-link, so a machine with only gcc gets a kernel that builds and a loader that silently stays whatever it already was. That is not hypothetical -- it is what left a stale boot splash on this tree for half a day. The mask in include/logo.h was the new mark, the kernel drew it, and the loader kept drawing one compiled months earlier because nothing could relink it and nothing said so. shell.nix declares everything docs/guides/building.md lists, and building.md gains a NixOS section saying why using it matters rather than just how. Verified: with clang 21.1.8 and LLD 21.1.8 the loader relinks and the splash draws Shift in metal, screendumped from the framebuffer rather than inferred. Pinned to the host's nixpkgs rather than a flake input, deliberately. This is a convenience for a development machine, not a reproducibility claim; if it ever needs to be the latter it wants a flake and should say so. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VQ7Qx8E1q1M1bbCq8QLHS2
This commit is contained in:
parent
c4d4f20548
commit
6c42ab3b1a
3 changed files with 68 additions and 0 deletions
|
|
@ -22,6 +22,25 @@ make qemu # build and boot it
|
|||
| `curl`, `tar` | fetching ports | Git Bash | present | present | present |
|
||||
| `xorriso` **or** `mkisofs` | `make iso` only | `scoop install cdrtools` | `xorriso` | `brew install xorriso` | `pkg install xorriso` |
|
||||
|
||||
On NixOS, `nix-shell` supplies every row above — see below.
|
||||
|
||||
## NixOS
|
||||
|
||||
```sh
|
||||
nix-shell # then: make, make qemu, make iso
|
||||
```
|
||||
|
||||
`shell.nix` in the repository root declares the lot. Worth using rather than
|
||||
assembling it by hand, for one specific reason: **`make` falls back to the GNU
|
||||
toolchain for the kernel but the UEFI loader genuinely cannot be built without
|
||||
clang and `lld-link`.** A machine with only gcc therefore produces a kernel that
|
||||
builds and a loader that silently stays whatever it already was — which left a
|
||||
stale boot splash on this tree for half a day before anyone looked at the
|
||||
screen rather than the build output.
|
||||
|
||||
PowerShell is the one thing the shell does not supply, and `tools/windows/`
|
||||
needs it. See the note at the end of this file.
|
||||
|
||||
A host C compiler (`cc`) is also needed, for the tools that build the disk
|
||||
images. On Windows that must be **mingw-w64's gcc**, not clang: clang defaults
|
||||
to an MSVC target there, and `tools/mkfs.c` needs `<unistd.h>` and `<dirent.h>`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue