diff options
Diffstat (limited to 'pkgs/os-specific/linux/kernel/manual-config.nix')
-rw-r--r-- | pkgs/os-specific/linux/kernel/manual-config.nix | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index c2f137183082f..67016b71918fd 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -1,4 +1,4 @@ -{ buildPackages, runCommand, nettools, bc, bison, flex, perl, rsync, gmp, libmpc, mpfr, openssl +{ lib, buildPackages, runCommand, nettools, bc, bison, flex, perl, rsync, gmp, libmpc, mpfr, openssl , libelf, cpio, elfutils, zstd, gawk , writeTextFile }: @@ -14,6 +14,7 @@ let echo "}" >> $out '').outPath; in { + lib, # Allow overriding stdenv on each buildLinux call stdenv, # The kernel version @@ -28,7 +29,7 @@ in { configfile, # Manually specified nixexpr representing the config # If unspecified, this will be autodetected from the .config - config ? stdenv.lib.optionalAttrs allowImportFromDerivation (readConfig configfile), + config ? lib.optionalAttrs allowImportFromDerivation (readConfig configfile), # Custom seed used for CONFIG_GCC_PLUGIN_RANDSTRUCT if enabled. This is # automatically extended with extra per-version and per-config values. randstructSeed ? "", @@ -48,11 +49,11 @@ in { }: let - inherit (stdenv.lib) + inherit (lib) hasAttr getAttr optional optionals optionalString optionalAttrs maintainers platforms; # Dependencies that are required to build kernel modules - moduleBuildDependencies = optional (stdenv.lib.versionAtLeast version "4.14") libelf; + moduleBuildDependencies = optional (lib.versionAtLeast version "4.14") libelf; installkernel = writeTextFile { name = "installkernel"; executable=true; text = '' #!${stdenv.shell} -e @@ -63,7 +64,7 @@ let commonMakeFlags = [ "O=$(buildRoot)" - ] ++ stdenv.lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags) + ] ++ lib.optionals (stdenv.hostPlatform.platform ? kernelMakeFlags) stdenv.hostPlatform.platform.kernelMakeFlags; drvAttrs = config_: platform: kernelPatches: configfile: @@ -88,14 +89,14 @@ let installsFirmware = (config.isEnabled "FW_LOADER") && (isModular || (config.isDisabled "FIRMWARE_IN_KERNEL")) && - (stdenv.lib.versionOlder version "4.14"); + (lib.versionOlder version "4.14"); in (optionalAttrs isModular { outputs = [ "out" "dev" ]; }) // { passthru = { inherit version modDirVersion config kernelPatches configfile moduleBuildDependencies stdenv; inherit isXen isZen isHardened isLibre; - kernelOlder = stdenv.lib.versionOlder version; - kernelAtLeast = stdenv.lib.versionAtLeast version; + kernelOlder = lib.versionOlder version; + kernelAtLeast = lib.versionAtLeast version; }; inherit src; @@ -103,9 +104,9 @@ let patches = map (p: p.patch) kernelPatches # Required for deterministic builds along with some postPatch magic. - ++ optional (stdenv.lib.versionAtLeast version "4.13") ./randstruct-provide-seed.patch + ++ optional (lib.versionAtLeast version "4.13") ./randstruct-provide-seed.patch # Fixes determinism by normalizing metadata for the archive of kheaders - ++ optional (stdenv.lib.versionAtLeast version "5.2" && stdenv.lib.versionOlder version "5.4") ./gen-kheaders-metadata.patch; + ++ optional (lib.versionAtLeast version "5.2" && lib.versionOlder version "5.4") ./gen-kheaders-metadata.patch; prePatch = '' for mf in $(find -name Makefile -o -name Makefile.include -o -name install.sh); do @@ -282,9 +283,9 @@ let "The Linux kernel" + (if kernelPatches == [] then "" else " (with patches: " - + stdenv.lib.concatStringsSep ", " (map (x: x.name) kernelPatches) + + lib.concatStringsSep ", " (map (x: x.name) kernelPatches) + ")"); - license = stdenv.lib.licenses.gpl2; + license = lib.licenses.gpl2; homepage = "https://www.kernel.org/"; repositories.git = "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git"; maintainers = [ @@ -296,8 +297,8 @@ let }; in -assert (stdenv.lib.versionAtLeast version "4.14" && stdenv.lib.versionOlder version "5.8") -> libelf != null; -assert stdenv.lib.versionAtLeast version "5.8" -> elfutils != null; +assert (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") -> libelf != null; +assert lib.versionAtLeast version "5.8" -> elfutils != null; stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches configfile) // { pname = "linux"; @@ -308,11 +309,11 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches depsBuildBuild = [ buildPackages.stdenv.cc ]; nativeBuildInputs = [ perl bc nettools openssl rsync gmp libmpc mpfr gawk zstd ] ++ optional (stdenv.hostPlatform.platform.kernelTarget == "uImage") buildPackages.ubootTools - ++ optional (stdenv.lib.versionAtLeast version "4.14" && stdenv.lib.versionOlder version "5.8") libelf + ++ optional (lib.versionAtLeast version "4.14" && lib.versionOlder version "5.8") libelf # Removed util-linuxMinimal since it should not be a dependency. - ++ optionals (stdenv.lib.versionAtLeast version "4.16") [ bison flex ] - ++ optional (stdenv.lib.versionAtLeast version "5.2") cpio - ++ optional (stdenv.lib.versionAtLeast version "5.8") elfutils + ++ optionals (lib.versionAtLeast version "4.16") [ bison flex ] + ++ optional (lib.versionAtLeast version "5.2") cpio + ++ optional (lib.versionAtLeast version "5.8") elfutils ; hardeningDisable = [ "bindnow" "format" "fortify" "stackprotector" "pic" "pie" ]; @@ -322,7 +323,7 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.platform kernelPatches "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" "HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc" "ARCH=${stdenv.hostPlatform.platform.kernelArch}" - ] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ + ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" ]; |