diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index 910541f0ba60..acf965d99507 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -114,7 +114,8 @@ let patches = map (p: p.patch) kernelPatches # Required for deterministic builds along with some postPatch magic. - ++ optional (lib.versionAtLeast version "4.13") ./randstruct-provide-seed.patch + ++ 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; diff --git a/pkgs/os-specific/linux/kernel/randstruct-provide-seed-5.19.patch b/pkgs/os-specific/linux/kernel/randstruct-provide-seed-5.19.patch new file mode 100644 index 000000000000..5ca897a76bf6 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/randstruct-provide-seed-5.19.patch @@ -0,0 +1,13 @@ +diff --git a/scripts/gen-randstruct-seed.sh b/scripts/gen-randstruct-seed.sh +index 61017b36c464..7bb494dd2e18 100755 +--- a/scripts/gen-randstruct-seed.sh ++++ b/scripts/gen-randstruct-seed.sh +@@ -1,7 +1,7 @@ + #!/bin/sh + # SPDX-License-Identifier: GPL-2.0 + +-SEED=$(od -A n -t x8 -N 32 /dev/urandom | tr -d ' \n') ++SEED="NIXOS_RANDSTRUCT_SEED" + echo "$SEED" > "$1" + HASH=$(echo -n "$SEED" | sha256sum | cut -d" " -f1) + echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2"