Page MenuHomeFreeBSD

D39013.diff
No OneTemporary

D39013.diff

diff --git a/sys/conf/Makefile.arm b/sys/conf/Makefile.arm
--- a/sys/conf/Makefile.arm
+++ b/sys/conf/Makefile.arm
@@ -69,9 +69,6 @@
# Generate the .bin (no elf headers) kernel as an extra build output.
# We must relink to generate the .bin kernel, because without headers the
# location of everything changes. We also strip the ARM marker symbols.
-KERNEL_EXTRA+= ${KERNEL_KO}.bin
-KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
-
${KERNEL_KO}.bin: ${SYSTEM_DEP} vers.o
@echo "linking ${.TARGET}"
@${SYSTEM_LD_BASECMD} \
@@ -100,8 +97,6 @@
%CLEAN
-CLEAN+= ${KERNEL_KO}.bin
-
%RULES
.include "$S/conf/kern.post.mk"
diff --git a/sys/conf/Makefile.arm64 b/sys/conf/Makefile.arm64
--- a/sys/conf/Makefile.arm64
+++ b/sys/conf/Makefile.arm64
@@ -56,11 +56,6 @@
--strip-symbol='$$[adtx]*' \
${.TARGET}
-# Generate the .bin (booti images) kernel as an extra build output.
-# The targets and rules to generate these appear near the end of the file.
-KERNEL_EXTRA+= ${KERNEL_KO}.bin
-KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
-
.if !empty(DDB_ENABLED) || !empty(DTRACE_ENABLED) || !empty(HWPMC_ENABLED)
CFLAGS += -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
.endif
@@ -76,7 +71,6 @@
%FILES.m
%CLEAN
-CLEAN+= ${KERNEL_KO}.bin
%RULES
diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk
--- a/sys/conf/kern.opts.mk
+++ b/sys/conf/kern.opts.mk
@@ -56,18 +56,18 @@
__DEFAULT_NO_OPTIONS = \
BHYVE_SNAPSHOT \
+ KERNEL_BIN \
KERNEL_RETPOLINE \
RATELIMIT \
REPRODUCIBLE_BUILD \
VERIEXEC
-# Some options are totally broken on some architectures. We disable
-# them. If you need to enable them on an experimental basis, you
-# must change this code.
-# Note: These only apply to the list of modules we build by default
-# and sometimes what is in the opt_*.h files by default.
-# Kernel config files are unaffected, though some targets can be
-# affected by KERNEL_SYMBOLS, FORMAT_EXTENSIONS, CTF and SSP.
+# Some options are totally broken on some architectures. We disable them. If you
+# need to enable them on an experimental basis, you must change this code.
+# Note: These only apply to the list of modules we build by default and
+# sometimes what is in the opt_*.h files by default. Kernel config files are
+# unaffected, though some targets can be affected by KERNEL_BIN, KERNEL_SYMBOLS,
+# FORMAT_EXTENSIONS, CTF and SSP.
# Broken on 32-bit arm, kernel module compile errors
.if ${MACHINE_CPUARCH} == "arm"
@@ -84,6 +84,11 @@
BROKEN_OPTIONS+=EFI
.endif
+# We only generate kernel.bin on arm and arm64, otherwise they break the build.
+.if ${MACHINE} != "arm" && ${MACHINE} != "arm64"
+BROKEN_OPTIONS+=KERNEL_BIN
+.endif
+
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
__DEFAULT_NO_OPTIONS += FDT
.else
diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -466,4 +466,13 @@
.endif
.endif
+# Generate the .bin (booti images) kernel as an extra build output.
+# The targets and rules to generate these appear in Makefile.$MACHINE
+# if the platform supports it.
+.if ${MK_KERNEL_BIN} != "no"
+KERNEL_EXTRA+= ${KERNEL_KO}.bin
+KERNEL_EXTRA_INSTALL+= ${KERNEL_KO}.bin
+CLEAN+= ${KERNEL_KO}.bin
+.endif
+
.include "kern.mk"
diff --git a/tools/build/options/WITH_KERNEL_BIN b/tools/build/options/WITH_KERNEL_BIN
new file mode 100644
--- /dev/null
+++ b/tools/build/options/WITH_KERNEL_BIN
@@ -0,0 +1,8 @@
+Generate and install kernel.bin from kernel as part of the normal build and
+install processes for the kernel. Available only on arm and arm64.
+
+Usually this will be added to the kernel config file with:
+
+makeoptions WITH_KERNEL_BIN=1
+
+though it can also be used on the command line.

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 16, 9:41 PM (21 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14664716
Default Alt Text
D39013.diff (3 KB)

Event Timeline