From f91b7abb04e4988ffd2ac244a7c4a71c92cea9d3 Mon Sep 17 00:00:00 2001 From: Daniel Cerna Date: Fri, 11 Aug 2023 17:08:36 -0600 Subject: [PATCH] [debian12] Adding nvidia driver This PR adds the required things in order to include the nvidia-driver with the smallest footprint possible --- software-modules/base/02-firmware/firmware.sh | 4 ++ .../base/02-firmware/nvidia/dkms-deps.txt | 29 ++++++++++++ .../nvidia/install-nvidia-drivers.sh | 45 +++++++++++++++++++ .../base/02-firmware/nvidia/nvidia-deps.txt | 37 +++++++++++++++ .../base/02-firmware/nvidia/prepare-kernel.sh | 26 +++++++++++ .../base/03-budgie/dependencies.txt | 17 ++++++- 6 files changed, 156 insertions(+), 2 deletions(-) create mode 100644 software-modules/base/02-firmware/nvidia/dkms-deps.txt create mode 100755 software-modules/base/02-firmware/nvidia/install-nvidia-drivers.sh create mode 100644 software-modules/base/02-firmware/nvidia/nvidia-deps.txt create mode 100755 software-modules/base/02-firmware/nvidia/prepare-kernel.sh diff --git a/software-modules/base/02-firmware/firmware.sh b/software-modules/base/02-firmware/firmware.sh index 2a00dfcd..54eb242e 100755 --- a/software-modules/base/02-firmware/firmware.sh +++ b/software-modules/base/02-firmware/firmware.sh @@ -25,5 +25,9 @@ apt update apt install --yes --no-install-recommends "${DEPENDENCIES[@]}" apt autoremove --yes --purge +## Install the nvidia drivers +cd nvidia +./install-nvidia-drivers.sh + savechanges /tmp/02-firmware.hsl cp /tmp/02-firmware.hsl /run/initramfs/memory/system/huronOS/base --verbose diff --git a/software-modules/base/02-firmware/nvidia/dkms-deps.txt b/software-modules/base/02-firmware/nvidia/dkms-deps.txt new file mode 100644 index 00000000..69653c28 --- /dev/null +++ b/software-modules/base/02-firmware/nvidia/dkms-deps.txt @@ -0,0 +1,29 @@ +binutils +binutils-common +binutils-x86-64-linux-gnu +cpp +cpp-12 +dpkg-dev +dkms +gcc +gcc-12 +libasan8 +libatomic1 +libbinutils +libcc1-0 +libctf-nobfd0 +libctf0 +libdpkg-perl +libgcc-12-dev +libgprofng0 +libisl23 +libitm1 +liblsan0 +libmpc3 +libmpfr6 +libquadmath0 +libtsan2 +libubsan1 +lsb-release +make +patch diff --git a/software-modules/base/02-firmware/nvidia/install-nvidia-drivers.sh b/software-modules/base/02-firmware/nvidia/install-nvidia-drivers.sh new file mode 100755 index 00000000..38a41910 --- /dev/null +++ b/software-modules/base/02-firmware/nvidia/install-nvidia-drivers.sh @@ -0,0 +1,45 @@ +#!/bin/bash +set -xe +mapfile -t DKMS_DEPS < dkms-deps.txt +mapfile -t NVIDIA_DEPS < nvidia-deps.txt +DEB_NAME="nvidia-kernel-dkms_525.105.17-1_amd64" +#@DEB_NAME="nvidia-kernel-dkms_470.182.03-1_amd64" +OG_DEB="$DEB_NAME.deb" +PATCHED_DEB="$DEB_NAME-patched.deb" +LAB_FOLDER="/tmp/deb-lab-$$" +EXTRACTED_DEB="$LAB_FOLDER/tmp-deb" +mkdir -p "$LAB_FOLDER" +cd "$LAB_FOLDER" +######################## +#### Prepare nvidia-DKMS +#### INSTALLING AND REMOVING DEPENDENCY +######################## +apt download nvidia-kernel-dkms +mkdir -p "$EXTRACTED_DEB" +dpkg-deb -R "$OG_DEB" "$EXTRACTED_DEB" +## Disable autoremove of dkms module on package removal +echo '#!/bin/bash' > "$EXTRACTED_DEB/DEBIAN/prerm" +# Remove dependency on dkms +sed -i 's|, dkms (>= 3.0.3-4~)||' "$EXTRACTED_DEB/DEBIAN/control" +## Repack patched deb +dpkg-deb -b "$EXTRACTED_DEB" "$PATCHED_DEB" +#rm -r "$LAB_FOLDER" +#rm "$DEB_NAME.deb" + +###################### +#### Install dkms deps +###################### +apt install --yes --no-install-recommends "${DKMS_DEPS[@]}" pahole +######################## +#### Install nvidia deps +######################## +apt install --yes --no-install-recommends "./$DEB_NAME-patched.deb" "${NVIDIA_DEPS[@]}" +#rm "$DEB_NAME-patched.deb" + +###################### +#### Remove dkms deps +###################### +apt remove --yes "${DKMS_DEPS[@]}" pahole nvidia-kernel-dkms +apt autoremove --yes + +# savechanges /run/initramfs/memory/system/huronOS/base/02-firmware-nvidia.hsl diff --git a/software-modules/base/02-firmware/nvidia/nvidia-deps.txt b/software-modules/base/02-firmware/nvidia/nvidia-deps.txt new file mode 100644 index 00000000..3ac5de52 --- /dev/null +++ b/software-modules/base/02-firmware/nvidia/nvidia-deps.txt @@ -0,0 +1,37 @@ +firmware-nvidia-gsp +glx-alternative-mesa +glx-alternative-nvidia +glx-diversions +libegl-nvidia0 +libepoxy0 +libfontenc1 +libgl1-nvidia-glvnd-glx +libglx-nvidia0 +libnvidia-egl-wayland1 +libnvidia-eglcore +libnvidia-glcore +libnvidia-ml1 +libxaw7 +libxcvt0 +libxfont2 +libxkbfile1 +libxmu6 +libxpm4 +libxrandr2 +libxt6 +nvidia-alternative +nvidia-driver-bin +nvidia-driver-libs +nvidia-egl-common +nvidia-egl-icd +nvidia-installer-cleanup +nvidia-kernel-common +nvidia-kernel-support +nvidia-legacy-check +nvidia-modprobe +nvidia-support +nvidia-vdpau-driver +update-glx +x11-xkb-utils +xserver-common +xserver-xorg-core diff --git a/software-modules/base/02-firmware/nvidia/prepare-kernel.sh b/software-modules/base/02-firmware/nvidia/prepare-kernel.sh new file mode 100755 index 00000000..0954ca81 --- /dev/null +++ b/software-modules/base/02-firmware/nvidia/prepare-kernel.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# nvidia-non-free.sh +# Script to build the in-between firmware huronOS System Layer (.hsl) +# for huronOS image. It packs the propietary nvidia drivers +# for a more stable experience of the distribution. +# +# Copyright (C) 2022, huronOS Project: +# +# +# Licensed under the GNU GPL Version 2 +# +# +# Authors: +# Enya Quetzalli + +set -xe + +KERNEL_HEADERS_BASE="/usr/lib/modules/$(uname -r)" + +LINUX_PATH="/mnt/ubuntu/home/dt3264/huronOS/kernel-stuff-6.1.31/linux" + +# Link the kernel source to where the headers should be +mkdir -p "$KERNEL_HEADERS_BASE" +ln -vnfs "$LINUX_PATH" "$KERNEL_HEADERS_BASE/build" +ln -vnfs "$LINUX_PATH" "$KERNEL_HEADERS_BASE/source" diff --git a/software-modules/base/03-budgie/dependencies.txt b/software-modules/base/03-budgie/dependencies.txt index face115c..51eacee8 100644 --- a/software-modules/base/03-budgie/dependencies.txt +++ b/software-modules/base/03-budgie/dependencies.txt @@ -1,7 +1,7 @@ apparmor +budgie-countdown-applet budgie-desktop budgie-desktop-view -budgie-countdown-applet budgie-extras-daemon connman-gtk dconf-cli @@ -11,21 +11,34 @@ gnome-calendar gnome-terminal gnome-themes-extra libdrm-intel1 +libepoxy0 +libfontenc1 libgl1-mesa-dri libglib2.0-bin libglu1-mesa +libxaw7 +libxcvt0 +libxfont2 +libxkbfile1 +libxmu6 +libxpm4 +libxrandr2 +libxt6 lightdm moka-icon-theme nautilus nautilus-extension-gnome-terminal okular plank -x11-xserver-utils x11-utils +x11-xkb-utils +x11-xserver-utils xdg-user-dirs xinit xinput +xserver-common xserver-xorg +xserver-xorg-core xserver-xorg-input-all xserver-xorg-video-amdgpu xserver-xorg-video-ati