From ddcdb532df623950e0b94e598acb2147c2697284 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Fri, 13 Feb 2004 13:58:16 +0000 Subject: fix deps problem because of 2.4/2.6 mappings, better support 2.4 and 2.6 alltogether by keeping 2.4 names in modules.conf --- perl-install/modules.pm | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/perl-install/modules.pm b/perl-install/modules.pm index 2bda575c7..0091ba2da 100644 --- a/perl-install/modules.pm +++ b/perl-install/modules.pm @@ -1,7 +1,7 @@ package modules; # $Id$ use strict; -use vars qw(%conf); +use vars qw(%conf %mappings_24_26 %mappings_26_24); use common; use detect_devices; @@ -25,6 +25,30 @@ sub category2modules_and_description { map { $_ => $modules_descriptions{$_} } category2modules($categories); } +%mappings_24_26 = ("usb-ohci" => "ohci-hcd", + "usb-uhci" => "uhci-hcd", + "uhci" => "uhci-hcd", + "printer" => "usblp", + "bcm4400" => "b44", + "3c559" => "3c359", + "3c90x" => "3c59x", + "dc395x_trm" => "dc395x"); +%mappings_26_24 = reverse %mappings_24_26; +sub mapping_24_26 { + return map { c::kernel_version() =~ /^\Q2.6/ ? $mappings_24_26{$_} || $_ : $_ } @_; +} +sub mapping_26_24 { + my ($modname) = @_; + if (c::kernel_version() =~ /^\Q2.6/) { + if ($modname eq 'uhci-hcd') { + return 'usb-uhci'; + } else { + return $mappings_26_24{$modname} || $modname; + } + } + $modname; +} + #-############################################################################### #- module loading #-############################################################################### @@ -36,11 +60,7 @@ sub load { my @l = map { my ($name, @options) = ref($_) ? @$_ : $_; $options{$name} = \@options; - my @l = dependencies_closure($name); - if (c::kernel_version() =~ /^\Q2.6/) { - push @l, "$1-hcd" if $name =~ /(uhci|ohci)/; # usb-uhci, uhci, usb-ohci are deprecated in 2.6 - } - @l; + dependencies_closure(mapping_24_26($name)); } @_; @l = difference2([ uniq(@l) ], [ map { my $s = $_; $s =~ s/_/-/g; $s, $_ } loaded_modules() ]) or return; @@ -370,6 +390,8 @@ sub name2file { sub when_load { my ($name, @options) = @_; + $name = mapping_26_24($name); #- need to stay with 2.4 names, modutils will allow booting 2.4 and 2.6 + if ($name =~ /[uo]hci/) { -f '/proc/bus/usb/devices' or eval { require fs; fs::mount('/proc/bus/usb', '/proc/bus/usb', 'usbdevfs'); -- cgit v1.2.1