From 8ec73786a5ddc7a7f5b8de614158c4c4a09fefd2 Mon Sep 17 00:00:00 2001 From: des Date: Mon, 14 Nov 2005 12:59:10 +0000 Subject: Add support for building other kernels than LINT and GENERIC. --- tools/tools/tinderbox/tinderbox.1 | 16 +++++++++++++--- tools/tools/tinderbox/tinderbox.pl | 38 ++++++++++++++++++++++++++------------ 2 files changed, 39 insertions(+), 15 deletions(-) diff --git a/tools/tools/tinderbox/tinderbox.1 b/tools/tools/tinderbox/tinderbox.1 index 3712103..37220df 100644 --- a/tools/tools/tinderbox/tinderbox.1 +++ b/tools/tools/tinderbox/tinderbox.1 @@ -172,13 +172,11 @@ If the specified patch file does not exist, the command will fail gracefully. .It Cm world Build the world. -.It Cm generic -Build a GENERIC kernel. .It Cm lint Build a LINT kernel if available. In .Fx -5, the +5 and newer, the .Pa LINT configuration file will first be generated from the corresponding .Pa NOTES @@ -190,6 +188,18 @@ nor exist in the kernel configuration directory, the .Cm lint command will fail gracefully. +.It Cm kernel: Ns Ar CONF +Build the +.Ar CONF +kernel. +If a file named +.Ar CONF +does not exist in the kernel configuration directory, this command +will fail gracefully. +.It Cm generic +Equivalent to +.Cm kernel: Ns Ar GENERIC , +for backward compatibility. .It Cm release Build a release by following the procedure described in .Xr release 7 . diff --git a/tools/tools/tinderbox/tinderbox.pl b/tools/tools/tinderbox/tinderbox.pl index 944b8b1..a85183d 100644 --- a/tools/tools/tinderbox/tinderbox.pl +++ b/tools/tools/tinderbox/tinderbox.pl @@ -65,10 +65,10 @@ my %cmds = ( 'update' => 0, 'patch' => 0, 'world' => 0, - 'generic' => 0, 'lint' => 0, 'release' => 0, ); +my %kernels; sub message(@) { @@ -375,6 +375,16 @@ MAIN:{ $userenv{$1} = $2; next; } + if ($cmd =~ m/^kernel:(\w+)$/) { + $kernels{$1} = 1; + next; + } + # backward compatibility + # note that LINT is special, GENERIC is not + if ($cmd eq 'generic') { + $kernels{'GENERIC'} = 1; + next; + } if (!exists($cmds{$cmd})) { error("unrecognized command: '$cmd'"); } @@ -527,7 +537,7 @@ MAIN:{ ); # Kernel-specific variables - if ($cmds{'generic'} || $cmds{'lint'} || $cmds{'release'}) { + if (%kernels || $cmds{'lint'} || $cmds{'release'}) { # None at the moment } @@ -565,7 +575,7 @@ MAIN:{ if (!exists($ENV{'CFLAGS'})) { $ENV{'CFLAGS'} = "-O -pipe"; } - if ($cmds{'generic'} || $cmds{'lint'} || $cmds{'release'}) { + if (%kernels || $cmds{'lint'} || $cmds{'release'}) { if (!exists($ENV{'COPTFLAGS'})) { $ENV{'COPTFLAGS'} = "-O -pipe"; } @@ -584,21 +594,13 @@ MAIN:{ cd("$sandbox/src"); make('buildworld') or error("failed to build world"); - } elsif ($cmds{'generic'} || $cmds{'lint'}) { + } elsif (%kernels || $cmds{'lint'}) { logstage("building kernel toolchain (CFLAGS=$ENV{'CFLAGS'})"); cd("$sandbox/src"); make('kernel-toolchain') or error("failed to build kernel toolchain"); } - # Build GENERIC if requested - if ($cmds{'generic'}) { - logstage("building generic kernel (COPTFLAGS=$ENV{'COPTFLAGS'})"); - cd("$sandbox/src"); - spawn('/usr/bin/make', 'buildkernel', 'KERNCONF=GENERIC') - or error("failed to build generic kernel"); - } - # Build LINT if requested if ($cmds{'lint'}) { if (-f "$sandbox/src/sys/$machine/conf/NOTES") { @@ -619,6 +621,18 @@ MAIN:{ or error("failed to build lint kernel"); } + # Build additional kernels + foreach my $kernel (sort(keys(%kernels))) { + if (! -f "$sandbox/src/sys/$machine/conf/$kernel") { + warning("no kernel config for $kernel"); + next; + } + logstage("building $kernel kernel (COPTFLAGS=$ENV{'COPTFLAGS'})"); + cd("$sandbox/src"); + spawn('/usr/bin/make', 'buildkernel', "KERNCONF=$kernel") + or error("failed to build $kernel kernel"); + } + # Build a release if requested if ($cmds{'release'}) { logstage("building a release"); -- cgit v1.1