From 72899f8d89744c8014ff74ea6496923684e8c2b5 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Sat, 4 Jan 2025 01:03:29 +0300 Subject: [PATCH] Handle framebuffer_coreboot driver built as a module The driver for coreboot firmware-initialized framebuffer can be built as a module. Debian kernels so far have it as built-in because they would not be probed automatically when built as a module. This is fixed now, likely with a patchset included in v6.9-rc1, so we might encounter it as a module either in Debian or with custom-built kernels. For MODULES=dep, check for the coreboot framebuffer in a different block from other platform drivers, and include the framebuffer_coreboot module if we find the device. For MODULES=most, add driver to the framebuffer modules list. Explicitly try to probe the module for break=top because it would not automatically probe there otherwise. Since it requires a driver for the "simple-framebuffer" device, add simpledrm and simplefb as its hidden dependencies. Signed-off-by: Alper Nebi Yasak --- hook-functions | 16 +++++++++++++--- scripts/functions | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hook-functions b/hook-functions index 9927155..893ee16 100644 --- a/hook-functions +++ b/hook-functions @@ -639,14 +639,20 @@ dep_add_modules() for device in /sys/bus/platform/drivers/efi-framebuffer/* \ /sys/bus/platform/drivers/platform-framebuffer/* \ /sys/bus/platform/drivers/simple-framebuffer/* \ - /sys/bus/platform/drivers/vesa-framebuffer/* \ - /sys/bus/coreboot/drivers/framebuffer/*; do + /sys/bus/platform/drivers/vesa-framebuffer/*; do if [ -d "$device" ] && [ "$(basename "$device")" != "module" ]; then walk_graphics=no break fi done + for device in /sys/bus/coreboot/drivers/framebuffer/*; do + if [ -d "$device" ] && [ "$(basename "$device")" != "module" ]; then + modules="$modules framebuffer_coreboot" + walk_graphics=no + 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. @@ -850,7 +856,7 @@ auto_add_modules() modules="$modules =drivers/usb/storage" ;; fb) - modules="$modules simpledrm simplefb" + modules="$modules simpledrm simplefb framebuffer_coreboot" # For machines that don't have a generic framebuffer device. modules="$modules rockchipdrm pwm-cros-ec pwm_bl pwm-rockchip panel-simple" modules="$modules analogix-anx6345 pwm-sun4i sun4i-drm sun8i-mixer panel-edp" @@ -942,6 +948,10 @@ hidden_dep_add_modules() # DP devices which don't have devlinks echo pmic_glink_altmode gpio_sbu_mux qrtr ;; + framebuffer_coreboot) + # Either one, we don't know which is a module + echo simpledrm simplefb + ;; esac done ) diff --git a/scripts/functions b/scripts/functions index 7e9dd7a..1e8b26f 100644 --- a/scripts/functions +++ b/scripts/functions @@ -103,7 +103,7 @@ maybe_break() /sbin/modprobe ${opts} -a i8042 atkbd ehci-pci ehci-orion \ ehci-hcd ohci-hcd ohci-pci uhci-hcd usbhid xhci \ xhci-pci xhci-hcd - /sbin/modprobe ${opts} -a simpledrm simplefb + /sbin/modprobe ${opts} -a simpledrm simplefb framebuffer_coreboot sleep 2 for modalias in /sys/bus/hid/devices/*/modalias; do if [ -f "${modalias}" ]; then