Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debian12] Adding nvidia driver #135

Draft
wants to merge 5 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions base-system/deps-dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gddrescue
genisoimage
gpart
netcat
netcat-openbsd
smartmontools
unzip
zip
zip
12 changes: 6 additions & 6 deletions base-system/usrroot/etc/apt/sources.list
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
12 changes: 6 additions & 6 deletions builder-scripts/kernel/sources.list
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
deb http://deb.debian.org/debian/ bullseye main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
deb-src http://security.debian.org/debian-security bullseye-security main contrib non-free
deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb-src http://deb.debian.org/debian/ bullseye-updates main contrib non-free
deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
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"
3 changes: 1 addition & 2 deletions system-layers/02-firmware/dependencies.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ firmware-bnx2x
firmware-brcm80211
firmware-cavium
firmware-intel-sound
firmware-intelwimax
firmware-ipw2x00
firmware-ivtv
firmware-iwlwifi
Expand Down Expand Up @@ -46,4 +45,4 @@ pulseaudio-module-gsettings
sigrok-firmware-fx2lafw
ubertooth-firmware
vulkan-tools
vulkan-validationlayers:amd64
vulkan-validationlayers:amd64
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
70 changes: 28 additions & 42 deletions system-layers/03-budgie/budgie.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,6 @@ rm -rf /usr/share/lightdm/*
rm -rf /usr/share/images/desktop-base/*
rm /usr/share/xsessions/budgie-desktop.desktop

## Replace debian logo branding with huronOS
rm -rf /usr/share/wallpapers/
rm -rf /usr/share/icons/desktop-base/*
rm -rf /usr/share/desktop-base/
rm -rf /usr/share/plymouth/
rm -rf /usr/share/pixmaps/debian*
cp -rf files/vendor/* /usr/share/icons/desktop-base
ln -sf /usr/share/icons/desktop-base/scalable/emblems/emblem-huronos.svg /etc/alternatives/emblem-vendor-scalable
ln -sf /usr/share/icons/desktop-base/scalable/emblems/emblem-huronos-symbolic.svg /etc/alternatives/emblem-vendor-symbolic-scalable
ln -sf /usr/share/icons/desktop-base/scalable/emblems/emblem-huronos-white.svg /etc/alternatives/emblem-vendor-white-scalable
ln -sf /usr/share/icons/desktop-base/64/emblems/emblem-huronos.png /etc/alternatives/emblem-vendor-64
ln -sf /usr/share/icons/desktop-base/64/emblems/emblem-huronos-symbolic.png /etc/alternatives/emblem-vendor-symbolic-64
ln -sf /usr/share/icons/desktop-base/64/emblems/emblem-huronos-white.png /etc/alternatives/emblem-vendor-white-64
ln -sf /usr/share/icons/desktop-base/128/emblems/emblem-huronos.png /etc/alternatives/emblem-vendor-128
ln -sf /usr/share/icons/desktop-base/128/emblems/emblem-huronos-symbolic.png /etc/alternatives/emblem-vendor-symbolic-128
ln -sf /usr/share/icons/desktop-base/128/emblems/emblem-huronos-white.png /etc/alternatives/emblem-vendor-white-128
ln -sf /usr/share/icons/desktop-base/256/emblems/emblem-huronos.png /etc/alternatives/emblem-vendor-256
ln -sf /usr/share/icons/desktop-base/256/emblems/emblem-huronos-symbolic.png /etc/alternatives/emblem-vendor-symbolic-256
ln -sf /usr/share/icons/desktop-base/256/emblems/emblem-huronos-white.png /etc/alternatives/emblem-vendor-white-256

## Fix terminals not updating $PATH on su
echo "ALWAYS_SET_PATH yes" >>/etc/login.defs

Expand All @@ -63,26 +43,27 @@ sed -i 's/#autologin-user=.*/autologin-user=contestant/g' /etc/lightdm/lightdm.c
sed -i 's/#autologin-user-timeout=.*/autologin-user-timeout=0/g' /etc/lightdm/lightdm.conf

## Set budgie background
mkdir -p /usr/share/backgrounds/
cp files/huronos-background.png /usr/share/backgrounds/huronos-background.png
cp files/huronos-background.png /usr/share/backgrounds/budgie/default.jpg
cp files/huronos-lightdm.png /usr/share/backgrounds/huronos-lightdm.png
chmod 644 /usr/share/backgrounds/huronos*
echo "background=/usr/share/backgrounds/huronos-lightdm.png" >>/etc/lightdm/lightdm-gtk-greeter.conf

