Skip to content

Commit

Permalink
kernel: Fix out-of-tree modules on aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
dezgeg committed Nov 17, 2017
1 parent 00056e7 commit eb85761
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions pkgs/os-specific/linux/kernel/manual-config.nix
Expand Up @@ -158,27 +158,38 @@ let
cp $buildRoot/{.config,Module.symvers} $dev/lib/modules/${modDirVersion}/build
make modules_prepare $makeFlags "''${makeFlagsArray[@]}" O=$dev/lib/modules/${modDirVersion}/build
# Keep some extra files on some arches (powerpc, aarch64)
for f in arch/powerpc/lib/crtsavres.o arch/arm64/kernel/ftrace-mod.o; do
if [ -f "$buildRoot/$f" ]; then
cp $buildRoot/$f $dev/lib/modules/${modDirVersion}/build/$f
fi
done
# !!! No documentation on how much of the source tree must be kept
# If/when kernel builds fail due to missing files, you can add
# them here. Note that we may see packages requiring headers
# from drivers/ in the future; it adds 50M to keep all of its
# headers on 3.10 though.
chmod u+w -R ../source
arch=`cd $dev/lib/modules/${modDirVersion}/build/arch; ls`
arch=$(cd $dev/lib/modules/${modDirVersion}/build/arch; ls)
# Remove unusued arches
mv arch/$arch .
rm -fR arch
mkdir arch
mv $arch arch
# Remove unused arches
for d in $(cd arch/; ls); do
if [ "$d" = "$arch" ]; then continue; fi
if [ "$arch" = arm64 ] && [ "$d" = arm ]; then continue; fi
rm -rf arch/$d
done
# Remove all driver-specific code (50M of which is headers)
rm -fR drivers
# Keep all headers
find . -type f -name '*.h' -print0 | xargs -0 chmod u-w
# Keep linker scripts (they are required for out-of-tree modules on aarch64)
find . -type f -name '*.lds' -print0 | xargs -0 chmod u-w
# Keep root and arch-specific Makefiles
chmod u-w Makefile
chmod u-w arch/$arch/Makefile*
Expand Down

0 comments on commit eb85761

Please sign in to comment.