From f9f92f216a7605c81a34c7df0723cbd9670c39d8 Mon Sep 17 00:00:00 2001 From: Eric Hameleers Date: Thu, 30 Apr 2020 22:34:02 +0200 Subject: Add a sample script to create a nvidia squashfs module from packages --- contrib/scripts/makemod_nvidia | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 contrib/scripts/makemod_nvidia (limited to 'contrib') diff --git a/contrib/scripts/makemod_nvidia b/contrib/scripts/makemod_nvidia new file mode 100644 index 0000000..508b299 --- /dev/null +++ b/contrib/scripts/makemod_nvidia @@ -0,0 +1,45 @@ +#!/bin/sh + +MAKEMOD=${MAKEMOD:-"/usr/local/sbin/makemod"} +SLACKARCH=${SLACKARCH:-"x86_64"} +SLACKVER=${SLACKVER:-"current"} + +TEMPDIR=$(mktemp -d -t alienmod.XXXXXX) +if [ ! -d ${TEMPDIR} ]; then + echo "**Failed to create temporary directory for installation of packages!" + exit 1 +fi + +# Install the nvidia-kernel and nvidia driver packages which were passed +# as arguments to the commandline: +for PKG in $* ; do + /sbin/installpkg -root ${TEMPDIR} ${PKG} +done + +# Prevent loading of the kernel's 'nouveau' driver: +mkdir -p ${TEMPDIR}/etc/modprobe.d +cat < ${TEMPDIR}/etc/modprobe.d/BLACKLIST-nouveau.conf +# Do not load the kernel nouveau dri module, since it interferes with both +# the nv and binary nvidia drivers. +blacklist nouveau +EOT + +STAMP=$(ls ${TEMPDIR}/var/log/packages/nvidia-kernel-* |rev |cut -d- -f3 |rev) +PKGVER=$(echo $STAMP |cut -d_ -f1) +PKGMAJ=$(echo $PKGVER |cut -d. -f1) +KVER=$(echo $STAMP |cut -d_ -f2) + +# Generate the squashfs module: +${MAKEMOD} ${TEMPDIR} /tmp/0060-nvidia-${STAMP}-${SLACKVER}-${SLACKARCH}.sxz + +# Generate list of PCI IDS for supported GPUs, sed magic taken from +# https://anonscm.debian.org/viewvc/pkg-nvidia/packages/nvidia-graphics-drivers/trunk/debian/rules?view=markup : +sed \ + -e '0,/A. Supported\|APPENDIX A: SUPPORTED/d' \ + -e '0,/Appendix A. Supported\|APPENDIX A: SUPPORTED/d' \ + -e '0,/^Below\|APPENDIX B/{/ 0x/s/.* 0x\([0-9a-fA-F]\{4\}\).*/10de\1/p; /^.\{41\} [0-9a-fA-F]\{4\} /s/^.\{41\} \([0-9a-fA-F]\{4\}\) .*/10de\1/p};d' \ + ${TEMPDIR}/usr/doc/nvidia-driver-*/README.txt \ + | tr 'a-f' 'A-F' | sort -u \ + > /tmp/nvidia-${PKGMAJ}xx.ids + +rm -r ${TEMPDIR} -- cgit v1.2.3