summaryrefslogtreecommitdiffstats
path: root/kernel/modules.pl
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/modules.pl')
-rw-r--r--kernel/modules.pl194
1 files changed, 128 insertions, 66 deletions
diff --git a/kernel/modules.pl b/kernel/modules.pl
index 6e8f04307..e06157368 100644
--- a/kernel/modules.pl
+++ b/kernel/modules.pl
@@ -10,111 +10,170 @@ BEGIN {
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
-)
+#- 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),
+ qw(fealnx 3c990 3c990fx prism2_plx dgrs),
+
+ # token ring
+ qw(tmspci ibmtr abyss),
+
+ qw(3c501 3c503 3c505 3c507 3c515), # unused, hopefully?
+ qw(eepro 82596 de620 depca ewrk3 cs89x0),
+
+ 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
+
+ qw(ewrk3 hamachi ibmtr),
+ qw(ne ni5010 ni52 ni65 nvnet olympic rcpci),
+ qw(skfp tc35815 lanstreamer farsync sdladrv orinoco_pci prism2_plx fealnx 3c990 3c990fx bcm4400),
+
+ qw(acx100_pci eth16i e2100 3c509 orinoco_plx wd eexpress),
+ ],
+
+ 'network/gigabit' => [
+
+ ],
+
+ '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"
+
+ qw(pcmcia_core ds tcic yenta_socket), # don't support laptop for now
+ 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(dc395x_trm mptscsih BusLogic fdomain),
+ qw(pci2220i eata eata_pio eata_dma),
+ 'aic7xxx_old',
+ 'lpfcdd',
+ qw(seagate wd7000 sim710 sym53c416 t128 tmscsim u14-34f ultrastor),
+ qw(eata eata_pio eata_dma nsp32),
+ qw(AM53C974 BusLogic NCR53c406a aha152x aha1542 aha1740 qlogicisp),
+ '53c7,8xx',
+ ],
+
+ 'disk/hardware_raid' => [
+ if_(arch() =~ /x86_64/, qw(ataraid)), #- old
+ qw(i2o_block qla2200 qla2300 cpqfc DAC960 gdth pdc-ultra),
+ ],
);
-my @skip_modules_on_stage1 = (
- qw(sktr tmspci ibmtr abyss), # alt token ring
- qw(old_tulip rtl8139),
- if_(arch() =~ /alpha|ppc/, qw(sb1000)),
- qw(
- tg3 r8169
- 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
+#- 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),
+ qw(ataraid hptraid silraid pdcraid), # ad-hoc raid which is unsupported in stage1 anyway
+ ],
);
+my @modules_always_on_stage1 = qw(floppy);
+
+
+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";
+ }
+ }
+ exit 1;
+ }
+ @l;
+ } 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 = (
+ network_gigabit
+ => 'fs/network network/raw network/gigabit',
+ network_usb
+ => 'fs/network network/raw bus/usb network/usb',
+ network_gigabit_usb
+ => 'fs/network network/raw bus/usb network/gigabit|usb',
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',
+ hdcdrom_usb
+ => 'disk/cdrom|raw fs/local|loopback|cdrom bus/usb disk/usb bus/firewire disk/firewire',
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 bus/firewire disk/firewire',
- 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 bus/firewire disk/firewire',
+ 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|gigabit bus/firewire disk/firewire',
);
+load_dependencies(glob("all.modules/2.4*/modules.dep"));
+
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;
+ my @modules = @modules_always_on_stage1;
foreach (split(' ', $l)) {
- if (/ONLY_BIG/) {
- @modules = intersection(\@modules, \@skip_big_modules_on_stage1);
- next;
- }
push @modules, category2modules($_);
}
+
+ @modules = difference2(\@modules, \@modules_removed_from_stage1);
if ($image !~ /all/) {
- @modules = difference2(\@modules, \@skip_modules_on_stage1);
- }
- if ($image !~ /other|all/) {
- @modules = difference2(\@modules, \@skip_big_modules_on_stage1)
+ @modules = difference2(\@modules, \@modules_only_for_all_img);
}
- @modules = map { dependencies_closure($_) } @modules;
+ @modules = uniq(map { dependencies_closure($_) } @modules);
printf qq(%s_modules="%s"\n), $image, join(" ", map { "$_.o" } @modules);
}
}
sub pci_modules4stage1 {
- print "$_\n" foreach difference2([ category2modules($_[0]) ], \@skip_modules_on_stage1);
+ print "$_\n" foreach uniq(map { dependencies_closure($_) } difference2([ category2modules($_[0]) ], \@modules_removed_from_stage1));
}
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;
- }
- }
- $error = 1;
- }
-
my %module2category;
my %deprecated_modules = %listed;
my $not_listed = sub {
@@ -144,16 +203,19 @@ sub check {
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;
+ 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;
#$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) {