From fe9d78d9751f720a0d85b1d82b4380228005208d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Na=C3=AFm=20Favier?= Date: Tue, 20 Dec 2022 18:38:47 +0100 Subject: [PATCH 1/3] lib/versions: add `pad` Pad a version string with zeros to match a given number of components. (cherry picked from commit 03554797153aa90263161784c296ef6518af3358) Reason: Necessary to backport kernel 6.2. --- lib/tests/misc.nix | 15 +++++++++++++++ lib/versions.nix | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/lib/tests/misc.nix b/lib/tests/misc.nix index 9bdc30d85d44a..68ae7b70d15fb 100644 --- a/lib/tests/misc.nix +++ b/lib/tests/misc.nix @@ -212,6 +212,21 @@ runTests { expected = [ "1" "2" "3" ]; }; + testPadVersionLess = { + expr = versions.pad 3 "1.2"; + expected = "1.2.0"; + }; + + testPadVersionLessExtra = { + expr = versions.pad 3 "1.3-rc1"; + expected = "1.3.0-rc1"; + }; + + testPadVersionMore = { + expr = versions.pad 3 "1.2.3.4"; + expected = "1.2.3"; + }; + testIsStorePath = { expr = let goodPath = diff --git a/lib/versions.nix b/lib/versions.nix index 0e9d81ac78b1e..986e7e5f9b37d 100644 --- a/lib/versions.nix +++ b/lib/versions.nix @@ -46,4 +46,19 @@ rec { builtins.concatStringsSep "." (lib.take 2 (splitVersion v)); + /* Pad a version string with zeros to match the given number of components. + + Example: + pad 3 "1.2" + => "1.2.0" + pad 3 "1.3-rc1" + => "1.3.0-rc1" + pad 3 "1.2.3.4" + => "1.2.3" + */ + pad = n: version: let + numericVersion = lib.head (lib.splitString "-" version); + versionSuffix = lib.removePrefix numericVersion version; + in lib.concatStringsSep "." (lib.take n (lib.splitVersion numericVersion ++ lib.genList (_: "0") n)) + versionSuffix; + } From 31437fa40a52eaaf7a34654ff60f8ed10e4394e7 Mon Sep 17 00:00:00 2001 From: Tyler Slabinski Date: Thu, 2 Feb 2023 15:54:46 -0500 Subject: [PATCH 2/3] linuxPackages_testing: remove unused options for 6.2 (cherry picked from commit f8f7820433f1abc7a0da38a49ab57448baca1ff2) Reason: Necessary to backport kernel 6.2. --- pkgs/os-specific/linux/kernel/common-config.nix | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/common-config.nix b/pkgs/os-specific/linux/kernel/common-config.nix index 22b71ad7af6f3..b3cd95e04ded2 100644 --- a/pkgs/os-specific/linux/kernel/common-config.nix +++ b/pkgs/os-specific/linux/kernel/common-config.nix @@ -286,7 +286,7 @@ let DRM_GMA500 = whenAtLeast "5.12" module; DRM_GMA600 = whenOlder "5.13" yes; DRM_GMA3600 = whenOlder "5.12" yes; - DRM_VMWGFX_FBCON = yes; + DRM_VMWGFX_FBCON = whenOlder "6.2" yes; # (experimental) amdgpu support for verde and newer chipsets DRM_AMDGPU_SI = yes; # (stable) amdgpu support for bonaire and newer chipsets @@ -434,7 +434,7 @@ let F2FS_FS_COMPRESSION = whenAtLeast "5.6" yes; UDF_FS = module; - NFSD_V2_ACL = yes; + NFSD_V2_ACL = whenOlder "6.2" yes; NFSD_V3 = whenOlder "5.18" yes; NFSD_V3_ACL = yes; NFSD_V4 = yes; @@ -461,7 +461,7 @@ let CEPH_FS_POSIX_ACL = yes; SQUASHFS_FILE_DIRECT = yes; - SQUASHFS_DECOMP_MULTI_PERCPU = yes; + SQUASHFS_DECOMP_MULTI_PERCPU = whenOlder "6.2" yes; SQUASHFS_XATTR = yes; SQUASHFS_ZLIB = yes; SQUASHFS_LZO = yes; @@ -508,8 +508,8 @@ let SECURITY_APPARMOR = yes; DEFAULT_SECURITY_APPARMOR = yes; - RANDOM_TRUST_CPU = whenAtLeast "4.19" yes; # allow RDRAND to seed the RNG - RANDOM_TRUST_BOOTLOADER = whenAtLeast "5.4" yes; # allow the bootloader to seed the RNG + RANDOM_TRUST_CPU = whenOlder "6.2" (whenAtLeast "4.19" yes); # allow RDRAND to seed the RNG + RANDOM_TRUST_BOOTLOADER = whenOlder "6.2" (whenAtLeast "5.4" yes); # allow the bootloader to seed the RNG MODULE_SIG = no; # r13y, generates a random key during build and bakes it in # Depends on MODULE_SIG and only really helps when you sign your modules @@ -834,7 +834,7 @@ let EFI_STUB = yes; # EFI bootloader in the bzImage itself EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER = - whenAtLeast "5.8" yes; # initrd kernel parameter for EFI + whenOlder "6.2" (whenAtLeast "5.8" yes); # initrd kernel parameter for EFI CGROUPS = yes; # used by systemd FHANDLE = yes; # used by systemd SECCOMP = yes; # used by systemd >= 231 From de6aa650966b8c464d352b8a2a49704599b1da63 Mon Sep 17 00:00:00 2001 From: K900 Date: Mon, 20 Feb 2023 13:40:41 +0300 Subject: [PATCH 3/3] linux: init 6.2 (cherry picked from commit 522512e7b46054645bba9deefb90547d47dbd149) --- pkgs/os-specific/linux/kernel/linux-6.2.nix | 18 ++++++++++++++++++ pkgs/top-level/aliases.nix | 2 ++ pkgs/top-level/linux-kernels.nix | 11 ++++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 pkgs/os-specific/linux/kernel/linux-6.2.nix diff --git a/pkgs/os-specific/linux/kernel/linux-6.2.nix b/pkgs/os-specific/linux/kernel/linux-6.2.nix new file mode 100644 index 0000000000000..61ab8f13e552e --- /dev/null +++ b/pkgs/os-specific/linux/kernel/linux-6.2.nix @@ -0,0 +1,18 @@ +{ lib, buildPackages, fetchurl, perl, buildLinux, nixosTests, ... } @ args: + +with lib; + +buildLinux (args // rec { + version = "6.2"; + + # modDirVersion needs to be x.y.z, will automatically add .0 if needed + modDirVersion = versions.pad 3 version; + + # branchVersion needs to be x.y + extraMeta.branch = versions.majorMinor version; + + src = fetchurl { + url = "mirror://kernel/linux/kernel/v6.x/linux-${version}.tar.xz"; + sha256 = "sha256-dIYvqKtA7a6FuzOFwLcf4QMoi85RhSbWMZeACzy97LE="; + }; +} // (args.argsOverride or { })) diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index ba5f9e50a07d5..178504adfb76a 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -822,6 +822,7 @@ mapAliases ({ linuxPackages_5_4 = linuxKernel.packages.linux_5_4; linuxPackages_6_0 = linuxKernel.packages.linux_6_0; linuxPackages_6_1 = linuxKernel.packages.linux_6_1; + linuxPackages_6_2 = linuxKernel.packages.linux_6_2; linuxPackages_hardkernel_4_14 = linuxKernel.packages.hardkernel_4_14; linuxPackages_rpi0 = linuxKernel.packages.linux_rpi1; linuxPackages_rpi02w = linuxKernel.packages.linux_rpi3; @@ -841,6 +842,7 @@ mapAliases ({ linux_5_4 = linuxKernel.kernels.linux_5_4; linux_6_0 = linuxKernel.kernels.linux_6_0; linux_6_1 = linuxKernel.kernels.linux_6_1; + linux_6_2 = linuxKernel.kernels.linux_6_2; linuxPackages_mptcp = throw "'linuxPackages_mptcp' has been moved to https://github.com/teto/mptcp-flake"; # Converted to throw 2022-10-04 linux_mptcp = throw "'linux_mptcp' has been moved to https://github.com/teto/mptcp-flake"; # Converted to throw 2022-10-04 linux_mptcp_95 = throw "'linux_mptcp_95' has been moved to https://github.com/teto/mptcp-flake"; # Converted to throw 2022-10-04 diff --git a/pkgs/top-level/linux-kernels.nix b/pkgs/top-level/linux-kernels.nix index f9e193b27a9f7..ab1972218811d 100644 --- a/pkgs/top-level/linux-kernels.nix +++ b/pkgs/top-level/linux-kernels.nix @@ -166,6 +166,14 @@ in { ]; }; + linux_6_2 = callPackage ../os-specific/linux/kernel/linux-6.2.nix { + kernelPatches = [ + kernelPatches.bridge_stp_helper + kernelPatches.request_key_helper + kernelPatches.fix-em-ice-bonding + ]; + }; + linux_testing = let testing = callPackage ../os-specific/linux/kernel/linux-testing.nix { kernelPatches = [ @@ -522,6 +530,7 @@ in { linux_5_19 = throw "linux 5.19 was removed because it reached its end of life upstream"; # Added 2022-11-01 linux_6_0 = throw "linux 6.0 was removed because it reached its end of life upstream"; # Added 2023-01-20 linux_6_1 = recurseIntoAttrs (packagesFor kernels.linux_6_1); + linux_6_2 = recurseIntoAttrs (packagesFor kernels.linux_6_2); }; rtPackages = { @@ -581,7 +590,7 @@ in { packageAliases = { linux_default = packages.linux_5_15; # Update this when adding the newest kernel major version! - linux_latest = packages.linux_6_1; + linux_latest = packages.linux_6_2; linux_mptcp = packages.linux_mptcp_95; linux_rt_default = packages.linux_rt_5_4; linux_rt_latest = packages.linux_rt_5_10;