2011-10-27 14:41:25 -05:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
print "Running on " . `hostname`;
|
2011-10-28 11:40:42 -05:00
|
|
|
if ($ARGV[0] eq "--clean") {
|
2011-10-31 10:56:05 -05:00
|
|
|
my_system("rm -rf linux-3.0.8");
|
2011-10-28 11:40:42 -05:00
|
|
|
exit;
|
|
|
|
}
|
2011-10-27 14:41:25 -05:00
|
|
|
|
|
|
|
if ( ! -e "linux-3.0.8.tar.xz") {
|
|
|
|
my $return = system("wget -c http://69.55.54.91/linux-3.0.8.tar.xz");
|
|
|
|
}
|
|
|
|
if ( ! -d "linux-3.0.8") {
|
2011-10-31 10:56:05 -05:00
|
|
|
my_system("tar xfJ linux-3.0.8.tar.xz");
|
|
|
|
my_system("sync");
|
2011-10-27 14:41:25 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
chdir "linux-3.0.8";
|
2011-10-27 16:04:35 -05:00
|
|
|
# system("cp /root/benchmarks/kernel/config-3.0.8 .config");
|
2011-10-28 11:40:42 -05:00
|
|
|
if ($ARGV[0] eq "--mrproper") {
|
2011-10-31 10:56:05 -05:00
|
|
|
my_system("make mrproper");
|
2011-10-28 11:40:42 -05:00
|
|
|
}
|
2011-10-27 14:41:25 -05:00
|
|
|
|
2011-10-27 15:25:31 -05:00
|
|
|
install_standard("make -v", "make");
|
2011-10-27 14:41:25 -05:00
|
|
|
install_gcc();
|
|
|
|
|
2011-10-27 14:54:38 -05:00
|
|
|
exit if $ARGV[0] eq "--prep";
|
2011-10-27 14:41:25 -05:00
|
|
|
|
2011-10-31 10:56:05 -05:00
|
|
|
if ($ARGV[0] eq "--bigconfig") {
|
|
|
|
my_system("rm .config*");
|
|
|
|
my_system("cp /root/benchmarks/kernel/config-3.0.8 .config");
|
2011-10-31 12:33:50 -05:00
|
|
|
my_system("yes \"\" |make oldconfig");
|
2011-10-31 10:56:05 -05:00
|
|
|
} else {
|
|
|
|
my_system("make defconfig");
|
|
|
|
}
|
|
|
|
|
2011-10-27 14:41:25 -05:00
|
|
|
my $cpus = `cat /proc/cpuinfo |grep QEMU |wc -l`;
|
|
|
|
chomp $cpus;
|
2011-10-31 10:56:05 -05:00
|
|
|
my_system("make -j$cpus");
|
|
|
|
|
2011-10-27 14:41:25 -05:00
|
|
|
|
|
|
|
sub install_gcc {
|
|
|
|
my $return = system("gcc --version");
|
|
|
|
print "gcc RETURN: $return\n";
|
|
|
|
|
|
|
|
if ($return eq "-1") {
|
|
|
|
if (-e "/etc/gentoo-release") {
|
|
|
|
system "emerge gcc";
|
|
|
|
} elsif (-e "/etc/redhat-release") {
|
|
|
|
my @parts = split " ", `cat /etc/redhat-release`;
|
|
|
|
if ($parts[2] eq "5.6") {
|
|
|
|
my $arch = `uname -m`;
|
|
|
|
chomp $arch;
|
|
|
|
if ($arch eq "x86_64") {
|
|
|
|
system "yum install gcc -y";
|
|
|
|
} else {
|
|
|
|
system "yum install gcc -y";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
system "yum install gcc -y";
|
|
|
|
} else {
|
|
|
|
system "apt-get -y install gcc";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
system "gcc --version";
|
|
|
|
}
|
2011-10-27 15:25:31 -05:00
|
|
|
|
|
|
|
sub install_standard {
|
|
|
|
my ($cmd, $name) = @_;
|
|
|
|
my $return = system($cmd);
|
|
|
|
print "gcc RETURN: $return\n";
|
|
|
|
|
|
|
|
if ($return eq "-1") {
|
|
|
|
if (-e "/etc/gentoo-release") {
|
|
|
|
system "emerge $name";
|
|
|
|
} elsif (-e "/etc/redhat-release") {
|
|
|
|
my @parts = split " ", `cat /etc/redhat-release`;
|
|
|
|
if ($parts[2] eq "5.6") {
|
|
|
|
my $arch = `uname -m`;
|
|
|
|
chomp $arch;
|
|
|
|
if ($arch eq "x86_64") {
|
|
|
|
system "yum install $name -y";
|
|
|
|
} else {
|
|
|
|
system "yum install $name -y";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
system "yum install $name -y";
|
|
|
|
} else {
|
|
|
|
system "apt-get -y install $name";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
system $cmd;
|
|
|
|
}
|
2011-10-31 10:56:05 -05:00
|
|
|
|
|
|
|
sub my_system {
|
|
|
|
print "RUN: @_\n";
|
|
|
|
system "@_";
|
|
|
|
}
|