Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions pkgs/os-specific/linux/kernel/generic.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{ buildPackages, runCommand, nettools, bc, bison, flex, perl, gmp, libmpc, mpfr, openssl
{ buildPackages
, ncurses
, libelf
, utillinux
, writeTextFile, ubootTools
, callPackage
}:

{ stdenv, buildPackages, perl, buildLinux
, perl
, bison ? null
, flex ? null
, stdenv

, # The kernel source tarball.
src
Expand Down Expand Up @@ -35,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:

Expand Down Expand Up @@ -67,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;
Expand All @@ -83,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
Expand All @@ -99,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
'';

Expand Down
2 changes: 1 addition & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13445,7 +13445,7 @@ with pkgs;

# A function to build a manually-configured kernel
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 { };

Expand Down