diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk index 81b11749291..f26a44eb61f 100644 --- a/sys/conf/kern.opts.mk +++ b/sys/conf/kern.opts.mk @@ -47,6 +47,7 @@ __DEFAULT_YES_OPTIONS = \ SOURCELESS_UCODE \ SPLIT_KERNEL_DEBUG \ TESTS \ + USB \ USB_GADGET_EXAMPLES \ ZFS @@ -207,6 +208,10 @@ MK_KERNEL_SYMBOLS:= no MK_DTRACE:= no .endif +.if ${MK_USB} == "no" +MK_USB_GADGET_EXAMPLES:= no +.endif + # Some modules only compile successfully if option FDT is set, due to #ifdef FDT # wrapped around declarations. Module makefiles can optionally compile such # things using .if !empty(OPT_FDT) diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 17358428a02..4f150959248 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -103,10 +103,14 @@ LINUXKPI_GENSRCS+= \ pci_iov_if.h \ pcib_if.h \ vnode_if.h \ - usb_if.h \ - opt_usb.h \ opt_stack.h +.if ${MK_USB} != "no" +LINUXKPI_GENSRCS+= \ + usb_if.h \ + opt_usb.h +.endif + LINUXKPI_INCLUDES+= \ -I${SYSDIR}/compat/linuxkpi/common/include \ -I${SYSDIR}/compat/linuxkpi/dummy/include \ diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 49a15588e9a..a4100c31ef2 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -356,7 +356,7 @@ SUBDIR= \ ${_rtw89} \ rtwn \ rtwn_pci \ - rtwn_usb \ + ${_rtwn_usb} \ ${_rtwnfw} \ ${_s3} \ ${_safe} \ @@ -411,7 +411,7 @@ SUBDIR= \ ${_ufshci} \ uinput \ unionfs \ - usb \ + ${_usb} \ ${_vesa} \ ${_vf_i2c} \ virtio \ @@ -710,6 +710,14 @@ SUBDIR+= ktest SUBDIR+= tests .endif +.if ${MK_USB} != "no" || defined(ALL_MODULES) +_rtwn_usb= rtwn_usb +_usb= usb +. if ${MACHINE_CPUARCH} == "amd64" +_thunderbolt= thunderbolt +. endif +.endif + .if ${MK_ZFS} != "no" || defined(ALL_MODULES) SUBDIR+= zfs .endif @@ -938,10 +946,6 @@ _bcm283x_pwm= bcm283x_pwm _neta= neta .endif -.if ${MACHINE_CPUARCH} == "amd64" -_thunderbolt= thunderbolt -.endif - .if !(${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} < 110000) # LLVM 10 crashes when building if_malo_pci.c, fixed in LLVM11: # https://bugs.llvm.org/show_bug.cgi?id=44351