diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-04-25 12:26:16 +0000 |
commit | 126777bc019a54afb4ec51299f2cf9d2841698aa (patch) | |
tree | 97f76e571902ead55ba138f1156a4b4f00b9b779 /kernel/modules.pl | |
parent | f1f67448efc714873378dfeb8279fae68054a90a (diff) | |
download | drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.gz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.bz2 drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.tar.xz drakx-126777bc019a54afb4ec51299f2cf9d2841698aa.zip |
re-sync after the big svn loss
Diffstat (limited to 'kernel/modules.pl')
-rw-r--r-- | kernel/modules.pl | 153 |
1 files changed, 13 insertions, 140 deletions
diff --git a/kernel/modules.pl b/kernel/modules.pl index d6efbf9f9..baccde635 100644 --- a/kernel/modules.pl +++ b/kernel/modules.pl @@ -10,61 +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(acenic), - qw(aironet4500_card com20020-pci hamachi starfire winbond-840), - - if_(arch() =~ /alpha|ppc/, qw(sb1000)), - qw(iph5526), - - qw(ac3200 at1700 atp ni5010 ni52 ni65), #- unused from Jeff - ], - - '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 dc395x_trm dmx3191d qla1280 BusLogic fdomain), - qw(pci2220i eata eata_pio eata_dma), - 'aic7xxx_old', - 'dtc', - ], - 'disk/sata' => [ - qw(ahci ata_piix sata_nv sata_promise sata_sil sata_sis sata_svw sata_sx4 sata_uli sata_via sata_vsc sx8), - ], - - 'disk/hardware_raid' => [ - qw(i2o_block qla2200 qla2300 cpqfc DAC960 gdth pdc-ultra mptscsih), - ], -); - -#- 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) = @_; @@ -85,52 +30,26 @@ 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 = ( - pcmcia => 'fs/cdrom|loopback disk/cdrom|raw|pcmcia bus/pcmcia', - cdrom => 'fs/cdrom|loopback disk/cdrom|raw|scsi', - network => 'bus/usb|usb_keyboard|pcmcia disk/raw|usb', - network_drivers => 'fs/network|loopback network/main|pcmcia|usb|raw|gigabit', - ka => 'fs/network network/main|raw|gigabit', - all => 'fs/cdrom disk/cdrom|raw bus/usb|usb_keyboard disk/usb|scsi fs/loopback|local bus/pcmcia disk/ide|pcmcia|sata|hardware_raid fs/network network/main|pcmcia|usb|raw|gigabit|wireless|tokenring bus/firewire disk/firewire', -); +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 image2modules { - my ($image) = @_; - my $l = $images{$image}; - - my @modules = if_($image !~ /drivers/, @modules_always_on_stage1); - push @modules, map { category2modules($_) } split(' ', $l); - - @modules = difference2(\@modules, \@modules_removed_from_stage1); - - if ($image !~ /all/) { - @modules = difference2(\@modules, \@modules_only_for_all_img); - } - - @modules; +sub modules() { + map { category2modules($_) } split(' ', $images_cat); } sub remove_unneeded_modules { my ($kern_ver) = @_; #- need creating a first time the modules.dep for all modules - #- it will be redone in make_modules_dep when unneeded modules are removed - make_modules_dep($kern_ver); + filter_modules_dep($kern_ver); load_dependencies("all.kernels/$kern_ver/modules.dep"); - my $ext = module_extension($kern_ver); - - my @all = list_modules::all_modules(); + my @all = modules(); my @all_with_deps = map { dependencies_closure($_) } @all; - my %wanted_modules = map { ("$_.$ext" => 1) } @all_with_deps; + my %wanted_modules = map { ("$_.ko.gz" => 1) } @all_with_deps; foreach (all("all.kernels/$kern_ver/modules")) { $wanted_modules{$_} or unlink "all.kernels/$kern_ver/modules/$_"; } @@ -139,34 +58,15 @@ sub remove_unneeded_modules { sub make_modules_per_image { my ($kern_ver) = @_; - make_modules_dep($kern_ver); - load_dependencies("all.kernels/$kern_ver/modules.dep"); - - my $ext = module_extension($kern_ver); - - foreach my $image (keys %images) { - my @modules_with_deps = uniq(map { dependencies_closure($_) } image2modules($image)); - my @l = map { "$_.$ext" } @modules_with_deps; - - my $dir = "all.kernels/$kern_ver/modules"; - @l = grep { -e "$dir/$_" } @l; + my $dir = "all.kernels/$kern_ver/modules"; - if ($image =~ /all/) { - system("cd $dir ; tar cf ../${image}_modules.tar @l") == 0 or die "tar failed\n"; - } else { - my $gi_base_dir = chomp_(`pwd`) . '/..'; - system("cd $dir ; $gi_base_dir/mdk-stage1/mar/mar -c ../${image}_modules.mar @l") == 0 or die "mar failed\n"; - } - } + system("cd $dir ; tar cf ../all_modules.tar *.ko.gz") == 0 or die "tar failed\n"; } -sub make_modules_dep { +sub filter_modules_dep { my ($kern_ver) = @_; - my @l = - kernel_is_26($kern_ver) ? - cat_("all.kernels/$kern_ver/lib/modules/$kern_ver/modules.dep") : - `/sbin/depmod-24 -F all.kernels/$kern_ver/boot/System.map-$kern_ver -e *.o | perl -pe 's/\\\n//'`; + my @l = cat_("all.kernels/$kern_ver/modules.dep"); @l = map { if (/(\S+):\s+(.*)/) { @@ -185,26 +85,6 @@ sub make_modules_dep { output("all.kernels/$kern_ver/modules.dep", map { "$_\n" } @l); } -sub make_modules_description { - my ($kern_ver) = @_; - my $ext = module_extension($kern_ver); - my $dir = "all.kernels/$kern_ver/modules"; - - my @l; - if (kernel_is_26(`uname -r`)) { #- modinfo behaves differently depending on the build kernel used - my $name; - @l = map { - $name = $1 if m!^filename:\s*(.*)\.$ext!; - if_($name && /^description:\s*(.*)/, "$name\t$1"); - } `cd $dir ; /sbin/modinfo *.$ext`; - } else { - @l = map { - if_(/(.*?)\.$ext "(.*)"/, "$1\t$2\n"); - } `cd $dir ; /sbin/modinfo-24 -f '%{filename} %{description}\n' *.$ext`; - } - output("modules.description", @l); -} - sub get_main_modules() { my $base = dirname($0); my $main = chomp_(cat_("$base/RPMS/.main")); @@ -213,15 +93,8 @@ sub get_main_modules() { sub pci_modules4stage1 { my ($category) = @_; - my @list = map { s/\.k?o.*$//; $_ } get_main_modules(); - my %listed; - @listed{@list} = (); - #- keep 2.4 compatibility aliases (to sync with get_name_kernel_26_transition() from mdk-stage1/modules.c) - @listed{qw(usb-ohci usb-uhci uhci bcm4400 3c559 3c90x dc395x_trm)} = (); - my @modules = difference2([ category2modules($category) ], \@modules_removed_from_stage1); - my ($kept, $rejected) = partition { exists $listed{$_} } @modules; - print STDERR "REJECTED @$rejected\n" if $verbose && @$rejected; - print "$_\n" foreach uniq(map { dependencies_closure($_) } @$kept); + my @modules = difference2([ category2modules($category) ]); + print "$_\n" foreach uniq(map { dependencies_closure($_) } @modules); } sub check() { @@ -245,7 +118,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($_); |