blob: 323af6d2c901599d00f8a084447d17aa713eafa5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/bin/ash
#
# This script checks whether the nvidia kernel module was loaded by udev
# and copies the kernel modules over to stage4 and disables nouveau
type emergency_shell >/dev/null 2>&1 || . /lib/dracut-lib.sh
copy_nvidia_modules() {
local nvidia_moddir="/lib/modules/$(uname -r)/kernel/drivers/gpu/drm/nvidia"
if [ -d "${NEWROOT}/${nvidia_moddir}" ]; then
warn "Stage4 contains nvidia driver which would be overwritten - skipping."
return 1
fi
if ! ( cp -r "$nvidia_moddir" "${NEWROOT}/${nvidia_moddir}" \
&& depmod -a -b "$NEWROOT" ); then
warn "Failed to copy/depmod nvidia modules to stage4."
return 1
fi
# nouveau driver would needlessly load, prevent that
mkdir -p "${NEWROOT}/etc/modprobe.d" # cause why not
echo "blacklist nouveau" > "${NEWROOT}/etc/modprobe.d/disable-nouveau.conf"
return 0
}
if lsmod | grep -q nvidia; then
copy_nvidia_modules
fi
: # fake success
|