diff options
| -rwxr-xr-x | archsetup | 43 |
1 files changed, 43 insertions, 0 deletions
@@ -2365,6 +2365,49 @@ HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore EOF + # TLP power management — laptops only (battery present). Manages wifi, + # USB, PCIe, and CPU power policy on AC/battery transitions. systemd-rfkill + # is masked per TLP's docs (it fights TLP's radio-state handling). + if ls /sys/class/power_supply/BAT* &>/dev/null; then + pacman_install tlp + action="writing TLP custom config" && display "task" "$action" + mkdir -p /etc/tlp.d + cat << 'EOF' > /etc/tlp.d/01-custom.conf +# Custom TLP overrides (tuned on a Framework 13 Intel; generic for any laptop). +# Defaults are sane; these pin the CPU energy/perf split explicitly. +CPU_ENERGY_PERF_POLICY_ON_AC=balance_performance +CPU_ENERGY_PERF_POLICY_ON_BAT=power +PLATFORM_PROFILE_ON_AC=balanced +PLATFORM_PROFILE_ON_BAT=low-power +# Battery longevity: cap charge at 80% where the EC supports it. +# Off by default — uncomment (and match the BAT name) to enable. +#STOP_CHARGE_THRESH_BAT1=80 +EOF + action="enabling TLP service" && display "task" "$action" + systemctl enable tlp.service >> "$logfile" 2>&1 || error_warn "$action" "$?" + systemctl mask systemd-rfkill.service systemd-rfkill.socket >> "$logfile" 2>&1 || \ + error_warn "masking systemd-rfkill for TLP" "$?" + fi + + # Firmware trim — Framework 13 Intel only (matched by DMI), where the + # hardware set is known: i915 graphics (linux-firmware-intel) and ath9k + # wifi (linux-firmware-atheros, firmware-free driver but kept for safety). + # Saves ~600MB. The meta package needs -Rdd because mkinitcpio-firmware + # declares a dependency on it; the dangling dep is cosmetic and the + # subsequent mkinitcpio warnings cover hardware this machine doesn't have. + if grep -qi "framework" /sys/class/dmi/id/product_name 2>/dev/null && \ + grep -qi "intel" /proc/cpuinfo 2>/dev/null; then + action="trimming firmware packages to Framework 13 hardware" && display "task" "$action" + pacman -Rdd --noconfirm \ + linux-firmware linux-firmware-amdgpu linux-firmware-broadcom \ + linux-firmware-cirrus linux-firmware-liquidio linux-firmware-mediatek \ + linux-firmware-mellanox linux-firmware-nfp linux-firmware-nvidia \ + linux-firmware-other linux-firmware-qlogic linux-firmware-radeon \ + linux-firmware-realtek >> "$logfile" 2>&1 || error_warn "$action" "$?" + action="rebuilding initramfs after firmware trim" && display "task" "$action" + mkinitcpio -P >> "$logfile" 2>&1 || error_warn "$action" "$?" + fi + # GRUB: reset timeouts, adjust log levels, larger menu for HiDPI screens, and show splashscreen # Note: nvme.noacpi=1 disables NVMe ACPI power management to prevent freezes on some drives. # Safe to keep on newer drives (minor power cost), remove if battery life is critical. |
