summaryrefslogtreecommitdiffstats
path: root/kernel/gen_modules_conf.pl.pl
blob: e842eafa0513f943bcdf70c7fe7d38b8ea301773 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/perl

use list_modules;

my %kinds = (
    scsi => 'disk/scsi|hardware_raid',
    network => 'network/main|usb',
);

my %kinds2all_modules = map { 
    $_ => [ list_modules::category2modules($kinds{$_}) ];
} keys %kinds;

$kinds2all_modules{usb} = [ qw(usb-uhci usb-ohci ehci-hcd) ];

use Data::Dumper;
print Data::Dumper->Dump([\%kinds2all_modules], ['$kinds2all_modules']);

print <<'EOF';
my @l = map { /^(\S+)\s*:/ ? $1 : () } `lspcidrake`;

my %kinds2modules = map { 
    $_ => [ intersection(\@l, $kinds2all_modules->{$_}) ];
} keys %$kinds2all_modules;

if (my @scsi = @{$kinds2modules{scsi}}) {
    print "probeall scsi_hostadapter ", join(" ", @scsi), "\n";
}
if (my @usb = @{$kinds2modules{usb}}) {
    print "probeall usb-interface ", join(" ", @usb), "\n";
}
my $eth = 0;
foreach (@{$kinds2modules{network}}) {
    print "alias eth$eth $_\n";
    $eth++;
}

sub intersection { my (%l, @m); @l{@{shift @_}} = (); foreach (@_) { @m = grep { exists $l{$_} } @$_; %l = (); @l{@m} = () } keys %l }
EOF