tpwrules / nixos-apple-silicon

Resources to install NixOS bare metal on Apple Silicon Macs
MIT License
757 stars 76 forks source link

Build of 'linux-asahi' fails when `hardware.asahi.use4KPages = true` #43

Closed NyxAlexandra closed 4 months ago

NyxAlexandra commented 1 year ago

The system builds fine when it is set to false. Occurs in default configuration.

System information:

Output of nixos-rebuild switch:

building Nix...
building the system configuration...
these 12 derivations will be built:
  /nix/store/0zh79jxidmsnjhy0qxvfx6mnkagnq0m0-linux-6.1.0-asahi.drv
  /nix/store/dk88i8xn8ziaqf222bwkycb1zjc9gqc4-boot.bin.drv
  /nix/store/z3f4g3vaxkhd5sv0qzn6xqm49v0q48an-copy-extra-files.drv
  /nix/store/bvn4lx7wl5jkxc8igdagzbqzrky6nn1a-systemd-boot-builder.py.drv
  /nix/store/cak34y6bc3pwvc3dvr0m5p17xg4qvw53-systemd-boot.drv
  /nix/store/1ypfzxxbkkypwjsnwwkhvkxcq423f25g-install-systemd-boot.sh.drv
  /nix/store/qm80rz049zqir027v41gcpfl1aq12vmm-linux-6.1.0-asahi-modules.drv
  /nix/store/xmwggk3lq134q90z80y09pcvwp9pvkvw-linux-6.1.0-asahi-modules-shrunk.drv
  /nix/store/n10y6jgbzvwl735kidrypv6idwvp7f3p-stage-1-init.sh.drv
  /nix/store/nr9lrapcaajm0vd9gpzpydgh9cia0556-initrd-linux-6.1.0-asahi.drv
  /nix/store/r59imdliv0lrr6npd5vrckpn2v69py4y-kernel-modules.drv
  /nix/store/b8zgk5ny0533r6zsyhg8fksscz2yz14a-nixos-system-M2NixOS-23.05pre-git.drv
building '/nix/store/0zh79jxidmsnjhy0qxvfx6mnkagnq0m0-linux-6.1.0-asahi.drv'...
unpacking sources
unpacking source archive /nix/store/aaijfm6z80pw06qnfpbqxdi7afbjg30m-source
source root is source
patching sources
applying patch /nix/store/2bjv3bjq46b39mfd0ib81pgkpq0afbbf-sven-iommu-4k.patch
patching file drivers/iommu/apple-dart.c
Hunk #1 FAILED at 97.
Hunk #2 FAILED at 115.
Hunk #3 FAILED at 499.
Hunk #4 succeeded at 862 (offset 232 lines).
Hunk #5 FAILED at 734.
Hunk #6 FAILED at 1119.
Hunk #7 FAILED at 1147.
6 out of 7 hunks FAILED -- saving rejects to file drivers/iommu/apple-dart.c.rej
patching file drivers/iommu/dma-iommu.c
Hunk #1 FAILED at 20.
Hunk #2 succeeded at 740 (offset 30 lines).
Hunk #3 succeeded at 782 (offset 30 lines).
Hunk #4 succeeded at 829 (offset 19 lines).
Hunk #5 succeeded at 865 (offset 31 lines).
Hunk #6 succeeded at 885 (offset 19 lines).
Hunk #7 FAILED at 1122.
Hunk #8 FAILED at 1164.
Hunk #9 FAILED at 1248.
Hunk #10 succeeded at 1599 (offset 105 lines).
4 out of 10 hunks FAILED -- saving rejects to file drivers/iommu/dma-iommu.c.rej
patching file drivers/iommu/iommu.c
Hunk #1 succeeded at 88 with fuzz 1 (offset 8 lines).
Hunk #2 succeeded at 1938 with fuzz 2 (offset -40 lines).
Hunk #3 succeeded at 1965 (offset -40 lines).
patching file drivers/iommu/iova.c
Hunk #1 succeeded at 54 (offset 5 lines).
patching file include/linux/iommu.h
Hunk #3 succeeded at 106 with fuzz 2.
error: builder for '/nix/store/0zh79jxidmsnjhy0qxvfx6mnkagnq0m0-linux-6.1.0-asahi.drv' failed with exit code 1
error: 1 dependencies of derivation '/nix/store/b8zgk5ny0533r6zsyhg8fksscz2yz14a-nixos-system-M2NixOS-23.05pre-git.drv' failed to build
tpwrules commented 1 year ago

Yes, this is a known problem. The patch which enables stuff like WiFi to work on a 4K kernel is out of date as of the update to 6.1 or so. I don't really have the skill to fix it, but you are welcome to do so yourself or find a fixed version (perhaps from one of the other alternate distro maintainers) and submit a PR.

nouun commented 1 year ago

Can there be a warning added for this in the installation guide? Just spent 30 minutes trying to debug this before I found this issue.

tpwrules commented 1 year ago

An error has been added so your configuration will refuse to evaluate instead of failing to apply a broken patch. Sorry about the inconvenience.

zzywysm commented 6 months ago

With the addition of the error above, and the advent of 4k microvms, can this now be closed?

https://sinrega.org/2023-10-06-using-microvms-for-gaming-on-fedora-asahi/

tpwrules commented 4 months ago

Nobody has stepped up to fix this so I'm finally removing it completely.