Merge branch 'dep-graphics-check-heuristics' into 'master'

hook_functions: dep_add_modules: Use heuristics for a generic framebuffer

See merge request kernel-team/initramfs-tools!111
This commit is contained in:
Ben Hutchings 2024-05-29 17:40:35 +00:00
commit 02fb5d2f1f

View File

@ -575,6 +575,25 @@ dep_add_modules()
fi
done
# It's possible that a generic framebuffer device works, but is taken
# over by a more capable driver and no longer available in /sys. We
# have no reliable consistent way to detect that, so apply heuristics.
case "$(uname -m)" in
i386|i686|x86_64) walk_graphics=no ;;
esac
if [ -d "/sys/firmware/efi/efivars" ]; then
walk_graphics=no
fi
for node in /sys/firmware/devicetree/base/chosen/framebuffer@*; do
if [ -d "$node" ] && grep -qz '^simple-framebuffer$' "$node/compatible"; then
if [ ! -f "$node/status" ] || grep -qz '^\(okay\|ok\)$' "$node/status"; then
walk_graphics=no
fi
fi
done
if [ "$walk_graphics" = "yes" ]; then
class_add_modules backlight
class_add_modules graphics