diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index acf965d99507..377f7fc1c077 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -1,6 +1,5 @@ { lib, buildPackages, runCommand, nettools, bc, bison, flex, perl, rsync, gmp, libmpc, mpfr, openssl , libelf, cpio, elfutils, zstd, python3Minimal, zlib, pahole -, writeTextFile }: let @@ -61,17 +60,12 @@ let ++ optional (lib.versionAtLeast version "5.13") zstd; - installkernel = writeTextFile { name = "installkernel"; executable=true; text = '' - #!${stdenv.shell} -e + installkernel = buildPackages.writeShellScript "installkernel" '' + set -e mkdir -p $4 cp -av $2 $4 cp -av $3 $4 - ''; }; - - commonMakeFlags = [ - "O=$(buildRoot)" - ] ++ lib.optionals (stdenv.hostPlatform.linux-kernel ? makeFlags) - stdenv.hostPlatform.linux-kernel.makeFlags; + ''; drvAttrs = config_: kernelConf: kernelPatches: configfile: let @@ -335,13 +329,15 @@ stdenv.mkDerivation ((drvAttrs config stdenv.hostPlatform.linux-kernel kernelPat hardeningDisable = [ "bindnow" "format" "fortify" "stackprotector" "pic" "pie" ]; # Absolute paths for compilers avoid any PATH-clobbering issues. - makeFlags = commonMakeFlags ++ [ + makeFlags = [ + "O=$(buildRoot)" "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" "HOSTCC=${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc" "ARCH=${stdenv.hostPlatform.linuxArch}" ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ "CROSS_COMPILE=${stdenv.cc.targetPrefix}" - ] ++ extraMakeFlags; + ] ++ (stdenv.hostPlatform.linux-kernel.makeFlags or []) + ++ extraMakeFlags; karch = stdenv.hostPlatform.linuxArch; } // (optionalAttrs (pos != null) { inherit pos; }))