Skip to content

Instantly share code, notes, and snippets.

@matthiasr
Created March 15, 2011 11:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthiasr/870614 to your computer and use it in GitHub Desktop.
Save matthiasr/870614 to your computer and use it in GitHub Desktop.
DragonFly build system: Choose the currently running KERNCONF by default
commit d15d496a8cc793545cba96c9626df2b99a23aaf6
Author: Matthias Rampke <matthias@rampke.de>
Date: Tue Mar 15 10:55:03 2011 +0100
Choose the currently running KERNCONF by default
If KERNCONF is set neither in the environment nor on the 'make buildkernel' command line, set it to the output of 'uname -i'. A straightforward kernel upgrade thus reduces to
make buildkernel
make installkernel
Note that KERNCONFDIR is not affected by this, so if it was set when building the current kernel it must be set when building and installing.
When cross-building from another OS set KERNCONF explicitly.
diff --git a/Makefile b/Makefile
index 86e8877..dbdbef1 100644
--- a/Makefile
+++ b/Makefile
@@ -54,8 +54,8 @@
#
# 1. `cd /usr/src' (or to the directory containing your source tree).
# 2. `make buildworld'
-# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
-# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
+# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is the current configuration).
+# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is the current configuration).
# 5. `make installworld'
# 6. `make upgrade'
# 7. `reboot'
diff --git a/Makefile.inc1 b/Makefile.inc1
index bfcc8c2..34ee7f0 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -473,7 +473,7 @@ reinstall:
# buildkernel, nativekernel, quickkernel, and installkernel
#
# Which kernels to build and/or install is specified by setting
-# KERNCONF. If not defined a GENERIC kernel is built/installed.
+# KERNCONF. If not defined a kernel is built/installed using the currently running kernel's configuration.
# Only the existing (depending TARGET) config files are used
# for building kernels and only the first of these is designated
# as the one being installed.
@@ -493,13 +493,8 @@ reinstall:
KERNCONF= ${KERNEL}
KERNWARN= yes
.else
-# XXX makeshift fix to build the right kernel for the (target) architecture
-# We should configure this in the platform files somehow
-.if ${TARGET_ARCH} == "i386"
-KERNCONF?= GENERIC
-.else
-KERNCONF?= X86_64_GENERIC
-.endif
+CURRENTKERNCONF!= uname -i
+KERNCONF?= ${CURRENTKERNCONF}
.endif
INSTKERNNAME?= kernel
diff --git a/share/man/man7/build.7 b/share/man/man7/build.7
index 416ece0..7f940e6 100644
--- a/share/man/man7/build.7
+++ b/share/man/man7/build.7
@@ -172,8 +172,7 @@ Used to override the path of
.Pa /etc/make.conf ) .
.It Ev KERNCONF
The name of the kernel configuration file from which the kernel should
-be built (the default is
-.Li GENERIC ) .
+be built (the default is the current configuration).
.It Ev KERNCONFDIR
The directory where the kernel configuration files are kept (the default is
.Pa /usr/src/sys/config ) .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment