From a7559cf15811737c71ff2dd3e6c2a0c709c6cd12 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Thu, 20 Feb 2014 15:38:54 +0100 Subject: [nvidia_libs] Module building libraries for nvidia GPU driver package. --- remote/modules/nvidia_libs/nvidia_libs.build | 120 +++++++++++++++++++++ remote/modules/nvidia_libs/nvidia_libs.conf | 25 +++++ remote/modules/nvidia_libs/nvidia_libs.conf.ubuntu | 10 ++ 3 files changed, 155 insertions(+) create mode 100644 remote/modules/nvidia_libs/nvidia_libs.build create mode 100644 remote/modules/nvidia_libs/nvidia_libs.conf create mode 100644 remote/modules/nvidia_libs/nvidia_libs.conf.ubuntu (limited to 'remote/modules/nvidia_libs') diff --git a/remote/modules/nvidia_libs/nvidia_libs.build b/remote/modules/nvidia_libs/nvidia_libs.build new file mode 100644 index 00000000..4c8d68bc --- /dev/null +++ b/remote/modules/nvidia_libs/nvidia_libs.build @@ -0,0 +1,120 @@ +fetch_source() { + mkdir -p src 2>/dev/null + cd src || perror "Could not change into src directory." + download "$REQUIRED_URL" +} + +build() { + local KERNELSRCDIR="$MODULE_DIR/../kernel/ksrc" # kernel sources + local TEMPDIR="$MODULE_DIR/temp" + local ROOTLOWERDIR="/" + local ROOTUPPERDIR="$MODULE_DIR/build" + local ROOTBINDDIR="$TEMPDIR/rootbind" + local ROOTMOUNTDIR="$TEMPDIR/rootmount" + local BINDMOUNTS="/dev /proc /run /sys" + local NVIDIA="$MODULE_DIR/src/$REQUIRED_NVIDIA" + local NVIDIAEXTRACTDIR="$ROOTMOUNTDIR/NVIDIA" + local NVEXTRACTDIR="/NVIDIA" # This is relative to the chroot. + + make_dirs () { + [ -d "$TEMPDIR" ] && rm -rf "$TEMPDIR" + mkdir -p "$TEMPDIR" || perror "Could not create base directory for mount directories $TEMPDIR." + for DIR in "$ROOTBINDDIR" "$ROOTMOUNTDIR"; do + mkdir -p "$DIR" || perror "Could not create directory for mount directory $DIR." + done + } + + mount_dirs () { + pinfo "Executing bind- and overlay mounts ..." + mount -o bind "$ROOTLOWERDIR" "$ROOTBINDDIR" || perror "Could not mount (bind) $ROOTLOWERDIR to $ROOTBINDDIR." + mount -o remount,ro "$ROOTBINDDIR" || perror "Could not remount $ROOTBINDDIR ro read-only." + mount -t overlayfs overlayfs -o lowerdir="$ROOTBINDDIR",upperdir="$ROOTUPPERDIR" "$ROOTMOUNTDIR" \ + || perror "Could not mount (overlayfs) $ROOTLOWERDIR, $ROOTUPPERDIR to $BINDDIR." + pinfo "Executing bind mounts ($BINDMOUNTS) for chroot root dir ..." + for MOUNT in $BINDMOUNTS; do + mount -o bind "$MOUNT" "$ROOTMOUNTDIR/$MOUNT" || perror "Could not mount (bind) $MOUNTS into chroot root dir." + done + } + + # We inject a bashrc to be executed later within the chroot. + gen_bashrc () { + local COMMON_OPTIONS=' --no-nouveau-check --no-network --no-backup --no-rpms --no-runlevel-check --no-distro-scripts --no-cc-version-check --no-x-check --no-precompiled-interface --silent ' + + cat >"$ROOTMOUNTDIR/$HOME/.bashrc"<<-EOF + echo "chroot successful." + alias ll='ls -alF' # A little convenience for debugging purposes. + PS1='\[\e[1;33m\]chroot@\h:\w\$ \[\e[1;32m\]' # To recognize the chroot instantly when debugging (yellow on black). + cd "$NVEXTRACTDIR" + ./nvidia-installer $COMMON_OPTIONS --no-kernel-module # Do the work! + exit # Out-comment this for debugging: Then script stays in chroot. +EOF + } + + unpack_nvidia () { + [ -d "$NVIDIAEXTRACTDIR" ] && rm -rf "$NVIDIAEXTRACTDIR" + pinfo "Unpacking NVidia archive ($NVIDIA) ..." + sh "$NVIDIA" --extract-only --target "$NVIDIAEXTRACTDIR" || perror "Could not extract $NVIDIA to $NVIDIAEXTRACTDIR." + } + + umount_dirs () { + # Let's tidy the place, or at least the mounts: Otherwise these would stack up, and we do not like that, don't we. + for MOUNT in $BINDMOUNTS; do + umount "$ROOTMOUNTDIR/$MOUNT" || pwarning "Could not unmount $ROOTMOUNTDIR/$MOUNT!" + done + umount "$ROOTMOUNTDIR" || pwarning "Could not unmount $ROOTMOUNTDIR!" + umount "$ROOTBINDDIR" || pwarning "Could not unmount $ROOTBINDDIR!" + } + + clean_whiteouts () { + # The case of these overlay whiteouts should be investigated instead of just killing them. But for now... + pdebug "Searching for overlayfs-whiteouts ..." + for WHITEOUT in $(find "$MODULE_DIR/build" -lname "(overlay-whiteout)"); do + pdebug "Whiteout found: $WHITEOUT" + rm -f "$WHITEOUT" || perror "Could not delete whiteout $WHITEOUT!" + done + } + + clean_temp () { + rm -rf "$TEMPDIR" || perror "Could not clean/delete temp directory $TEMPDIR." + } + + # Main stuff + pinfo "Generating temporary directories ..." + make_dirs + pinfo "Mounting directories ..." + mount_dirs + + pinfo "Injecting .bashrc into later chroot ..." + gen_bashrc + + pinfo "Unpacking NVidia-Installer ..." + unpack_nvidia + + pinfo "Ready to chroot - compiling may take some time." + pdebug "--- chroot ---------------------------------------------------------------------" + pdebug "- -" + pdebug "- Notice: This may take a while! -" + pdebug "- -" + pdebug "- Please keep note the Nvidia installer _will_ complain about -" + pdebug "- several warnings and errors. It will do this in any case. -" + pdebug "- -" + pdebug "- This does _not_ mean the kernel module compilation was unsuccessful! -" + pdebug "- -" + pdebug "--------------------------------------------------------------------------------" + chroot "$ROOTMOUNTDIR" + pinfo "chroot terminated." + + pinfo "Unmount directories ..." + umount_dirs + + pinfo "Cleaning whiteouts ..." + clean_whiteouts + + pinfo "Cleaning / deleting temp directories." + clean_temp +} + +post_copy() { + : +} + diff --git a/remote/modules/nvidia_libs/nvidia_libs.conf b/remote/modules/nvidia_libs/nvidia_libs.conf new file mode 100644 index 00000000..0ef76cc3 --- /dev/null +++ b/remote/modules/nvidia_libs/nvidia_libs.conf @@ -0,0 +1,25 @@ +REQUIRED_VERSION="331.38" +REQUIRED_NVIDIA="NVIDIA-Linux-x86_64-$REQUIRED_VERSION.run" +REQUIRED_URL="http://download.nvidia.com/XFree86/Linux-x86_64/$REQUIRED_VERSION/$REQUIRED_NVIDIA" + +REQUIRED_FILES=" + /etc/OpenCL/vendors/nvidia.icd + /usr/share/nvidia/nvidia-application-profiles-331.38-rc + /usr/share/applications/nvidia-settings.desktop +" + +REQUIRED_DIRECTORIES=" + /usr/bin + /usr/lib + /usr/lib/vdpau + /usr/lib/xorg + /usr/lib/xorg/modules + /usr/lib/xorg/modules/drivers + /usr/lib/xorg/modules/extensions + /usr/lib/tls + /usr/lib/x86_64-linux-gnu + /usr/lib/x86_64-linux-gnu/mesa + /usr/lib32 + /usr/lib32/vdpau + +" diff --git a/remote/modules/nvidia_libs/nvidia_libs.conf.ubuntu b/remote/modules/nvidia_libs/nvidia_libs.conf.ubuntu new file mode 100644 index 00000000..1eccb199 --- /dev/null +++ b/remote/modules/nvidia_libs/nvidia_libs.conf.ubuntu @@ -0,0 +1,10 @@ +# libvdpau: While nvidia delivers a linvdpau within it's driver package, nvidia +# itself recommends using a distribution package if available. So, here we go. + +REQUIRED_CONTENT_PACKAGES=" + libvdpau1 +" + +REQUIRED_INSTALLED_PACKAGES=" + libvdpau1 +" -- cgit v1.2.3-55-g7522 From c4756f786d74fb6c3ba606a3ed80887cbbeb5c47 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Thu, 20 Feb 2014 18:30:29 +0100 Subject: [nvidia_libs] Debug: Checkin für Joey:). --- remote/modules/nvidia_libs/nvidia_libs.build | 3 ++- remote/modules/nvidia_libs/nvidia_libs.conf | 40 +++++++++++++++------------- 2 files changed, 24 insertions(+), 19 deletions(-) (limited to 'remote/modules/nvidia_libs') diff --git a/remote/modules/nvidia_libs/nvidia_libs.build b/remote/modules/nvidia_libs/nvidia_libs.build index 4c8d68bc..9dd4c0e2 100644 --- a/remote/modules/nvidia_libs/nvidia_libs.build +++ b/remote/modules/nvidia_libs/nvidia_libs.build @@ -76,6 +76,7 @@ EOF clean_temp () { rm -rf "$TEMPDIR" || perror "Could not clean/delete temp directory $TEMPDIR." + rm -rf "$ROOTUPPERDIR/NVIDIA" } # Main stuff @@ -98,7 +99,7 @@ EOF pdebug "- Please keep note the Nvidia installer _will_ complain about -" pdebug "- several warnings and errors. It will do this in any case. -" pdebug "- -" - pdebug "- This does _not_ mean the kernel module compilation was unsuccessful! -" + pdebug "- This does _not_ mean the library module compilation was unsuccessful! -" pdebug "- -" pdebug "--------------------------------------------------------------------------------" chroot "$ROOTMOUNTDIR" diff --git a/remote/modules/nvidia_libs/nvidia_libs.conf b/remote/modules/nvidia_libs/nvidia_libs.conf index 0ef76cc3..faec87ec 100644 --- a/remote/modules/nvidia_libs/nvidia_libs.conf +++ b/remote/modules/nvidia_libs/nvidia_libs.conf @@ -2,24 +2,28 @@ REQUIRED_VERSION="331.38" REQUIRED_NVIDIA="NVIDIA-Linux-x86_64-$REQUIRED_VERSION.run" REQUIRED_URL="http://download.nvidia.com/XFree86/Linux-x86_64/$REQUIRED_VERSION/$REQUIRED_NVIDIA" -REQUIRED_FILES=" - /etc/OpenCL/vendors/nvidia.icd - /usr/share/nvidia/nvidia-application-profiles-331.38-rc - /usr/share/applications/nvidia-settings.desktop -" +#REQUIRED_FILES=" +# /etc/OpenCL/vendors/nvidia.icd +# /usr/share/nvidia/nvidia-application-profiles-331.38-rc +# /usr/share/applications/nvidia-settings.desktop +#" -REQUIRED_DIRECTORIES=" - /usr/bin - /usr/lib - /usr/lib/vdpau - /usr/lib/xorg - /usr/lib/xorg/modules - /usr/lib/xorg/modules/drivers - /usr/lib/xorg/modules/extensions - /usr/lib/tls - /usr/lib/x86_64-linux-gnu - /usr/lib/x86_64-linux-gnu/mesa - /usr/lib32 - /usr/lib32/vdpau +#REQUIRED_DIRECTORIES=" +# /usr/bin +# /usr/lib +# /usr/lib/vdpau +# /usr/lib/xorg +# /usr/lib/xorg/modules +# /usr/lib/xorg/modules/drivers +# /usr/lib/xorg/modules/extensions +# /usr/lib/tls +# /usr/lib/x86_64-linux-gnu +# /usr/lib/x86_64-linux-gnu/mesa +# /usr/lib32 +# /usr/lib32/vdpau +# +#" +REQUIRED_DIRECTORIES=" + / " -- cgit v1.2.3-55-g7522 From 672d6dacea77c60b787a57499e2a4965ecc4a15d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 24 Feb 2014 11:58:58 +0100 Subject: [nvidia_libs] Fix indentation --- remote/modules/nvidia_libs/nvidia_libs.build | 54 ++++++++++++++-------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'remote/modules/nvidia_libs') diff --git a/remote/modules/nvidia_libs/nvidia_libs.build b/remote/modules/nvidia_libs/nvidia_libs.build index 9dd4c0e2..7e4e86c7 100644 --- a/remote/modules/nvidia_libs/nvidia_libs.build +++ b/remote/modules/nvidia_libs/nvidia_libs.build @@ -6,7 +6,7 @@ fetch_source() { build() { local KERNELSRCDIR="$MODULE_DIR/../kernel/ksrc" # kernel sources - local TEMPDIR="$MODULE_DIR/temp" + local TEMPDIR="$MODULE_DIR/temp" local ROOTLOWERDIR="/" local ROOTUPPERDIR="$MODULE_DIR/build" local ROOTBINDDIR="$TEMPDIR/rootbind" @@ -15,7 +15,7 @@ build() { local NVIDIA="$MODULE_DIR/src/$REQUIRED_NVIDIA" local NVIDIAEXTRACTDIR="$ROOTMOUNTDIR/NVIDIA" local NVEXTRACTDIR="/NVIDIA" # This is relative to the chroot. - + make_dirs () { [ -d "$TEMPDIR" ] && rm -rf "$TEMPDIR" mkdir -p "$TEMPDIR" || perror "Could not create base directory for mount directories $TEMPDIR." @@ -23,23 +23,23 @@ build() { mkdir -p "$DIR" || perror "Could not create directory for mount directory $DIR." done } - + mount_dirs () { pinfo "Executing bind- and overlay mounts ..." mount -o bind "$ROOTLOWERDIR" "$ROOTBINDDIR" || perror "Could not mount (bind) $ROOTLOWERDIR to $ROOTBINDDIR." mount -o remount,ro "$ROOTBINDDIR" || perror "Could not remount $ROOTBINDDIR ro read-only." mount -t overlayfs overlayfs -o lowerdir="$ROOTBINDDIR",upperdir="$ROOTUPPERDIR" "$ROOTMOUNTDIR" \ - || perror "Could not mount (overlayfs) $ROOTLOWERDIR, $ROOTUPPERDIR to $BINDDIR." + || perror "Could not mount (overlayfs) $ROOTLOWERDIR, $ROOTUPPERDIR to $BINDDIR." pinfo "Executing bind mounts ($BINDMOUNTS) for chroot root dir ..." for MOUNT in $BINDMOUNTS; do - mount -o bind "$MOUNT" "$ROOTMOUNTDIR/$MOUNT" || perror "Could not mount (bind) $MOUNTS into chroot root dir." + mount -o bind "$MOUNT" "$ROOTMOUNTDIR/$MOUNT" || perror "Could not mount (bind) $MOUNTS into chroot root dir." done } - + # We inject a bashrc to be executed later within the chroot. gen_bashrc () { local COMMON_OPTIONS=' --no-nouveau-check --no-network --no-backup --no-rpms --no-runlevel-check --no-distro-scripts --no-cc-version-check --no-x-check --no-precompiled-interface --silent ' - + cat >"$ROOTMOUNTDIR/$HOME/.bashrc"<<-EOF echo "chroot successful." alias ll='ls -alF' # A little convenience for debugging purposes. @@ -47,24 +47,24 @@ build() { cd "$NVEXTRACTDIR" ./nvidia-installer $COMMON_OPTIONS --no-kernel-module # Do the work! exit # Out-comment this for debugging: Then script stays in chroot. -EOF + EOF } - + unpack_nvidia () { - [ -d "$NVIDIAEXTRACTDIR" ] && rm -rf "$NVIDIAEXTRACTDIR" - pinfo "Unpacking NVidia archive ($NVIDIA) ..." - sh "$NVIDIA" --extract-only --target "$NVIDIAEXTRACTDIR" || perror "Could not extract $NVIDIA to $NVIDIAEXTRACTDIR." + [ -d "$NVIDIAEXTRACTDIR" ] && rm -rf "$NVIDIAEXTRACTDIR" + pinfo "Unpacking NVidia archive ($NVIDIA) ..." + sh "$NVIDIA" --extract-only --target "$NVIDIAEXTRACTDIR" || perror "Could not extract $NVIDIA to $NVIDIAEXTRACTDIR." } - + umount_dirs () { # Let's tidy the place, or at least the mounts: Otherwise these would stack up, and we do not like that, don't we. - for MOUNT in $BINDMOUNTS; do - umount "$ROOTMOUNTDIR/$MOUNT" || pwarning "Could not unmount $ROOTMOUNTDIR/$MOUNT!" - done - umount "$ROOTMOUNTDIR" || pwarning "Could not unmount $ROOTMOUNTDIR!" - umount "$ROOTBINDDIR" || pwarning "Could not unmount $ROOTBINDDIR!" + for MOUNT in $BINDMOUNTS; do + umount "$ROOTMOUNTDIR/$MOUNT" || pwarning "Could not unmount $ROOTMOUNTDIR/$MOUNT!" + done + umount "$ROOTMOUNTDIR" || pwarning "Could not unmount $ROOTMOUNTDIR!" + umount "$ROOTBINDDIR" || pwarning "Could not unmount $ROOTBINDDIR!" } - + clean_whiteouts () { # The case of these overlay whiteouts should be investigated instead of just killing them. But for now... pdebug "Searching for overlayfs-whiteouts ..." @@ -73,24 +73,24 @@ EOF rm -f "$WHITEOUT" || perror "Could not delete whiteout $WHITEOUT!" done } - + clean_temp () { rm -rf "$TEMPDIR" || perror "Could not clean/delete temp directory $TEMPDIR." rm -rf "$ROOTUPPERDIR/NVIDIA" } - + # Main stuff pinfo "Generating temporary directories ..." make_dirs pinfo "Mounting directories ..." mount_dirs - + pinfo "Injecting .bashrc into later chroot ..." gen_bashrc - + pinfo "Unpacking NVidia-Installer ..." unpack_nvidia - + pinfo "Ready to chroot - compiling may take some time." pdebug "--- chroot ---------------------------------------------------------------------" pdebug "- -" @@ -104,13 +104,13 @@ EOF pdebug "--------------------------------------------------------------------------------" chroot "$ROOTMOUNTDIR" pinfo "chroot terminated." - + pinfo "Unmount directories ..." umount_dirs - + pinfo "Cleaning whiteouts ..." clean_whiteouts - + pinfo "Cleaning / deleting temp directories." clean_temp } -- cgit v1.2.3-55-g7522