Merge branch 'manual-config-multiple-outputs' into upstream-master
This branch makes the manual config kernel a lot more space efficient by separating out the build and source trees (needed for out-of-tree modules) from the actual bzImage and in-tree modules. Also some other small improvements along the way.
This commit is contained in:
commit
e4d7e87c14
@ -75,16 +75,6 @@ let
|
|||||||
"INSTALL_PATH=$(out)"
|
"INSTALL_PATH=$(out)"
|
||||||
] ++ (optional isModular "INSTALL_MOD_PATH=$(out)")
|
] ++ (optional isModular "INSTALL_MOD_PATH=$(out)")
|
||||||
++ optional installsFirmware "INSTALL_FW_PATH=$(out)/lib/firmware";
|
++ optional installsFirmware "INSTALL_FW_PATH=$(out)/lib/firmware";
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
|
||||||
name = "linux-${version}";
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
|
||||||
|
|
||||||
passthru = {
|
|
||||||
inherit version modDirVersion config kernelPatches src;
|
|
||||||
};
|
|
||||||
|
|
||||||
sourceRoot = stdenv.mkDerivation {
|
sourceRoot = stdenv.mkDerivation {
|
||||||
name = "linux-${version}-source";
|
name = "linux-${version}-source";
|
||||||
@ -108,16 +98,30 @@ stdenv.mkDerivation {
|
|||||||
mv $sourceRoot $out
|
mv $sourceRoot $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
in
|
||||||
|
|
||||||
|
stdenv.mkDerivation {
|
||||||
|
name = "linux-${version}";
|
||||||
|
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
|
outputs = if isModular then [ "out" "dev" ] else null;
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit version modDirVersion config kernelPatches src;
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit sourceRoot;
|
||||||
|
|
||||||
unpackPhase = ''
|
unpackPhase = ''
|
||||||
mkdir build
|
mkdir build
|
||||||
export buildRoot="$(pwd)/build"
|
export buildRoot="$(pwd)/build"
|
||||||
ln -sv ${configfile} $buildRoot/.config
|
cd ${sourceRoot}
|
||||||
cd $sourceRoot
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
ln -sv ${configfile} $buildRoot/.config
|
||||||
make $makeFlags "''${makeFlagsArray[@]}" oldconfig
|
make $makeFlags "''${makeFlagsArray[@]}" oldconfig
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
@ -140,17 +144,25 @@ stdenv.mkDerivation {
|
|||||||
make modules_install $makeFlags "''${makeFlagsArray[@]}" \
|
make modules_install $makeFlags "''${makeFlagsArray[@]}" \
|
||||||
$installFlags "''${installFlagsArray[@]}"
|
$installFlags "''${installFlagsArray[@]}"
|
||||||
rm -f $out/lib/modules/${modDirVersion}/build
|
rm -f $out/lib/modules/${modDirVersion}/build
|
||||||
mv $buildRoot $out/lib/modules/${modDirVersion}/build
|
mkdir -p $dev/lib/modules/${modDirVersion}
|
||||||
|
mv $out/lib/modules/${modDirVersion}/source $dev/lib/modules/${modDirVersion}/source
|
||||||
|
mv $buildRoot $dev/lib/modules/${modDirVersion}/build
|
||||||
'' else optionalString installsFirmware ''
|
'' else optionalString installsFirmware ''
|
||||||
make firmware_install $makeFlags "''${makeFlagsArray[@]}" \
|
make firmware_install $makeFlags "''${makeFlagsArray[@]}" \
|
||||||
$installFlags "''${installFlagsArray[@]}"
|
$installFlags "''${installFlagsArray[@]}"
|
||||||
'');
|
'');
|
||||||
|
|
||||||
postFixup = optionalString isModular ''
|
postFixup = if isModular then ''
|
||||||
if [ -z "$dontStrip" ]; then
|
if [ -z "$dontStrip" ]; then
|
||||||
find $out -name "*.ko" -print0 | xargs -0 -r strip -S
|
find $out -name "*.ko" -print0 | xargs -0 -r strip -S
|
||||||
|
# Remove all references to the source directory to avoid unneeded
|
||||||
|
# runtime dependencies
|
||||||
|
find $out -name "*.ko" -print0 | xargs -0 -r sed -i \
|
||||||
|
"s|${sourceRoot}|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-${sourceRoot.name}|g"
|
||||||
fi
|
fi
|
||||||
'';
|
'' else null;
|
||||||
|
|
||||||
|
__ignoreNulls = true;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
description = "The Linux kernel";
|
description = "The Linux kernel";
|
||||||
|
@ -44,42 +44,58 @@ let
|
|||||||
if !allowUnfree && (let l = attrs.meta.license or ""; in l == "unfree" || l == "unfree-redistributable" || l == lib.licenses.proprietary) then
|
if !allowUnfree && (let l = attrs.meta.license or ""; in l == "unfree" || l == "unfree-redistributable" || l == lib.licenses.proprietary) then
|
||||||
throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
|
throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
|
||||||
else
|
else
|
||||||
(derivation (
|
let
|
||||||
(removeAttrs attrs ["meta" "passthru" "crossAttrs"])
|
drv = derivation (
|
||||||
// (let
|
(removeAttrs attrs ["meta" "passthru" "crossAttrs"])
|
||||||
buildInputs = attrs.buildInputs or [];
|
// (let
|
||||||
buildNativeInputs = attrs.buildNativeInputs or [];
|
buildInputs = attrs.buildInputs or [];
|
||||||
propagatedBuildInputs = attrs.propagatedBuildInputs or [];
|
buildNativeInputs = attrs.buildNativeInputs or [];
|
||||||
propagatedBuildNativeInputs = attrs.propagatedBuildNativeInputs or [];
|
propagatedBuildInputs = attrs.propagatedBuildInputs or [];
|
||||||
crossConfig = attrs.crossConfig or null;
|
propagatedBuildNativeInputs = attrs.propagatedBuildNativeInputs or [];
|
||||||
in
|
crossConfig = attrs.crossConfig or null;
|
||||||
{
|
in
|
||||||
builder = attrs.realBuilder or shell;
|
{
|
||||||
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
|
builder = attrs.realBuilder or shell;
|
||||||
stdenv = result;
|
args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
|
||||||
system = result.system;
|
stdenv = result;
|
||||||
|
system = result.system;
|
||||||
|
|
||||||
# Inputs built by the cross compiler.
|
# Inputs built by the cross compiler.
|
||||||
buildInputs = lib.optionals (crossConfig != null) buildInputs;
|
buildInputs = lib.optionals (crossConfig != null) buildInputs;
|
||||||
propagatedBuildInputs = lib.optionals (crossConfig != null)
|
propagatedBuildInputs = lib.optionals (crossConfig != null)
|
||||||
propagatedBuildInputs;
|
propagatedBuildInputs;
|
||||||
# Inputs built by the usual native compiler.
|
# Inputs built by the usual native compiler.
|
||||||
buildNativeInputs = buildNativeInputs ++ lib.optionals
|
buildNativeInputs = buildNativeInputs ++ lib.optionals
|
||||||
(crossConfig == null) buildInputs;
|
(crossConfig == null) buildInputs;
|
||||||
propagatedBuildNativeInputs = propagatedBuildNativeInputs ++
|
propagatedBuildNativeInputs = propagatedBuildNativeInputs ++
|
||||||
lib.optionals (crossConfig == null) propagatedBuildInputs;
|
lib.optionals (crossConfig == null) propagatedBuildInputs;
|
||||||
}))
|
}));
|
||||||
)
|
|
||||||
# The meta attribute is passed in the resulting attribute set,
|
outputs = drv.outputs or [ "out" ];
|
||||||
# but it's not part of the actual derivation, i.e., it's not
|
|
||||||
# passed to the builder and is not a dependency. But since we
|
commonAttrs = drv // (builtins.listToAttrs outputsList) //
|
||||||
# include it in the result, it *is* available to nix-env for
|
({ all = map (x: x.value) outputsList;
|
||||||
# queries.
|
# The meta attribute is passed in the resulting attribute set,
|
||||||
// { meta = attrs.meta or {}; }
|
# but it's not part of the actual derivation, i.e., it's not
|
||||||
# Pass through extra attributes that are not inputs, but
|
# passed to the builder and is not a dependency. But since we
|
||||||
# should be made available to Nix expressions using the
|
# include it in the result, it *is* available to nix-env for
|
||||||
# derivation (e.g., in assertions).
|
# queries.
|
||||||
// (attrs.passthru or {});
|
meta = attrs.meta or {};
|
||||||
|
}) //
|
||||||
|
# Pass through extra attributes that are not inputs, but
|
||||||
|
# should be made available to Nix expressions using the
|
||||||
|
# derivation (e.g., in assertions).
|
||||||
|
(attrs.passthru or {});
|
||||||
|
|
||||||
|
outputToAttrListElement = outputName:
|
||||||
|
{ name = outputName;
|
||||||
|
value = commonAttrs // {
|
||||||
|
inherit (builtins.getAttr outputName drv) outPath drvPath type outputName;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputsList = map outputToAttrListElement outputs;
|
||||||
|
in (builtins.head outputsList).value;
|
||||||
|
|
||||||
# Utility flags to test the type of platform.
|
# Utility flags to test the type of platform.
|
||||||
isDarwin = result.system == "x86_64-darwin";
|
isDarwin = result.system == "x86_64-darwin";
|
||||||
|
@ -6008,120 +6008,124 @@ let
|
|||||||
for a specific kernel. This function can then be called for
|
for a specific kernel. This function can then be called for
|
||||||
whatever kernel you're using. */
|
whatever kernel you're using. */
|
||||||
|
|
||||||
linuxPackagesFor = kernel: self: let callPackage = newScope self; in rec {
|
linuxPackagesFor = kernel:
|
||||||
|
let
|
||||||
|
callPackage = newScope self;
|
||||||
|
|
||||||
inherit kernel;
|
self = {
|
||||||
|
kernel = kernel.dev or kernel;
|
||||||
|
|
||||||
acpi_call = callPackage ../os-specific/linux/acpi-call {};
|
acpi_call = callPackage ../os-specific/linux/acpi-call {};
|
||||||
|
|
||||||
bbswitch = callPackage ../os-specific/linux/bbswitch {};
|
bbswitch = callPackage ../os-specific/linux/bbswitch {};
|
||||||
|
|
||||||
ati_drivers_x11 = callPackage ../os-specific/linux/ati-drivers { };
|
ati_drivers_x11 = callPackage ../os-specific/linux/ati-drivers { };
|
||||||
|
|
||||||
aufs =
|
aufs =
|
||||||
if kernel.features ? aufs2 then
|
if self.kernel.features ? aufs2 then
|
||||||
callPackage ../os-specific/linux/aufs/2.nix { }
|
callPackage ../os-specific/linux/aufs/2.nix { }
|
||||||
else if kernel.features ? aufs3 then
|
else if self.kernel.features ? aufs3 then
|
||||||
callPackage ../os-specific/linux/aufs/3.nix { }
|
callPackage ../os-specific/linux/aufs/3.nix { }
|
||||||
else null;
|
else null;
|
||||||
|
|
||||||
aufs_util =
|
aufs_util =
|
||||||
if kernel.features ? aufs2 then
|
if self.kernel.features ? aufs2 then
|
||||||
callPackage ../os-specific/linux/aufs-util/2.nix { }
|
callPackage ../os-specific/linux/aufs-util/2.nix { }
|
||||||
else if kernel.features ? aufs3 then
|
else if self.kernel.features ? aufs3 then
|
||||||
callPackage ../os-specific/linux/aufs-util/3.nix { }
|
callPackage ../os-specific/linux/aufs-util/3.nix { }
|
||||||
else null;
|
else null;
|
||||||
|
|
||||||
blcr = callPackage ../os-specific/linux/blcr { };
|
blcr = callPackage ../os-specific/linux/blcr { };
|
||||||
|
|
||||||
cryptodev = callPackage ../os-specific/linux/cryptodev { };
|
cryptodev = callPackage ../os-specific/linux/cryptodev { };
|
||||||
|
|
||||||
e1000e = callPackage ../os-specific/linux/e1000e {};
|
e1000e = callPackage ../os-specific/linux/e1000e {};
|
||||||
|
|
||||||
exmap = callPackage ../os-specific/linux/exmap { };
|
exmap = callPackage ../os-specific/linux/exmap { };
|
||||||
|
|
||||||
frandom = callPackage ../os-specific/linux/frandom { };
|
frandom = callPackage ../os-specific/linux/frandom { };
|
||||||
|
|
||||||
iscsitarget = callPackage ../os-specific/linux/iscsitarget { };
|
iscsitarget = callPackage ../os-specific/linux/iscsitarget { };
|
||||||
|
|
||||||
iwlwifi = callPackage ../os-specific/linux/iwlwifi { };
|
iwlwifi = callPackage ../os-specific/linux/iwlwifi { };
|
||||||
|
|
||||||
iwlwifi4965ucode =
|
iwlwifi4965ucode =
|
||||||
(if (builtins.compareVersions kernel.version "2.6.27" == 0)
|
(if (builtins.compareVersions self.kernel.version "2.6.27" == 0)
|
||||||
|| (builtins.compareVersions kernel.version "2.6.27" == 1)
|
|| (builtins.compareVersions self.kernel.version "2.6.27" == 1)
|
||||||
then iwlwifi4965ucodeV2
|
then iwlwifi4965ucodeV2
|
||||||
else iwlwifi4965ucodeV1);
|
else iwlwifi4965ucodeV1);
|
||||||
|
|
||||||
atheros = callPackage ../os-specific/linux/atheros/0.9.4.nix { };
|
atheros = callPackage ../os-specific/linux/atheros/0.9.4.nix { };
|
||||||
|
|
||||||
broadcom_sta = callPackage ../os-specific/linux/broadcom-sta/default.nix { };
|
broadcom_sta = callPackage ../os-specific/linux/broadcom-sta/default.nix { };
|
||||||
|
|
||||||
kernelHeaders = callPackage ../os-specific/linux/kernel-headers { };
|
kernelHeaders = callPackage ../os-specific/linux/kernel-headers { };
|
||||||
|
|
||||||
nvidia_x11 = callPackage ../os-specific/linux/nvidia-x11 { };
|
nvidia_x11 = callPackage ../os-specific/linux/nvidia-x11 { };
|
||||||
|
|
||||||
nvidia_x11_legacy96 = callPackage ../os-specific/linux/nvidia-x11/legacy96.nix { };
|
nvidia_x11_legacy96 = callPackage ../os-specific/linux/nvidia-x11/legacy96.nix { };
|
||||||
nvidia_x11_legacy173 = callPackage ../os-specific/linux/nvidia-x11/legacy173.nix { };
|
nvidia_x11_legacy173 = callPackage ../os-specific/linux/nvidia-x11/legacy173.nix { };
|
||||||
nvidia_x11_legacy304 = callPackage ../os-specific/linux/nvidia-x11/legacy304.nix { };
|
nvidia_x11_legacy304 = callPackage ../os-specific/linux/nvidia-x11/legacy304.nix { };
|
||||||
|
|
||||||
openafsClient = callPackage ../servers/openafs-client { };
|
openafsClient = callPackage ../servers/openafs-client { };
|
||||||
|
|
||||||
openiscsi = callPackage ../os-specific/linux/open-iscsi { };
|
openiscsi = callPackage ../os-specific/linux/open-iscsi { };
|
||||||
|
|
||||||
wis_go7007 = callPackage ../os-specific/linux/wis-go7007 { };
|
wis_go7007 = callPackage ../os-specific/linux/wis-go7007 { };
|
||||||
|
|
||||||
kqemu = callPackage ../os-specific/linux/kqemu { };
|
kqemu = callPackage ../os-specific/linux/kqemu { };
|
||||||
|
|
||||||
klibc = callPackage ../os-specific/linux/klibc {
|
klibc = callPackage ../os-specific/linux/klibc {
|
||||||
linuxHeaders = glibc.kernelHeaders;
|
linuxHeaders = glibc.kernelHeaders;
|
||||||
};
|
};
|
||||||
|
|
||||||
splashutils = let hasFbConDecor = if kernel ? features
|
splashutils = let hasFbConDecor = if self.kernel ? features
|
||||||
then kernel.features ? fbConDecor
|
then self.kernel.features ? fbConDecor
|
||||||
else kernel.config.isEnabled "FB_CON_DECOR";
|
else self.kernel.config.isEnabled "FB_CON_DECOR";
|
||||||
in if hasFbConDecor then pkgs.splashutils else null;
|
in if hasFbConDecor then pkgs.splashutils else null;
|
||||||
|
|
||||||
/* compiles but has to be integrated into the kernel somehow
|
/* compiles but has to be integrated into the kernel somehow
|
||||||
Let's have it uncommented and finish it..
|
Let's have it uncommented and finish it..
|
||||||
*/
|
*/
|
||||||
ndiswrapper = callPackage ../os-specific/linux/ndiswrapper { };
|
ndiswrapper = callPackage ../os-specific/linux/ndiswrapper { };
|
||||||
|
|
||||||
perf = callPackage ../os-specific/linux/kernel/perf.nix { };
|
perf = callPackage ../os-specific/linux/kernel/perf.nix { };
|
||||||
|
|
||||||
spl = callPackage ../os-specific/linux/spl/default.nix { };
|
spl = callPackage ../os-specific/linux/spl/default.nix { };
|
||||||
|
|
||||||
sysprof = callPackage ../development/tools/profiling/sysprof {
|
sysprof = callPackage ../development/tools/profiling/sysprof {
|
||||||
inherit (gnome) libglade;
|
inherit (gnome) libglade;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemtap = callPackage ../development/tools/profiling/systemtap {
|
systemtap = callPackage ../development/tools/profiling/systemtap {
|
||||||
linux = kernel;
|
linux = self.kernel;
|
||||||
inherit (gnome) libglademm;
|
inherit (gnome) libglademm;
|
||||||
};
|
};
|
||||||
|
|
||||||
tp_smapi = callPackage ../os-specific/linux/tp_smapi { };
|
tp_smapi = callPackage ../os-specific/linux/tp_smapi { };
|
||||||
|
|
||||||
v86d = callPackage ../os-specific/linux/v86d { };
|
v86d = callPackage ../os-specific/linux/v86d { };
|
||||||
|
|
||||||
virtualbox = callPackage ../applications/virtualization/virtualbox {
|
virtualbox = callPackage ../applications/virtualization/virtualbox {
|
||||||
stdenv = stdenv_32bit;
|
stdenv = stdenv_32bit;
|
||||||
inherit (gnome) libIDL;
|
inherit (gnome) libIDL;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualboxGuestAdditions = callPackage ../applications/virtualization/virtualbox/guest-additions { };
|
virtualboxGuestAdditions = callPackage ../applications/virtualization/virtualbox/guest-additions { };
|
||||||
|
|
||||||
zfs = callPackage ../os-specific/linux/zfs/default.nix { };
|
zfs = callPackage ../os-specific/linux/zfs/default.nix { };
|
||||||
};
|
};
|
||||||
|
in (self // { kernel = self.kernel.out; });
|
||||||
|
|
||||||
# Build the kernel modules for the some of the kernels.
|
# Build the kernel modules for the some of the kernels.
|
||||||
linuxPackages_2_6_32 = recurseIntoAttrs (linuxPackagesFor linux_2_6_32 pkgs.linuxPackages_2_6_32);
|
linuxPackages_2_6_32 = recurseIntoAttrs (linuxPackagesFor linux_2_6_32);
|
||||||
linuxPackages_2_6_35 = recurseIntoAttrs (linuxPackagesFor linux_2_6_35 pkgs.linuxPackages_2_6_35);
|
linuxPackages_2_6_35 = recurseIntoAttrs (linuxPackagesFor linux_2_6_35);
|
||||||
linuxPackages_3_0 = recurseIntoAttrs (linuxPackagesFor linux_3_0 pkgs.linuxPackages_3_0);
|
linuxPackages_3_0 = recurseIntoAttrs (linuxPackagesFor linux_3_0);
|
||||||
linuxPackages_3_2 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_2 pkgs.linuxPackages_3_2);
|
linuxPackages_3_2 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_2);
|
||||||
linuxPackages_3_2_xen = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_2_xen pkgs.linuxPackages_3_2_xen);
|
linuxPackages_3_2_xen = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_2_xen);
|
||||||
linuxPackages_3_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_4 pkgs.linuxPackages_3_4);
|
linuxPackages_3_4 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_4);
|
||||||
linuxPackages_3_7 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_7 pkgs.linuxPackages_3_7);
|
linuxPackages_3_7 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_7);
|
||||||
linuxPackages_3_8 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_8 pkgs.linuxPackages_3_8);
|
linuxPackages_3_8 = recurseIntoAttrs (linuxPackagesFor pkgs.linux_3_8);
|
||||||
|
|
||||||
# The current default kernel / kernel modules.
|
# The current default kernel / kernel modules.
|
||||||
linux = linuxPackages.kernel;
|
linux = linuxPackages.kernel;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user