Solved Is the WITHOUT_MODULES variable broken ?

I don't need WiFi, bluetooth, and the axge module, and want them to exclude from being statically compiled into the kernel.
I have looked up my currently loaded module names with
Code:
INPUT:
kldstat

OUTPUT:
...
if_iwlwifi.ko
if_axge.ko
ng_bluetooth.ko
...
To achieve that I created a /etc/make.conf file with the following content:
Code:
...
WITHOUT_MODULES += if_iwlwifi
WITHOUT_MODULES += if_axge
WITHOUT_MODULES += ng_bluetooth
...

Have I overlooked something ? 🤔
 
make.conf is literally the config file for the make command. So... when in doubt about how to use variables just check make(1). The general syntax is variable=value so that's what I'd use.

In addition, but now I'm threading on somewhat vague territory for me: make.conf(5). It seems WITHOUT_MODULES (being a string) can utilize a list. So you wouldn't need to specify one module at a time; just list 'm together. I'm pretty sure of this because that's how I once used MODULES_OVERRIDE, but that was a long time ago, still from what I can tell the syntax should still be the same.

Hope this can help.
 
You certainly have overlooked something.

Modules are dynamically loaded loaded through the kld interface. To exclude them from the kernel copy GENERIC for your architecture, i.e. for amd64 it is /usr/src/sys/amd64/conf/GENERIC, to another file and remove the drivers.

This is the easiest understood method. The preferred approach would be to make your own kernel config file, include GENERIC (include statement), and use nodevice statements. I'd recommend the first, simpler, approach.
 
make.conf is literally the config file for the make command. So... when in doubt about how to use variables just check make(1). The general syntax is variable=value so that's what I'd use.
I already checked that file thrice.
Usually, variable=value or variable = value works for me, but if I want to concatenate things I use variable += value.

In addition, but now I'm threading on somewhat vague territory for me: make.conf(5). It seems WITHOUT_MODULES (being a string) can utilize a list. So you wouldn't need to specify one module at a time; just list 'm together.
I tried WITHOUT_MODULES="if_axge ng_bluetooth ...", and make tells me it cannot find ng_bluetooth.
I remember to have seen something like WITHOUT_MODULES="module1 module2 moduleX" yesterday.

Modules are dynamically loaded loaded through the kld interface. To exclude them from the kernel copy GENERIC for your architecture, i.e. for amd64 it is /usr/src/sys/amd64/conf/GENERIC, to another file and remove the drivers.

This is the easiest understood method. The preferred approach would be to make your own kernel config file, include GENERIC (include statement), and use nodevice statements. I'd recommend the first, simpler, approach.
Here is the output of my kernel config file:
Code:
#
# MINPERF -- Minimal performant custom kernel configuration file for FreeBSD/amd64
#
# An exhaustive list of options and more detailed explanations of the
# device lines is also present in the ../../conf/NOTES and NOTES files.
# If you are in doubt as to the purpose or necessity of a line, check first
# in NOTES.
#

cpu        HAMMER
ident        MINPERF

makeoptions    DEBUG=-g        # Build kernel with gdb(1) debug symbols
makeoptions    WITH_CTF=1        # Run ctfconvert(1) for DTrace support

