chore: Cleanup bazzite-hardware-setup, make more use of initramfs

chore: Use lower numbers for sysctl.d
This commit is contained in:
Kyle Gospodnetich 2023-10-20 15:50:54 -07:00
parent caf4a9eaa3
commit df3f1c4375
14 changed files with 70 additions and 86 deletions

View File

@ -202,13 +202,15 @@ RUN if grep -qv "nvidia" <<< "${IMAGE_NAME}"; then \
rocm-clinfo \
waydroid \
weston && \
sed -i~ -E 's/=.\$\(command -v (nft|ip6?tables-legacy).*/=/g' /usr/lib/waydroid/data/scripts/waydroid-net.sh \
sed -i~ -E 's/=.\$\(command -v (nft|ip6?tables-legacy).*/=/g' /usr/lib/waydroid/data/scripts/waydroid-net.sh && \
rm -f /usr/etc/modprobe.d/nvidia.conf \
; else \
rm -f /usr/etc/modprobe.d/amdgpu.conf && \
if [[ "${FEDORA_MAJOR_VERSION}" -lt "39" ]]; then \
rpm-ostree install \
mesa-libGL.i686 \
mesa-libEGL.i686 \
;fi && \
; fi && \
rpm-ostree install \
vulkan-loader.i686 \
alsa-lib.i686 \

View File

@ -0,0 +1,5 @@
# Blacklist the Intel TCO Watchdog/Timer module
blacklist iTCO_wdt
# Blacklist the AMD SP5100 TCO Watchdog/Timer module (Required for Ryzen CPUs)
blacklist sp5100_tco

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
# Script Version
VER=4
VER=5
VER_FILE="/etc/bazzite/flatpak_manager_version"
VER_RAN=$(cat $VER_FILE)

View File

