mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 00:12:56 +00:00
linux/manual-config: put build and source trees into a separate 'dev' output.
This makes it possible to still build out-of-tree modules without making a system using this kernel depend on the full source and build tree at runtime. Note that references to the source tree are removed from kernel modules after build. Ideally, this would be accomplished by modifying the Makefile that puts the reference there in the first place, but I haven't tracked that down yet.
This commit is contained in:
parent
5d952411c6
commit
0bdd926a32
@ -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,11 +98,25 @@ 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"
|
||||||
cd $sourceRoot
|
cd ${sourceRoot}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
@ -140,7 +144,9 @@ 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[@]}"
|
||||||
@ -149,6 +155,10 @@ stdenv.mkDerivation {
|
|||||||
postFixup = if isModular then ''
|
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;
|
'' else null;
|
||||||
|
|
||||||
|
@ -6013,7 +6013,7 @@ let
|
|||||||
callPackage = newScope self;
|
callPackage = newScope self;
|
||||||
|
|
||||||
self = {
|
self = {
|
||||||
inherit kernel;
|
kernel = kernel.dev or kernel;
|
||||||
|
|
||||||
acpi_call = callPackage ../os-specific/linux/acpi-call {};
|
acpi_call = callPackage ../os-specific/linux/acpi-call {};
|
||||||
|
|
||||||
@ -6115,7 +6115,7 @@ let
|
|||||||
|
|
||||||
zfs = callPackage ../os-specific/linux/zfs/default.nix { };
|
zfs = callPackage ../os-specific/linux/zfs/default.nix { };
|
||||||
};
|
};
|
||||||
in self;
|
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);
|
linuxPackages_2_6_32 = recurseIntoAttrs (linuxPackagesFor linux_2_6_32);
|
||||||
|
Loading…
Reference in New Issue
Block a user