options     SCHED_ULE        # ULE scheduler
options     NUMA            # Non-Uniform Memory Architecture support
options     PREEMPTION        # Enable kernel thread preemption
options     VIMAGE            # Subsystem virtualization, e.g. VNET
options     INET            # InterNETworking
options     INET6            # IPv6 communications protocols
options     IPSEC_SUPPORT        # Allow kldload of ipsec and tcpmd5
options     ROUTE_MPATH        # Multipath routing support
options     FIB_ALGO        # Modular fib lookups
options     TCP_OFFLOAD        # TCP offload
options     TCP_BLACKBOX        # Enhanced TCP event logging
options     TCP_HHOOK        # hhook(9) framework for TCP
options     TCP_RFC7413        # TCP Fast Open
options     SCTP_SUPPORT        # Allow kldload of SCTP
options     KERN_TLS        # TLS transmit & receive offload
options     FFS            # Berkeley Fast Filesystem
options     SOFTUPDATES        # Enable FFS soft updates support
options     UFS_ACL            # Support for access control lists
options     UFS_DIRHASH        # Improve performance on big directories
options     UFS_GJOURNAL        # Enable gjournal-based UFS journaling
options     QUOTA            # Enable disk quotas for UFS
options     MD_ROOT            # MD is a potential root device
options     PROCFS            # Process filesystem (requires PSEUDOFS)
options     PSEUDOFS        # Pseudo-filesystem framework
options     TMPFS            # Efficient memory filesystem
options     GEOM_RAID        # Soft RAID functionality.
options     GEOM_LABEL        # Provides labelization
options     EFIRT            # EFI Runtime Services support
options     COMPAT_FREEBSD32    # Compatible with i386 binaries
#options     COMPAT_FREEBSD4        # Compatible with FreeBSD4
#options     COMPAT_FREEBSD5        # Compatible with FreeBSD5
#options     COMPAT_FREEBSD6        # Compatible with FreeBSD6
#options     COMPAT_FREEBSD7        # Compatible with FreeBSD7
#options     COMPAT_FREEBSD9        # Compatible with FreeBSD9
#options     COMPAT_FREEBSD10    # Compatible with FreeBSD10
#options     COMPAT_FREEBSD11    # Compatible with FreeBSD11
#options     COMPAT_FREEBSD12    # Compatible with FreeBSD12
options     COMPAT_FREEBSD13    # Compatible with FreeBSD13
options     SCSI_DELAY=5000        # Delay (in ms) before probing SCSI
options     KTRACE            # ktrace(1) support
options     STACK            # stack(9) support
options     SYSVSHM            # SYSV-style shared memory
options     SYSVMSG            # SYSV-style message queues
options     SYSVSEM            # SYSV-style semaphores
options     _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options     PRINTF_BUFR_SIZE=128    # Prevent printf output being interspersed.
options     KBD_INSTALL_CDEV    # install a CDEV entry in /dev
options     HWPMC_HOOKS        # Necessary kernel hooks for hwpmc(4)
options     AUDIT            # Security event auditing
options     CAPABILITY_MODE        # Capsicum capability mode
options     CAPABILITIES        # Capsicum capabilities
options     MAC            # TrustedBSD MAC Framework
options     KDTRACE_FRAME        # Ensure frames are compiled in
options     KDTRACE_HOOKS        # Kernel DTrace hooks
options     DDB_CTF            # Kernel ELF linker loads CTF data
options     INCLUDE_CONFIG_FILE    # Include this file in kernel
options     RACCT            # Resource accounting framework
options     RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default
options     RCTL            # Resource limits

# Debugging support.  Always need this:
options     KDB            # Enable kernel debugger support.
options     KDB_TRACE        # Print a stack trace for a panic.

# Kernel Sanitizers
#options     COVERAGE        # Generic kernel coverage. Used by KCOV
#options     KCOV            # Kernel Coverage Sanitizer
# Warning: KUBSAN can result in a kernel too large for loader to load
#options     KUBSAN            # Kernel Undefined Behavior Sanitizer
#options     KCSAN            # Kernel Concurrency Sanitizer

# Kernel dump features.
options     EKCD            # Support for encrypted kernel dumps
options     GZIO            # gzip-compressed kernel and user dumps
options     ZSTDIO            # zstd-compressed kernel and user dumps
options     DEBUGNET        # debugnet networking
options     NETDUMP            # netdump(4) client support
options     NETGDB            # netgdb(4) client support

# Make an SMP-capable kernel by default
options     SMP            # Symmetric MultiProcessor Kernel

# CPU frequency control
device        cpufreq

# Bus support.
device        acpi
device        smbios
options     IOMMU
device        pci
options     PCI_HP            # PCI-Express native HotPlug
options     PCI_IOV            # PCI SR-IOV support

options     COMPAT_LINUXKPI

# Enable support for the kernel PLL to use an external PPS signal,
# under supervision of [x]ntpd(8)
# More info in ntpd documentation: http://www.eecis.udel.edu/~ntp

options     PPS_SYNC

# ATA controllers
device        ahci            # AHCI-compatible SATA controllers

# ATA/SCSI peripherals
device        scbus            # SCSI bus (required for ATA/SCSI)
device        da            # Direct Access (disks)

