aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-10 15:27:39 -0500
committerCraig Jennings <c@cjennings.net>2026-06-10 15:27:39 -0500
commitadb39f2b4e1c166a45b6081d1e2c22be9607643c (patch)
treed2903f3f23667c83bfa039978bd0520554d145e7
parent4736058c56b27ad91526506f2bb223f8c7623d0b (diff)
downloadarchsetup-adb39f2b4e1c166a45b6081d1e2c22be9607643c.tar.gz
archsetup-adb39f2b4e1c166a45b6081d1e2c22be9607643c.zip
feat(install): TLP for laptops + Framework 13 firmware trim
TLP installs and enables on any machine with a battery (BAT* present), with an /etc/tlp.d/01-custom.conf pinning the CPU energy/perf split per power source; systemd-rfkill gets masked per TLP's docs. The firmware trim is DMI-gated to Framework Intel machines, where the hardware set is known: keep linux-firmware-intel and -atheros, remove the meta and the other ten subpackages (~600MB). Applied live on velox first — TLP 1.10.1 active, wifi up after the trim, initramfs rebuilt clean.
-rwxr-xr-xarchsetup43
1 files changed, 43 insertions, 0 deletions
diff --git a/archsetup b/archsetup
index dbc0b16..19d79dc 100755
--- a/archsetup
+++ b/archsetup
@@ -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.