From 4bd02868957f5a4b317d5a821d9c72312b7dd676 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 3 Feb 2014 17:13:19 +0100 Subject: Clean up root 'data' dir... Lots of old stuff not required anymore or already taken care of --- data/README.data | 9 ----- data/activate-swap.sh | 35 ----------------- data/analyse-disk.sh | 105 -------------------------------------------------- data/basic.nocopy | 32 --------------- data/disk-tmp.sh | 24 ------------ data/ip-dns-conf | 86 ----------------------------------------- data/printk.service | 6 --- 7 files changed, 297 deletions(-) delete mode 100644 data/README.data delete mode 100644 data/activate-swap.sh delete mode 100755 data/analyse-disk.sh delete mode 100644 data/basic.nocopy delete mode 100755 data/disk-tmp.sh delete mode 100644 data/ip-dns-conf delete mode 100644 data/printk.service (limited to 'data') diff --git a/data/README.data b/data/README.data deleted file mode 100644 index fdf10a47..00000000 --- a/data/README.data +++ /dev/null @@ -1,9 +0,0 @@ -This directory contains the config and share-able stuff for the InitRamFS. The -following structure applies - -~/data/base - distro-independent fall-back files -~/data//base - distro-dependent version-independent files -~/data// - distro-dependenent version-dependent files - -The principle should be pretty simple - copy all from very generic to very -specific overwriting the generic files. diff --git a/data/activate-swap.sh b/data/activate-swap.sh deleted file mode 100644 index edaad1f2..00000000 --- a/data/activate-swap.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Initialize swap for OpenSLX linux stateless clients, first for swap as -# compressed RAM (zram) and then on local disk partitions, if detected by -# disk-analyse.sh script - -############################################################################# - -# Depends on analyse-disk.sh and on availability of the appropriate kernel -# module/functionality - -# try to enable compressed RAM SWAP / ZRAM -if modprobe -q zram 2>/dev/null ; then - # assign a quarter of total mem to zram - echo $(( $(free -k | awk '/^Mem:/ { print $2 }') * 256 )) > /sys/block/zram0/disksize - mkswap /dev/zram0 2>/dev/null - swapon /dev/zram0 1>/dev/null 2>/dev/null -fi - -# add on-disk swap if available -for hdpartnr in $(cat /etc/fstab | sed -n -e "/swap.*swap/p"| \ - sed -e "s/[[:space:]].*//") ; do - mkswap ${hdpartnr} 2>/dev/null - swapon ${hdpartnr} 1>/dev/null 2>/dev/null -done - diff --git a/data/analyse-disk.sh b/data/analyse-disk.sh deleted file mode 100755 index 27c3f306..00000000 --- a/data/analyse-disk.sh +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/bash -# Copyright (c) 2013 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Local hard disk autodetection script for OpenSLX linux stateless clients, -# detecting swap and special partitions - -############################################################################# - -# General formatter for the /tmp partition on a local harddisk -diskfm () { -local target=$1 -local fs -local path -for fs in xfs ext3 ext2 ; do - unset available - case $(cat /proc/filesystems) in - *${fs}*) available=yes;; - *) modprobe -q ${fs} 2>/dev/null && available=yes;; - esac - if [ -n ${available} ]; then - unset found - for path in /sbin /bin /usr/sbin /usr/bin /openslx/sbin /openslx/bin; do - if test -x /$path/mkfs.$fs ; then - found=yes - case mkfs.$fs in - mkfs.xfs) - fopt="-f" - mopt="-o noexec" - ;; - mkfs.ext2) - fopt="-Fq" - mopt="-o nocheck,noexec" - ;; - mkfs.reiserfs) - fopt="-f" - mopt="-o noexec" - ;; - esac - mkfs.$fs ${fopt} ${target} >/dev/null 2>&1 #|| error - mkdir -p /run/mount/tmp - mount -t ${fs} ${target} /run/mount/tmp - fi - done - [ -n "$found" ] && break - fi -done -} - -# Check for local harddisks and appropriate partitions -fdisk -l |sed -n "/^\/dev\//p" >/etc/disk.partition - -# Check for standard swap partitions and make them available to the system -for hdpartnr in $(cat /etc/disk.partition | \ - sed -n -e "/ 82 /p"|sed -e "s/[[:space:]].*//") ; do - echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >>/etc/fstab -done - -# We use special non assigned partition type (id44) for harddisk scratch -# space, thus no normal filesystem will be incidentally deleted or -# corrupted -for hdpartnr in $(cat /etc/disk.partition | \ - sed -n -e "/ 44 /p"|sed -e "s/[[:space:]].*//") ; do - # check for supported filesystem and formatter - ( if diskfm $hdpartnr ; then - # echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready - echo -e "$hdpartnr\t/tmp\t\tnoauto\t\tdefaults\t 0 0" >>/etc/fstab - else - echo "formatting failed for some reason " >/tmp/tmpready - fi ) & - break -done - -# Put detected linux partitions (83) into /etc/fstab with "noauto", special -# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx -for partid in 83 45 46 ; do - for hdpartnr in $(cat /etc/disk.partition | \ - sed -n -e "/ ${partid} /p"|sed -e "s/[[:space:]].*//") ; do - mkdir -p /media/${hdpartnr#/dev/*} 2>/dev/null - if [ ${partid} -eq 83 ] ; then - echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\ -noexec\t 0 0" >>/tmp/fstab - elif [ ${partid} -eq 45 ] ; then - #mount -t auto ${hdpartnr} /media/${hdpartnr#/dev/*} - #ln -sf /media/${hdpartnr#/dev/*} /var/scratch - echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\ -\t\t 0 0" >>/tmp/fstab - elif [ ${partid} -eq 46 ] ; then - # Mount a home directory to (/mnt)/var/home - #mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*} \n\ - #test -d /mnt/media/${hdpartnr#/dev/*}/home && \ - # ln -sf /media/${hdpartnr#/dev/*} /var/home - echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\ -\t\t 0 0" >>/tmp/fstab - fi - done -done - diff --git a/data/basic.nocopy b/data/basic.nocopy deleted file mode 100644 index b81a32c4..00000000 --- a/data/basic.nocopy +++ /dev/null @@ -1,32 +0,0 @@ -/boot -/cdrom -/dev -/export -/home -/lib/modules -/lost+found -/media -/mnt -/opt/openslx -/proc -/root -/run -/srv -/sys -/tmp -/usr/src -/var/log -/var/run -/var/www -/var/cache/nscd -/etc/resolv.conf -/etc/resolvconf -*~ -*.bak -*.pid -*.tmp -*tm-scripts* -/initrd.img -/initrd.img.old -/vmlinuz -/vmlinuz.old diff --git a/data/disk-tmp.sh b/data/disk-tmp.sh deleted file mode 100755 index 4378c45c..00000000 --- a/data/disk-tmp.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Mount local ID44 partition to /tmp after all existing stuff is preserved - -############################################################################# - -# Check if ID44 is available by analysing /etc/fstab for appropriate entry -if cat /proc/mounts | grep -qe "/dev/.*/tmp" ; then - mkdir -p /run/tmp - mv /tmp/* /run/tmp - mount --bind /run/mount/tmp /tmp - umount /run/mount/tmp - mv /run/tmp/* /tmp - rmdir /run/tmp -fi diff --git a/data/ip-dns-conf b/data/ip-dns-conf deleted file mode 100644 index f14ecd88..00000000 --- a/data/ip-dns-conf +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Set IP and DNS configuration ... - -############################################################################# - -# Depends on running network interface, provides IP and DNS configuration - -# Dns and ip configuration, hostname of the machine --> to be merged with udhcpc.default.script!! -echo "$host_name" >/proc/sys/kernel/hostname -echo -e "# /etc/hosts - file generated by $0 during OpenSLX stage3\ -\n#\n# IP-Address Full-Qualified-Hostname Short-Hostname\n#\n\ -127.0.0.1\tlocalhost\n::1\t\tlocalhost ipv6-localhost ipv6-loopback\n\ -fe00::0\t\tipv6-localnet\nff00::0\t\tipv6-mcastprefix\nff02::1\ -\t\tipv6-allnodes\nff02::2\t\tipv6-allrouters\nff02::3\t\t\ -ipv6-allhosts\n" >/etc/hosts -if [ -n "${domain_name}" ]; then - echo -en "${clientip}\t" >>/etc/hosts - for name in ${domain_name}; do - echo -en "${host_name}.${name} " >>/etc/hosts - done - echo -e "${host_name}" >>/etc/hosts -else - echo -e "${clientip}\t${host_name}" >>/etc/hosts -fi -# set up domainname and resolving -#rm -rf /etc/resolv.conf - -out=/etc/resolv.conf -echo -e "# /etc/resolv.conf - file generated by\n#\t$0:\n\ -#\t${date}\n#options timeout:1 attempts:1 rotate" > $out - -[ "x${domain_name}" != "x" ] && echo -e "domain ${domain_name}" >> $out -[ "x${domain_search}" != "x" ] && echo -e "search ${domain_search}" >> $out -# fallback -[ "x${domain_search}" == "x" ] && [ "x${domain_name}" != "x" ] && \ - echo -e "search ${domain_name}" >> $out - -[ -n "${domain_name_servers}" ] && { - for name in ${domain_name_servers}; do - echo nameserver ${name} >> $out; - done; } - -# Create hostname file -[ -n ${host_name} ] && [ -n ${domain_name} ] && \ - echo "${host_name}.${domain_name}" > /etc/hostname - - -# Set greeting and add information on booted system -len=$(expr length ${SLXVERSION}${SYSTEM_NAME}) -if [ $len -le 28 ] ; then - vdstr="Stateless Workstation (V${SLXVERSION}/${SYSTEM_NAME})" - smax=28 -else - vdstr="V${SLXVERSION}/${SYSTEM_NAME}" - smax=52 -fi -while [ $len -le $smax ] ; do - vdstr="$vdstr " - len=$(($len + 1)) -done -len=$(expr length ${host_name}) -while [ $len -le 30 ] ; do - space="$space " - len=$(($len + 1)) -done -echo " - WELCOME TO $space \n (\l) - _____ ______ ______ __ __ _______ __ __ __ - / _ | _ | ___| | | | | ____| | | | | | - | | | | |_| | |_ | | | | |___ | | / / - | | | | ___/| _| | | ____ | | | | - | |_| | | | |___| | | | ____| | |___ / / - _____/|__| |______|__| |__| |_______|______|__| |__| - - $vdstr (c) -" >/etc/issue diff --git a/data/printk.service b/data/printk.service deleted file mode 100644 index 97fe8055..00000000 --- a/data/printk.service +++ /dev/null @@ -1,6 +0,0 @@ -[Unit] -Description=shuts up kernel - -[Service] -Type=simple -ExecStart=/openslx/bin/echo "0" > /proc/sys/kernel/printk -- cgit v1.2.3-55-g7522 From 4af465b0a445237627c4c6f248737b4a9a5515e1 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 3 Feb 2014 17:14:16 +0100 Subject: My first steps when taking a look at the prop nvidia drivers Tried to extract the drivers and doing a fake install into a specific directory without messing up the system. Doesn't really work yet. Didn't have any more time/better things to do then. This stuff is about a year old.... --- data/nvidia-driver-extraction-experiments.sh | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100755 data/nvidia-driver-extraction-experiments.sh (limited to 'data') diff --git a/data/nvidia-driver-extraction-experiments.sh b/data/nvidia-driver-extraction-experiments.sh new file mode 100755 index 00000000..edc06424 --- /dev/null +++ b/data/nvidia-driver-extraction-experiments.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +ROOT_DIR="$HOME" + +. "/root/tm-scripts/helper/logging.inc" || exit 1 + +# XXX: Mounts stuff from my NFS.... +[ ! -d /mnt/store ] && mkdir -p /mnt/store +if [ "x$(ls /mnt/store/drivers)" == "x" ]; then + mount -t nfs -o ro,async,nolock 132.230.8.113:/srv/vmext /mnt/store || perror "Could not mount vmware bundle directory. Exiting." +fi + +# There is no generic "--root-prefix=" option, so we have to pass a shitload of arguments, and even then the installer +# does some stuff in your actual system tree... :-( better do some sort of chroot? +function gogo() +{ + + local DIR="$ROOT_DIR/build" + mkdir -p "$DIR" || perror "Couldn ot create $DIR" + + local XPREFIX="/usr" + + set -x + + local XLP="$(X -showDefaultLibPath 2>&1)" + [ -z "$XLP" ] && XLP="$(pkg-config --variable=libdir xorg-server 2>&1)" + [ -z "$XLP" ] && XLP="$XPREFIX" + [ -z "$XLP" ] && perror "Could not determine X lib path" + + local XMP="$(X -showDefaultModulePath 2>&1)" + [ -z "$XMP" ] && XMP="$(pkg-config --variable=moduledir xorg-server 2>&1)" + [ -z "$XMP" ] && XMP="$XLP" + [ -z "$XMP" ] && perror "Could not determine X module path" + + cd /mnt/store/drivers || perror "No /mnt/store/drivers" + set -x + # TODO: Insert proper kernel name and path from our own kernel <----- XXX + ./NVIDIA-Linux-x86-319.23.run -a --x-prefix="$DIR/$XPREFIX" --x-module-path="$DIR/$XMP" --x-library-path="$DIR/$XLP" --opengl-prefix="$DIR/usr" --utility-prefix="$DIR/usr" --documentation-prefix="$DIR/garbage" --application-profile-path="$DIR/usr/share/nvidia" --kernel-source-path="/root/tm-scripts/remote/modules/kernel/ksrc" --kernel-install-path="$DIR/lib/modules/nvidia" --log-file-name="$DIR/install-log" --ui=none --no-nvidia-modprobe --kernel-name="3.7.10-1.11-desktop-openslx" --no-precompiled-interface --no-rpms --no-network --no-x-check --no-nouveau-check --no-distro-scripts --kernel-module-source-prefix="$DIR/usr/src" --no-questions + set +x + +} + +gogo + +# --no-questions +# -a +# --x-prefix= ..../usr +# --x-module-path= ... + X -showDefaultModulePath +# --x-library-path= ... + X -showDefaultLibPath (oder --x-prefix) +# --opengl-prefix= .../usr +# --utility-prefix= ..../usr +# --documentation-prefix= müll +# --application-profile-path= ??? /usr/share/nvidia +# --kernel-source-path= unser kack +# --kernel-install-path= .../lib/modules/nvidia +# --log-file-name= +# --ui=none +# --no-nvidia-modprobe +# --kernel-name=UNSERKERNEL +# --no-precompiled-interface +# --no-rpms +# --no-network +# --no-x-check +# --no-nouveau-check +# --no-distro-scripts +# --kernel-module-source-prefix= ..../usr/src -- cgit v1.2.3-55-g7522 From 8a34e9349a76a18aaf849839afad42d26158d9ea Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Fri, 14 Feb 2014 19:41:38 +0100 Subject: Overhauled vmware kernel module patching, also added global kernel version variables Variables are now: KERNEL_CURRENT_VERSION - currently running kernel (uname -r) SYS_UTS_RELEASE - What uname -r will yield on the generated system SYS_KERNEL - Just version number of SYS_UTS_RELEASE (eg. 3.5.6-12-openslx -> 3.5.6) --- data/kernel.wanted.config | 2 + remote/includes/kernel.inc | 18 ++- remote/includes/versioncompare.inc | 63 +++++++++++ .../patches/vmblock__3.0-3.9__1.0-100.0.patch | 11 ++ .../vmware/patches/vmblock__3.10__1.0-100.0.patch | 34 ++++++ .../patches/vmblock__3.11-9.9__1.0-100.0.patch | 123 +++++++++++++++++++++ remote/modules/vmware/vmware.build | 63 ++++++++--- remote/setup_target | 3 + 8 files changed, 298 insertions(+), 19 deletions(-) create mode 100644 remote/includes/versioncompare.inc create mode 100644 remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch create mode 100644 remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch create mode 100644 remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch (limited to 'data') diff --git a/data/kernel.wanted.config b/data/kernel.wanted.config index 62dc3b37..ee41a80b 100644 --- a/data/kernel.wanted.config +++ b/data/kernel.wanted.config @@ -238,4 +238,6 @@ CONFIG_IP_PNP_DHCP=n CONFIG_IP_PNP_BOOTP=n CONFIG_IP_PNP_RARP=n CONFIG_RD_XZ=y +CONFIG_OPENVSWITCH=m +CONFIG_OPENVSWITCH_GRE=n diff --git a/remote/includes/kernel.inc b/remote/includes/kernel.inc index ae5791df..ccd10970 100644 --- a/remote/includes/kernel.inc +++ b/remote/includes/kernel.inc @@ -13,13 +13,23 @@ # must be given as kernel/fs/nfs/nfs.ko # -# determine kernel version -KERNEL_CURRENT_VERSION=$(uname -r) -[ -z "$KERNEL_CURRENT_VERSION" ] && pwarning "Could not determine kernel version." - # set global KERNEL_TARGET_NAME KERNEL_TARGET_NAME="kernel" +get_kernel_version () { + # determine kernel version currently running on this machine + KERNEL_CURRENT_VERSION=$(uname -r) + [ -z "$KERNEL_CURRENT_VERSION" ] && pwarning "Could not determine kernel version." + # determine kernel version that will be running in the generated system + if [ -e "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" ]; then + SYS_UTS_RELEASE=$(grep 'UTS_RELEASE' "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" | awk -F '"' '{print $2}') + SYS_KERNEL=$(echo "$SYS_UTS_RELEASE" | grep -o -E '^[0-9\.]+') + else + SYS_UTS_RELEASE="(unknown-not-compiled-yet)" + SYS_KERNEL="$SYS_UTS_RELEASE" + fi +} + check_kernel_build_dir() { [ -d "${MODULES_DIR}/kernel/build" ] && KERNEL_BUILD_DIR="${MODULES_DIR}/kernel/build" \ || perror "No build directory set for the kernel. Was is built?" diff --git a/remote/includes/versioncompare.inc b/remote/includes/versioncompare.inc new file mode 100644 index 00000000..75f59456 --- /dev/null +++ b/remote/includes/versioncompare.inc @@ -0,0 +1,63 @@ + +# From http://stackoverflow.com/a/4025065/2043481 +# Returns 0 when equal, 1 when $1 > $2, 2 otherwise +version_compare () { + if [[ "$1" == "$2" ]]; then + return 0 + fi + local IFS=".-_" + local i ver1=($1) ver2=($2) + # fill empty fields in ver1 with zeros + for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do + ver1[i]=0 + done + for ((i=0; i<${#ver1[@]}; i++)); do + if [[ -z "${ver2[i]}" ]]; then + # fill empty fields in ver2 with zeros + ver2[i]=0 + fi + if ((10#${ver1[i]} > 10#${ver2[i]})); then + return 1 + fi + if ((10#${ver1[i]} < 10#${ver2[i]})); then + return 2 + fi + done + return 0 +} + +version_ge () { + version_compare "$1" "$2" + local RET=$? + [ "$RET" == "2" ] && return 1 + return 0 +} + +version_le () { + version_compare "$1" "$2" + local RET=$? + [ "$RET" == "1" ] && return 1 + return 0 +} + +version_gt () { + version_compare "$1" "$2" + local RET=$? + [ "$RET" == "1" ] && return 0 + return 1 +} + +version_lt () { + version_compare "$1" "$2" + local RET=$? + [ "$RET" == "2" ] && return 0 + return 1 +} + +version_eq () { + version_compare "$1" "$2" + return $? +} + +version_eq "1.0" "1" && ! version_eq "1.0" "1.1" && version_ge "1.1" "1.0" + diff --git a/remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch b/remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch new file mode 100644 index 00000000..89b3a7c6 --- /dev/null +++ b/remote/modules/vmware/patches/vmblock__3.0-3.9__1.0-100.0.patch @@ -0,0 +1,11 @@ +--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/control.c 2014-02-14 15:54:59.895201379 +0100 +@@ -293,7 +293,7 @@ + + retval = i < 0 ? -EINVAL : blockOp(name, blocker); + +- putname(name); ++ __putname(name); + + return retval; + } diff --git a/remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch b/remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch new file mode 100644 index 00000000..e54317f9 --- /dev/null +++ b/remote/modules/vmware/patches/vmblock__3.10__1.0-100.0.patch @@ -0,0 +1,34 @@ +--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/control.c 2014-02-14 16:20:18.667236035 +0100 +@@ -208,17 +208,18 @@ + VMBlockSetProcEntryOwner(controlProcMountpoint); + + /* Create /proc/fs/vmblock/dev */ +- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, ++ /* controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, + VMBLOCK_CONTROL_MODE, +- controlProcDirEntry); +- if (!controlProcEntry) { ++ controlProcDirEntry);*/ ++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps); ++ if (controlProcEntry == NULL) { + Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n"); + remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry); + remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL); + return -EINVAL; + } + +- controlProcEntry->proc_fops = &ControlFileOps; ++ /*controlProcEntry->proc_fops = &ControlFileOps;*/ + return 0; + } + +@@ -293,7 +294,7 @@ + + retval = i < 0 ? -EINVAL : blockOp(name, blocker); + +- putname(name); ++ __putname(name); + + return retval; + } diff --git a/remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch b/remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch new file mode 100644 index 00000000..dedb2646 --- /dev/null +++ b/remote/modules/vmware/patches/vmblock__3.11-9.9__1.0-100.0.patch @@ -0,0 +1,123 @@ +--- a/linux/control.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/control.c 2014-02-14 16:20:18.667236035 +0100 +@@ -208,17 +208,18 @@ + VMBlockSetProcEntryOwner(controlProcMountpoint); + + /* Create /proc/fs/vmblock/dev */ +- controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, ++ /* controlProcEntry = create_proc_entry(VMBLOCK_CONTROL_DEVNAME, + VMBLOCK_CONTROL_MODE, +- controlProcDirEntry); +- if (!controlProcEntry) { ++ controlProcDirEntry);*/ ++ controlProcEntry = proc_create(VMBLOCK_CONTROL_DEVNAME, VMBLOCK_CONTROL_MODE, controlProcDirEntry, &ControlFileOps); ++ if (controlProcEntry == NULL) { + Warning("SetupProcDevice: could not create " VMBLOCK_DEVICE "\n"); + remove_proc_entry(VMBLOCK_CONTROL_MOUNTPOINT, controlProcDirEntry); + remove_proc_entry(VMBLOCK_CONTROL_PROC_DIRNAME, NULL); + return -EINVAL; + } + +- controlProcEntry->proc_fops = &ControlFileOps; ++ /*controlProcEntry->proc_fops = &ControlFileOps;*/ + return 0; + } + +@@ -293,7 +294,7 @@ + + retval = i < 0 ? -EINVAL : blockOp(name, blocker); + +- putname(name); ++ __putname(name); + + return retval; + } +--- a/linux/file.c 2013-10-18 19:56:11.000000000 +0200 ++++ b/linux/file.c 2014-02-14 16:20:21.455236098 +0100 +@@ -38,46 +38,6 @@ + typedef ino_t inode_num_t; + #endif + +-/* Specifically for our filldir_t callback */ +-typedef struct FilldirInfo { +- filldir_t filldir; +- void *dirent; +-} FilldirInfo; +- +- +-/* +- *---------------------------------------------------------------------------- +- * +- * Filldir -- +- * +- * Callback function for readdir that we use in place of the one provided. +- * This allows us to specify that each dentry is a symlink, but pass through +- * everything else to the original filldir function. +- * +- * Results: +- * Original filldir's return value. +- * +- * Side effects: +- * Directory information gets copied to user's buffer. +- * +- *---------------------------------------------------------------------------- +- */ +- +-static int +-Filldir(void *buf, // IN: Dirent buffer passed from FileOpReaddir +- const char *name, // IN: Dirent name +- int namelen, // IN: len of dirent's name +- loff_t offset, // IN: Offset +- inode_num_t ino, // IN: Inode number of dirent +- unsigned int d_type) // IN: Type of file +-{ +- FilldirInfo *info = buf; +- +- /* Specify DT_LNK regardless */ +- return info->filldir(info->dirent, name, namelen, offset, ino, DT_LNK); +-} +- +- + /* File operations */ + + /* +@@ -166,11 +126,10 @@ + + static int + FileOpReaddir(struct file *file, // IN +- void *dirent, // IN +- filldir_t filldir) // IN ++ struct dir_context *ctx) // IN + { + int ret; +- FilldirInfo info; ++ + struct file *actualFile; + + if (!file) { +@@ -184,12 +143,10 @@ + return -EINVAL; + } + +- info.filldir = filldir; +- info.dirent = dirent; +- +- actualFile->f_pos = file->f_pos; +- ret = vfs_readdir(actualFile, Filldir, &info); +- file->f_pos = actualFile->f_pos; ++ /* Ricky Wong Yung Fei: ++ * Manipulation of pos is now handled internally by iterate_dir(). ++ */ ++ ret = iterate_dir(actualFile, ctx); + + return ret; + } +@@ -237,7 +194,7 @@ + + + struct file_operations RootFileOps = { +- .readdir = FileOpReaddir, ++ .iterate = FileOpReaddir, + .open = FileOpOpen, + .release = FileOpRelease, + }; diff --git a/remote/modules/vmware/vmware.build b/remote/modules/vmware/vmware.build index 2ff6e895..16ee4c77 100644 --- a/remote/modules/vmware/vmware.build +++ b/remote/modules/vmware/vmware.build @@ -136,24 +136,46 @@ EOF ln -sf "appLoader" "$MODULE_BUILD_DIR/usr/lib/vmware/bin/vmware-modconfig" ln -sf "appLoader" "$MODULE_BUILD_DIR/usr/lib/vmware/bin/vmware-modconfig-console" - [ ! -e "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" ] && perror "Could not find uts release!!!" - local UTS_RELEASE="$(cat "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" | awk -F '"' '{print $2}')" - pinfo "Patching vmblock.tar" + # See what we need to patch cd "$MODULE_BUILD_DIR/usr/lib/vmware/modules/source" || perror "cd failed." - tar xf "vmblock.tar" || perror "untar of vmblock.tar failed." - for sourcefile in $(grep -l -r -E '\sputname' "vmblock-only/"); do - sed -r -i 's/\sputname/__putname/g' "$sourcefile" || perror "sed of $sourcefile failed." + local KMOD SHORT PATCH MIN_KERN MAX_KERN + for KMOD in *.tar; do + SHORT="${KMOD%%.tar}" + [ -e ".${SHORT}.patched" ] && continue + for PATCH in $(find "${MODULE_DIR}/patches/" -name "${SHORT}__*__*.patch"); do + parse_patch_name "$PATCH" + [ -z "${MIN_KERN}" -o -z "${MAX_KERN}" ] && perror "Could not parse patch filename" + if version_lt "$SYS_KERNEL" "$MIN_KERN" || version_gt "$SYS_KERNEL" "$MAX_KERN"; then + pinfo "*NOT* applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$SYS_KERNEL)" + continue # Not suitable for our kernel + fi + pinfo "Applying $PATCH (min=$MIN_KERN max=$MAX_KERN cmp=$SYS_KERNEL)" + [ ! -d "${SHORT}-only" ] && tar xf "$KMOD" + [ ! -d "${SHORT}-only" ] && perror "untar of $KMOD failed." + cd "${SHORT}-only" || perror "Where is ${SHORT}-only?" + if ! patch -p1 < "$PATCH"; then + cd .. + rm -rf -- "${SHORT}-only" + perror "Applying $PATCH failed." + fi + cd .. + done + if [ -d "${SHORT}-only" ]; then + tar cf "$KMOD" "${SHORT}-only/" || perror "repacking of $KMOD failed." + rm -rf -- "${SHORT}-only" + touch ".${SHORT}.patched" + fi done - tar cf "vmblock.tar" "vmblock-only/" || perror "repacking of vmblock.tar failed." - cd - - + cd "$MODULE_DIR" || perror "wat." + # + # Then, compile pinfo "KOMPILIERE VMWARE KERNEL MODULE" for MOD in vsock vmblock vmmon vmnet vmci; do pinfo "Kompiliere $MOD" - [ -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && unlink "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" - "$VMWARE_MODCONFIG" --console --build-mod -k "$UTS_RELEASE" "$MOD" "$(which gcc)" "$MODULES_DIR/kernel/ksrc/include" "vmplayer" "$MOD" - [ ! -s "/lib/modules/$UTS_RELEASE/vmplayer/$MOD.ko" ] && perror "Error compiling via $VMWARE_MODCONFIG" - done + [ -s "/lib/modules/$SYS_UTS_RELEASE/vmplayer/$MOD.ko" ] && unlink "/lib/modules/$SYS_UTS_RELEASE/vmplayer/$MOD.ko" + "$VMWARE_MODCONFIG" --console --build-mod -k "$SYS_UTS_RELEASE" "$MOD" "$(which gcc)" "$MODULES_DIR/kernel/ksrc/include" "vmplayer" "$MOD" + [ ! -s "/lib/modules/$SYS_UTS_RELEASE/vmplayer/$MOD.ko" ] && perror "Error compiling via $VMWARE_MODCONFIG" + done cd - @@ -163,8 +185,19 @@ EOF } function copy_modules() { - local UTS_RELEASE="$(cat "$MODULES_DIR/kernel/ksrc/include/generated/utsrelease.h" | awk -F '"' '{print $2}')" mkdir -p "$TARGET_BUILD_DIR/lib/modules/vmware/" - cp "/lib/modules/$UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!" + cp "/lib/modules/$SYS_UTS_RELEASE/vmplayer/"* "$TARGET_BUILD_DIR/lib/modules/vmware/" || perror "Could not cp vmware modules to target!" +} + +function parse_patch_name() { + [ $# -ne 1 ] && perror "parse_patch_name: Wrong parameter count." + local PATCH="$1" + MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)-[0-9\.]+__[^_]+\.patch$/\1/g') + [[ "$MIN_KERN" == /* ]] && MIN_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') + MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__[0-9\.]+-([0-9\.]+)__[^_]+\.patch$/\1/g') + [[ "$MAX_KERN" == /* ]] && MAX_KERN=$(echo "$PATCH" | sed -r 's/^[^_]+__([0-9\.]+)__[^_]+\.patch$/\1/g') + [[ "$MIN_KERN" == /* ]] && MIN_KERN= + [[ "$MAX_KERN" == /* ]] && MAX_KERN= + # TODO: Parse min and max vmplayer/workstation version } diff --git a/remote/setup_target b/remote/setup_target index 9ae948ab..4b026a6d 100755 --- a/remote/setup_target +++ b/remote/setup_target @@ -60,6 +60,7 @@ EXPORT_DIR="/export/build" PROCESSED_MODULES="" initial_checks () { + get_kernel_version detect_distribution } @@ -390,6 +391,8 @@ process_module() { pdebug "## Installing dependencies" cd "${MODULE_DIR}" || perror "cd to '${MODULE_DIR}' failed." install_dependencies + # update kernel version variables before running a module, as the last one might have been the kernel... + get_kernel_version # Fetch source code if [ ! -e "$SOURCE_FLAG" ]; then pinfo "## Fetching source" -- cgit v1.2.3-55-g7522 From c6a33c3da72715b5a6ea8ca722c0462bdd6d8290 Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Tue, 18 Feb 2014 18:13:53 +0100 Subject: nvidia driver extraction: First working script, perhaps useful for someone. Use with care. --- data/nvidia-driver-extraction-experiments.sh | 179 ++++++++++++++++++--------- 1 file changed, 118 insertions(+), 61 deletions(-) (limited to 'data') diff --git a/data/nvidia-driver-extraction-experiments.sh b/data/nvidia-driver-extraction-experiments.sh index edc06424..85617f04 100755 --- a/data/nvidia-driver-extraction-experiments.sh +++ b/data/nvidia-driver-extraction-experiments.sh @@ -1,66 +1,123 @@ #!/bin/bash -ROOT_DIR="$HOME" - -. "/root/tm-scripts/helper/logging.inc" || exit 1 - -# XXX: Mounts stuff from my NFS.... -[ ! -d /mnt/store ] && mkdir -p /mnt/store -if [ "x$(ls /mnt/store/drivers)" == "x" ]; then - mount -t nfs -o ro,async,nolock 132.230.8.113:/srv/vmext /mnt/store || perror "Could not mount vmware bundle directory. Exiting." -fi - -# There is no generic "--root-prefix=" option, so we have to pass a shitload of arguments, and even then the installer -# does some stuff in your actual system tree... :-( better do some sort of chroot? -function gogo() -{ - - local DIR="$ROOT_DIR/build" - mkdir -p "$DIR" || perror "Couldn ot create $DIR" - - local XPREFIX="/usr" - - set -x - - local XLP="$(X -showDefaultLibPath 2>&1)" - [ -z "$XLP" ] && XLP="$(pkg-config --variable=libdir xorg-server 2>&1)" - [ -z "$XLP" ] && XLP="$XPREFIX" - [ -z "$XLP" ] && perror "Could not determine X lib path" - - local XMP="$(X -showDefaultModulePath 2>&1)" - [ -z "$XMP" ] && XMP="$(pkg-config --variable=moduledir xorg-server 2>&1)" - [ -z "$XMP" ] && XMP="$XLP" - [ -z "$XMP" ] && perror "Could not determine X module path" - - cd /mnt/store/drivers || perror "No /mnt/store/drivers" - set -x - # TODO: Insert proper kernel name and path from our own kernel <----- XXX - ./NVIDIA-Linux-x86-319.23.run -a --x-prefix="$DIR/$XPREFIX" --x-module-path="$DIR/$XMP" --x-library-path="$DIR/$XLP" --opengl-prefix="$DIR/usr" --utility-prefix="$DIR/usr" --documentation-prefix="$DIR/garbage" --application-profile-path="$DIR/usr/share/nvidia" --kernel-source-path="/root/tm-scripts/remote/modules/kernel/ksrc" --kernel-install-path="$DIR/lib/modules/nvidia" --log-file-name="$DIR/install-log" --ui=none --no-nvidia-modprobe --kernel-name="3.7.10-1.11-desktop-openslx" --no-precompiled-interface --no-rpms --no-network --no-x-check --no-nouveau-check --no-distro-scripts --kernel-module-source-prefix="$DIR/usr/src" --no-questions - set +x +# This is the first working nvidia extractor. +BASEDIR=/root/temp/ +TMSCRIPTS=/root/tm-scripts/ +MODULE_DIR="$TMSCRIPTS/remote/modules/kernel/" +KERNELSRCDIR="$MODULE_DIR/ksrc" +ROOTLOWERDIR="/" +ROOTUPPERDIR="$BASEDIR/rootupper" +ROOTBINDDIR="$BASEDIR/rootbind" +ROOTMOUNTDIR="$BASEDIR/rootmount" +BINDMOUNTS="/dev /proc /run /sys" + +NVIDIA="$BASEDIR/NVIDIA-Linux-x86_64-331.38.run" +NVIDIAEXTRACTDIR="$ROOTMOUNTDIR/NVIDIA" +NVEXTRACTDIR="/NVIDIA" # this one relative to chroot" +STARTDM="false" + + +# This is just an experiment to look whether the annoying message "could not insert kernel module" +# by the nvidia installer when compiling on a computer lacking a nvidia gpu card could be killed. +# It does not work, as the nvidia-installer uses a self-brewed module loader. +dump_modprobe () { + [ -d "$ROOTMOUNTDIR/sbin" ] || mkdir "$ROOTMOUNTDIR/sbin" + for FILE in insmod modprobe; do + cat>"$ROOTMOUNTDIR/sbin/$FILE"<<-EOF + #/bin/sh + exit 0 + EOF + chmod +x "$ROOTMOUNTDIR/sbin/$FILE" + done +} + +stop_display_managers () { + for DM in kdm gdm lightdm; do + ps a|grep -v grep|grep "$DM" + ERR=$? + if [ "$ERR" -eq 0 ]; then + /etc/init.d/"$DM" stop + killall "$DM" # line above leaves a residue sometimes... + STARTDM="$DM" + echo "Stopped $DM." + break + fi + done +} + +# Several directories for bind mount and overlay mounts. +make_dirs () { + mkdir "$ROOTUPPERDIR" + mkdir "$ROOTBINDDIR" + mkdir "$ROOTMOUNTDIR" +} + +mount_dirs () { + mount -o bind "$ROOTLOWERDIR" "$ROOTBINDDIR" + mount -o remount,ro "$ROOTBINDDIR" + mount -t overlayfs overlayfs -o lowerdir="$ROOTBINDDIR",upperdir="$ROOTUPPERDIR" "$ROOTMOUNTDIR" + for MOUNT in $BINDMOUNTS; do + echo "Erzeuge bind-mount $MOUNT ..." + mount -o bind "$MOUNT" "$ROOTMOUNTDIR/$MOUNT" || echo "Bind mount auf $MOUNT schlug fehl." + done +} + +# We inject a bashrc to be executed within the chroot. +gen_bashrc () { + echo "chroot erfolgreich." + 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 + alias ll='ls -alF' + PS1='\[\e[1;33m\]chroot@\h:\w\$ \[\e[1;32m\]' + cd "$NVEXTRACTDIR" + echo "First pass... compiling kernel module." + ./nvidia-installer $COMMON_OPTIONS --kernel-source-path /"$KERNELSRCDIR" # compiles .ko, but not always the rest. + echo "Second pass... compiling everything else." + ./nvidia-installer $COMMON_OPTIONS --no-kernel-module # compiles the rest - hopefully. + exit +EOF +} + +unpack_nvidia () { + [ -d "$NVIDIAEXTRACTDIR" ] && rm -rf "$NVIDIAEXTRACTDIR" + echo "Entpacke $NVIDIA ..." + sh "$NVIDIA" --extract-only --target "$NVIDIAEXTRACTDIR" } -gogo - -# --no-questions -# -a -# --x-prefix= ..../usr -# --x-module-path= ... + X -showDefaultModulePath -# --x-library-path= ... + X -showDefaultLibPath (oder --x-prefix) -# --opengl-prefix= .../usr -# --utility-prefix= ..../usr -# --documentation-prefix= müll -# --application-profile-path= ??? /usr/share/nvidia -# --kernel-source-path= unser kack -# --kernel-install-path= .../lib/modules/nvidia -# --log-file-name= -# --ui=none -# --no-nvidia-modprobe -# --kernel-name=UNSERKERNEL -# --no-precompiled-interface -# --no-rpms -# --no-network -# --no-x-check -# --no-nouveau-check -# --no-distro-scripts -# --kernel-module-source-prefix= ..../usr/src +umount_dirs () { + for MOUNT in $BINDMOUNTS; do + umount "$ROOTMOUNTDIR/$MOUNT" + done + umount "$ROOTMOUNTDIR" + umount "$ROOTBINDDIR" +} + +start_display_manager () { + [ "$STARTDM" != "false" ] && echo /etc/init.d/"$DM" start +} + + +# stop_display_managers + +make_dirs +echo "Mounte Verzeichnisse ..." +mount_dirs + +echo "Lege .bashrc ab ..." +gen_bashrc + +echo "Entpacke NVidia-Installer ..." +unpack_nvidia + +echo "Dumpe modprobe / insmod ..." +# dump_modprobe + +echo "Fertig für chroot." +chroot "$ROOTMOUNTDIR" +echo "chroot durch." + +echo "Unmounte Verzeichnisse." +umount_dirs + +# start_display_manager -- cgit v1.2.3-55-g7522