Revert "linuxManualConfig: unpack directly into $dev"

This reverts commit 7de3f08ce3.
This commit is contained in:
Adam Joseph
2023-07-28 12:32:03 -07:00
parent 12a06dc2b8
commit 93021f12c3
@@ -116,20 +116,6 @@ let
hash = "sha256-bBOyJcP6jUvozFJU0SPTOf3cmnTQ6ZZ4PlHjiniHXLU=";
});
preUnpack = ''
# The same preUnpack is used to build the configfile,
# which does not have $dev.
if [ -n "$dev" ]; then
mkdir -p $dev/lib/modules/${modDirVersion}
cd $dev/lib/modules/${modDirVersion}
fi
'';
postUnpack = ''
mv -Tv "$sourceRoot" source 2>/dev/null || :
export sourceRoot=$PWD/source
'';
postPatch = ''
sed -i Makefile -e 's|= depmod|= ${buildPackages.kmod}/bin/depmod|'
@@ -200,12 +186,6 @@ let
buildFlags = [
"KBUILD_BUILD_VERSION=1-NixOS"
# Set by default in the kernel since a73619a845d5,
# replicated here to apply to older versions.
# Makes __FILE__ relative to the build directory.
"KCPPFLAGS=-fmacro-prefix-map=$(sourceRoot)/="
kernelConf.target
"vmlinux" # for "perf" and things like that
] ++ optional isModular "modules"
@@ -282,6 +262,7 @@ let
];
postInstall = optionalString isModular ''
mkdir -p $dev
cp vmlinux $dev/
if [ -z "''${dontStrip-}" ]; then
installFlagsArray+=("INSTALL_MOD_STRIP=1")
@@ -291,7 +272,12 @@ let
unlink $out/lib/modules/${modDirVersion}/build
unlink $out/lib/modules/${modDirVersion}/source
mkdir $dev/lib/modules/${modDirVersion}/build
mkdir -p $dev/lib/modules/${modDirVersion}/{build,source}
# To save space, exclude a bunch of unneeded stuff when copying.
(cd "$NIX_BUILD_TOP" && cd "$sourceRoot" &&
rsync --archive --prune-empty-dirs \
* $dev/lib/modules/${modDirVersion}/source/)
cd $dev/lib/modules/${modDirVersion}/source