Merge pull request #183615 from alyssais/manual-config-cleanup

linux: small manual-config cleanups
This commit is contained in:
Bernardo Meurer 2022-07-29 09:53:34 -07:00 committed by GitHub
commit be3c39fb8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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; }))