summaryrefslogtreecommitdiffstats
path: root/os-plugins
diff options
context:
space:
mode:
authorBastian Wissler2009-05-06 15:22:03 +0200
committerBastian Wissler2009-05-06 15:22:03 +0200
commit7d0d899f6ce70084c30bca7fba9784694beece12 (patch)
tree3884c9972e3349ca43e4d6ab13a435b98ad49558 /os-plugins
parentBugfix: vmware kind var not defined (diff)
downloadcore-7d0d899f6ce70084c30bca7fba9784694beece12.tar.gz
core-7d0d899f6ce70084c30bca7fba9784694beece12.tar.xz
core-7d0d899f6ce70084c30bca7fba9784694beece12.zip
xserver plugin:
* switched to stage1-ld.so.cache generation * ld.so.cache /ld.so.conf is copied/changed in stage3 git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2842 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins')
-rw-r--r--os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm129
-rw-r--r--os-plugins/plugins/xserver/XX_xserver.sh46
2 files changed, 52 insertions, 123 deletions
diff --git a/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm b/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm
index e3522f35..b21d579a 100644
--- a/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm
+++ b/os-plugins/plugins/xserver/OpenSLX/OSPlugin/xserver.pm
@@ -131,8 +131,7 @@ sub getAttrInfo
description => unshiftHereDoc(<<' End-of-Here'),
Path to downloaded ATI or Nvidia package
End-of-Here
- # TODO:
- #content_regex => qr{^0|1$},
+ content_regex => qr{^.+$}, # not empty
content_descr => 'Path to Nvidia or ATI packages',
default => '/root/xserver-pkgs',
},
@@ -196,7 +195,6 @@ sub preInstallationPhase()
}
if (-d $pkgpath && ($installNvidia == 1 || $installAti == 1)) {
- # Todo: use a openslx copy function!
system("cp -r $pkgpath $self->{pluginRepositoryPath}/packages");
}
@@ -241,8 +239,7 @@ sub installationPhase
my $engine = $self->{'os-plugin-engine'};
# removeLinks is to remove Links to the files
- # otherwise some wrong files are created
- # this can happed here
+ # TODO: In future versions this call can be removed - deprecated version
$self->removeLinks();
if ($attrs->{'xserver::nvidia'} == 1 || $attrs->{'xserver::ati'} == 1 ) {
@@ -253,23 +250,18 @@ sub installationPhase
$binDrivers = 1;
}
if ($attrs->{'xserver::ati'} == 1) {
- #TODO: if ($vendorOSName contains 'suse-11.1')
- $engine->installPackages(
- $engine->getInstallablePackagesForSelection('libstdc++33')
- );
-
copyFile("$pluginFilesPath/ati-install.sh", "$installationPath");
system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/ati-install.sh $vendorOSName");
- #system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/linkage.sh ati");
}
if ($attrs->{'xserver::nvidia'} == 1) {
copyFile("$pluginFilesPath/nvidia-install.sh", "$installationPath");
system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/nvidia-install.sh $vendorOSName");
- #system("/bin/bash /opt/openslx/plugin-repo/$self->{'name'}/linkage.sh nvidia");
}
+
+
if ($binDrivers == 1) {
- $self->linkLibs($info);
+ $self->ldconf($info);
`chmod -R 755 $installationPath`
}
@@ -309,100 +301,57 @@ sub removalPhase
# As this method is being executed while chrooted into the vendor-OS,
# this path is relative to that root (i.e. directly usable).
-
+
+ # TODO (in far future): Remove - linking is deprecated
+ # Make sure nobody has installed the old plugin version
$self->removeLinks();
return;
}
-sub linkLibs
+
+# Create ld.so.conf for the binary drivers
+sub ldconf
{
my $self = shift;
my $info = shift;
- my $pluginRepoPath = $info->{'plugin-repo-path'};
- my $divertFolder = "/var/X11R6/lib/";
my $attrs = $info->{'plugin-attrs'};
+ my $ldincl = $info->{'plugin-repo-path'}.'/';
+ my $ldpl = "/etc/ld.conf.preload";
+ my $ldconf = "/etc/ld.so.conf";
- my @libList;
- unless( $attrs->{'xserver::nvidia'} == 1 ||
- $attrs->{'xserver::ati'} == 1 )
- {
- return;
- }
-
- my $command;
- if( $attrs->{'xserver::nvidia'} == 1 ) {
- $command = "find $pluginRepoPath\/nvidia ".
- "-wholename \"*/xorg/modules\" -prune ".
- "-a '!' -type d -o -name '*so*'";
- @libList = `$command`;
- }
- if( $attrs->{'xserver::ati'} == 1 ) {
- $command = "find $pluginRepoPath/ati -wholename ".
- "\"*/xorg/modules\" -prune ".
- "-a '!' -type d -o -name '*so*'";
- push @libList, `$command` ;
- }
+ ## WRITE ld.so.conf for different GL-implementations ##
- my $libname= '';
- my $divname= '';
- my $oldlib = '';
- my $dirname = '';
- for my $lib (@libList) {
- chomp($lib);
- if($lib =~ /.*(\/usr\/.*?lib\/.*?)$/) {
- # oldlib is the MESA lib
- $oldlib = $1;
- $dirname = dirname($oldlib);
- if( -e $oldlib ) {
- $oldlib =~ /\/usr\/.*?lib\/(.*)/;
- # libname is the Name of MESA lib
- $libname = $1;
-
- # we have to move the original (MESA) file
- # and symlink to a diversion folder
- $divname = $libname;
-
- $divname =~ s/\.so/_MESA.so/;
-
- # move only if both are real files !!
- if( -f $oldlib && ! -l $oldlib && ! -l $lib )
- {
- rename($oldlib, $dirname."/".$divname);
- symlink($divertFolder.$libname, $oldlib);
- #print "DEBUG: symlink 1 $divertFolder.$libname, $oldlib\n";
- }
- elsif( -l $oldlib && -l $lib )
- {
- my $tmp1 = readlink $oldlib;
- my $tmp2 = readlink $lib;
- if( $tmp1 ne $tmp2 )
- {
- # here the links are pointing to different files -
- # as in libGLcore.so.1 in nvidia drivers
- unlink($oldlib);
- symlink($divertFolder.$libname, $oldlib);
- }
- }
- }
- else {
- # this file does not exist
- # check for not existing folders
- unless( -d $dirname ) {
- `mkdir -p $dirname`;
- }
- # just link
- symlink( $lib, $oldlib );
- #print "DEBUG: symlink 2 $lib, $oldlib\n";
- }
- }
- }
+ open(IN,'>'.$ldincl.'nvidia/ld.so.conf');
+ print IN $ldincl."nvidia/usr/lib\n".$ldincl.'nvidia/usr/X11R6/lib';
+ close(IN);
+ open(IN,'>'.$ldincl.'ati/ld.so.conf');
+ print IN $ldincl."ati/usr/lib\n".$ldincl.'ati/usr/X11R6/lib';
+ close(IN);
+
+
+
+ ## CREATE TWO DIFFERENT 'ld.so.cache's ##
+
+ my $ldcache = $ldincl.'/nvidia/ld.so.cache';
+ system('sed -e "1s,^,include '.$ldincl.'nvidia/ld.so.conf\n,g" -i '.$ldconf);
+ #print "Calling ldconfig to create $ldcache ... Please Wait\n";
+ system('ldconfig -C '.$ldcache);
+ system('sed -e "1d" -i '.$ldconf);
+
+ $ldcache = $ldincl.'/ati/ld.so.cache';
+ system('sed -e "1s,^,include '.$ldincl.'ati/ld.so.conf\n,g" -i '.$ldconf);
+ #print "Calling ldconfig to create $ldcache ... Please Wait\n";
+ system('ldconfig -C '.$ldcache);
+ system('sed -e "1d" -i '.$ldconf);
}
+# deprecated
+# removes linked libraries from /usr/lib/
sub removeLinks
{
my $instFolders = "/usr/lib /usr/X11R6/lib";
diff --git a/os-plugins/plugins/xserver/XX_xserver.sh b/os-plugins/plugins/xserver/XX_xserver.sh
index b7f925ea..614fbf0a 100644
--- a/os-plugins/plugins/xserver/XX_xserver.sh
+++ b/os-plugins/plugins/xserver/XX_xserver.sh
@@ -78,12 +78,15 @@ if [ -e /initramfs/plugin-conf/xserver.conf -a \
# this will be written before standard module path into xorg.conf
MODULE_PATH="${PLUGIN_ROOTFS}/usr/lib/xorg/modules/\,\
- ${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\,"
+${PLUGIN_ROOTFS}/usr/X11R6/lib/modules/\,"
xmodule="fglrx"
PLUGIN_PATH="/mnt/${PLUGIN_ROOTFS}"
-
+
+ # impossible to load it directly via stage3 insmod - yes, somehow this is too big
+ chroot /mnt /sbin/insmod ${PLUGIN_ROOTFS}/modules/fglrx.ko
+
# we need some database for driver initialization
- cp -r ${PLUGIN_PATH}/etc/* /mnt/etc
+ cp -r "${PLUGIN_PATH}/etc/ati" /mnt/etc
# if fglrx_dri.so is linked wrong -> we have to link it here
if [ "1" -eq "$( ls -l /mnt/usr/lib/dri/fglrx_dri.so \
@@ -240,37 +243,14 @@ a\ \ InputDevice\ \ "Synaptics TP"\ \ \ \ \ \ "SendCoreEvents"
-i $xfc
fi
- # setup the matching OpenGL, DRI libraries depending on choosen driver
- # type (mesa/gpl, fglrx, nvidia, (matrox)). We should not see nvidia,
- # fglrx here if xserver_prefnongpl is set to "0"
- if [ "${xmodule}" = "fglrx" ]; then
- DRILPATH=/mnt/var/X11R6/lib/usr/X11R6/lib/modules/dri/
- testmkd "${DRILPATH}"
- ln -fs ${PLUGIN_ROOTFS}/usr/lib/dri/fglrx_dri.so ${DRILPATH}/fglrx_dri.so
- ln -fs ${PLUGIN_ROOTFS}/usr/lib/libGL.so.1.2 ${glliblinks}/libGL.so
- ln -fs ${PLUGIN_ROOTFS}/usr/lib/libGL.so.1.2 ${glliblinks}/libGL.so.1
- ln -fs ${PLUGIN_ROOTFS}/usr/lib/libGL.so.1.2 ${glliblinks}/libGL.so.1.2
- # impossible to load it directly via stage3 insmod - yes, somehow this is too big
- chroot /mnt /sbin/insmod ${PLUGIN_ROOTFS}/modules/fglrx.ko
- # we need some pci.ids for fglrx driver
- cp -r "${PLUGIN_PATH}/etc/ati" /mnt/etc
- elif [ "${xmodule}" = "nvidia" ]; then
- # create all relevant libGL links
- # this is the most important thing
- ln -sf ${PLUGIN_ROOTFS}/usr/lib/libGLcore.so.1 \
- ${glliblinks}/libGLcore.so.1
+ ############################################
+ # Copy the appropriate ld.so.cache file
+ ############################################
+ if [ "${xmodule}" = "fglrx" -o "${xmodule}" = "nvidia" ]; then
+ cp ${PLUGIN_PATH}/ld.so.cache /mnt/etc/ld.so.cache
- # create all relevant libGL links
- # libGL.so.1 for NVidia is a link to libGL.so.1.somebignumber
- ln -sf ${PLUGIN_ROOTFS}/usr/lib/libGL.so.1 ${glliblinks}/libGL.so
- ln -sf ${PLUGIN_ROOTFS}/usr/lib/libGL.so.1 ${glliblinks}/libGL.so.1
- ln -sf ${PLUGIN_ROOTFS}/usr/lib/libGL.so.1 ${glliblinks}/libGL.so.1.2
- else
- if [ -e /mnt/usr/lib/libGL_MESA.so.1.2 ]; then
- ln -sf /usr/lib/libGL_MESA.so.1.2 /mnt/var/X11R6/lib/libGL.so
- ln -sf /usr/lib/libGL_MESA.so.1.2 /mnt/var/X11R6/lib/libGL.so.1
- ln -sf /usr/lib/libGL_MESA.so.1.2 /mnt/var/X11R6/lib/libGL.so.1.2
- fi
+ # just in case somebody needs to run ldconfig - insert GL-Libs at the beginning
+ sed -e "1s,^,include ${PLUGIN_ROOTFS}/ld.so.conf\n,g" -i /mnt/etc/ld.so.conf
fi
# check if tablet hardware available, read device information from file