mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-30 12:32:37 +00:00
88 lines
2.5 KiB
Bash
Executable File
88 lines
2.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
source /etc/default/bazzite
|
|
|
|
# GLOBAL
|
|
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
|
|
KARGS=$(rpm-ostree kargs)
|
|
NEEDED_KARGS=""
|
|
echo "Current kargs: $KARGS"
|
|
|
|
# FSTAB CONFIGURATION
|
|
if [[ $(grep "compress=zstd" /etc/fstab) ]]; then
|
|
echo "Applying fstab param adjustments"
|
|
if grep -q '64GB' <<< $(lsblk -o MODEL); then
|
|
echo "64GB eMMC detected"
|
|
sed -i 's/compress=zstd:1/noatime,lazytime,commit=5,discard=sync,compress-force=zstd:3,space_cache=v2/g' /etc/fstab
|
|
else
|
|
sed -i 's/compress=zstd:1/noatime,lazytime,commit=120,discard=async,compress-force=zstd:1,space_cache=v2/g' /etc/fstab
|
|
fi
|
|
else
|
|
echo "No fstab param adjustments needed"
|
|
fi
|
|
|
|
# DECK KERNEL ARGUMENTS
|
|
if [[ ":Jupiter:" =~ ":$SYS_ID:" ]]; then
|
|
echo "Checking for needed karg changes (Jupiter)"
|
|
|
|
if [[ ! $KARGS =~ "amd_pstate" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=amd_pstate=active"
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "amd_iommu" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=amd_iommu=off"
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "amdgpu.gttsize" ]]; then
|
|
if [[ "$(awk '/MemTotal/{print $(NF-1)}' /proc/meminfo)" == "31664740" ]]; then
|
|
echo "32GB Steam Deck detected"
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.gttsize=16256"
|
|
else
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=amdgpu.gttsize=8128"
|
|
fi
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "spi_amd.speed_dev" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=spi_amd.speed_dev=1"
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "audit" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=audit=0"
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "initcall_blacklist" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=initcall_blacklist=simpledrm_platform_driver_init"
|
|
fi
|
|
fi
|
|
|
|
if [[ $IMAGE_NAME =~ "nvidia" ]]; then
|
|
echo "Checking for needed karg changes (Nvidia)"
|
|
|
|
if [[ ! $KARGS =~ "rd.driver.blacklist" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=rd.driver.blacklist=nouveau"
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "modprobe.blacklist" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=modprobe.blacklist=nouveau"
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "nvidia-drm.modeset" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=nvidia-drm.modeset=1"
|
|
fi
|
|
fi
|
|
|
|
if [[ $KARGS =~ "nomodeset" ]]; then
|
|
echo "Removing nomodeset"
|
|
NEEDED_KARGS="$NEEDED_KARGS --delete=nomodeset"
|
|
fi
|
|
|
|
if [[ ! $KARGS =~ "rd.luks.options" ]]; then
|
|
NEEDED_KARGS="$NEEDED_KARGS --append=rd.luks.options=discard"
|
|
fi
|
|
|
|
if [[ ! -z "$NEEDED_KARGS" ]]; then
|
|
echo "Found needed karg changes, applying the following: $NEEDED_KARGS"
|
|
rpm-ostree kargs ${NEEDED_KARGS} --reboot
|
|
else
|
|
echo "No karg changes needed"
|
|
fi
|