diff options
Diffstat (limited to 'kernel/modules.pl')
| -rw-r--r-- | kernel/modules.pl | 161 |
1 files changed, 66 insertions, 95 deletions
diff --git a/kernel/modules.pl b/kernel/modules.pl index 587674e8f..9ec6f5356 100644 --- a/kernel/modules.pl +++ b/kernel/modules.pl @@ -10,69 +10,6 @@ BEGIN { use MDK::Common; use list_modules; -#- seldom used modules -#- we don't bother making a special floppy for those -my %modules_only_for_all_img = ( - - 'network/main' => [ - qw(olympic acenic), - qw(aironet4500_card com20020-pci hamachi starfire winbond-840), - - # token ring - qw(tmspci ibmtr abyss), - - if_(arch() =~ /x86_64/, qw(orinoco_plx)), # don't support laptop for now - if_(arch() =~ /x86_64/, qw(hp100 epic100)), # old (nico) - if_(arch() =~ /alpha|ppc/, qw(sb1000)), - qw(iph5526), - - qw(ac3200 at1700 atp ni5010 ni52 ni65), #- unused from Jeff - ], - - 'bus/pcmcia' => [ - if_(arch() =~ /x86_64/, qw(pcmcia_core ds tcic yenta_socket)), # don't support laptop for now - if_(arch() =~ /x86_64/, qw(i82092 i82365)), # doco says "older laptops" - ], - - 'disk/scsi' => [ - # ISA cards: - qw(NCR53c406a aha152x psi240i qlogicfas qlogicfc wd7000 sim710 t128 ultrastor), '53c7,8xx', - qw(qla2x00 in2000 pas16 a100u2w seagate g_NCR5380), - if_(arch() =~ /x86_64/, qw(53c7,8xx nsp32 initio advansys atp870u)), #- old - qw(AM53C974), # deprecated by tmscsim - qw(u14-34f), #- duplicate from ultrastor.o - #- still used, keeping them: qw(aha1542 sym53c416), - qw(lpfcdd), #- HUGE!! - - qw(dc395x_trm mptscsih BusLogic fdomain), - qw(pci2220i eata eata_pio eata_dma), - 'aic7xxx_old', 'qlogicisp', - 'dtc', - ], - - 'disk/hardware_raid' => [ - if_(arch() =~ /x86_64/, qw(ataraid)), #- old - qw(i2o_block qla2200 qla2300 cpqfc DAC960 gdth pdc-ultra), - ], -); - -#- modules that will only be available in stage2 -#- those modules are NOT in all.img, network.img... -#- there should only be modules that can't be used on stage1 -#- completly unused modules should be removed directly from the kernel -#- (and so be removed from stage2 too) -my %modules_removed_from_stage1 = ( - 'network/main' => [ - 'plip' - ], - - 'disk/hardware_raid' => [ - qw(imm ppa), - ], -); - -my @modules_always_on_stage1 = qw(floppy); - sub flatten_and_check { my ($h) = @_; @@ -93,40 +30,56 @@ sub flatten_and_check { } keys %$h; } -my @modules_only_for_all_img = flatten_and_check(\%modules_only_for_all_img); -my @modules_removed_from_stage1 = flatten_and_check(\%modules_removed_from_stage1); +my $images_cat = 'fs/* disk/* bus/* network/* input/* various/*'; #- ie everything except multimedia +my $verbose = $ARGV[0] eq '-v' && shift; +my ($f, @para) = @ARGV; +$::{$f}->(@para); -my %images = ( - pcmcia => 'fs/cdrom disk/cdrom|raw|pcmcia bus/pcmcia', - cdrom => 'fs/cdrom disk/cdrom|raw|scsi', - network => 'bus/usb|usb_keyboard|pcmcia disk/raw|usb', - network_drivers => 'fs/network network/main|pcmcia|usb|raw|gigabit', - all => 'fs/cdrom disk/cdrom|raw bus/usb|usb_keyboard disk/usb|scsi fs/loopback|local bus/pcmcia disk/pcmcia|hardware_raid fs/network network/main|pcmcia|usb|raw|gigabit bus/firewire disk/firewire', -); +sub modules() { + my @nls_modules = ('nls_cp437', 'nls_iso8859_1'); + @nls_modules, map { category2modules($_) } split(' ', $images_cat); +} -my $verbose = "@ARGV" =~ /-v/; -images() if "@ARGV" =~ /images/; -check() if "@ARGV" =~ /check/; -pci_modules4stage1($1) if "@ARGV" =~ /pci_modules4stage1:(.*)/; +sub list_needed_modules { + my ($kern_ver) = @_; -sub images() { - while (my ($image, $l) = each %images) { - my @modules = if_($image !~ /drivers/, @modules_always_on_stage1); - push @modules, map { category2modules($_) } split(' ', $l); - - @modules = difference2(\@modules, \@modules_removed_from_stage1); + load_dependencies("/lib/modules/$kern_ver/modules.dep"); - if ($image !~ /all/) { - @modules = difference2(\@modules, \@modules_only_for_all_img); - } - printf qq(%s_modules_raw="%s"\n), $image, join ' ', @modules; + my @all = modules(); + my @all_with_deps = map { dependencies_closure($_) } @all; + my %wanted_modules = map { (list_modules::modname2filename($_) => 1) } @all_with_deps; + foreach (`find /lib/modules/$kern_ver -name '*.ko.?z'`) { + my $modfile = basename($_); + $modfile =~ s/\.ko\.xz//; + $wanted_modules{$modfile} and print "$modfile\n"; + } +} + +sub list_fake_modules { + my ($kern_ver) = @_; + + load_dependencies("/lib/modules/$kern_ver/modules.dep"); + + my @all = map { category2modules($_) } split(' ', 'multimedia/*'); + my %wanted_modules = map { (list_modules::modname2filename($_) => 1) } @all; + foreach (`find /lib/modules/$kern_ver -name '*.ko.?z'`) { + my $modfile = basename($_); + $modfile =~ s/\.ko\.xz//; + $wanted_modules{$modfile} and print "$modfile\n"; } - printf qq(images="%s"\n), join(' ', keys %images); +} + +sub get_main_modules() { + my $base = dirname($0); + my $main = chomp_(cat_("$base/RPMS/.main")); + chomp_(`tar tf $base/all.kernels/$main/all_modules.tar`); } sub pci_modules4stage1 { - print "$_\n" foreach uniq(map { dependencies_closure($_) } difference2([ category2modules($_[0]) ], \@modules_removed_from_stage1)); + my ($category) = @_; + my @modules = difference2([ category2modules($category) ]); + print "$_\n" foreach uniq(map { dependencies_closure($_) } @modules); } sub check() { @@ -150,7 +103,7 @@ sub check() { my ($mod) = m|([^/]*)\.k?o(\.gz)?$| or next; delete $deprecated_modules{$mod}; next if $listed{$mod}; - s|.*?mdk(BOOT)?/||; + s|.*?mdk/||; s|kernel/||; s|drivers/||; s|3rdparty/||; $_ = dirname $_; $_ = dirname $_ if $mod eq basename($_); @@ -161,8 +114,8 @@ sub check() { print "$msg $_: ", join(" ", @{$not_listed{$_}}), "\n" foreach sort keys %not_listed; } }; - $not_listed->('NOT LISTED', 1, `cd all.kernels/2.6* ; find -name "*.k?o" -o -name "*.k?o.gz"`); - $not_listed->('not listed', $verbose, `rpm -qpl /RPMS/kernel-2.6*`); + $not_listed->('NOT LISTED', 1, get_main_modules()); + $not_listed->('not listed', $verbose, chomp_(`rpm -qpl RPMS/kernel-*2.6*`)); if (%deprecated_modules) { my %per_cat; push @{$per_cat{$listed{$_}}}, $_ foreach keys %deprecated_modules; @@ -183,7 +136,7 @@ sub check() { if (my $l = delete $not_listed{''}) { print "bad/old pcitable modules : ", join(" ", @$l), "\n"; } - print STDERR "PCITABLE MODULES NOT LISTED $_: ", join(" ", @{$not_listed{$_}}), "\n" foreach sort keys %not_listed; + print STDERR "PCITABLE MODULES NOT LISTED $_: ", join(" ", sort @{$not_listed{$_}}), "\n" foreach sort keys %not_listed; #$error = 1; } @@ -191,11 +144,29 @@ sub check() { if (my @l = difference2(\@l2, [ keys %listed ])) { my %not_listed; push @{$not_listed{$module2category{$_}}}, $_ foreach @l; - if ($verbose) { - print "usbtable modules not listed $_: ", join(" ", @{$not_listed{$_}}), "\n" foreach sort keys %not_listed; - } + print STDERR "usbtable modules not listed $_: ", join(" ", sort @{$not_listed{$_}}), "\n" foreach sort keys %not_listed; } } exit $error; } + +sub list_additional_firmware { + my ($kern_ver) = @_; + + # The firmware reported by 'modinfo iwlwifi' is the latest supported version of each firmware + # type. Sometimes the latest supported version is not available, and the driver falls back to + # an older version. This means dracut doesn't automatically identify and include the necessary + # firmware files, so we need to list them here (mga#9541). + foreach (map { /^firmware:\s+(.*)/ ? $1 : () } split("\n", `modinfo -k $kern_ver iwlwifi`)) { + next if -f "/lib/firmware/$_"; + my ($basename, $version) = /(.*)-([0-9]+).ucode/; + while ($version-- > 0) { + my $filepath = "/lib/firmware/$basename-$version.ucode"; + if (-f $filepath) { + print "$filepath\n"; + last; + } + } + } +} |
