From 6fb82427d4e3cb76e20700d8e0cfb609056ec2b9 Mon Sep 17 00:00:00 2001 From: Bastian Wissler Date: Fri, 5 Jun 2009 18:17:40 +0000 Subject: Various changes to xserver plugin: * added support for kernel version detection - yet from local function * now falls back to ati package installation, if download fails ATTENTION: If you have a recent Kernel Version in Suse-11.1, consider downgrading your Kernel to support fglrx-drivers from their RPM repository. git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2937 95ad53e4-c205-0410-b2fa-d234c58c8868 --- os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm | 106 ++++++++++++++++++++-- 1 file changed, 97 insertions(+), 9 deletions(-) (limited to 'os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm') diff --git a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm index b96f6ffb..e9505b4e 100644 --- a/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm +++ b/os-plugins/plugins/xserver/OpenSLX/Distro/Suse.pm @@ -23,7 +23,9 @@ use File::Path; use OpenSLX::Basics; use OpenSLX::Utils; +use OpenSLX::DistroUtils; +use Data::Dumper; ################################################################################ ### interface methods @@ -63,9 +65,9 @@ sub installNvidia system("rm -rf $tmpdir/*"); } - # TODO: Sort out kernel version programmatically - my $kver = "2.6.25.20-0.1"; - my $ksuffix = "pae"; + my $mykernel = $self->SUPER::getKernelVersion("/boot"); + my $kver = $mykernel->{'version'}; + my $ksuffix = $mykernel->{'suffix'}; my $srinfo = `head -n1 /etc/SuSE-release`; my @data = split (/ /, $srinfo); @@ -88,7 +90,7 @@ sub installNvidia my $rpm = @rpm; if($rpm == 0) { - print "Could not find nvidia kernel module rpm on filesystem!"; + print "Could not download nvidia kernel module rpm!"; return; } @@ -143,11 +145,12 @@ sub installAti system("rm -rf $tmpdir/*"); } - # TODO: Sort out kernel version programmatically - my $kver = "2.6.25.20-0.1"; + my $mykernel = $self->SUPER::getKernelVersion("/boot"); + my $kver = $mykernel->{'version'}; my $kver_ati = $kver; $kver_ati =~ s/-/_/; - my $ksuffix = "pae"; + + my $ksuffix = $mykernel->{'suffix'}; my $srinfo = `head -n1 /etc/SuSE-release`; my @data = split (/ /, $srinfo); @@ -170,8 +173,9 @@ sub installAti my $rpm = @rpm; if($rpm == 0) { - print "Could not find ATI kernel module rpm on filesystem!\n"; - print "Exiting!"; + print "Could not download ATI kernel module rpm (for kernel $kver)!\n"; + print "Consider downgrading your Kernel! \nTrying package-install!\n"; + $self->installAtiOldStyle(@_); return; } @@ -215,4 +219,88 @@ sub installAti rmtree($tmpdir); } + + +sub installAtiOldStyle +{ + my $self = shift; + my $repopath = shift || "/opt/openslx/plugin-repo/xserver/"; + my $pkgpath = shift || "packages"; + + + my $ret = $self->SUPER::installAti(@_); + + if($ret =~ /^error$/) { + print "Something went wrong installing ATI files!\n"; + return; + } + + $self->SUPER::getdkms(); + my $mykernel = $self->SUPER::getKernelVersion("/boot"); + my $kver = $mykernel->{'version'}; + my $kver_ati = $kver; + $kver_ati =~ s/-/_/; + + my $ksuffix = $mykernel->{'suffix'}; + + my $srinfo = `head -n1 /etc/SuSE-release`; + my @data = split (/ /, $srinfo); + chomp(@data); + + my $version = $data[1]; + my $chost = substr($data[2],1,-1); + + # here we have to compile the kernel modules for all kernels + # + my $ati_version = `head $repopath/$pkgpath/ati-driver-installer-*.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 >/dev/null 2>&1 \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 >/dev/null 2>&1"); + system($cmd); + #if ($? > 0) { + # print "\n\nCould not compile module! Exit with Ctrl-D\n"; + # system("/bin/bash"); + #} + } + + + if(!-d "$repopath/ati/modules/") + { + mkdir( "$repopath/ati/modules/" ); + } + + if( -e "/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko") { + copyFile("/var/lib/dkms/fglrx/$ati_version/$kver-$ksuffix/$chost/module/fglrx.ko", + "$repopath/ati/modules"); + } + else { + print "Could not install ati driver via pkg-installer!\n"; + rmtree($repopath."/ati"); + return; + } + rmtree("$repopath/ati/temp"); + + +} + 1; -- cgit v1.2.3-55-g7522