summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/.cvsignore3
-rw-r--r--kernel/Makefile13
-rw-r--r--kernel/list_modules.pm190
-rw-r--r--kernel/modules.pl125
-rwxr-xr-xkernel/update_kernel92
5 files changed, 423 insertions, 0 deletions
diff --git a/kernel/.cvsignore b/kernel/.cvsignore
new file mode 100644
index 000000000..827e0ba13
--- /dev/null
+++ b/kernel/.cvsignore
@@ -0,0 +1,3 @@
+modules.description
+all.modules
+all.kernels
diff --git a/kernel/Makefile b/kernel/Makefile
new file mode 100644
index 000000000..90fad04b6
--- /dev/null
+++ b/kernel/Makefile
@@ -0,0 +1,13 @@
+all: all.modules
+
+all.modules: ../mdk-stage1/mar/mar update_kernel list_modules.pm
+ `../tools/specific_arch ./update_kernel`
+
+../mdk-stage1/mar/mar:
+ make -C `dirname $@`
+
+clean:
+ rm -rf *~ modules.description all.modules all.modules64
+
+check:
+ perl modules.pl check > /dev/null
diff --git a/kernel/list_modules.pm b/kernel/list_modules.pm
new file mode 100644
index 000000000..2b8dfd2d8
--- /dev/null
+++ b/kernel/list_modules.pm
@@ -0,0 +1,190 @@
+package list_modules;
+
+use MDK::Common;
+
+our @ISA = qw(Exporter);
+our @EXPORT = qw(load_dependencies dependencies_closure category2modules module2category sub_categories);
+
+# the categories have 2 purposes
+# - choosing modules to include on stage1's (cf update_kernel)
+# (scsi/main scsi/main+hardware_raid
+# - performing a load_thiskind or get_that_type
+# (usb scsi|disk net isdn tv scanner photo sound)
+
+our %l = (
+ ################################################################################
+ network =>
+ {
+ main => [
+ if_(arch() =~ /ppc/, qw(mace bmac gmac)),
+ if_(arch() =~ /^sparc/, qw(myri_sbus sunbmac sunhme sunqe)),
+ if_(arch() !~ /alpha/ && arch() !~ /sparc/,
+ qw(3c501 3c503 3c505 3c507 3c509 3c515), # 3c90x
+ qw(82596 abyss ac3200 acenic aironet4500_card at1700 atp com20020-pci),
+ qw(cs89x0 de600 de620),
+ qw(defxx), # most unused
+ qw(depca dgrs dmfe e100 e1000 e2100 eepro eepro100 eexpress epic100 eth16i),
+ qw(ewrk3 hamachi hp hp-plus hp100 ibmtr),
+ qw(lance natsemi ne ne2k-pci ni5010 ni52 ni65 olympic pcnet32 plip rcpci), #old_tulip
+ qw(sb1000 sis900 sk98lin smc-ultra smc9194 starfire tlan tmspci tulip via-rhine), #sktr
+ qw(wd winbond-840 yellowfin ns83820),
+ ),
+ qw(3c59x 8139too sundance dl2k), #rtl8139
+ ],
+ raw => [
+ qw(8390 mii),
+ qw(ppp_generic ppp_async slhc aironet4500_core),
+ ],
+ pcmcia => [
+ qw(3c574_cs 3c589_cs airo airo_cs aironet4500_cs axnet_cs fmvj18x_cs),
+ qw(ibmtr_cs netwave_cs nmclan_cs pcnet_cs ray_cs smc91c92_cs wavelan_cs wvlan_cs),
+ qw(xirc2ps_cs xircom_cb xircom_tulip_cb),
+ ],
+ usb => [
+ qw(pegasus kaweth usbnet catc CDCEther),
+ ],
+ isdn => [
+ qw(hisax hysdn b1pci t1pci c4),
+ ],
+ },
+
+ ################################################################################
+ disk =>
+ {
+ scsi => [
+ if_(arch() =~ /ppc/, qw(mesh mac53c94)),
+ if_(arch() =~ /^sparc/, qw(qlogicpti)),
+ if_(arch() !~ /alpha/ && arch() !~ /sparc/,
+ qw(3w-xxxx AM53C974 BusLogic NCR53c406a a100u2w advansys aha152x aha1542 aha1740),
+ qw(atp870u dc395x_trm dtc fdomain g_NCR5380 in2000 initio pci2220i psi240i),
+ qw(qla1280 qla2x00 qlogicfas qlogicfc),
+ qw(seagate sim710 sym53c416 t128 tmscsim u14-34f ultrastor wd7000),
+ qw(eata eata_pio eata_dma),
+ ),
+ '53c7,8xx',
+ qw(aic7xxx pci2000 qlogicisp sym53c8xx), # ncr53c8xx
+ ],
+ hardware_raid => [
+ if_(arch() =~ /^sparc/, qw(pluto)),
+ if_(arch() !~ /alpha/ && arch() !~ /sparc/,
+ qw(DAC960 dpt_i2o megaraid aacraid ataraid cciss cpqarray gdth i2o_block),
+ qw(ips ppa imm),
+ ),
+ ],
+ pcmcia => [ qw(aha152x_cs fdomain_cs nsp_cs qlogic_cs ide-cs) ], #ide_cs
+ raw => [ qw(scsi_mod sd_mod) ],
+ usb => [ qw(usb-storage) ],
+ cdrom => [ qw(ide-cd sr_mod cdrom) ],
+ },
+
+ ################################################################################
+
+ bus =>
+ {
+ usb => [ qw(usbcore usb-uhci usb-ohci ehci-hcd usbkbd keybdev input) ],
+ pcmcia => [
+ if_(arch() !~ /^sparc/, qw(pcmcia_core tcic ds i82365 yenta_socket)), # cb_enabler
+ ],
+ #serial_cs
+ #ftl_cs 3c575_cb apa1480_cb epic_cb serial_cb tulip_cb iflash2+_mtd iflash2_mtd
+ #cb_enabler
+ },
+
+ fs =>
+ {
+ network => [ qw(af_packet nfs lockd sunrpc) ],
+ cdrom => [ qw(isofs) ],
+ loopback => [ qw(isofs loop) ],
+ local => [
+ if_(arch() =~ /^i.86/, qw(vfat fat)),
+ if_(arch() =~ /^ppc/, qw(hfs)),
+ qw(reiserfs),
+ ],
+ various => [ qw(smbfs romfs jbd xfs) ],
+
+ },
+
+ ################################################################################
+ multimedia =>
+ {
+ sound => [
+ if_(arch() =~ /ppc/, qw(dmasound_awacs)),
+ if_(arch() !~ /^sparc/,
+ qw(cmpci cs46xx cs4281 es1370 es1371 esssolo1 i810_audio maestro maestro3),
+ qw(nm256_audio pas16 trident via82cxxx_audio sonicvibes emu10k1 ymfpci),
+
+ qw(snd-ice1712 snd-cmipci snd-ens1371),
+ qw(snd-es1938 snd-fm801 snd-intel8x0 snd-rme96),
+ qw(snd-trident snd-ymfpci),
+ ),
+ ],
+ tv => [ qw(bttv cpia_usb ibmcam mod_quickcam ov511 ultracam usbvideo) ],
+ photo => [ qw(dc2xx mdc800) ],
+ radio => [ qw(radio-maxiradio) ],
+ scanner => [ qw(scanner microtek) ],
+ joystick => [ qw(ns558) ],
+ },
+
+ various =>
+ # just here for classification, unused categories (nor auto-detect, nor load_thiskind)
+ {
+ raid => [
+ qw(linear raid0 raid1 raid5 lvm-mod md multipath xor),
+ ],
+ mouse => [
+ qw(busmouse msbusmouse logibusmouse serial qpmouse atixlmouse),
+ ],
+ char => [
+ qw(amd768_rng applicom n_r3964 nvram pc110pad ppdev amd768_pm),
+ ],
+ other => [
+ qw(agpgart defxx i810_rng i810fb ide-floppy ide-scsi ide-tape loop lp nbd sg st parport parport_pc),
+ ],
+ },
+);
+
+my %dependencies;
+
+sub load_dependencies {
+ my ($file) = @_;
+
+ %dependencies = map {
+ my ($f, $deps) = split ':';
+ $f => [ split ' ', $deps ];
+ } cat_($file);
+}
+
+sub dependencies_closure {
+ my @l = map { dependencies_closure($_) } @{$dependencies{$_[0]} || []};
+ (@l, $_[0]);
+}
+
+sub category2modules {
+ map {
+ my ($t1, $t2s) = m|(.*)/(.*)|;
+ map {
+ my $l = $l{$t1}{$_} or die "bad category $t1/$_\n" . backtrace();
+ @$l;
+ } split('\|', $t2s);
+ } split(' ', $_[0]);
+}
+
+sub module2category {
+ my ($module) = @_;
+ my ($t1, $t2);
+ while (($t1, my $h) = each %l) {
+ while (($t2, my $l) = each %$h) {
+ $module eq $_ and goto found foreach @$l;
+ }
+ }
+ return;
+ found:
+ "$t1/$t2";
+}
+
+sub sub_categories {
+ my ($t1) = @_;
+ keys %{$l{$t1}};
+}
+
+1;
diff --git a/kernel/modules.pl b/kernel/modules.pl
new file mode 100644
index 000000000..ebcdaaa2c
--- /dev/null
+++ b/kernel/modules.pl
@@ -0,0 +1,125 @@
+use strict;
+
+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)),
+ "apa1480_cb",
+ "imm",
+ "ppa",
+ "plip",
+ qw(3w-xxxx pci2220i qla2x00 i2o_block),
+ qw(eata_pio eata_dma),
+ '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/main|raw bus/pcmcia',
+ cdrom => 'fs/cdrom disk/cdrom|scsi|raw',
+ hd => 'fs/local fs/loopback disk/scsi|hardware_raid|raw',
+ usb => 'fs/network|cdrom bus/usb network/usb|raw disk/cdrom|usb|raw',
+ pcmcia => 'fs/network|cdrom disk/cdrom|pcmcia|raw bus/pcmcia network/pcmcia|raw',
+ other => 'network/main disk/scsi|hardware_raid ONLY_BIG fs/network network/raw fs/cdrom disk/cdrom|raw',
+ all => 'fs/network|cdrom|loopback|local bus/pcmcia|usb network/main|pcmcia|usb|raw disk/cdrom|scsi|hardware_raid|pcmcia|usb|raw',
+);
+
+my $verbose = "@ARGV" =~ /-v/;
+images() if "@ARGV" =~ /images/;
+check() if "@ARGV" =~ /check/;
+
+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;
+ }
+ push @modules, category2modules($_);
+ }
+
+ @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" } sort @modules);
+ }
+}
+
+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";
+ print "MODULE: $_\n" foreach @$l;
+ 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 %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($_);
+ 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;
+
+ exit $error;
+}
diff --git a/kernel/update_kernel b/kernel/update_kernel
new file mode 100755
index 000000000..3d07c4155
--- /dev/null
+++ b/kernel/update_kernel
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+ALL_KERNELS="all.kernels"
+
+function create_marfile() {
+ marfile=$1
+ shift
+ $GIBASEDIR/mdk-stage1/mar/mar -c $marfile $*
+}
+
+function create_modules() {
+ kernel_path=$1
+ kern=$2
+ echo "Updating modules in '`pwd`' for kernel '$kern'"
+ cp -f `find $kernel_path/lib/modules/ -name "*.o"` .
+ /sbin/depmod -F $kernel_path/boot/System.map* -e *.o | perl -pe 's/\\\n//' \
+ | perl -ne 's/\.o//g; s/[ \t]+/ /g; print if /: /' > modules.dep
+ perl -pi -e 's/((plip|ppa|imm): parport)/$1 parport_pc/' modules.dep
+
+ modinfo -f '%{filename} %{description}\n' *.o | perl -lne 'print "$1\t$2" if /(.*?)\.o "(.*)"/' > modules.description
+
+ echo -n "packdrake $kern: "
+ ls *.o | packdrake -b9s "modules.cz" 400000
+ echo "done"
+ mv modules.cz ../modules.cz-$kern
+ for i in network cdrom hd usb other pcmcia all; do
+ modules_var="${i}_modules"
+ eval "create_marfile ${i}_modules.mar \$$modules_var"
+ done
+ echo
+}
+
+[ -e $ALL_KERNELS/.main ] && main=$(cat $ALL_KERNELS/.main)
+
+rpm=$(rpm -qp --qf '%{name}' /RPMS/kernel-BOOT-*.rpm | perl -pe 's/kernel-BOOT-(.*)\.(.*)/$1-${2}BOOT/')
+if [ -n "$rpm" -a ! -e $ALL_KERNELS/$rpm ]; then
+ [ -n "$main" ] && rm -rf $ALL_KERNELS/$main
+ cd $ALL_KERNELS
+ rm -rf $rpm ; mkdir $rpm
+ cd $rpm
+ rpm2cpio /RPMS/kernel-BOOT-*.rpm | cpio -id
+ find -type f -name "*.o.gz" | xargs gunzip
+ cd ../..
+
+ for dir in /tftpboot /var/lib/tftpboot; do
+ rm -f $dir/{vmlinuz,network.rdz}
+ done
+fi
+
+[ -n "$main" -a -e $ALL_KERNELS/$main ] || {
+ cd $ALL_KERNELS
+ main=$(echo 2.* | sed 's/.* //')
+ echo "Choosing $main"
+ echo $main > .main
+ cd ..
+}
+
+ARCH=`uname -m | sed -e 's/i.86/i386/' -e 's/sparc.*/sparc/'`
+
+eval `perl modules.pl images`
+
+if [ "$ARCH" == "i386" ]; then
+ for i in $ALL_KERNELS/*/boot/vmlinuz*; do
+ #disable any existing resolution!!!
+ /usr/sbin/rdev -v $i 65535 #788 #785
+ done
+else
+ if [ "$ARCH" == "ppc" ]; then
+ cp -f "$KERNEL_BOOT_PATH"/boot/vmlinux .
+ else
+ cp -f "$KERNEL_BOOT_PATH"/boot/vmlinux.gz .
+ fi
+fi
+
+
+GIBASEDIR=`pwd`/..
+
+rm -rf all.modules ; mkdir all.modules
+for i in $ALL_KERNELS/*; do
+ kern=`basename $i`
+ (
+ mkdir all.modules/$kern
+ cd all.modules/$kern
+ if [ "$kern" = "$main" ]; then
+ create_modules ../../$i $kern
+ else
+ echo "$kern ($main)"
+ create_modules ../../$i $kern 2>/dev/null
+ fi
+ ) || exit 1
+done
+cp -f all.modules/$main/modules.description .