#!/bin/bash
set -euo pipefail
KVER=$(uname -r)
MODPATH="/lib/modules/$KVER/kernel/drivers/gpu/drm/amd/amdgpu"
echo "Kernel: $KVER"
echo "Module path: $MODPATH"
echo "--- Install validation-patched module (2500 MHz range check) ---"
sudo cp /tmp/amdgpu_repatched.ko.zst "$MODPATH/amdgpu.ko.zst"
ls -lh "$MODPATH/amdgpu.ko.zst"
echo "--- Running depmod ---"
sudo depmod -a
echo "--- Rebuilding initramfs via limine-update ---"
sudo limine-update
echo "DONE. Reboot required."