summaryrefslogtreecommitdiffstats
path: root/kernel/modules.pl
blob: 4e9631b6f682cec25e94095f61f5f7ad8224d697 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
use strict;


BEGIN {
    #- for testing purpose
    (my $f = __FILE__) =~ s|/[^/]*$||;
    push @INC, $f;
}

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),
    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
  ],

  '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',
  ],

  '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),
    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',
    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',
    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',
);

my $verbose = "@ARGV" =~ /-v/;
images() if "@ARGV" =~ /images/;
check() if "@ARGV" =~ /check/;
pci_modules4stage1($1) if "@ARGV" =~ /pci_modules4stage1:(.*)/;

sub images {
    while (my ($image, $l) = each %images) {
	my @modules = @modules_always_on_stage1;
	foreach (split(' ', $l)) { 
	    push @modules, category2modules($_);
	}
	
	@modules = difference2(\@modules, \@modules_removed_from_stage1);

	if ($image !~ /all/) {
	    @modules = difference2(\@modules, \@modules_only_for_all_img);
	}
	printf qq(%s_modules_raw="%s"\n), $image, join ' ', @modules;
    }
}

sub pci_modules4stage1 {
    print "$_\n" foreach uniq(map { dependencies_closure($_) } difference2([ category2modules($_[0]) ], \@modules_removed_from_stage1));
}

