From 3ccc65a36cbb9871830d746e1b2c9b1a09e71291 Mon Sep 17 00:00:00 2001 From: Matthieu Coudron Date: Thu, 8 Mar 2018 12:47:06 +0900 Subject: [PATCH] buildLinux: allow to override arch/modules/builtin - Easy override of autoModules and preferBuiltin and kernelArch parameters (currently living in `hostSystem` set). --- pkgs/os-specific/linux/kernel/generic.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pkgs/os-specific/linux/kernel/generic.nix b/pkgs/os-specific/linux/kernel/generic.nix index a8f55d81466f..1b8c3f76155e 100644 --- a/pkgs/os-specific/linux/kernel/generic.nix +++ b/pkgs/os-specific/linux/kernel/generic.nix @@ -33,6 +33,12 @@ hostPlatform != stdenv.buildPlatform , extraMeta ? {} , hostPlatform + +# easy overrides to hostPlatform.platform members +, autoModules ? hostPlatform.platform.kernelAutoModules +, preferBuiltin ? hostPlatform.platform.kernelPreferBuiltin or false +, kernelArch ? hostPlatform.platform.kernelArch + , ... } @ args: @@ -65,7 +71,7 @@ let in lib.concatStringsSep "\n" ([baseConfig] ++ configFromPatches); configfile = stdenv.mkDerivation { - inherit ignoreConfigErrors; + inherit ignoreConfigErrors autoModules preferBuiltin kernelArch; name = "linux-config-${version}"; generateConfig = ./generate-config.pl; @@ -81,9 +87,6 @@ let kernelBaseConfig = hostPlatform.platform.kernelBaseConfig; # e.g. "bzImage" kernelTarget = hostPlatform.platform.kernelTarget; - autoModules = hostPlatform.platform.kernelAutoModules; - preferBuiltin = hostPlatform.platform.kernelPreferBuiltin or false; - arch = hostPlatform.platform.kernelArch; prePatch = kernel.prePatch + '' # Patch kconfig to print "###" after every question so that @@ -97,12 +100,12 @@ let export buildRoot="''${buildRoot:-build}" # Get a basic config file for later refinement with $generateConfig. - make HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc -C . O="$buildRoot" $kernelBaseConfig ARCH=$arch + make HOSTCC=${buildPackages.stdenv.cc.targetPrefix}gcc -C . O="$buildRoot" $kernelBaseConfig ARCH=$kernelArch # Create the config file. echo "generating kernel configuration..." echo "$kernelConfig" > "$buildRoot/kernel-config" - DEBUG=1 ARCH=$arch KERNEL_CONFIG="$buildRoot/kernel-config" AUTO_MODULES=$autoModules \ + DEBUG=1 ARCH=$kernelArch KERNEL_CONFIG="$buildRoot/kernel-config" AUTO_MODULES=$autoModules \ PREFER_BUILTIN=$preferBuiltin BUILD_ROOT="$buildRoot" SRC=. perl -w $generateConfig '';