script , , , , .
#!/bin/bash
/sbin/lsmod | tail -n+2 | cut -d" " -f1 | xargs /sbin/modinfo -n | sort ;
, , , , .
, .config , ubuntu lum ( script ):
use strict;
use Getopt::Long;
my ($kernConfigIn, $kernConfigOut, $kernSourceDir, $lumSourceDir, $lumConfigIn, $lumConfigOut, $help);
GetOptions(
'ksd=s' => \$kernSourceDir,
'lsd=s' => \$lumSourceDir,
'kci=s' => \$kernConfigIn,
'lci=s' => \$lumConfigIn,
'kco=s' => \$kernConfigOut,
'lco=s' => \$lumConfigOut,
'help' => \$help);
if ($help || !$kernSourceDir || !$lumSourceDir ) { Usage($0); }
sub Usage { print "usage error\n"; exit; };
my @modules = `/sbin/lsmod | tail -n+2 | cut -d" " -f1 | xargs /sbin/modinfo -n | sort ;`;
my @kconfig;
foreach my $module (@modules) {
my ($package, $path, $modName) = ( $module =~ m/\/((?:kernel)|(?:ubuntu))\/(.*)\/(.*)\.ko/) ;
$package eq 'kernel' ? push @kconfig, kernel($package, $path, $modName) : ubuntu($package, $path, $modName);
}
sub kernel {
my ($package, $path, $modName) = @_;
my $makefile = $kernSourceDir.$path."/Makefile";
my $option;
chomp($option = `cat $makefile | sed -n "s/^obj-\\\$(CONFIG_\\([A-Z0-9_]*\\))\\W*+=.*"$modName"\\.o.*/CONFIG_\\1/p"`);
print "$option\n";
return $option;
}
sub ubuntu {
}
There is a Andrea Goelzer script that, with minor modifications, will disable all unused kernel modules in your .config, which will greatly speed up your compilation.
You can find it here:
http://andreas.goelzer.de/kernel-config-based-on-lsmod-output
source
share