sub check {
    my $error;
    my %listed;
    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; 
	    }
	}
    }

    my %module2category;
    my %deprecated_modules = %listed;
    my $not_listed = sub {
	my ($msg, $verbose, @l) = @_;
	my %not_listed;
	foreach (@l) {
	    my ($mod) = m|([^/]*)\.o(\.gz)?$| or next;
	    delete $deprecated_modules{$mod};
	    next if $listed{$mod};
	    s|.*?mdk(BOOT)?/||;
	    s|kernel/||; s|drivers/||; s|3rdparty/||;
	    $_ = dirname $_;
	    $_ = dirname $_ if $mod eq basename($_);
	    $module2category{$mod} = $_;
	    push @{$not_listed{$_}}, $mod;
	}
	if ($verbose) {
	    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;

    {
	require '/usr/bin/merge2pcitable.pl';
	my $pcitable = read_pcitable("/usr/share/ldetect-lst/pcitable");
	my $usbtable = read_pcitable("/usr/share/ldetect-lst/usbtable");

	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 @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;
	    }
	}
    }

    exit $error;
}
opt">), => 'att20c498', __("AT&T 20C409/20C499 (S3, autodetected)"), => 'att20c409', __("AT&T 20C505 (S3)"), => 'att20c505', __("BrookTree BT481 (AGX)"), => 'bt481', __("BrookTree BT482 (AGX)"), => 'bt482', __("BrookTree BT485/9485 (S3)"), => 'bt485', __("Sierra SC15025 (S3, AGX)"), => 'sc15025', __("S3 GenDAC (86C708) (autodetected)"), => 's3gendac', __("S3 SDAC (86C716) (autodetected)"), => 's3_sdac', __("STG-1700 (S3, autodetected)"), => 'stg1700', __("STG-1703 (S3, autodetected)"), => 'stg1703', __("TI 3020 (S3)"), => 'ti3020', __("TI 3025 (S3, autodetected)"), => 'ti3025', __("TI 3026 (S3, autodetected)"), => 'ti3026', __("IBM RGB 514 (S3, autodetected)"), => 'ibm_rgb514', __("IBM RGB 524 (S3, autodetected)"), => 'ibm_rgb524', __("IBM RGB 525 (S3, autodetected)"), => 'ibm_rgb525', __("IBM RGB 526 (S3)"), => 'ibm_rgb526', __("IBM RGB 528 (S3, autodetected)"), => 'ibm_rgb528', __("ICS5342 (S3, ARK)"), => 'ics5342', __("ICS5341 (W32)"), => 'ics5341', __("IC Works w30C516 ZoomDac (ARK)"), => 'zoomdac', __("Normal DAC"), => 'normal', ); @clockchip_name = ( __("No Clockchip Setting (recommended)") => '', __("Chrontel 8391") => 'ch8391', __("ICD2061A and compatibles (ICS9161A => DCS2824)") => 'icd2061a', __("ICS2595") => 'ics2595', __("ICS5342 (similar to SDAC, but not completely compatible)") => 'ics5342', __("ICS5341") => 'ics5341', __("S3 GenDAC (86C708) and ICS5300 (autodetected)") => 's3gendac', __("S3 SDAC (86C716)") => 's3_sdac', __("STG 1703 (autodetected)") => 'stg1703', __("Sierra SC11412") => 'sc11412', __("TI 3025 (autodetected)") => 'ti3025', __("TI 3026 (autodetected)") => 'ti3026', __("IBM RGB 51x/52x (autodetected)") => 'ibm_rgb5xx', ); $intro_text = " This program will create a basic XF86Config file, based on menu selections you make. The XF86Config file usually resides in /usr/X11R6/lib/X11 or /etc/X11. A sample XF86Config file is supplied with XFree86; it is configured for a standard VGA card and monitor with 640x480 resolution. You can either take the sample XF86Config as a base and edit it for your configuration, or let this program produce a base XF86Config file for your configuration and fine-tune it. Refer to /usr/X11R6/lib/X11/doc/README.Config for a detailed overview of the configuration process. For accelerated servers (including accelerated drivers in the SVGA server), there are many chipset and card-specific options and settings. This program does not know about these. On some configurations some of these settings must be specified. Refer to the server man pages and chipset-specific READMEs. Before continuing with this program, make sure you know the chipset and amount of video memory on your video card. SuperProbe can help with this. It is also helpful if you know what server you want to run."; $finalcomment_text = " configuration file has been written. Take a look at it before running 'startx'. Note that the XF86Config file must be in one of the directories searched by the server (e.g. /etc/X11/XF86Config) in order to be used. Within the server press ctrl, alt and '+' simultaneously to cycle video resolutions. Pressing ctrl, alt and backspace simultaneously immediately exits the server (use if the monitor doesn't sync for a particular mode). For further configuration, refer to /usr/X11R6/lib/X11/doc/README.Config. "; $s3_comment = ' # Use Option "nolinear" if the server doesn\'t start up correctly # (this avoids the linear framebuffer probe). If that fails try # option \"nomemaccess\". # # Refer to /usr/X11R6/lib/doc/README.S3, and the XF86_S3 man page. '; $cirrus_comment = ' # Use Option \"no_bitblt\" if you have graphics problems. If that fails # try Option \"noaccel\". # Refer to /usr/X11R6/lib/doc/README.cirrus. # To allow linear addressing, uncomment the Option line and the # address that the card maps the framebuffer to. '; $probeonlywarning_text = ' It is possible that the hardware detection routines in the server some how cause the system to crash and the screen to remain blank. If this is the case, skip this step the next time. The server may need a Ramdac, ClockChip or special option (e.g. "nolinear" for S3) to probe and start-up correctly. '; $monitorintro_text = __(' Now we want to set the specifications of the monitor. The two critical parameters are the vertical refresh rate, which is the rate at which the the whole screen is refreshed, and most importantly the horizontal sync rate, which is the rate at which scanlines are displayed. The valid range for horizontal sync and vertical sync should be documented in the manual of your monitor. If in doubt, check the monitor database /usr/X11R6/lib/X11/doc/Monitors to see if your monitor is there. '); $hsyncintro_text = __(' You must indicate the horizontal sync range of your monitor. You can either select one of the predefined ranges below that correspond to industry- standard monitor types, or give a specific range. It is VERY IMPORTANT that you do not specify a monitor type with a horizontal sync range that is beyond the capabilities of your monitor. If in doubt, choose a conservative setting. '); $vsyncintro_text = __(' You must indicate the vertical sync range of your monitor. You can either select one of the predefined ranges below that correspond to industry- standard monitor types, or give a specific range. For interlaced modes, the number that counts is the high one (e.g. 87 Hz rather than 43 Hz). '); $XF86firstchunk_text = ' # File generated by XConfigurator. # ********************************************************************** # Refer to the XF86Config(4/5) man page for details about the format of # this file. # ********************************************************************** # ********************************************************************** # Files section. This allows default font and rgb paths to be set # ********************************************************************** Section "Files" # The location of the RGB database. Note, this is the name of the # file minus the extension (like ".txt" or ".db"). There is normally # no need to change the default. RgbPath "/usr/X11R6/lib/X11/rgb" # Multiple FontPath entries are allowed (they are concatenated together) # By default, Red Hat 6.0 and later now use a font server independent of # the X server to render fonts. FontPath "unix/:-1" EndSection # ********************************************************************** # Server flags section. # ********************************************************************** Section "ServerFlags" # Uncomment this to cause a core dump at the spot where a signal is # received. This may leave the console in an unusable state, but may # provide a better stack trace in the core dump to aid in debugging #NoTrapSignals # Uncomment this to disable the <Crtl><Alt><BS> server abort sequence # This allows clients to receive this key event. #DontZap # Uncomment this to disable the <Crtl><Alt><KP_+>/<KP_-> mode switching # sequences. This allows clients to receive these key events. #DontZoom EndSection # ********************************************************************** # Input devices # ********************************************************************** '; $keyboardsection_start = ' # ********************************************************************** # Keyboard section # ********************************************************************** Section "Keyboard" Protocol "Standard" # when using XQUEUE, comment out the above line, and uncomment the # following line #Protocol "Xqueue" AutoRepeat 500 5 # Let the server do the NumLock processing. This should only be # required when using pre-R6 clients #ServerNumLock # Specify which keyboard LEDs can be user-controlled (eg, with xset(1)) #Xleds 1 2 3 #To set the LeftAlt to Meta, RightAlt key to ModeShift, #RightCtl key to Compose, and ScrollLock key to ModeLock: LeftAlt Meta '; $keyboardsection_part2 = ' ScrollLock Compose RightCtl Control # To disable the XKEYBOARD extension, uncomment XkbDisable. # XkbDisable # To customise the XKB settings to suit your keyboard, modify the # lines below (which are the defaults). For example, for a non-U.S. # keyboard, you will probably want to use: # XkbModel "pc102" # If you have a US Microsoft Natural keyboard, you can use: # XkbModel "microsoft" # # Then to change the language, change the Layout setting. # For example, a german layout can be obtained with: # XkbLayout "de" # or: # XkbLayout "de" # XkbVariant "nodeadkeys" # # If you\'d like to switch the positions of your capslock and # control keys, use: # XkbOptions "ctrl:swapcaps" # These are the default XKB settings for XFree86 # XkbRules "xfree86" # XkbModel "pc101" # XkbLayout "us" # XkbVariant "" # XkbOptions "" XkbKeycodes "xfree86" XkbTypes "default" XkbCompat "default" XkbSymbols "us(pc101)" XkbGeometry "pc" XkbRules "xfree86" XkbModel "pc101" '; $keyboardsection_end = ' EndSection '; $pointersection_text1 = ' # ********************************************************************** # Pointer section