diff options
| author | Bastian Wissler | 2009-05-14 19:27:12 +0200 |
|---|---|---|
| committer | Bastian Wissler | 2009-05-14 19:27:12 +0200 |
| commit | 641917d1f5eae763fbb6cffe4b583c2dd06d7d5e (patch) | |
| tree | 68cbdf42e9f3814f95635e51b0c44ed5737f34b8 /os-plugins/plugins/xserver/OpenSLX/Distro | |
| parent | status in wlanboot plugin and typo in suse-11.1 installation (diff) | |
| download | core-641917d1f5eae763fbb6cffe4b583c2dd06d7d5e.tar.gz core-641917d1f5eae763fbb6cffe4b583c2dd06d7d5e.tar.xz core-641917d1f5eae763fbb6cffe4b583c2dd06d7d5e.zip | |
xserver plugin (some severe changes):
* Suse-11.x driver installation supported by perl module in Distro
* Ubuntu-9.04 tested with recent scripts (ubuntu-8.10-gfx-install.sh)
* this version does NOT (yet) support < suse-11.0, < ubuntu-8.04
-> below suse-11.0 is only not tested
* we use driver packages just for ati drivers on SuSE-11.0 and greater
git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2856 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/plugins/xserver/OpenSLX/Distro')
| -rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm | 112 | ||||
| -rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm | 180 | ||||
| -rw-r--r-- | os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm | 25 |
3 files changed, 317 insertions, 0 deletions
diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm index 65ccb879..9672de87 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Base.pm @@ -19,6 +19,7 @@ use warnings; our $VERSION = 1.01; # API-version . implementation-version use File::Basename; +use File::Path; use OpenSLX::Basics; use OpenSLX::Utils; @@ -73,4 +74,115 @@ sub XserverPathInfo return $pathInfo; } + +# looks for the NVIDIA-installer and extracts it +sub installNvidia +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my @paths = glob $repopath.$pkgpath."/NVIDIA-Linux-x86*\n"; + my $paths = @paths; + + if ($paths > 1) + { + print "Found more than one NVIDIA-Linux-x86 installer. Taking first one.\n"; + } + if ($paths == 0) + { + print "Found no NVIDIA-Linux-x86 installer. Quitting NVIDIA installation!\n"; + return "error"; + } + + if ( ! -X $paths[0] ) + { + system("chmod +x ".$paths[0]); + } + system($paths[0]." -x --target $repopath/nvidia/temp >/dev/null 2>&1"); + + if($? == -1 ) + { + print "Failed to execute ".$paths[0]."\n"; + return "error"; + } + + system("mv $repopath/nvidia/temp/usr/src $repopath/nvidia/temp/"); + system("mv $repopath/nvidia/temp/usr/ $repopath/nvidia/"); + rmtree("$repopath/nvidia/usr/share/"); + + return "$repopath/nvidia/temp/src/nv"; +} + + +sub installAti +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my @paths = glob $repopath."/".$pkgpath."/ati-driver-installer*"; + my $paths = @paths; + + if ($paths > 1) + { + print "Found more than one ati-driver-installer. Taking first one.\n"; + } + if ($paths == 0) + { + print "Found no ati-driver-installer. Quitting ATI installation!\n"; + return "error"; + } + + if ( ! -X $paths[0] ) + { + system("chmod +x ".$paths[0]); + } + system($paths[0]." --extract $repopath/ati/temp >/dev/null 2>&1"); + + if($? == -1 ) + { + print "Failed to execute ".$paths[0]."\n"; + return "error"; + } + + # TODO: allow x86_64 driver installation (libs) + my $arch = "x86"; + + rmtree("$repopath/ati/usr"); + system("mv $repopath/ati/temp/common/usr $repopath/ati/"); + if (!-d "$repopath/ati/usr/lib" ) { + mkdir "$repopath/ati/usr/lib"; + } + system("mv $repopath/ati/temp/arch/$arch/usr/X11R6/lib/* $repopath/ati/usr/lib/"); + system("mv $repopath/ati/temp/arch/$arch/usr/lib/* $repopath/ati/usr/lib/"); + rmtree("$repopath/ati/usr/share/"); + + my $cmd='gcc --version | head -n 1 | sed -e "s/[^0-9. ]//g;s/^ *//;s/^\(.\)\..*$/\1/"'; + my $gcc_ver_maj =`$cmd`; + chomp($gcc_ver_maj); + + system("mv $repopath/ati/temp/arch/$arch/lib/modules/fglrx/build_mod/libfglrx_ip.a.GCC$gcc_ver_maj $repopath/ati/temp/common/lib/modules/fglrx/build_mod/"); + + + return "$repopath/ati/temp/common/lib/modules/fglrx/build_mod"; +} + +# get dkms with wget/tar and put it into /sbin +sub getdkms +{ + if( !-f "/sbin/dkms") { + if(!-f "dkms-2.0.21.1.tar.gz" ) { + system("wget http://linux.dell.com/dkms/permalink/dkms-2.0.21.1.tar.gz"); + die("Could not download dkms tarball! Exiting!") if($? > 0 ); + } + if(!-f "dkms-2.0.21.1/dkms" ) { + system("tar -zxvf dkms-2.0.21.1.tar.gz dkms-2.0.21.1/dkms"); + die("Could not extract dkms script from tarball! Exiting!") if($? > 0 ); + } + copy("dkms-2.0.21.1/dkms","/sbin/dkms"); + chmod 0755, "/sbin/dkms"; + } +} + 1; diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm index 7ceb704e..6419bc44 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm @@ -24,6 +24,7 @@ use File::Path; use OpenSLX::Basics; use OpenSLX::Utils; + ################################################################################ ### interface methods ################################################################################ @@ -47,4 +48,183 @@ sub setupXserverScript return $script; } + +sub installNvidia +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $tmpdir = "$repopath/nvidia/temp"; + if( !-d $tmpdir ) { + mkdir( $tmpdir ); + } +# +# my $ret = $self->SUPER::installNvidia(@_); +# +# if($ret =~ /^error$/) { +# print "Something went wrong installing NVIDIA files!\n"; +# return; +# } +# +# $self->SUPER::getdkms(); +# + my $kver = "2.6.25.20-0.1"; + my $ksuffix = "pae"; +# +# # here we have to compile the kernel modules for all kernels +# my $grep = "grep -io DNV_VERSION_STRING=.* $ret/Makefile.nvidia |". +# "cut -d'\\' -f2 | cut -d'\"' -f2"; +# my $nv_version = `$grep`; +# chomp($nv_version); +# +# system("mv $ret /usr/src/nvidia-$nv_version >/dev/null 2>&1"); +# +# open FH,">/usr/src/nvidia-$nv_version/dkms.conf"; +# print FH "DEST_MODULE_LOCATION=/updates\n"; +# print FH "PACKAGE_NAME=nvidia\n"; +# print FH "PACKAGE_VERSION=$nv_version\n"; +# close FH; +# +# system("/sbin/dkms add -m nvidia -v $nv_version"); +# my $cmd = "#============= Executing following command =============\n". +# "/sbin/dkms ". +# " -m nvidia -v $nv_version ". +# " -k $kver-$ksuffix ". +# " --kernelsourcedir /usr/src/linux-$kver-obj/i586/$ksuffix ". +# " --no-prepare-kernel ". +# " --no-clean-kernel ". +# " build \n". +# "#=========================================================="; +# +# print $cmd; +# system($cmd); + + + my $srinfo = `head -n1 /etc/SuSE-release`; + my @data = split (/ /, $srinfo); + chomp(@data); + + my $version = $data[1]; + my $chost = substr($data[2],1,-1); + + my $url = "ftp://download.nvidia.com/opensuse/$version/$chost"; + system("wget -P $tmpdir $url/nvidia-gfxG01-kmp-$ksuffix* >/dev/null 2>&1"); + + if($? > 0) { + print "Could not download nvidia kernel module rpm!\n"; + } + + my @rpm = glob "$tmpdir/nvidia-gfxG01*.rpm"; + my $rpm = @rpm; + + if($rpm == 0) { + print "Could not find nvidia kernel module rpm on filesystem!"; + return; + } + + system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1"); + + if(!-d "$repopath/nvidia/modules/") + { + mkdir("$repopath/nvidia/modules/"); + } + copyFile("$tmpdir/lib/modules/$kver-$ksuffix/updates/nvidia.ko", + "$repopath/nvidia/modules"); + + + my @versions = split(/-/, $rpm[0]); + my @nv_versions = split('_',$versions[5]); + my $nv_version = $nv_versions[0]; + + system("wget -P $tmpdir $url/x11-video-nvidiaG01-$nv_version* >/dev/null 2>&1"); + + @rpm = glob "$tmpdir/x11-video-nvidiaG01-$nv_version*"; + $rpm = @rpm; + + if($rpm == 0) + { + print "Could not download x11-video-nvidia-$nv_version*.rpm!\n"; + print "Exiting nvidia driver installation!\n"; + return; + } + + system("cd $tmpdir; rpm2cpio $rpm[0] | cpio -idv >/dev/null 2>&1"); + + rmtree("$tmpdir/usr/share"); + system("mv $tmpdir/usr $repopath/nvidia/"); + + rmtree($tmpdir); + +} + +sub installAti +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $srinfo = `head -n1 /etc/SuSE-release`; + my @data = split (/ /, $srinfo); + chomp(@data); + + my $version = $data[1]; + my $chost = substr($data[2],1,-1); + + my $ret = $self->SUPER::installAti(@_); + + if($ret =~ /^error$/) { + print "Something went wrong intalling ATI files!\n"; + return; + } + + $self->SUPER::getdkms(); + + my $kver = "2.6.25.20-0.1"; + my $ksuffix = "pae"; + + # here we have to compile the kernel modules for all kernels + # + my $ati_version = `head $repopath/$pkgpath/ati-driver-installer-9-1-x86.x86_64.run | grep -P -o '[0-9]+\.[0-9]{3}' | tail -n1`; + chomp($ati_version); + + system("mv $ret /usr/src/fglrx-$ati_version >/dev/null 2>&1"); + + open FH,">/usr/src/fglrx-$ati_version/dkms.conf"; + print FH "DEST_MODULE_LOCATION=/updates\n"; + print FH "PACKAGE_NAME=fglrx\n"; + print FH "PACKAGE_VERSION=$ati_version\n"; + close FH; + + my $cmd = "#============= Executing following command =============\n". + "/sbin/dkms ". + " -m fglrx -v $ati_version ". + " -k $kver-$ksuffix ". + " --kernelsourcedir /usr/src/linux-$kver-obj/i586/$ksuffix ". + " --no-prepare-kernel ". + " --no-clean-kernel ". + " build \n". + "#=========================================================="; + +# print $cmd; + if(!-f "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") { + system("/sbin/dkms add -m fglrx -v $ati_version"); + system($cmd." >/dev/null 2>&1"); + } + + if(!-d "$repopath/ati/modules/") + { + mkdir( "$repopath/ati/modules/" ); + } + copyFile("/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko", + "$repopath/ati/modules"); + #if ($? > 0) { + # print "\n\nCould not copy! Exit with Ctrl-D\n"; + # system("/bin/bash"); + #} + rmtree("$repopath/ati/temp"); + + +} + 1; diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm index d422c589..537ef54c 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Ubuntu.pm @@ -42,4 +42,29 @@ sub setupXserverScript return $script; } + +sub installNvidia +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $distroName = $self->{engine}->distroName(); + + system($repopath."/ubuntu-gfx-install.sh nvidia $distroName"); + +} + +sub installAti +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + my $distroName = $self->{engine}->distroName(); + + system($repopath."/ubuntu-gfx-install.sh ati $distroName"); + +} + 1; |
