#!/bin/sh # setup-i915-kernel7-fix.sh # # Run on a fresh hp-chell (HP Chromebook 13 "chell", coreboot/MrChromebox # firmware, KDE neon) install to apply two things: # # 1. The kernel 7.x cold-boot black-screen workaround: a # /usr/share/sddm/scripts/Xsetup hook that forces a second modeset # on eDP-1 to un-stick i915's pipe A on 7.x kernels. See project # CLAUDE.md for the full diagnosis writeup. # 2. GRUB_TIMEOUT=5 / GRUB_TIMEOUT_STYLE=menu, so the boot menu is # visible for 5 seconds (useful for picking a fallback kernel like # 6.17.0-42-generic if a future 7.x point release regresses again). # # Safe to re-run; idempotent. set -eu if [ "$(id -u)" -ne 0 ]; then echo "must run as root (sudo $0)" >&2 exit 1 fi echo "==> installing SDDM Xsetup i915 kernel-7.x workaround" cat > /usr/share/sddm/scripts/Xsetup << 'EOF' #!/bin/sh # Xsetup - run as root before the login dialog appears if [ -e /sbin/prime-offload ]; then echo running NVIDIA Prime setup /sbin/prime-offload /sbin/prime-offload fi # Workaround: on kernel 7.x, the first i915 modeset at cold boot (Xorg's # auto-modeset to the panel's native 3200x1800) leaves pipe A in a bad # state (persistent CPU pipe A FIFO underrun -> blank panel, backlight # still on, even though DRM/plane state reports healthy). Forcing a # second modeset unsticks it. Rather than cycle back to native, just # land on 1600x900 (exact half of 3200x1800, clean 2x integer scaling) # and stay there -- it's only the login screen; the logged-in session # renews the modeset itself and comes up at full native resolution. # Not needed on 6.17.x kernels. See project CLAUDE.md for the full # writeup. case "$(uname -r)" in 7.*) xrandr --output eDP-1 --mode 1600x900 >/tmp/xsetup-modeset.log 2>&1 echo "set eDP-1 to 1600x900 (i915 kernel 7.x cold-boot workaround)" ;; esac EOF chmod 755 /usr/share/sddm/scripts/Xsetup echo "==> setting GRUB_TIMEOUT=5 / GRUB_TIMEOUT_STYLE=menu" grub_conf=/etc/default/grub set_grub_key() { key=$1 value=$2 if grep -q "^${key}=" "$grub_conf"; then sed -i "s|^${key}=.*|${key}=${value}|" "$grub_conf" elif grep -q "^#${key}=" "$grub_conf"; then sed -i "s|^#${key}=.*|${key}=${value}|" "$grub_conf" else echo "${key}=${value}" >> "$grub_conf" fi } set_grub_key GRUB_TIMEOUT 5 set_grub_key GRUB_TIMEOUT_STYLE menu echo "==> running update-grub" update-grub echo "==> done"