summaryrefslogtreecommitdiffstats
path: root/kernel/modules.pl
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/modules.pl')
-rw-r--r--kernel/modules.pl201
1 files changed, 104 insertions, 97 deletions
diff --git a/kernel/modules.pl b/kernel/modules.pl
index 4f5c948db..9ec6f5356 100644
--- a/kernel/modules.pl
+++ b/kernel/modules.pl
@@ -11,107 +11,87 @@ use MDK::Common;
use list_modules;
-my @skip_big_modules_on_stage1 = (
-qw(
-olympic
-sk98lin acenic
-3c90x
-ns83820
-aironet4500_card aironet4500_core com20020-pci hamachi starfire winbond-840
-
-dc395x_trm
-BusLogic seagate fdomain g_NCR5380
-)
-);
-
-my @skip_modules_on_stage1 = (
- qw(sktr tmspci ibmtr abyss), # alt token ring
- qw(old_tulip rtl8139),
- if_(arch() =~ /alpha|ppc/, qw(sb1000)),
- qw(
- apa1480_cb
- imm ppa plip
- 3w-xxxx pci2220i qla2x00 i2o_block
- eata_pio eata_dma
- qla2200 qla2300
- iph5526
- ),
- 'AM53C974', # deprecated by tmscsim
- qw(ac3200 at1700 atp ni5010 ni52 ni65), #- unused from Jeff
- "u14-34f", #- duplicate from ultrastor.o
-);
-
-my %images = (
- network => 'fs/network network/raw bus/pcmcia network/main',
- hd => 'disk/raw fs/local|loopback disk/scsi|hardware_raid',
- other => 'disk/scsi|hardware_raid network/main ONLY_BIG fs/cdrom disk/cdrom|raw fs/network network/raw',
- pcmcia => 'fs/cdrom disk/cdrom|raw|pcmcia bus/pcmcia fs/network network/pcmcia|raw',
- cdrom => 'fs/cdrom disk/cdrom|raw|scsi',
- usb => 'fs/cdrom disk/cdrom|raw bus/usb disk/usb fs/network network/usb|raw',
- all => 'fs/cdrom disk/cdrom|raw bus/usb disk/usb|scsi fs/loopback|local bus/pcmcia disk/pcmcia|hardware_raid fs/network network/main|pcmcia|usb|raw',
-);
-
-my $verbose = "@ARGV" =~ /-v/;
-images() if "@ARGV" =~ /images/;
-check() if "@ARGV" =~ /check/;
-pci_modules4stage1($1) if "@ARGV" =~ /pci_modules4stage1:(.*)/;
-
-sub images {
- load_dependencies('modules.dep');
-
- while (my ($image, $l) = each %images) {
- my @modules;
- foreach (split(' ', $l)) {
- if (/ONLY_BIG/) {
- @modules = intersection(\@modules, \@skip_big_modules_on_stage1);
- next;
+sub flatten_and_check {
+ my ($h) = @_;
+ map {
+ my $category = $_;
+ my @l = @{$h->{$category}};
+ if (my @bad = difference2(\@l, [ category2modules($category) ])) {
+ foreach (@bad) {
+ if (my $cat = module2category($_)) {
+ warn "ERROR in modules.pl: module $_ is in category $cat, not in $category\n";
+ } else {
+ warn "ERROR in modules.pl: unknown module $_\n";
+ }
}
- push @modules, category2modules($_);
+ exit 1;
}
+ @l;
+ } keys %$h;
+}
- if ($image !~ /all/) {
- @modules = difference2(\@modules, \@skip_modules_on_stage1);
- }
- if ($image !~ /other|all/) {
- @modules = difference2(\@modules, \@skip_big_modules_on_stage1)
- }
- @modules = map { dependencies_closure($_) } @modules;
- printf qq(%s_modules="%s"\n), $image, join(" ", map { "$_.o" } @modules);
+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);
+
+sub modules() {
+ my @nls_modules = ('nls_cp437', 'nls_iso8859_1');
+ @nls_modules, map { category2modules($_) } split(' ', $images_cat);
+}
+
+sub list_needed_modules {
+ my ($kern_ver) = @_;
+
+ load_dependencies("/lib/modules/$kern_ver/modules.dep");
+
+ 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";
+ }
+}
+
+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 difference2([ category2modules($_[0]) ], \@skip_modules_on_stage1);
+ my ($category) = @_;
+ my @modules = difference2([ category2modules($category) ]);
+ print "$_\n" foreach uniq(map { dependencies_closure($_) } @modules);
}
-sub check {
+sub check() {
my $error;
my %listed;
- my %big_modules_categories;
while (my ($t1, $l) = each %list_modules::l) {
while (my ($t2, $l) = each %$l) {
ref $l or die "bad $l in $t1/$t2";
foreach (@$l) {
- $listed{$_} = 1;
- push @{$big_modules_categories{$t1}{$t2}}, $_ if member($_, @skip_modules_on_stage1);
- }
- }
- }
-
- # remove accepted categories for other.img
- delete $big_modules_categories{disk}{hardware_raid};
- delete $big_modules_categories{disk}{scsi};
- delete $big_modules_categories{network}{main};
-
- if (map { %$_ } values %big_modules_categories) {
- my @l = map { "$_/" . join('|', sort keys %{$big_modules_categories{$_}}) } sort keys %big_modules_categories;
- print STDERR "WEIRD CATEGORIES USED FOR other.img: ", join(" ", @l), "\n";
- if ($verbose) {
- while (my ($t1, $t2s) = each %big_modules_categories) {
- print "$t1/$_ used for other.img: ", join(" ", @{$t2s->{$_}}), "\n" foreach keys %$t2s;
+ $listed{$_} = "$t1/$t2";
}
}
- $error = 1;
}
my %module2category;
@@ -120,10 +100,10 @@ sub check {
my ($msg, $verbose, @l) = @_;
my %not_listed;
foreach (@l) {
- my ($mod) = m|([^/]*)\.o(\.gz)?$| or next;
+ 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($_);
@@ -134,32 +114,59 @@ sub check {
print "$msg $_: ", join(" ", @{$not_listed{$_}}), "\n" foreach sort keys %not_listed;
}
};
- $not_listed->('NOT LISTED', 1, `cd all.kernels/2.4* ; find -name "*.o" -o -name "*.o.gz"`);
- $not_listed->('not listed', $verbose, `rpm -qpl /RPMS/kernel-2.4*`);
- print "bad/old modules : ", join(" ", sort keys %deprecated_modules), "\n" if %deprecated_modules;
+ $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;
+ foreach my $cat (sort keys %per_cat) {
+ print "bad/old modules ($cat) : ", join(" ", sort @{$per_cat{$cat}}), "\n";
+ }
+ }
{
require '/usr/bin/merge2pcitable.pl';
my $pcitable = read_pcitable("/usr/share/ldetect-lst/pcitable");
my $usbtable = read_pcitable("/usr/share/ldetect-lst/usbtable");
- my @l = uniq grep { !/:/ && $_ ne 'unknown' } map { $_->[0] } values %$pcitable;
- if (my @l = difference2(\@l, [ keys %listed ])) {
+ my @l1 = uniq grep { !/:/ && $_ ne 'unknown' } map { $_->[0] } values %$pcitable;
+ if (my @l = difference2(\@l1, [ keys %listed ])) {
my %not_listed;
push @{$not_listed{$module2category{$_}}}, $_ foreach @l;
- print STDERR "PCITABLE MODULES NOT LISTED $_: ", join(" ", @{$not_listed{$_}}), "\n" foreach sort keys %not_listed;
+ if (my $l = delete $not_listed{''}) {
+ print "bad/old pcitable modules : ", join(" ", @$l), "\n";
+ }
+ print STDERR "PCITABLE MODULES NOT LISTED $_: ", join(" ", sort @{$not_listed{$_}}), "\n" foreach sort keys %not_listed;
#$error = 1;
}
- my @l = uniq grep { !/:/ && $_ ne 'unknown' } map { $_->[0] } values %$usbtable;
- if (my @l = difference2(\@l, [ keys %listed ])) {
+ my @l2 = uniq grep { !/:/ && $_ ne 'unknown' } map { $_->[0] } values %$usbtable;
+ 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;
+ }
+ }
+ }
+}