diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh new file mode 100644 index 0000000000000..44baff1f7dfd3 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/builder.sh @@ -0,0 +1,8 @@ +# TODO testing if that's better +source $stdenv/setup + +# that s how cmake replaces +# if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then +# setOutputFlags= +# configurePhase=cmakeConfigurePhase +# fi diff --git a/pkgs/os-specific/linux/kernel/config.nix b/pkgs/os-specific/linux/kernel/config.nix new file mode 100644 index 0000000000000..dd7ec4d162323 --- /dev/null +++ b/pkgs/os-specific/linux/kernel/config.nix @@ -0,0 +1,155 @@ +{ + stdenv +, lib +# , config +# , buildRoot +# , srcRoot +, ignoreConfigErrors, version +# , kernelConfig +, config, configCross ?null +, kernelPatches +, runCommand +, kernel +, perl, hostPlatform +, ... +}: + +# with import lib.nix; +/* + +# TODO we should be able to generate standalone config and config on the go +# => we need functions with module etc +# espcially we need a bash builder +# TODO have a standalone +# etait defini dans generic.nix + +There variables are exported to be used by the generate-config.pl script, see the buildPhase +debug +autoModules +preferBuiltin +ignoreConfigErrors +kernel_config + +kernel-config is a file + +TODO doesn t need to be a derviation ? +can 't we justr override the source or split into two derivations: +- standalone +- embedded +*/ +let + + readConfig = configfile: import (runCommand "config.nix" {} '' + echo "{" > "$out" + while IFS='=' read key val; do + [ "x''${key#CONFIG_}" != "x$key" ] || continue + no_firstquote="''${val#\"}"; + echo ' "'"$key"'" = "'"''${no_firstquote%\"}"'";' >> "$out" + done < "${configfile}" + echo "}" >> $out + '').outPath; + + # RENAME to 'load' + convertKernelConfigToJson = readConfig; + + patchKconfig = '' + # Patch kconfig to print "###" after every question so that + # generate-config.pl from the generic builder can answer them. + sed -e '/fflush(stdout);/i\printf("###");' -i scripts/kconfig/conf.c + ''; + + # generates functor + # + kernelConfigFun = baseConfig: kernelPatches: + let + configFromPatches = + map ({extraConfig ? "", ...}: extraConfig) kernelPatches; + in lib.concatStringsSep "\n" ([baseConfig] ++ configFromPatches); +in +stdenv.mkDerivation rec { + inherit ignoreConfigErrors; + name = "linux-config-${version}"; + + + # Runs generate-config + # my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$wd config SHELL=bash ARCH=$ENV{ARCH}"); + generateConfig = ./generate-config.pl; + + # string that will be echoed to kernel-config file + # writeFile + # echo "$kernelConfig" > kernel-config + kernelConfig = kernelConfigFun config kernelPatches; + + nativeBuildInputs = [ perl ]; + + platformName = stdenv.platform.name; + + # sthg like "defconfig" + kernelBaseConfig = stdenv.platform.kernelBaseConfig; + + # e.g. "bzImage" + kernelTarget = stdenv.platform.kernelTarget; + # HHHAAAACCKKK + autoModules = false; # stdenv.platform.kernelAutoModules; + preferBuiltin = stdenv.platform.kernelPreferBuiltin or false; + # kernel ARCH + arch = stdenv.platform.kernelArch; + + crossAttrs = let + cp = hostPlatform.platform; + in { + arch = cp.kernelArch; + platformName = cp.name; + kernelBaseConfig = cp.kernelBaseConfig; + kernelTarget = cp.kernelTarget; + autoModules = cp.kernelAutoModules; + + # Just ignore all options that don't apply (We are lazy). + ignoreConfigErrors = true; + + kernelConfig = kernelConfigFun configCross; + + inherit (kernel.crossDrv) src patches preUnpack; + }; + + patchKconfig = '' + # Patch kconfig to print "###" after every question so that + # generate-config.pl from the generic builder can answer them. + echo "Patching Kconfig" + sed -e '/fflush(stdout);/i\printf("###");' -i scripts/kconfig/conf.c + ''; + + prePatch = kernel.prePatch + patchKconfig; + # inherit (kernel) src patches preUnpack; + inherit (kernel) src patches preUnpack; + + # TODO replace with config.nix buildPhase + # add a cd ? + buildPhase = buildConfigCommands; + + # need to be in srcRoot before launching this ! + buildConfigCommands = '' + set -x + echo $PWD + cd $buildRoot + + # Get a basic config file for later refinement with $ generateConfig. + # make O=$buildRoot $kernelBaseConfig ARCH=$arch + # /$sourceRoot + make -C .. O=$buildRoot $kernelBaseConfig ARCH=$arch + + # Create the config file. + echo "generating kernel configuration..." + echo "${kernelConfig}" > $buildRoot/kernel-config + echo "Printing kernel config" + # TODO SRC ? + DEBUG=1 ARCH=$arch KERNEL_CONFIG=$buildRoot/kernel-config \ + AUTO_MODULES=${builtins.toString autoModules} \ + ignoreConfigErrors=${builtins.toString ignoreConfigErrors} \ + PREFER_BUILTIN=$preferBuiltin SRC=. BUILD_FOLDER=$buildRoot perl -w ${generateConfig} + ''; + + installPhase = "mv $buildRoot/.config $out"; + + enableParallelBuilding = true; +} diff --git a/pkgs/os-specific/linux/kernel/generate-config.pl b/pkgs/os-specific/linux/kernel/generate-config.pl index 5bce3af94293a..ba272eefeac1e 100644 --- a/pkgs/os-specific/linux/kernel/generate-config.pl +++ b/pkgs/os-specific/linux/kernel/generate-config.pl @@ -13,18 +13,22 @@ use IPC::Open2; use Cwd; -my $wd = getcwd; +# my $wd = getcwd; +# exported via nix my $debug = $ENV{'DEBUG'}; my $autoModules = $ENV{'AUTO_MODULES'}; my $preferBuiltin = $ENV{'PREFER_BUILTIN'}; - +my $ignoreConfigErrors = $ENV{'ignoreConfigErrors'}; +my $buildFolder=$ENV{'BUILD_FOLDER'}; +my $finalConfig="$buildFolder/.config"; + $SIG{PIPE} = 'IGNORE'; # Read the answers. my %answers; my %requiredAnswers; -open ANSWERS, "<$ENV{KERNEL_CONFIG}" or die; +open ANSWERS, "<$ENV{KERNEL_CONFIG}" or die "Could not open answer file"; while () { chomp; s/#.*//; @@ -40,7 +44,7 @@ sub runConfig { # Run `make config'. - my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$wd config SHELL=bash ARCH=$ENV{ARCH}"); + my $pid = open2(\*IN, \*OUT, "make -C $ENV{SRC} O=$buildFolder config SHELL=bash ARCH=$ENV{ARCH}"); # Parse the output, look for questions and then send an # appropriate answer. @@ -122,7 +126,7 @@ sub runConfig { # there. `make config' often overrides answers if later questions # cause options to be selected. my %config; -open CONFIG, "<.config" or die; +open CONFIG, "<$finalConfig" or die "Could not read .config"; while () { chomp; if (/^CONFIG_([A-Za-z0-9_]+)="(.*)"$/) { @@ -137,7 +141,7 @@ sub runConfig { close CONFIG; foreach my $name (sort (keys %answers)) { - my $f = $requiredAnswers{$name} && $ENV{'ignoreConfigErrors'} ne "1" + my $f = $requiredAnswers{$name} && $ignoreConfigErrors ne "1" ? sub { die "error: " . $_[0]; } : sub { warn "warning: " . $_[0]; }; &$f("unused option: $name\n") unless defined $config{$name}; &$f("option not set correctly: $name (wanted '$answers{$name}', got '$config{$name}')\n") diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index c2f4e6843f591..05672caf96d18 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -6,7 +6,11 @@ , # The kernel version. version -, # Overrides to the kernel config. +, # path to a .config file (or its content ?) + # if it s null we generate it + configfilename ? null + +, # Appended verbatim to kernel .config extraConfig ? "" , # The version number used for the module directory @@ -26,8 +30,10 @@ , ignoreConfigErrors ? stdenv.platform.name != "pc" , extraMeta ? {} , hostPlatform +, callPackage +# , pkgs , ... -}: +} @ args: assert stdenv.isLinux; @@ -51,79 +57,38 @@ let config = configWithPlatform stdenv.platform; configCross = configWithPlatform hostPlatform.platform; - kernelConfigFun = baseConfig: - let - configFromPatches = - map ({extraConfig ? "", ...}: extraConfig) kernelPatches; - in lib.concatStringsSep "\n" ([baseConfig] ++ configFromPatches); - - configfile = stdenv.mkDerivation { + configDrv = callPackage ./config.nix { inherit ignoreConfigErrors; - name = "linux-config-${version}"; - - generateConfig = ./generate-config.pl; - - kernelConfig = kernelConfigFun config; - - nativeBuildInputs = [ perl ]; - - platformName = stdenv.platform.name; - kernelBaseConfig = stdenv.platform.kernelBaseConfig; - kernelTarget = stdenv.platform.kernelTarget; - autoModules = stdenv.platform.kernelAutoModules; - preferBuiltin = stdenv.platform.kernelPreferBuiltin or false; - arch = stdenv.platform.kernelArch; - - crossAttrs = let - cp = hostPlatform.platform; - in { - arch = cp.kernelArch; - platformName = cp.name; - kernelBaseConfig = cp.kernelBaseConfig; - kernelTarget = cp.kernelTarget; - autoModules = cp.kernelAutoModules; - - # Just ignore all options that don't apply (We are lazy). - ignoreConfigErrors = true; - - kernelConfig = kernelConfigFun configCross; - inherit (kernel.crossDrv) src patches preUnpack; - }; + inherit version src kernelPatches stdenv config; + # modDirVersion + inherit kernel; + }; - prePatch = kernel.prePatch + '' - # Patch kconfig to print "###" after every question so that - # generate-config.pl from the generic builder can answer them. - sed -e '/fflush(stdout);/i\printf("###");' -i scripts/kconfig/conf.c - ''; - - inherit (kernel) src patches preUnpack; - - buildPhase = '' - cd $buildRoot - - # Get a basic config file for later refinement with $generateConfig. - make -C ../$sourceRoot O=$PWD $kernelBaseConfig ARCH=$arch - - # Create the config file. - echo "generating kernel configuration..." - echo "$kernelConfig" > kernel-config - DEBUG=1 ARCH=$arch KERNEL_CONFIG=kernel-config AUTO_MODULES=$autoModules \ - PREFER_BUILTIN=$preferBuiltin SRC=../$sourceRoot perl -w $generateConfig - ''; - - installPhase = "mv .config $out"; - - enableParallelBuilding = true; - }; + # TODO moved it + # callPackage ./config.nix {}; + # configfile = stdenv.mkDerivation { + # configfile = (import ./config.nix); + # TODO le transformer plutot en kernel = buildLinux { + # TODO args inherit version modDirVersion src kernelPatches stdenv; + # inherit ignoreConfigErrors; + inherit configDrv; + + # configfile = configfile.nativeDrv or configfile; + # configfile = configfile.nativeDrv or configfile; + + # this is really configfilename + # configfile = if configfilename then configfilename else (callPackage ./config.nix {}); + configfile = null; - configfile = configfile.nativeDrv or configfile; - crossConfigfile = configfile.crossDrv or configfile; + # TODO fix later + # crossConfigfile = configfile.crossDrv or configfile; + # erase parent config ???! config = { CONFIG_MODULES = "y"; CONFIG_FW_LOADER = "m"; }; crossConfig = { CONFIG_MODULES = "y"; CONFIG_FW_LOADER = "m"; }; diff --git a/pkgs/os-specific/linux/kernel/lib.nix b/pkgs/os-specific/linux/kernel/lib.nix new file mode 100644 index 0000000000000..23918a47f47ce --- /dev/null +++ b/pkgs/os-specific/linux/kernel/lib.nix @@ -0,0 +1,63 @@ +# this should be +# +{ + stdenv +, lib +# , buildRoot +# , srcRoot +# , ignoreConfigErrors: version, kernelConfig, runCommand +, version +, runCommand +}: +rec { + # runCommand = name: env: buildCommand: + /* generate a file config.nix with { + key=val; + } + from a kernel .config file passed as "configfile" + key#CONFIG_ removes "CONFIG_" prefix + */ + readConfig = configfile: import (runCommand "config.nix" {} '' + echo "{" > "$out" + while IFS='=' read key val; do + [ "x''${key#CONFIG_}" != "x$key" ] || continue + no_firstquote="''${val#\"}"; + echo ' "'"$key"'" = "'"''${no_firstquote%\"}"'";' >> "$out" + done < "${configfile}" + echo "}" >> $out + '').outPath; + + # RENAME to 'load' + convertKernelConfigToJson = readConfig; + + patchKconfig = '' + # Patch kconfig to print "###" after every question so that + # generate-config.pl from the generic builder can answer them. + sed -e '/fflush(stdout);/i\printf("###");' -i scripts/kconfig/conf.c + ''; + + # generates functor + # + kernelConfigFun = baseConfig: kernelPatches: + let + configFromPatches = + map ({extraConfig ? "", ...}: extraConfig) kernelPatches; + in lib.concatStringsSep "\n" ([baseConfig] ++ configFromPatches); + + # TODO check bash variables exist -u + buildKernelConfig = arch: autoModules: '' + # cd $buildRoot + + # Get a basic config file for later refinement with $generateConfig. + # make -C ../$sourceRoot O=$PWD $kernelBaseConfig ARCH=$arch + make -C .. O=$PWD $kernelBaseConfig ARCH=$arch + + # Create the config file. + echo "generating kernel configuration..." + echo "$kernelConfig" > kernel-config + DEBUG=1 ARCH=$arch KERNEL_CONFIG=kernel-config AUTO_MODULES=$autoModules \ + PREFER_BUILTIN=$preferBuiltin SRC=../$sourceRoot perl -w $generateConfig + ''; +} + + diff --git a/pkgs/os-specific/linux/kernel/linux-4.9.nix b/pkgs/os-specific/linux/kernel/linux-4.9.nix index 3e3626cb39d4b..15d64ad0db1b1 100644 --- a/pkgs/os-specific/linux/kernel/linux-4.9.nix +++ b/pkgs/os-specific/linux/kernel/linux-4.9.nix @@ -1,9 +1,17 @@ -{ stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args: +{ stdenv, hostPlatform, ignoreConfigErrors ? true, fetchurl, perl, buildLinux, callPackage, ... } @ args: import ./generic.nix (args // rec { version = "4.9.65"; extraMeta.branch = "4.9"; + extraConfig='' + VIRTIO_PCI y + VIRTIO_PCI_LEGACY y + VIRTIO_BALLOON m + VIRTIO_INPUT m + VIRTIO_MMIO m + ''; + src = fetchurl { url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz"; sha256 = "15a8a7p6i2dgiglps22cwsy5gsfkc39fy4jzvhjwz8s9fn3p1fi4"; diff --git a/pkgs/os-specific/linux/kernel/linux-mptcp.nix b/pkgs/os-specific/linux/kernel/linux-mptcp.nix index 92b202100a63d..d5d7d59748dc3 100644 --- a/pkgs/os-specific/linux/kernel/linux-mptcp.nix +++ b/pkgs/os-specific/linux/kernel/linux-mptcp.nix @@ -1,5 +1,6 @@ -{ stdenv, hostPlatform, fetchFromGitHub, perl, buildLinux, ... } @ args: +{ stdenv, callPackage, hostPlatform, fetchFromGitHub, perl, buildLinux, ... } @ args: +# ~ linux_mptcp = callPackage generic.nix (linux_mptcp.nix) import ./generic.nix (rec { mptcpVersion = "0.93"; modDirVersion = "4.9.60"; @@ -43,4 +44,4 @@ import ./generic.nix (rec { TCP_CONG_BALIA m '' + (args.extraConfig or ""); -} // args // (args.argsOverride or {})) +} // removeAttrs args ["extraConfig"]) diff --git a/pkgs/os-specific/linux/kernel/manual-config.nix b/pkgs/os-specific/linux/kernel/manual-config.nix index b4ee23079d930..3cbc554b52299 100644 --- a/pkgs/os-specific/linux/kernel/manual-config.nix +++ b/pkgs/os-specific/linux/kernel/manual-config.nix @@ -1,20 +1,28 @@ -{ runCommand, nettools, bc, perl, gmp, libmpc, mpfr, kmod, openssl +# defines buildLinux, aka returns a function +{ runCommand, stdenv, nettools, bc, perl, gmp, libmpc, mpfr, kmod, openssl , libelf ? null , utillinux ? null , writeTextFile, ubootTools +# , callPackage + +# in fact this refers to a system (see lib/systems/examples.nix) and not a "platform" +# since this sometimes call +# should be a set like https://github.com/NixOS/nixpkgs/issues/24388 , hostPlatform }: let - readConfig = configfile: import (runCommand "config.nix" {} '' - echo "{" > "$out" - while IFS='=' read key val; do - [ "x''${key#CONFIG_}" != "x$key" ] || continue - no_firstquote="''${val#\"}"; - echo ' "'"$key"'" = "'"''${no_firstquote%\"}"'";' >> "$out" - done < "${configfile}" - echo "}" >> $out - '').outPath; + # TODO import from config + # readConfig = configfile: import (runCommand "config.nix" {} '' + # echo "{" > "$out" + # while IFS='=' read key val; do + # [ "x''${key#CONFIG_}" != "x$key" ] || continue + # no_firstquote="''${val#\"}"; + # echo ' "'"$key"'" = "'"''${no_firstquote%\"}"'";' >> "$out" + # done < "${configfile}" + # echo "}" >> $out + # '').outPath; + confHelpers = stdenv.lib.callPackage ./config.nix {}; in { # Allow overriding stdenv on each buildLinux call stdenv, @@ -30,15 +38,20 @@ in { nativeKernelPatches ? [], # Patches for cross compiling only crossKernelPatches ? [], + # ignoreConfigErrors, + # NEW pass a set with config inside + configDrv, # The native kernel .config file + # TODO if null, generate it from readFile configDrv configfile, # The cross kernel .config file crossConfigfile ? configfile, # Manually specified nixexpr representing the config # If unspecified, this will be autodetected from the .config - config ? stdenv.lib.optionalAttrs allowImportFromDerivation (readConfig configfile), + config ? stdenv.lib.optionalAttrs allowImportFromDerivation (confHelpers.readConfig configfile), + # config ? null, # Cross-compiling config - crossConfig ? if allowImportFromDerivation then (readConfig crossConfigfile) else config, + crossConfig ? if allowImportFromDerivation then (confHelpers.readConfig crossConfigfile) else config, # Whether to utilize the controversial import-from-derivation feature to parse the config allowImportFromDerivation ? false }: @@ -47,6 +60,8 @@ let inherit (stdenv.lib) hasAttr getAttr optional optionalString optionalAttrs maintainers platforms; + platform = stdenv.platform; + installkernel = writeTextFile { name = "installkernel"; executable=true; text = '' #!${stdenv.shell} -e mkdir -p $4 @@ -54,10 +69,12 @@ let cp -av $3 $4 ''; }; + # flags common to the cross-compiled and native builds commonMakeFlags = [ "O=$(buildRoot)" + ] ++ stdenv.lib.optionals (stdenv.platform ? kernelMakeFlags) - stdenv.platform.kernelMakeFlags; + platform.kernelMakeFlags; drvAttrs = config_: platform: kernelPatches: configfile: let @@ -81,17 +98,25 @@ let installsFirmware = (config.isEnabled "FW_LOADER") && (isModular || (config.isDisabled "FIRMWARE_IN_KERNEL")); - in (optionalAttrs isModular { outputs = [ "out" "dev" ]; }) // { + in (optionalAttrs isModular { outputs = [ "out" "dev" ]; }) // rec { passthru = { - inherit version modDirVersion config kernelPatches configfile; + inherit version modDirVersion kernelPatches configfile; + # inherit config; }; inherit src; + # to help debug + # inherit config crossConfig; + + # why this preUnpack = '' - mkdir build - export buildRoot="$(pwd)/build" ''; + # HAAAACCKKKKK + autoModules = platform.kernelAutoModules; + preferBuiltin = platform.kernelPreferBuiltin or false; + arch = platform.kernelArch; + kernelBaseConfig = platform.kernelBaseConfig; patches = map (p: p.patch) kernelPatches; @@ -101,11 +126,52 @@ let sed -i "$mf" -e 's|/usr/bin/||g ; s|/bin/||g ; s|/sbin/||g' done sed -i Makefile -e 's|= depmod|= ${kmod}/bin/depmod|' - ''; - - configurePhase = '' + '' + # if no configfile set then it means we have to generate it on the go + # configfile == null + # configfile.patchKconfig + # + stdenv.lib.optionalString (true) confHelpers.patchKconfig; + + stdenv.lib.optionalString (true) configDrv.patchKconfig; + + # imported from generic.nix + + # preConfigure = buildConfigPhase; + + + # we are in $sourceRoot + configurePhase = let + + # if configfile is valid file + linkConfig = if (configfile != null) then '' + ln -sv ${configfile} $buildRoot/.config + '' else + # TODO la le kernel config n est pas genere + configDrv.buildConfigCommands + # '' + # # TODO generate CONFIG !!! + # '' + ; + + in '' + # if [ -z "$buildRoot" ]; then + + # we should be in $sourceRoot + # assume we are in the $sourceRoot folder + # echo "buildRoot is not set" + mkdir build + export buildRoot="$PWD/build" + echo "buildRoot was not set, now is $buildRoot" + # fi runHook preConfigure - ln -sv ${configfile} $buildRoot/.config + '' + + + linkConfig + + + '' + + + # reads the existing .config file and prompts the user for options in + # the current kernel source that are not found in the file. make $makeFlags "''${makeFlagsArray[@]}" oldconfig runHook postConfigure @@ -154,7 +220,7 @@ let unlink $out/lib/modules/${modDirVersion}/source mkdir -p $dev/lib/modules/${modDirVersion}/build - cp -dpR ../$sourceRoot $dev/lib/modules/${modDirVersion}/source + cp -dpR .. $dev/lib/modules/${modDirVersion}/source cd $dev/lib/modules/${modDirVersion}/source cp $buildRoot/{.config,Module.symvers} $dev/lib/modules/${modDirVersion}/build @@ -211,6 +277,8 @@ let make firmware_install $makeFlags "''${makeFlagsArray[@]}" \ $installFlags "''${installFlagsArray[@]}" ''); + # TODO add it as an output + # installPhase = "mv .config $out"; requiredSystemFeatures = [ "big-parallel" ]; @@ -234,24 +302,35 @@ in assert stdenv.lib.versionAtLeast version "4.15" -> libelf != null; assert stdenv.lib.versionAtLeast version "4.15" -> utillinux != null; -stdenv.mkDerivation ((drvAttrs config stdenv.platform (kernelPatches ++ nativeKernelPatches) configfile) // { +stdenv.mkDerivation ((drvAttrs config platform (kernelPatches ++ nativeKernelPatches) configfile) // { +# config ? stdenv.lib.optionalAttrs allowImportFromDerivation (readConfig configfile), +# stdenv.mkDerivation ((drvAttrs config stdenv.platform (kernelPatches ++ nativeKernelPatches) configfile) // rec { name = "linux-${version}"; enableParallelBuilding = true; nativeBuildInputs = [ perl bc nettools openssl gmp libmpc mpfr ] - ++ optional (stdenv.platform.kernelTarget == "uImage") ubootTools + ++ optional (platform.kernelTarget == "uImage") ubootTools ++ optional (stdenv.lib.versionAtLeast version "4.15") libelf ++ optional (stdenv.lib.versionAtLeast version "4.15") utillinux ; hardeningDisable = [ "bindnow" "format" "fortify" "stackprotector" "pic" ]; - makeFlags = commonMakeFlags ++ [ - "ARCH=${stdenv.platform.kernelArch}" - ]; + # concatenated from drvAttrs + # configurePhase = '' + # ''; + # TODO add an output for the config ? - karch = stdenv.platform.kernelArch; + makeFlags = commonMakeFlags ++ [ + "ARCH=${platform.kernelArch}" + ] + # {cfg.buildCores} + # ++ stdenv.lib.optional enableParallelBuilding "-j4" + # cfg.buildCores # TODO set + ; + + karch = platform.kernelArch; crossAttrs = let cp = hostPlatform.platform; in (drvAttrs crossConfig cp (kernelPatches ++ crossKernelPatches) crossConfigfile) // {