@ -7,7 +7,7 @@ BASE_IMAGE_NAME=$(jq -r '."base-image-name"' < $IMAGE_INFO)
FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)
# SCRIPT VERSION
HWS_VER=9
HWS_VER=11
HWS_VER_FILE="/etc/bazzite/hws_version"
HWS_VER_RAN=$(cat $HWS_VER_FILE)
@ -19,14 +19,57 @@ KNOWN_IMAGE_FLAVOR=$(cat $KNOWN_IMAGE_FLAVOR_FILE)
KNOWN_FEDORA_VERSION_FILE="/etc/bazzite/fedora_version"
KNOWN_FEDORA_VERSION=$(cat $KNOWN_FEDORA_VERSION_FILE)
# RUN REMAINDER OF SCRIPT ONLY IF UPDATED
if [[ -f $HWS_VER_FILE && $HWS_VER = $HWS_VER_RAN ]]; then
if [[ -f $KNOWN_IMAGE_NAME_FILE && -f $KNOWN_IMAGE_FLAVOR_FILE ]]; then
if [[ -f $KNOWN_FEDORA_VERSION_FILE && -f $KNOWN_FEDORA_VERSION_FILE ]]; then
# Run script if image has been rebased
if [[ $IMAGE_NAME = $KNOWN_IMAGE_NAME && $IMAGE_FLAVOR = $KNOWN_IMAGE_FLAVOR && $FEDORA_VERSION = $KNOWN_FEDORA_VERSION ]]; then
echo "Hardware setup has already run. Exiting..."
exit 0
fi
fi
fi
fi
# GLOBAL
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
GPU_ID=$(lspci -k | grep -A 3 -E "(VGA|3D)")
KARGS=$(rpm-ostree kargs)
INITRAMFS=$(rpm-ostree initramfs)
NEEDED_KARGS=""
echo "Current kargs: $KARGS"
mkdir -p /etc/bazzite
INITRAMFS=$(rpm-ostree initramfs)
NEEDED_INITRAMFS=""
echo "Current initramfs: $INITRAMFS"
# INITRAMFS
if [[ ! $INITRAMFS =~ "/etc/crypttab" ]]; then
NEEDED_INITRAMFS="$NEEDED_INITRAMFS --arg=/etc/crypttab"
fi
if [[ $IMAGE_FLAVOR =~ "nvidia" ]]; then
if [[ ! $INITRAMFS =~ "/etc/modprobe.d/nvidia.conf" ]]; then
NEEDED_INITRAMFS="$NEEDED_INITRAMFS --arg=/etc/modprobe.d/nvidia.conf"
fi
else
if [[ ! $INITRAMFS =~ "/etc/modprobe.d/amdgpu.conf" ]]; then
NEEDED_INITRAMFS="$NEEDED_INITRAMFS --arg=/etc/modprobe.d/amdgpu.conf"
fi
fi
if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegame" ]]; then
if [[ ! $INITRAMFS =~ "/etc/modprobe.d/deck-blacklist.conf" ]]; then
NEEDED_INITRAMFS="$NEEDED_INITRAMFS --arg=/etc/modprobe.d/deck-blacklist.conf"
fi
fi
if [[ -n "$NEEDED_INITRAMFS" ]]; then
echo "Found needed initramfs changes, applying the following: $NEEDED_INITRAMFS"
plymouth display-message --text="Updating initramfs - Please wait, this may take a while" || true
rpm-ostree initramfs --enable --arg=-I ${NEEDED_INITRAMFS}
else
echo "No initramfs changes needed"
fi
# KERNEL ARGUMENTS
if [[ ":Jupiter:" =~ ":$SYS_ID:" ]]; then
@ -44,73 +87,14 @@ if [[ ":Jupiter:" =~ ":$SYS_ID:" ]]; then
if [[ "$(awk '/MemTotal/{print $(NF-1)}' /proc/meminfo)" == "31664740" ]]; then
echo "32GB RAM Steam Deck detected"
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=amdgpu.gttsize=16256"
sed -i 's/zram-size=1024/zram-size=2048/g' /etc/systemd/zram-generator.conf
else
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=amdgpu.gttsize=8128"
fi
fi
if [[ ! $KARGS =~ "spi_amd.speed_dev" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=spi_amd.speed_dev=1"
fi
if [[ ! $KARGS =~ "initcall_blacklist" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=initcall_blacklist=simpledrm_platform_driver_init"
fi
if [[ ! $KARGS =~ "modprobe.blacklist=sp5100_tco" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=modprobe.blacklist=sp5100_tco"
fi
fi
if grep -qz "Kernel driver in use: radeon" <<< $GPU_ID; then
echo "Legacy AMD hardware detected, enabling CIK and SI support in AMDGPU"
if [[ ! $KARGS =~ "radeon.si_support" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=radeon.si_support=0"
fi
if [[ ! $KARGS =~ "radeon.cik_support" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=radeon.cik_support=0"
fi
if [[ ! $KARGS =~ "amdgpu.si_support" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=amdgpu.si_support=1"
fi
if [[ ! $KARGS =~ "amdgpu.cik_support" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=amdgpu.cik_support=1"
fi
fi
if [[ $IMAGE_FLAVOR =~ "nvidia" ]]; then
echo "Checking for needed karg changes (Nvidia)"
if [[ ! $KARGS =~ "rd.driver.blacklist=nouveau" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=rd.driver.blacklist=nouveau"
fi
if [[ ! $KARGS =~ "modprobe.blacklist=nouveau" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=modprobe.blacklist=nouveau"
fi
if [[ ! $KARGS =~ "nvidia-drm.modeset" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --append-if-missing=nvidia-drm.modeset=1"
fi
else
echo "Checking for needed karg changes"
if [[ $KARGS =~ "rd.driver.blacklist=nouveau" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --delete-if-present=rd.driver.blacklist=nouveau"
fi
if [[ $KARGS =~ "modprobe.blacklist=nouveau" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --delete-if-present=modprobe.blacklist=nouveau"
fi
if [[ $KARGS =~ "nvidia-drm.modeset" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --delete-if-present=nvidia-drm.modeset=1"
fi
fi
if [[ $KARGS =~ "nomodeset" ]]; then
@ -118,12 +102,6 @@ if [[ $KARGS =~ "nomodeset" ]]; then
NEEDED_KARGS="$NEEDED_KARGS --delete-if-present=nomodeset"
fi
if [[ $INITRAMFS =~ "disabled" ]]; then
echo "Found needed initramfs changes, applying."
plymouth display-message --text="Updating initramfs - Please wait, this may take a while" || true
rpm-ostree initramfs --enable --arg=-I --arg=/etc/crypttab
fi
if [[ -n "$NEEDED_KARGS" ]]; then
echo "Found needed karg changes, applying the following: $NEEDED_KARGS"
plymouth display-message --text="Updating kargs - Please wait, this may take a while" || true
@ -132,19 +110,6 @@ else
echo "No karg changes needed"
fi
# RUN REMAINDER OF SCRIPT ONLY IF UPDATED
if [[ -f $HWS_VER_FILE && $HWS_VER = $HWS_VER_RAN ]]; then
if [[ -f $KNOWN_IMAGE_NAME_FILE && -f $KNOWN_IMAGE_FLAVOR_FILE ]]; then
if [[ -f $KNOWN_FEDORA_VERSION_FILE && -f $KNOWN_FEDORA_VERSION_FILE ]]; then
# Run script if image has been rebased
if [[ $IMAGE_NAME = $KNOWN_IMAGE_NAME && $IMAGE_FLAVOR = $KNOWN_IMAGE_FLAVOR && $FEDORA_VERSION = $KNOWN_FEDORA_VERSION ]]; then
echo "Hardware setup has already run. Exiting..."
exit 0
fi
fi
fi
fi
if [[ $IMAGE_NAME =~ "deck" || $IMAGE_NAME =~ "ally" || $IMAGE_NAME =~ "framegame" ]]; then
if [[ ":Jupiter:" =~ ":$SYS_ID:" ]]; then
# Future updates to Deck on Jupiter here
@ -187,6 +152,7 @@ if (( $(hostname | wc -m) > 16 )); then
hostnamectl set-hostname bazzite
fi
mkdir -p /etc/bazzite
echo $HWS_VER > $HWS_VER_FILE
echo $IMAGE_NAME > $KNOWN_IMAGE_NAME_FILE
echo $IMAGE_FLAVOR > $KNOWN_IMAGE_FLAVOR_FILE

View File

@ -7,7 +7,7 @@ FEDORA_VERSION=$(jq -r '."fedora-version"' < $IMAGE_INFO)
SYS_ID="$(cat /sys/devices/virtual/dmi/id/product_name)"
# SCRIPT VERSION
USER_SETUP_VER=9
USER_SETUP_VER=10
USER_SETUP_VER_FILE="$HOME/.bazzite-configured"
USER_SETUP_VER_RAN=$(cat $USER_SETUP_VER_FILE)
USER_SETUP_FEDORA_VER_FILE="$HOME/.bazzite-configured-fedora-version"

View File

@ -0,0 +1,5 @@
# Use Vulkan driver for AMD GCN 1.0 & GCN 2.0 GPUs (HD 7000-8000 series)
options amdgpu si_support=1
options amdgpu cik_support=1
options radeon si_support=0
options radeon cik_support=0

View File

@ -0,0 +1,6 @@
# Blacklist Nouveau
blacklist nouveau
options nouveau modeset=0
# Enable Nvidia Modeset
options nvidia-drm modeset=1