mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
Add support for building other kernels than LINT and GENERIC.
This commit is contained in:
parent
433aaf04cb
commit
c9b130583b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152411
@ -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 .
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user