Modprobe from mdevd

This commit is contained in:
Emery Hemingway 2023-07-01 17:58:32 +01:00
parent e35ab0946b
commit ffa22ab4be
5 changed files with 14 additions and 18 deletions

View File

@ -247,6 +247,7 @@ ln -sfn /proc/self/fd/2 /dev/stderr
mkdir -p /dev/.mdadm mkdir -p /dev/.mdadm
info "running mdevd..." info "running mdevd..."
echo '.* 0:0 660' >/etc/mdev.conf
mdevd -O4 -v 3 & mdevd -O4 -v 3 &
mdevd_pid=$! mdevd_pid=$!
mdevd-coldplug -O4 -v 3 mdevd-coldplug -O4 -v 3

View File

@ -350,9 +350,6 @@ let
{ object = pkgs.kmod-debian-aliases; { object = pkgs.kmod-debian-aliases;
symlink = "/etc/modprobe.d/debian.conf"; symlink = "/etc/modprobe.d/debian.conf";
} }
{ object = config.system.build.mdevConf;
symlink = "/etc/mdev.conf";
}
] ++ lib.optionals config.services.multipath.enable [ ] ++ lib.optionals config.services.multipath.enable [
{ object = pkgs.runCommand "multipath.conf" { { object = pkgs.runCommand "multipath.conf" {
src = config.environment.etc."multipath.conf".text; src = config.environment.etc."multipath.conf".text;
@ -423,16 +420,12 @@ let
(cd "$tmp" && find . -print0 | sort -z | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @-) | \ (cd "$tmp" && find . -print0 | sort -z | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @-) | \
${compressorExe} ${lib.escapeShellArgs initialRamdisk.compressorArgs} >> "$1" ${compressorExe} ${lib.escapeShellArgs initialRamdisk.compressorArgs} >> "$1"
''; '';
mdevConf = builtins.toFile "mdev.conf" ''
.* 0:0 777
'';
in in
{ {
config = mkIf config.boot.initrd.enable { config = mkIf config.boot.initrd.enable {
system.build = lib.mapAttrs (_: lib.mkForce) { inherit bootStage1 initialRamdisk initialRamdiskSecretAppender extraUtils mdevConf; }; system.build = lib.mapAttrs (_: lib.mkForce) { inherit bootStage1 initialRamdisk initialRamdiskSecretAppender extraUtils; };
}; };
} }

View File

@ -1,6 +1,9 @@
<require-service <daemon mdevd>> <require-service <daemon mdevd>>
<daemon mdevd ["@mdevd@/bin/mdevd" "-v" "3"]> <daemon mdevd {
argv: ["@mdevd@/bin/mdevd" "-v" "9" "-f" "@mdevdConf@"]
env: { PATH: "@mdevdPath@" }
}>
<require-service <daemon mdevd-coldplug>> <require-service <daemon mdevd-coldplug>>
<depends-on <daemonmdevd-coldplug> <service-state <daemon mdevd> up>> <depends-on <daemonmdevd-coldplug> <service-state <daemon mdevd> up>>
<daemon mdevd-coldplug <one-shot ["@mdevd@/bin/mdevd-coldplug" "-v" "3"]>> <daemon mdevd-coldplug <one-shot ["@mdevd@/bin/mdevd-coldplug" "-v" "9"]>>

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, lib, pkgs, ... }:
let let
substituteDirectory = args: substituteDirectory = args:
@ -11,10 +11,6 @@ let
in { in {
environment.etc = { environment.etc = {
"mdev.conf".text = ''
.* 0:0 660
'';
"syndicate/boot".source = substituteDirectory { "syndicate/boot".source = substituteDirectory {
src = ./boot; src = ./boot;
getty = "${pkgs.busybox}/bin/busybox getty"; getty = "${pkgs.busybox}/bin/busybox getty";
@ -23,10 +19,14 @@ in {
"syndicate/core".source = substituteDirectory { "syndicate/core".source = substituteDirectory {
src = ./core; src = ./core;
inherit (pkgs) mdevd;
hostnameOneShot = hostnameOneShot =
"${pkgs.busybox}/bin/busybox hostname ${config.networking.hostName}"; "${pkgs.busybox}/bin/busybox hostname ${config.networking.hostName}";
};
inherit (pkgs) mdevd;
mdevdConf = pkgs.writeText "mdevd.conf" ''
-$MODALIAS=.* 0:0 660 +importas -iu MODALIAS MODALIAS ${pkgs.kmod}/bin/modprobe -q $MODALIAS
'';
mdevdPath = lib.strings.makeBinPath [ pkgs.execline pkgs.busybox ];
};
}; };
} }

View File

@ -5,7 +5,6 @@ eval "$preInstall"
pushd $src || exit pushd $src || exit
find ./* -type f | while read filepath find ./* -type f | while read filepath
do do
echo "find file $filepath"
fileout=$out/$filepath fileout=$out/$filepath
dirout=$(dirname "$fileout") dirout=$(dirname "$fileout")
mkdir -p "$dirout" mkdir -p "$dirout"