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.
This commit is contained in:
Adam Joseph 2022-09-23 14:23:31 -07:00 committed by Rick van Schijndel
parent 61ca853b1e
commit 88e32095e1

View File

@ -1,5 +1,6 @@
{ lib, stdenv, 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.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=";
});
postPatch = ''
sed -i Makefile -e 's|= depmod|= ${buildPackages.kmod}/bin/depmod|'