diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:54:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-03 13:54:25 +0000 |
commit | 9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a (patch) | |
tree | 2efb72864cc69e174c9c5ee33efb88a5f1553b48 /modules.d/50drm | |
parent | Initial commit. (diff) | |
download | dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.tar.xz dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.zip |
Adding upstream version 060+5.upstream/060+5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/50drm')
-rwxr-xr-x | modules.d/50drm/module-setup.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/modules.d/50drm/module-setup.sh b/modules.d/50drm/module-setup.sh new file mode 100755 index 0000000..1fb3867 --- /dev/null +++ b/modules.d/50drm/module-setup.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# called by dracut +check() { + return 255 +} + +# called by dracut +depends() { + return 0 +} + +# called by dracut +installkernel() { + # Include KMS capable drm drivers + + if [[ ${DRACUT_ARCH:-$(uname -m)} == arm* || ${DRACUT_ARCH:-$(uname -m)} == aarch64 ]]; then + # arm/aarch64 specific modules needed by drm + instmods \ + "=drivers/gpu/drm/i2c" \ + "=drivers/gpu/drm/panel" \ + "=drivers/gpu/drm/bridge" \ + "=drivers/video/backlight" + fi + + instmods amdkfd hyperv_fb "=drivers/pwm" + + # if the hardware is present, include module even if it is not currently loaded, + # as we could e.g. be in the installer; nokmsboot boot parameter will disable + # loading of the driver if needed + if [[ $hostonly ]]; then + local i modlink modname + + for i in /sys/bus/{pci/devices,platform/devices,virtio/devices,soc/devices/soc?,vmbus/devices}/*/modalias; do + [[ -e $i ]] || continue + [[ -n $(< "$i") ]] || continue + # shellcheck disable=SC2046 + if hostonly="" dracut_instmods --silent -s "drm_crtc_init|drm_dev_register|drm_encoder_init" -S "iw_handler_get_spy" $(< "$i"); then + if strstr "$(modinfo -F filename $(< "$i") 2> /dev/null)" radeon.ko; then + hostonly='' instmods amdkfd + fi + fi + done + # if there is a privacy screen then its driver must be loaded before the + # kms driver will bind, otherwise its probe() will return -EPROBE_DEFER + # note privacy screens always register, even with e.g. nokmsboot + for i in /sys/class/drm/privacy_screen-*/device/driver/module; do + [[ -L $i ]] || continue + modlink=$(readlink "$i") + modname=$(basename "$modlink") + instmods "$modname" + done + else + dracut_instmods -o -s "drm_crtc_init|drm_dev_register|drm_encoder_init" "=drivers/gpu/drm" "=drivers/staging" + # also include privacy screen providers (see above comment) + # atm all providers live under drivers/platform/x86 + dracut_instmods -o -s "drm_privacy_screen_register" "=drivers/platform/x86" + fi +} |