Skip to content

Commit

Permalink
[debian12] Adding nvidia driver
Browse files Browse the repository at this point in the history
This PR adds the required things in order to include the nvidia-driver with the smallest footprint possible
  • Loading branch information
DT3264 authored and equetzal committed Jul 26, 2024
1 parent 6c7b5ca commit 7e2a66c
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 2 deletions.
29 changes: 29 additions & 0 deletions software-modules/base/02-firmware/nvidia/dkms-deps.txt
Original file line number Diff line number Diff line change
@@ -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
45 changes: 45 additions & 0 deletions software-modules/base/02-firmware/nvidia/install-nvidia-drivers.sh
Original file line number Diff line number Diff line change
@@ -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
37 changes: 37 additions & 0 deletions software-modules/base/02-firmware/nvidia/nvidia-deps.txt
Original file line number Diff line number Diff line change
@@ -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
26 changes: 26 additions & 0 deletions software-modules/base/02-firmware/nvidia/prepare-kernel.sh
Original file line number Diff line number Diff line change
@@ -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:
# <http://huronos.org>
#
# Licensed under the GNU GPL Version 2
# <http://www.gnu.org/licenses/gpl-2.0.html>
#
# Authors:
# Enya Quetzalli <equetzal@huronos.org>

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"
4 changes: 4 additions & 0 deletions system-layers/02-firmware/firmware.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,9 @@ export DEBIAN_FRONTEND=noninteractive
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
17 changes: 15 additions & 2 deletions system-layers/03-budgie/dependencies.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apparmor
budgie-countdown-applet
budgie-desktop
budgie-desktop-view
budgie-countdown-applet
budgie-extras-daemon
connman-gtk
dconf-cli
Expand All @@ -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
Expand Down

0 comments on commit 7e2a66c

Please sign in to comment.