From 6ed65c2d95420705163c152b4dcb7a9057463b87 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 3 Jul 2008 10:45:14 +0000 Subject: [PATCH] * Removing hardware-scan.nix also removed the loading of the kernel modules listed in config.boot.kernelModules. So do that in the udev job for lack of a better place. svn path=/nixos/trunk/; revision=12249 --- upstart-jobs/default.nix | 3 +-- upstart-jobs/udev.nix | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/upstart-jobs/default.nix b/upstart-jobs/default.nix index a3e988eab767..147dded26b1e 100644 --- a/upstart-jobs/default.nix +++ b/upstart-jobs/default.nix @@ -88,7 +88,7 @@ let # The udev daemon creates devices nodes and runs programs when # hardware events occur. (import ../upstart-jobs/udev.nix { - inherit modprobe; + inherit modprobe config; inherit (pkgs) stdenv writeText substituteAll udev procps; inherit (pkgs.lib) cleanSource; firmwareDirs = @@ -101,7 +101,6 @@ let extraUdevPkgs = pkgs.lib.optional config.services.hal.enable pkgs.hal ++ pkgs.lib.optional config.hardware.enableGo7007 kernelPackages.wis_go7007; - sndMode = config.services.udev.sndMode; }) # Makes LVM logical volumes available. diff --git a/upstart-jobs/udev.nix b/upstart-jobs/udev.nix index 5d8e8269cea9..f2235a7b481a 100644 --- a/upstart-jobs/udev.nix +++ b/upstart-jobs/udev.nix @@ -1,10 +1,12 @@ { stdenv, writeText, substituteAll, cleanSource, udev, procps, firmwareDirs, modprobe , extraUdevPkgs ? [] -, sndMode ? "0600" +, config }: let + cfg = config.services.udev; + firmwareLoader = substituteAll { src = ./udev-firmware-loader.sh; path = "${stdenv.coreutils}/bin"; @@ -24,12 +26,12 @@ let #KERNEL=="sr[0-9]", BUS=="scsi", SYMLINK+="cdrom cdrom-%k" # ALSA sound devices. - KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="${sndMode}" - KERNEL=="hwC[D0-9]*", NAME="snd/%k", MODE="${sndMode}" - KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k", MODE="${sndMode}" - KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="${sndMode}" - KERNEL=="timer", NAME="snd/%k", MODE="${sndMode}" - KERNEL=="seq", NAME="snd/%k", MODE="${sndMode}" + KERNEL=="controlC[0-9]*", NAME="snd/%k", MODE="${cfg.sndMode}" + KERNEL=="hwC[D0-9]*", NAME="snd/%k", MODE="${cfg.sndMode}" + KERNEL=="pcmC[D0-9cp]*", NAME="snd/%k", MODE="${cfg.sndMode}" + KERNEL=="midiC[D0-9]*", NAME="snd/%k", MODE="${cfg.sndMode}" + KERNEL=="timer", NAME="snd/%k", MODE="${cfg.sndMode}" + KERNEL=="seq", NAME="snd/%k", MODE="${cfg.sndMode}" # Firmware loading. SUBSYSTEM=="firmware", ACTION=="add", RUN+="${firmwareLoader}" @@ -87,6 +89,13 @@ in # Get rid of possible old udev processes. ${procps}/bin/pkill -u root "^udevd$" || true + # Do the loading of additional stage 2 kernel modules. + # Maybe this isn't the best place... + for i in ${toString config.boot.kernelModules}; do + echo "Loading kernel module $i..." + ${modprobe}/sbin/modprobe $i || true + done + # Start udev. ${udev}/sbin/udevd --daemon