From 9eb1946e1d213344bb12c47b24b668f321add3c4 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 23 Sep 2022 14:23:31 -0700 Subject: [PATCH] linux/kernel: backport symbol GPLification fix from 5.19 Linux has a few PowerPC-specific symbols which are marked as GPL exports; these symbols wound up being exposed in Linux 5.12 and are needed by OpenZFS. The symbol licensing was fixed in mainline 5.19; this commit backports the fix to all previous affected kernels. This commit is required in order to build the NixOS ISO for PowerPC64. --- pkgs/os-specific/linux/kernel/manual-config.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 4780c959315d7..9d49d6425e07d 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -1,5 +1,6 @@ { lib, buildPackages, runCommand, nettools, bc, bison, flex, perl, rsync, gmp, libmpc, mpfr, openssl , libelf, cpio, elfutils, zstd, python3Minimal, zlib, pahole +, fetchpatch }: let @@ -103,7 +104,17 @@ let ++ optional (lib.versionAtLeast version "4.13" && lib.versionOlder version "5.19") ./randstruct-provide-seed.patch ++ optional (lib.versionAtLeast version "5.19") ./randstruct-provide-seed-5.19.patch # Fixes determinism by normalizing metadata for the archive of kheaders - ++ optional (lib.versionAtLeast version "5.2" && lib.versionOlder version "5.4") ./gen-kheaders-metadata.patch; + ++ optional (lib.versionAtLeast version "5.2" && lib.versionOlder version "5.4") ./gen-kheaders-metadata.patch + # Linux 5.12 marked certain PowerPC-only symbols as GPL, which breaks + # OpenZFS; this was fixed in Linux 5.19 so we backport the fix + # https://github.com/openzfs/zfs/pull/13367 + ++ optional (lib.versionAtLeast version "5.12" && + lib.versionOlder version "5.19" && + stdenv.hostPlatform.isPower) + (fetchpatch { + url = "https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/patch/?id=d9e5c3e9e75162f845880535957b7fd0b4637d23"; + hash = "sha256-bBOyJcP6jUvozFJU0SPTOf3cmnTQ6ZZ4PlHjiniHXLU="; + }); prePatch = '' sed -i Makefile -e 's|= depmod|= ${buildPackages.kmod}/bin/depmod|'