## Set budgie menu configs
## Prepare budgie menu configs
cp files/huronOS-desktop-config.dump /tmp/huronOS-desktop-config.dump
chmod 777 /tmp/huronOS-desktop-config.dump
cp files/gnome-applications.menu /etc/xdg/menus/gnome-applications.menu
rm /usr/share/desktop-directories/* -rf
cp files/directories/* /usr/share/desktop-directories/
## This section below doesn't work
#cp files/gnome-applications.menu /etc/xdg/menus/gnome-applications.menu
#rm /usr/share/desktop-directories/* -rf
#mkdir -p /usr/share/desktop-directories
#cp files/directories/* /usr/share/desktop-directories/
rfkill unblock bluetooth

## Set .desktop launchers
mkdir -p /tmp/save/
cp files/nano.svg /usr/share/icons/hicolor/scalable/apps/
cp /usr/share/applications/gnome-*-panel.desktop /tmp/save/
cp /usr/share/applications/budgie-*.desktop /tmp/save/
cp /usr/share/applications/gnome-control-center.desktop /tmp/save/
cp /usr/share/applications/budgie-*-panel.desktop /tmp/save/
cp /usr/share/applications/org.buddiesofbudgie.*.desktop /tmp/save/
cp /usr/share/applications/budgie-control-center.desktop /tmp/save/
cp /usr/share/applications/org.gnome.Calendar.desktop /tmp/save/
cp /usr/share/applications/org.gnome.Nautilus.desktop /tmp/save/
cp /usr/share/applications/org.gnome.Terminal.desktop /tmp/save/
Expand All @@ -92,31 +73,27 @@ cp /tmp/save/* /usr/share/applications/
rm -rf /tmp/save

## Replace nm-applet with connman-gtk
sed -i 's/Exec=.*$/Exec=connman-gtk --tray/g' /etc/xdg/autostart/budgie-desktop-nm-applet.desktop
sed -i 's/TryExec=.*$/TryExec=connman-gtk/g' /etc/xdg/autostart/budgie-desktop-nm-applet.desktop
mv /etc/xdg/autostart/budgie-desktop-nm-applet.desktop /etc/xdg/autostart/budgie-desktop-connman-applet.desktop
sed -i 's/Exec=.*$/Exec=connman-gtk --tray/g' /etc/xdg/autostart/org.buddiesofbudgie.BudgieDesktopNmApplet.desktop
sed -i 's/TryExec=.*$/TryExec=connman-gtk/g' /etc/xdg/autostart/org.buddiesofbudgie.BudgieDesktopNmApplet.desktop
mv /etc/xdg/autostart/org.buddiesofbudgie.BudgieDesktopNmApplet.desktop /etc/xdg/autostart/budgie-desktop-connman-applet.desktop
rm -f /etc/xdg/autostart/nm-applet.desktop

## Add our own default mime apps
rm -rf /usr/share/applications/gnome-mimeapps.list
ln -s /etc/xdg/mimeapps.list /usr/share/applications/mimeapps.list

## Set Budgie as default desktop
sed -i 's/Name=.*/Name=Budgie/g' /usr/share/xsessions/lightdm-xsession.desktop
sed -i 's/Exec=.*/Exec=budgie-desktop/g' /usr/share/xsessions/lightdm-xsession.desktop
echo "DesktopNames=Budgie;GNOME" >>/usr/share/xsessions/lightdm-xsession-desktop
sed -i 's|Name=.*|Name=Budgie|g' /usr/share/xsessions/lightdm-xsession.desktop
sed -i 's|Exec=.*|Exec=/usr/bin/budgie-desktop|g' /usr/share/xsessions/lightdm-xsession.desktop
echo "DesktopNames=Budgie;GNOME" >>/usr/share/xsessions/lightdm-xsession.desktop

## Set default dconf settings
## Prepare plank settings
cp files/huronOS-plank-config.dump /tmp/huronOS-plank-config.dump
chmod 777 /tmp/huronOS-plank-config.dump
mkdir -p /etc/dconf/
cp -rf files/dconf/* /etc/dconf/
chmod -R 755 /etc/dconf/
dconf update

## Create user for contest with no password for login
useradd -m -s /bin/bash contestant
sed -i 's/contestant:x:/contestant::/g' /etc/passwd
mkdir -p /home/contestant/.config/JetBrains
chown -R contestant:contestant /home/contestant/

## Activate services
Expand All @@ -138,8 +115,12 @@ rm /usr/lib/udev/rules.d/*udisks2*.rules

## Compile schemas to include connman-gtk
glib-compile-schemas /usr/share/glib-2.0/schemas/

systemctl daemon-reload

## TODO: Check why systemd is not allowing to enable directly the service
systemctl disable lightdm.service
systemctl disable hsync.timer
systemctl disable ipman.service
systemctl enable lightdm.service
systemctl enable hsync.timer
systemctl enable ipman.service
Expand All @@ -148,6 +129,11 @@ systemctl enable ipman.service
cp -f "files/plankrm" "/usr/local/bin/plankrm"
chmod +x "/usr/local/bin/plankrm"

# Copy autostart files
cp -f setup-desktop.sh /tmp/setup-desktop.sh
mkdir -p /tmp/files/autostart
cp -f -r files/autostart/* /tmp/files/autostart

## Launch lightdm to configure desktops
systemctl start lightdm.service
echo "Waiting to lightdm to start"
Expand Down
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
Loading