fix kernel 3.4+ early cifs mounting (qemu-vm target)

kernel 3.4+ needs cifs-utils to mount CIFS filesystems.
the kernel itself (and busybox's cifs mount code) are no longer able
to do this in some/most cases and will error out saying:
"CIFS VFS: connecting to DFS root not implemented yet"

Nixos' qemu-vm target is hurt by this, as it wants to mount /nix/store
via cifs very early in the boot process.

This commit makes sure the initrd for affected kernels is built with
cifs-utils if needed.
This commit is contained in:
Mathijs Kwik 2012-08-30 18:31:45 +02:00
parent a502ce1128
commit bce1cdd59c
1 changed files with 20 additions and 1 deletions

View File

@ -121,6 +121,20 @@ let
enableSplashScreen =
config.boot.vesa && config.boot.initrd.enableSplashScreen && kernelPackages.splashutils != null;
needsCifsUtils = kernelPackages.kernel ? features
&& kernelPackages.kernel.features ? needsCifsUtils
&& kernelPackages.kernel.features.needsCifsUtils
&& any (fs: fs.fsType == "cifs") fileSystems;
busybox = if needsCifsUtils
then pkgs.busybox.override {
extraConfig = ''
CONFIG_FEATURE_MOUNT_CIFS n
CONFIG_FEATURE_MOUNT_HELPERS y
'';
}
else pkgs.busybox;
# Some additional utilities needed in stage 1, like mount, lvm, fsck
# etc. We don't want to bring in all of those packages, so we just
@ -146,7 +160,7 @@ let
cp -pv ${pkgs.gcc.gcc}/lib*/libgcc_s.so.* $out/lib
# Copy BusyBox.
cp -rvd ${pkgs.busybox}/{bin,sbin} $out/
cp -rvd ${busybox}/{bin,sbin} $out/
chmod -R u+w $out
# Copy some utillinux stuff.
@ -175,6 +189,11 @@ let
cp ${kernelPackages.splashutils}/${kernelPackages.splashutils.helperName} $out/bin/splash_helper
''}
# Maybe copy cifs utils
${optionalString needsCifsUtils ''
cp -v ${pkgs.cifs_utils}/sbin/mount.cifs $out/bin
''}
${config.boot.initrd.extraUtilsCommands}
# Strip binaries further than normal.