* Jonas Smedegaard <[EMAIL PROTECTED]> [070330 20:54]: > This raises another question: It seems to me that this patch will fail > for kernels that offers devspec in sysfs but does not ship with a > modules.ofmap file.
- Without this patch the kernel running at the time yaird is called has sysfs support for openfirmware, then yaird fails with "unrecognized device" and I found no way to make it run without patching it. - If a new official kernel is installed, or a new package build with make-kpkg, or a kernel installed by hand without removing files, it will have a ofmap file. (I think make-kpkg just installes all map files, and the ofmap support added consists of removing the file when deinstalling). So the only point it could even be a problem is when a new yaird is used to install an old kernel. Attached modified patch makes missing that file only a warning and no fatal error, so it should even work in those cases. Hochachtungsvoll, Bernhard R. Link P.S: somehow your mails do not seem to arrive here. I'll keep polling the bugreport for new mails, though my answer times might a bit long due to this. P.P.S: Please also consider to always add esp.ko for sparc (as requested by #341522). This will vastly increase the usability for sparc, as it will both support older kernels and upgrading kernels from and old non-sysfs aware kernel (like sarge's) to a new one (like etch's). I've never seen a sun sparc not needing esp as their scsi driver. (Though I know nothing of the very new ones, though they propably have ide anyway so it stays true).
diff -r -u -N yaird.original/usr/lib/yaird/perl/Conf.pm /usr/lib/yaird/perl/Conf.pm --- yaird.original/usr/lib/yaird/perl/Conf.pm 2006-08-27 05:36:27.000000000 +0200 +++ /usr/lib/yaird/perl/Conf.pm 2006-11-01 12:01:37.000000000 +0100 @@ -51,6 +51,9 @@ pciMap => sub { get('libModules') . '/' . get('version') . '/modules.pcimap'; }, + ofMap => sub { get('libModules') + . '/' . get('version') + . '/modules.ofmap'; }, ccwMap => sub { get('libModules') . '/' . get('version') . '/modules.ccwmap'; }, diff -r -u -N yaird.original/usr/lib/yaird/perl/Hardware.pm /usr/lib/yaird/perl/Hardware.pm --- yaird.original/usr/lib/yaird/perl/Hardware.pm 2006-08-27 05:36:26.000000000 +0200 +++ /usr/lib/yaird/perl/Hardware.pm 2006-11-01 12:55:54.000000000 +0100 @@ -30,6 +30,8 @@ use ScsiDev; use PciDev; use PciTab; +use OpenFirmwareDev; +use OpenFirmwareTab; use UsbDev; use UsbTab; use CcwDev; @@ -74,6 +76,12 @@ $modules = UsbTab::find ($dev); } + elsif (-f "$abspath/devspec") { + # OpenFirmware specification + my $dev = OpenFirmwareDev->new (path => $abspath); + $modules = OpenFirmwareTab::find ($dev); + } + elsif ($abspath =~ m!/css0$!) { # S390 Channel SubSystem; harmless } @@ -245,7 +253,6 @@ elsif ($abspath =~ m!/floppy.\d+$!) { $modules = [ "floppy" ]; } - else { # NOTE: We may want to avoid duplicate messages Base::error ("unrecognised device: $abspath"); diff -r -u -N yaird.original/usr/lib/yaird/perl/OpenFirmwareDev.pm /usr/lib/yaird/perl/OpenFirmwareDev.pm --- yaird.original/usr/lib/yaird/perl/OpenFirmwareDev.pm 1970-01-01 01:00:00.000000000 +0100 +++ /usr/lib/yaird/perl/OpenFirmwareDev.pm 2006-11-01 12:01:05.000000000 +0100 @@ -0,0 +1,42 @@ +#!perl -w +# +# OpenFirmwareDev -- the probed values for a PCI device, as found in /sys. +# this file is based on PciDev which is +# Copyright (C) 2005 Erik van Konijnenburg +# and modified for OpenFirmware by Bernhard R. Link in 2006 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +use strict; +use warnings; +use Base; +package OpenFirmwareDev; +use base 'Obj'; + +sub fill { + my $self = shift; + $self->SUPER::fill(); + $self->takeArgs ('path'); + my $path = $self->path; + my $devspec = Base::getStringFile ("$path/devspec"); + $devspec =~ s/.*\///; + $devspec =~ s/@[EMAIL PROTECTED]//; + $self->{name} = $devspec; +} + +sub path { return $_[0]->{path}; } +sub name { return $_[0]->{name}; } + +1; diff -r -u -N yaird.original/usr/lib/yaird/perl/OpenFirmwareMapEntry.pm /usr/lib/yaird/perl/OpenFirmwareMapEntry.pm --- yaird.original/usr/lib/yaird/perl/OpenFirmwareMapEntry.pm 1970-01-01 01:00:00.000000000 +0100 +++ /usr/lib/yaird/perl/OpenFirmwareMapEntry.pm 2006-11-01 12:18:37.000000000 +0100 @@ -0,0 +1,51 @@ +#!perl -w +# +# OpenFirmwareMapEntry - iencapsulate a line form modules.ofmap. +# this file is bases on PciMapEnty which is +# Copyright (C) 2005 Erik van Konijnenburg +# and changed for OpenFirmware by Bernhard R. Link in 2006 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +# +# Knows how to match, can return module name. +# + +use strict; +use warnings; +use Base; +package OpenFirmwareMapEntry; +use base 'Obj'; + +sub fill { + my $self = shift; + $self->SUPER::fill(); + $self->takeArgs ('module', 'name', 'type', 'compatible'); +} + +sub module { return $_[0]->{module}; } + +sub matches { + my ($self, $dev) = @_; + # As /sys only contains the name, neigther type nor compatible + # can be checked... + if ($self->{name} eq $dev->name) { + return 1; + } + return 0; +} + +1; + diff -r -u -N yaird.original/usr/lib/yaird/perl/OpenFirmwareTab.pm /usr/lib/yaird/perl/OpenFirmwareTab.pm --- yaird.original/usr/lib/yaird/perl/OpenFirmwareTab.pm 1970-01-01 01:00:00.000000000 +0100 +++ /usr/lib/yaird/perl/OpenFirmwareTab.pm 2006-11-01 12:57:26.000000000 +0100 @@ -0,0 +1,90 @@ +#!perl -w +# +# OpenFirmwareTab -- encapsulate modules.ofmap +# this file is based on PciTab which is +# Copyright (C) 2005 Erik van Konijnenburg +# changed for OpenFirmware by Bernhard R. Link in 2006 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +use strict; +use warnings; +use Base; +use Conf; +use OpenFirmwareMapEntry; +package OpenFirmwareTab; + +my $ofList = undef; + +# Parse this: +# # of module name type compatible +# esp SUNW,esp * * +# esp SUNW,fas * * +# esp esp * * +# parport_sunbpp SUNW,bpp * * + +sub init () { + if (defined ($ofList)) { + return; + } + $ofList = []; + my $name = Conf::get('ofMap'); + if (! open (IN, "<", "$name")) { + Base::warning ("can't open of module list $name"); + return; + } + while (defined (my $line = <IN>)) { + chomp $line; + $line =~ s/#.*//; + $line =~ s/^\s+//; + $line =~ s/\s+$//; + next if ($line eq ""); + my @fields = split (/\s+/, $line, 999); + if ($#fields != 3) { + Base::fatal "malformed line in of module list $name"; + } + push @{$ofList}, OpenFirmwareMapEntry->new ( + module => $fields[0], + name => $fields[1], + type => $fields[2], + compatible => $fields[3], + ); + } + if (! close (IN)) { + Base::fatal "could not read of module list $name"; + } +} + +sub all () { + init; + return $ofList; +} + +# given pathname in devices tree, find module name in OF map as a list. +sub find ($) { + my ($dev) = @_; + my @result = (); + for my $ome (@{OpenFirmwareTab::all()}) { + if ($ome->matches ($dev)) { + push @result, $ome->module; + } + } + return [EMAIL PROTECTED]; +} + + +1; +