git: bcb1b157fdf9 - main - loader: Add two new build knobs for x86 BIOS loaders

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 10 Jul 2026 04:18:45 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=bcb1b157fdf97d5296457a0a95dfc04e33c2faeb

commit bcb1b157fdf97d5296457a0a95dfc04e33c2faeb
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2026-07-10 04:05:25 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2026-07-10 04:13:07 +0000

    loader: Add two new build knobs for x86 BIOS loaders
    
    We have two sets of BIOS loaders: One that lives in stand/i386 and one
    that lives in stand/userboot. Add knows to turn these on/off, with the
    default being on. These often aren't needed when creating a minimal UEFI
    system, so add knobs to turn them off.  Given light-weight VMs have
    created a new use cases for these loaders, there's no plans at all to
    eliminate them.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D58072
---
 share/man/man5/src.conf.5                   | 8 +++++++-
 share/mk/src.opts.mk                        | 2 ++
 stand/Makefile.amd64                        | 4 ++--
 tools/build/options/WITHOUT_LOADER_BIOS     | 2 ++
 tools/build/options/WITHOUT_LOADER_USERBOOT | 2 ++
 tools/build/options/WITH_LOADER_BIOS        | 2 ++
 tools/build/options/WITH_LOADER_USERBOOT    | 2 ++
 7 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5
index 03c43bed733c..b1c511f596ef 100644
--- a/share/man/man5/src.conf.5
+++ b/share/man/man5/src.conf.5
@@ -1,5 +1,5 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
-.Dd July  7, 2026
+.Dd July  9, 2026
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -1065,6 +1065,9 @@ Do not build LLVM target support for X86.
 The
 .Va LLVM_TARGET_ALL
 option should be used rather than this in most cases.
+.It Va WITHOUT_LOADER_BIOS
+Do not build x86 BIOS loader support
+
 .It Va WITHOUT_LOADER_BIOS_TEXTONLY
 Include graphics, font and video mode support in the i386 and amd64 BIOS
 boot loader.
@@ -1146,6 +1149,9 @@ arm/armv7 and powerpc/powerpc64.
 .It Va WITH_LOADER_USB
 Build the usb/kshim library
 
+.It Va WITHOUT_LOADER_USERBOOT
+Do not build x86 userboot loader support
+
 .It Va WITH_LOADER_VERBOSE
 Build with extra verbose debugging in the loader.
 May explode already nearly too large loader over the limit.
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index 1b5a44c231f3..1dbd1d2d9703 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -125,6 +125,7 @@ __DEFAULT_YES_OPTIONS = \
     LLVM_BINUTILS \
     LLVM_BINUTILS_BOOTSTRAP \
     LLVM_COV \
+    LOADER_BIOS \
     LOADER_BIOS_TEXTONLY \
     LOADER_GELI \
     LOADER_IA32 \
@@ -133,6 +134,7 @@ __DEFAULT_YES_OPTIONS = \
     LOADER_OFW \
     LOADER_PXEBOOT \
     LOADER_UBOOT \
+    LOADER_USERBOOT \
     LOADER_ZFS \
     LOCALES \
     LOCATE \
diff --git a/stand/Makefile.amd64 b/stand/Makefile.amd64
index 48e5136ec33f..1a19dd76ba46 100644
--- a/stand/Makefile.amd64
+++ b/stand/Makefile.amd64
@@ -1,5 +1,5 @@
-S.yes+=		userboot
-S.yes+=		i386
+S.${MK_LOADER_USERBOOT}+= userboot
+S.${MK_LOADER_BIOS}+=	i386
 
 SUBDIR_DEPEND_userboot+=	${INTERP_DEPENDS}
 # These won't get tacked on in an amd64 build
diff --git a/tools/build/options/WITHOUT_LOADER_BIOS b/tools/build/options/WITHOUT_LOADER_BIOS
new file mode 100644
index 000000000000..702d33340d56
--- /dev/null
+++ b/tools/build/options/WITHOUT_LOADER_BIOS
@@ -0,0 +1,2 @@
+Do not build x86 BIOS loader support
+
diff --git a/tools/build/options/WITHOUT_LOADER_USERBOOT b/tools/build/options/WITHOUT_LOADER_USERBOOT
new file mode 100644
index 000000000000..3a9c755306b9
--- /dev/null
+++ b/tools/build/options/WITHOUT_LOADER_USERBOOT
@@ -0,0 +1,2 @@
+Do not build x86 userboot loader support
+
diff --git a/tools/build/options/WITH_LOADER_BIOS b/tools/build/options/WITH_LOADER_BIOS
new file mode 100644
index 000000000000..c876ddaddb20
--- /dev/null
+++ b/tools/build/options/WITH_LOADER_BIOS
@@ -0,0 +1,2 @@
+Build x86 BIOS loader support
+
diff --git a/tools/build/options/WITH_LOADER_USERBOOT b/tools/build/options/WITH_LOADER_USERBOOT
new file mode 100644
index 000000000000..363facc112ec
--- /dev/null
+++ b/tools/build/options/WITH_LOADER_USERBOOT
@@ -0,0 +1,2 @@
+Build x86 userboot loader support
+