lol

Merge pull request #237873 from Mic92/fix-aarch64-zfs

authored by

Ryan Lahfa and committed by
GitHub
ed2f0091 7be83143

+60 -11
+44 -3
nixos/modules/tasks/filesystems/zfs.nix
··· 323 323 Defaults to 0, which waits forever. 324 324 ''; 325 325 }; 326 + 327 + removeLinuxDRM = lib.mkOption { 328 + type = types.bool; 329 + default = false; 330 + description = lib.mdDoc '' 331 + Linux 6.2 dropped some kernel symbols required on aarch64 required by zfs. 332 + Enabling this option will bring them back to allow this kernel version. 333 + Note that in some jurisdictions this may be illegal as it might be considered 334 + removing copyright protection from the code. 335 + See https://www.ifross.org/?q=en/artikel/ongoing-dispute-over-value-exportsymbolgpl-function for further information. 336 + 337 + If configure your kernel package with `zfs.latestCompatibleLinuxPackages`, you will need to also pass removeLinuxDRM to that package like this: 338 + 339 + ``` 340 + { pkgs, ... }: { 341 + boot.kernelPackages = (pkgs.zfs.override { 342 + removeLinuxDRM = pkgs.hostPlatform.isAarch64; 343 + }).latestCompatibleLinuxPackages; 344 + 345 + boot.zfs.removeLinuxDRM = true; 346 + } 347 + ``` 348 + ''; 349 + }; 326 350 }; 327 351 328 352 services.zfs.autoSnapshot = { ··· 541 565 # https://github.com/NixOS/nixpkgs/issues/106093 542 566 kernelParams = lib.optionals (!config.boot.zfs.allowHibernation) [ "nohibernate" ]; 543 567 544 - extraModulePackages = [ 545 - (if config.boot.zfs.enableUnstable then 568 + extraModulePackages = let 569 + kernelPkg = if config.boot.zfs.enableUnstable then 546 570 config.boot.kernelPackages.zfsUnstable 547 571 else 548 - config.boot.kernelPackages.zfs) 572 + config.boot.kernelPackages.zfs; 573 + in [ 574 + (kernelPkg.override { inherit (cfgZfs) removeLinuxDRM; }) 549 575 ]; 550 576 }; 551 577 ··· 662 688 663 689 services.udev.packages = [ cfgZfs.package ]; # to hook zvol naming, etc. 664 690 systemd.packages = [ cfgZfs.package ]; 691 + 692 + # Export kernel_neon_* symbols again. 693 + # This change is necessary until ZFS figures out a solution 694 + # with upstream or in their build system to fill the gap for 695 + # this symbol. 696 + # In the meantime, we restore what was once a working piece of code 697 + # in the kernel. 698 + boot.kernelPatches = lib.optional (cfgZfs.removeLinuxDRM && pkgs.stdenv.hostPlatform.system == "aarch64-linux") { 699 + name = "export-neon-symbols-as-gpl"; 700 + patch = pkgs.fetchpatch { 701 + url = "https://github.com/torvalds/linux/commit/aaeca98456431a8d9382ecf48ac4843e252c07b3.patch"; 702 + hash = "sha256-L2g4G1tlWPIi/QRckMuHDcdWBcKpObSWSRTvbHRIwIk="; 703 + revert = true; 704 + }; 705 + }; 665 706 666 707 systemd.services = let 667 708 createImportService' = pool: createImportService {
+6 -2
pkgs/os-specific/linux/zfs/stable.nix
··· 2 2 , kernel ? null 3 3 , stdenv 4 4 , linuxKernel 5 + , removeLinuxDRM ? false 5 6 , ... 6 7 } @ args: 7 8 ··· 11 12 callPackage ./generic.nix args { 12 13 # check the release notes for compatible kernels 13 14 kernelCompatible = 14 - if stdenv'.isx86_64 15 + if stdenv'.isx86_64 || removeLinuxDRM 15 16 then kernel.kernelOlder "6.4" 16 17 else kernel.kernelOlder "6.2"; 17 - latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_3; 18 + latestCompatibleLinuxPackages = if stdenv'.isx86_64 || removeLinuxDRM then 19 + linuxKernel.packages.linux_6_3 20 + else 21 + linuxKernel.packages.linux_6_1; 18 22 19 23 # this package should point to the latest release. 20 24 version = "2.1.12";
+10 -6
pkgs/os-specific/linux/zfs/unstable.nix
··· 2 2 , kernel ? null 3 3 , stdenv 4 4 , linuxKernel 5 + , removeLinuxDRM ? false 5 6 , ... 6 7 } @ args: 7 8 ··· 13 14 # NOTE: 14 15 # zfs-2.1.9<=x<=2.1.10 is broken with aarch64-linux-6.2 15 16 # for future releases, please delete this condition. 16 - kernelCompatible = if stdenv'.isx86_64 17 - then kernel.kernelOlder "6.3" 17 + kernelCompatible = if stdenv'.isx86_64 || removeLinuxDRM 18 + then kernel.kernelOlder "6.4" 18 19 else kernel.kernelOlder "6.2"; 19 - latestCompatibleLinuxPackages = linuxKernel.packages.linux_6_1; 20 + 21 + latestCompatibleLinuxPackages = if stdenv'.isx86_64 || removeLinuxDRM then 22 + linuxKernel.packages.linux_6_3 23 + else 24 + linuxKernel.packages.linux_6_1; 20 25 21 26 # this package should point to a version / git revision compatible with the latest kernel release 22 27 # IMPORTANT: Always use a tagged release candidate or commits from the 23 28 # zfs-<version>-staging branch, because this is tested by the OpenZFS 24 29 # maintainers. 25 - version = "2.1.12-staging-2023-04-18"; 26 - rev = "e25f9131d679692704c11dc0c1df6d4585b70c35"; 30 + version = "2.1.12"; 27 31 28 - sha256 = "tJLwyqUj1l5F0WKZDeMGrEFa8fc/axKqm31xtN51a5M="; 32 + sha256 = "eYUR5d4gpTrlFu6j1uL83DWL9uPGgAUDRdSEb73V5i4="; 29 33 30 34 isUnstable = true; 31 35 }