Merge pull request #34672 from teto/kernel_overrides

buildLinux: add overrides for modules
This commit is contained in:
John Ericson 2018-03-08 11:11:51 -05:00 committed by GitHub
commit ce5a76274d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 14 deletions

View File

@ -1,12 +1,10 @@
{ buildPackages, runCommand, nettools, bc, bison, flex, perl, gmp, libmpc, mpfr, openssl { buildPackages
, ncurses , ncurses
, libelf
, utillinux
, writeTextFile, ubootTools
, callPackage , callPackage
}: , perl
, bison ? null
{ stdenv, buildPackages, perl, buildLinux , flex ? null
, stdenv
, # The kernel source tarball. , # The kernel source tarball.
src src
@ -35,6 +33,12 @@
hostPlatform != stdenv.buildPlatform hostPlatform != stdenv.buildPlatform
, extraMeta ? {} , extraMeta ? {}
, hostPlatform , hostPlatform
# easy overrides to hostPlatform.platform members
, autoModules ? hostPlatform.platform.kernelAutoModules
, preferBuiltin ? hostPlatform.platform.kernelPreferBuiltin or false
, kernelArch ? hostPlatform.platform.kernelArch
, ... , ...
} @ args: } @ args:
@ -67,7 +71,7 @@ let
in lib.concatStringsSep "\n" ([baseConfig] ++ configFromPatches); in lib.concatStringsSep "\n" ([baseConfig] ++ configFromPatches);
configfile = stdenv.mkDerivation { configfile = stdenv.mkDerivation {
inherit ignoreConfigErrors; inherit ignoreConfigErrors autoModules preferBuiltin kernelArch;
name = "linux-config-${version}"; name = "linux-config-${version}";
generateConfig = ./generate-config.pl; generateConfig = ./generate-config.pl;
@ -83,9 +87,6 @@ let
kernelBaseConfig = hostPlatform.platform.kernelBaseConfig; kernelBaseConfig = hostPlatform.platform.kernelBaseConfig;
# e.g. "bzImage" # e.g. "bzImage"
kernelTarget = hostPlatform.platform.kernelTarget; kernelTarget = hostPlatform.platform.kernelTarget;
autoModules = hostPlatform.platform.kernelAutoModules;
preferBuiltin = hostPlatform.platform.kernelPreferBuiltin or false;
arch = hostPlatform.platform.kernelArch;
prePatch = kernel.prePatch + '' prePatch = kernel.prePatch + ''
# Patch kconfig to print "###" after every question so that # Patch kconfig to print "###" after every question so that
@ -99,12 +100,12 @@ let
export buildRoot="''${buildRoot:-build}" export buildRoot="''${buildRoot:-build}"
# Get a basic config file for later refinement with $generateConfig. # 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. # Create the config file.
echo "generating kernel configuration..." echo "generating kernel configuration..."
echo "$kernelConfig" > "$buildRoot/kernel-config" 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 PREFER_BUILTIN=$preferBuiltin BUILD_ROOT="$buildRoot" SRC=. perl -w $generateConfig
''; '';

View File

@ -13460,7 +13460,7 @@ with pkgs;
# A function to build a manually-configured kernel # A function to build a manually-configured kernel
linuxManualConfig = makeOverridable (callPackage ../os-specific/linux/kernel/manual-config.nix {}); linuxManualConfig = makeOverridable (callPackage ../os-specific/linux/kernel/manual-config.nix {});
buildLinux = makeOverridable (callPackage ../os-specific/linux/kernel/generic.nix {}); buildLinux = attrs: callPackage ../os-specific/linux/kernel/generic.nix attrs;
keyutils = callPackage ../os-specific/linux/keyutils { }; keyutils = callPackage ../os-specific/linux/keyutils { };