20 lines
811 B
Bash
20 lines
811 B
Bash
# Add kernel cmdline tuning to the systemd-boot loader entries, idempotently.
|
|
# systemd-boot reads `options` at boot — no initramfs/entry regeneration needed.
|
|
# (intel_iommu is harmless on AMD CPUs; both target machines are Intel.)
|
|
|
|
toks="intel_iommu=on iommu=pt" # VFIO / PCI passthrough
|
|
[ "$GPU" = amd ] && toks="$toks amdgpu.mcbp=0 amdgpu.ppfeaturemask=0xfff7ffff"
|
|
|
|
shopt -s nullglob
|
|
entries=(/boot/loader/entries/arch*.conf)
|
|
[ "${#entries[@]}" -gt 0 ] || die "no loader entries in /boot/loader/entries (run base install first)"
|
|
|
|
for f in "${entries[@]}"; do
|
|
opts="$(sed -n 's/^options //p' "$f")"
|
|
for t in $toks; do
|
|
case " $opts " in *" $t "*) ;; *) opts="$opts $t" ;; esac
|
|
done
|
|
sed -i "s|^options .*|options $opts|" "$f"
|
|
info "$(basename "$f"): options $opts"
|
|
done
|