mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
linux: add setup hook for kernel compression
This setup hook ensures that kernel modules are compressed with parameters the kernel is capable of decompressing. This is currently only effective when xz is used as the kernel module compression algorithm.
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
rustc-unwrapped,
|
||||
rust-bindgen-unwrapped,
|
||||
rustPlatform,
|
||||
makeSetupHook,
|
||||
xz,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -158,6 +160,11 @@ lib.makeOverridable (
|
||||
elfutils
|
||||
# module makefiles often run uname commands to find out the kernel version
|
||||
(buildPackages.deterministic-uname.override { inherit modDirVersion; })
|
||||
(makeSetupHook {
|
||||
name = "setup-module-compression";
|
||||
substitutions = { inherit configfile modDirVersion; };
|
||||
propagatedNativeBuildInputs = [ xz ];
|
||||
} ./setup-module-compression.sh)
|
||||
]
|
||||
++ optional (lib.versionAtLeast version "5.13") zstd
|
||||
++ optionals withRust [
|
||||
|
||||
11
pkgs/os-specific/linux/kernel/setup-module-compression.sh
Normal file
11
pkgs/os-specific/linux/kernel/setup-module-compression.sh
Normal file
@@ -0,0 +1,11 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
setupModuleCompressionHook() {
|
||||
# Ensure CRC32 is used, which the kernel is capable of decompressing natively (enabled by CONFIG_MODULE_DECOMPRESS=y).
|
||||
export XZ_OPT="--check=crc32"
|
||||
}
|
||||
|
||||
if [[ -z "${dontSetupModuleCompression-}" ]]; then
|
||||
nixInfoLog "Using setupModuleCompressionHook"
|
||||
postConfigureHooks+=(setupModuleCompressionHook)
|
||||
fi
|
||||
Reference in New Issue
Block a user