#!/usr/bin/perl -w use strict; my $KERNEL = shift || die "usage: tweakboot \n"; # dirty, dirty, you can also point at files here my $GETDMESG = "/sbin/dmesg |"; my $GETCONF = "/bin/echo 'lines 1000\nlist' | /usr/sbin/config -e $KERNEL |"; open(DMESG, $GETDMESG) || die "cannot get dmesg: $!\n"; open(CONFIG, $GETCONF) || die "cannot get kernelconfig: $!\n"; my %dmesgdev; $dmesgdev{"mainbus0 at root"}++; # always there while () { if (m/^([a-z]{2,}[0-9]+) at ([a-z]{2,}[0-9]+)/) { $dmesgdev{"$1 at $2"}++; } } LINE: while () { s/\s+/ /g; if (m/(\d+) ([a-z0-9*]+) at ([a-z0-9*|]+)/) { my ($num, $dev, $par) = ($1, $2, $3); my @pars = split /\|/, $par; foreach (@pars) { my $regex = "$dev at $_"; $regex =~ s/\*/\\d\+/g; foreach (keys %dmesgdev) { next LINE if ($_ =~ m/^$regex$/); } } # did not find a match in dmesg printf("disable %-3d %s at %.40s\n", $num, $dev, $par); } } print "quit\n";