# NVM Express (NVMe) support
device        nvme            # base NVMe driver
device        nvd            # expose NVMe namespaces as disks, depends on nvme

device        kbdmux            # keyboard multiplexer

# syscons is the legacy console driver, resembling an SCO console
device        vga            # VGA video card driver
device        splash            # Splash screen and screen saver support
device        sc
options     SC_PIXEL_MODE        # add support for the raster text mode

# vt is the default video console driver
device        vt
device        vt_vga
device        vt_efifb
device        vt_vbefb

# Pseudo devices.
device        crypto            # core crypto support
device        aesni            # AES-NI OpenCrypto module
device        loop            # Network loopback
device        padlock_rng        # VIA Padlock RNG
device        rdrand_rng        # Intel Bull Mountain RNG
device        ether            # Ethernet support
device        vlan            # 802.1Q VLAN support
device        tuntap            # Packet tunnel.
device        md            # Memory "disks"
device        gif            # IPv6 and IPv4 tunneling
device        firmware        # firmware assist module
device        xz            # lzma decompression

# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
device        bpf            # Berkeley packet filter

# USB support
options     USB_DEBUG        # enable debug msgs
device        uhci            # UHCI PCI->USB interface
device        ohci            # OHCI PCI->USB interface
device        ehci            # EHCI PCI->USB interface (USB 2.0)
device        xhci            # XHCI PCI->USB interface (USB 3.0)
device        usb            # USB Bus (required)
device        usbhid            # USB HID Transport
device        hkbd            # HID Keyboard
device        ukbd            # USB Keyboard
device        umass            # Disks/Mass storage - Requires scbus and da

# Sound support
device        sound            # Generic sound driver (required)
device        snd_hda            # Intel High Definition Audio

# VirtIO support
device        virtio            # Generic VirtIO bus (required)
device        virtio_pci        # VirtIO PCI device
device        vtnet            # VirtIO Ethernet device
device        virtio_blk        # VirtIO Block device
device        virtio_scsi        # VirtIO SCSI device
device        virtio_balloon        # VirtIO Memory Balloon device

# Linux KVM paravirtualization support
device        kvm_clock        # KVM paravirtual clock driver

# HyperV drivers and enhancement support
device        hyperv            # HyperV drivers

# Xen HVM Guest Optimizations
# NOTE: XENHVM depends on xenpci and xentimer.
# They must be added or removed together.
options     XENHVM            # Xen HVM kernel infrastructure
device        xenefi            # Xen EFI timer device
device        xenpci            # Xen HVM Hypervisor services driver
device        xentimer        # Xen x86 PV timer device

# Netmap provides direct access to TX/RX rings on supported NICs
device        netmap            # netmap(4) support

# evdev interface
options     EVDEV_SUPPORT        # evdev support in legacy drivers
device        evdev            # input event device support
device        uinput            # install /dev/uinput cdev

# HID support
options     HID_DEBUG        # enable debug msgs
device        hid            # Generic HID support
device        hidbus            # Generic HID Bus
options     IICHID_SAMPLING        # Workaround missing GPIO INTR support

nodevice axge
In case of axge I searched for its module name in /usr/src/sys/modules but did not find it.

EDIT:
I tried setting if_axge="NO" in /boot/loader.conf, but no luck at all.
Maybe it gets loaded, because my ethernet USB adapter has two settings.
The first involves axge as driver.
The second involves cdce as driver. (my current setting set through a devd config file).
Regarding WiFi, and bluetooth I thought disabling them through the BIOS, but I don't have such options there.

It is not that these options are harmful to me, but seeing a polluted boot process due to wifi messages although not having any wifi software installed, or autoloading axge where only cdce is needed is somehow strange.
 
There is a mechanism that automatically loads kernel modules, especially for network drivers. module_blacklist is probably a better place to prevent it from being loaded.
 
I tried to set in /boot/loader.conf for axge:
-> if_axge_load="NO" (the module still autoloads itself)
-> module_blacklist="axge"
-> module_blacklist="if_axge"
-> module_blacklist="if_axge.ko"
But nothing helped, sadly.

Furthermore I looked up /boot/kernel | grep axge and found that it has if_axge.ko inside.
Would it be a good way to just rename/delete modules I don't want from that directory ?
 
Privet.
I have built and installed it.
However I have used methods described in /usr/src/UPDATING this time.
I also set the KERNCONF variable in /etc/make.conf.
To build and install the kernel I used these 2 commands:
Code:
make -DALWAYS_CHECK_MAKE -j13 buildkernel
make -DALWAYS_CHECK_MAKE installkernel

Through parallel building I achieved to build the kernel in 1 minute and 12 seconds instead of almost 15 minutes.
 
However I have used methods described in /usr/src/UPDATING this time.
To build and install the kernel I used these 2 commands:
make -DALWAYS_CHECK_MAKE -j13 buildkernel make -DALWAYS_CHECK_MAKE installkernel
I am not sure but I believe that you should have been used KERNCONF=MINPERF.

# make buildkernel KERNCONF=MINPERF
# make installkernel KERNCONF=MINPERF
 
I am not sure but I believe that you should have been used KERNCONF=MINPERF.

# make buildkernel KERNCONF=MINPERF
# make installkernel KERNCONF=MINPERF
I tried out both methods.
Setting it up in make.conf, and your suggested method.
Maybe axge is loaded as a dependency of another module, but I am not sure.
If that is the case, it would explain why axge does not want to be blacklisted.
The only problem I could have with axge is, if my ethernet goes down.
Then my USB ethernet adapter picks axge as the driver automatically upon router restart.
That is fine, but axge causes frequent ethernet crashes on my system...
 
Try to use
Code:
WITHOUT_MODULES=module1 module2 moduleX
without quotation marks
or just include one module

also you can try to grep axge in saved build and install results to ensure that this module is not build and installed
 
I solved the issue by replacing my trashy Aorus X670E Xtreme mainboard.
Sadly or luckily it died yesterday morning, and killed my 8 month old undervolted CPU, too.
So, I got a mainboard from MSI with a RTL 8125 + RTL 8126 chipset, and a better CPU ...

The first thing I did was to disable the bluetooth and wifi driver in the BIOS (couldn't be done on my old mainboard).
The second thing was to build the net/realtek-re-kmod port, and install the resulting pkg.
After configuring the re interface, I could ditch my USB ethernet adapter.
Now, after booting up and issuing:
Code:
INPUT:
kldstat

OUTPUT:
 1   98 0xffffffff80200000  1219ac0 kernel
 2    1 0xffffffff8141a000   5da658 zfs.ko
 3    2 0xffffffff819f5000     5308 xdr.ko
 4    1 0xffffffff819fc000   11d718 if_re.ko
 5    1 0xffffffff81b1a000     77d8 cryptodev.ko
 6    1 0xffffffff81b22000    1c5e8 geom_eli.ko
 7    1 0xffffffff82668000     d8a0 msdosfs.ko
 8    1 0xffffffff82676000     3160 amdtemp.ko
 9    1 0xffffffff8267a000     2138 amdsmn.ko
10    1 0xffffffff8267d000    12e18 fusefs.ko
11    1 0xffffffff82690000     2b60 mac_priority.ko
12    1 0xffffffff82693000    149b0 nvidia-drm.ko
13    1 0xffffffff826a8000    87090 drm.ko
14    1 0xffffffff82730000     22b8 iic.ko
15    1 0xffffffff82733000     4120 linuxkpi_video.ko
16    2 0xffffffff82738000     7350 dmabuf.ko
17    1 0xffffffff82740000     3378 lindebugfs.ko
18    2 0xffffffff82800000  40ac9a8 nvidia.ko
19    1 0xffffffff868ad000   1325e8 nvidia-modeset.ko
20    1 0xffffffff82744000     3390 acpi_wmi.ko
21    1 0xffffffff82748000     6020 ig4.ko
22    1 0xffffffff8274f000     3220 intpm.ko
23    1 0xffffffff82753000     2178 smbus.ko
24    1 0xffffffff82756000     6760 cuse.ko
25    1 0xffffffff8275d000     3360 uhid.ko
26    1 0xffffffff82761000     3360 wmt.ko
27    1 0xffffffff82765000     4364 ums.ko
28    1 0xffffffff8276a000    27450 ipfw.ko
29    1 0xffffffff82792000    2f5c0 if_wg.ko

I can verify that no (axge|wifi|bluetooth) module is loaded.
 
Back
Top