summaryrefslogtreecommitdiff
path: root/net/wifi-firmware-kmod/Makefile.inc
diff options
context:
space:
mode:
Diffstat (limited to 'net/wifi-firmware-kmod/Makefile.inc')
-rw-r--r--net/wifi-firmware-kmod/Makefile.inc94
1 files changed, 35 insertions, 59 deletions
diff --git a/net/wifi-firmware-kmod/Makefile.inc b/net/wifi-firmware-kmod/Makefile.inc
index cc957a76fb6a..68755828064b 100644
--- a/net/wifi-firmware-kmod/Makefile.inc
+++ b/net/wifi-firmware-kmod/Makefile.inc
@@ -1,12 +1,13 @@
PORTNAME= wifi-firmware-${FWDRV}-kmod
PORTVERSION= ${FWDRV_VERSION}
-PORTREVISION?= 2
+#PORTREVISION?= 0
CATEGORIES= net
MASTER_SITES= https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
- https://ams.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
- https://dfw.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
- https://nyc.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
- https://sin.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/
+ https://fra.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
+ https://sea.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
+ https://sg2.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
+ https://sto.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/ \
+ https://tor.source.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/plain/
MAINTAINER= bz@FreeBSD.org
COMMENT= Firmware modules for the ${FWDRV} (${FLAVOR}) WiFi NIC driver
@@ -77,29 +78,31 @@ DISTFILES= ${DISTFILES_${FLAVOR}:O:u} \
DIST_SUBDIR= linux-firmware/${FWDRV}fw
EXTRACT_ONLY=
-ONLY_FOR_ARCHS= aarch64 amd64 i386
+.if !defined(NOT_FOR_ARCHS)
+ONLY_FOR_ARCHS?= aarch64 amd64 i386
ONLY_FOR_ARCHS_REASON= LinuxKPI driver only available for these architectures
+.endif
USES= uidfix
-# We do not need that anymore for the modern build but making it conditional on
-# OSVERSION seems to not add the _USES_install bits from kmod.mk.
-USES+= kmod
-
-BOOT_LOADERCONFD= /boot/loader.conf.d
.include <bsd.port.pre.mk>
-.if (${OSVERSION} >= 1500014) || (${OSVERSION} < 1500000 && ${OSVERSION} >= 1402000)
# src.git main 479905a1ed26c54ef29cdff65cf25f7feade654b (stable/14 2ca7b03d6275)
-# allows direct loading of firmware files. For anything before that we still need
-# to create kernel modules. We need to write a PLIST file so we can then simply use
-# COPYTREE_SHARE with adjusted permissions to copy the files over.
+# allows direct loading of firmware files.
+# We write a PLIST file so we can then simply use COPYTREE_SHARE with adjusted
+# permissions to copy the files over.
+.if (${OSVERSION} < 1402000) || (${OSVERSION} >= 1500000 && ${OSVERSION} < 1500014)
+# For 13.5, which is the last supported release before plain firmware loading is
+# implemented, we did ship firmware in src/ still so there is no need to build.
+# Also mtw (mt7601u) was never in a version earlier than this.
+# XXX remove comment after April 2026 when 13.5 goes out of support as well.
+IGNORE= Not supported for this osversion.
+.endif
+
+BOOT_LOADERCONFD= /boot/loader.conf.d
BOOTFWDIR?= /boot/firmware
_SHAREMODE= 0444
NO_BUILD= yes
-.else
-MAKE_ENV+= FWSRCDIR=${WRKSRC}/fw
-.endif
post-extract:
@${MKDIR} ${WRKSRC}/fw
@@ -117,72 +120,45 @@ post-extract:
@${ECHO_CMD} "compat.linuxkpi.skb.mem_limit=${COMPAT_LINUXKPI_SKB_MEM_LIMIT}" >> ${WRKSRC}/${BOOT_LOADERCONFD}/${FLAVOR}.conf
@${ECHO_CMD} "${BOOT_LOADERCONFD}/${FLAVOR}.conf" >> ${PLIST}
.endif
-.if defined(COMPAT_LINUXKPI_IWL_HWCRYPTO_HT_VHT) && (${COMPAT_LINUXKPI_IWL_HWCRYPTO_HT_VHT:M${FLAVOR}} != "")
+.if defined(COMPAT_LINUXKPI_HWCRYPTO_HT_VHT) && (${COMPAT_LINUXKPI_HWCRYPTO_HT_VHT:M${FLAVOR}} != "")
@${MKDIR} ${WRKSRC}/${BOOT_LOADERCONFD}
- @${ECHO_CMD} "compat.linuxkpi.80211.hw_crypto=1" >> ${WRKSRC}/${BOOT_LOADERCONFD}/iwlwifi-${FLAVOR}.conf
- @${ECHO_CMD} "compat.linuxkpi.iwlwifi_11n_disable=0" >> ${WRKSRC}/${BOOT_LOADERCONFD}/iwlwifi-${FLAVOR}.conf
- @${ECHO_CMD} "compat.linuxkpi.iwlwifi_disable_11ac=0" >> ${WRKSRC}/${BOOT_LOADERCONFD}/iwlwifi-${FLAVOR}.conf
- @${ECHO_CMD} "${BOOT_LOADERCONFD}/iwlwifi-${FLAVOR}.conf" >> ${PLIST}
+ @${ECHO_CMD} "compat.linuxkpi.80211.hw_crypto=1" >> ${WRKSRC}/${BOOT_LOADERCONFD}/${FWDRV}-${FLAVOR}.conf
+ # "iwlwifi_11n_disable" one is iwlwifi specific; for all the others bz created them homogeneously.
+ # Setting an unknown kenv does not hurt.
+ @${ECHO_CMD} "compat.linuxkpi.${FWDRV}_11n_disable=0" >> ${WRKSRC}/${BOOT_LOADERCONFD}/${FWDRV}-${FLAVOR}.conf
+ @${ECHO_CMD} "compat.linuxkpi.${FWDRV}_disable_11n=0" >> ${WRKSRC}/${BOOT_LOADERCONFD}/${FWDRV}-${FLAVOR}.conf
+ @${ECHO_CMD} "compat.linuxkpi.${FWDRV}_disable_11ac=0" >> ${WRKSRC}/${BOOT_LOADERCONFD}/${FWDRV}-${FLAVOR}.conf
+ @${ECHO_CMD} "${BOOT_LOADERCONFD}/${FWDRV}-${FLAVOR}.conf" >> ${PLIST}
.endif
################################################################################
-.if (${OSVERSION} >= 1500014) || (${OSVERSION} < 1500000 && ${OSVERSION} >= 1402000)
.for _f in ${DISTFILES_${FLAVOR}:O:u}
# Create firmware source directory and copy in distfile.
- @${MKDIR} ${WRKSRC}/fw/${_f:H}
- ${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@}
- @${ECHO_CMD} ${BOOTFWDIR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@} >> ${PLIST}.tmp
+ @${MKDIR} ${WRKSRC}/fw/${_f:S@${STRIP_FWSUBDIR:Q}@@:H}
+ ${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S@${STRIP_FWSUBDIR:Q}@@}
+ @${ECHO_CMD} ${BOOTFWDIR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S@${STRIP_FWSUBDIR:Q}@@} >> ${PLIST}.tmp
.endfor
+ # Create PLIST for firmware files.
(cd ${WRKSRC}/fw/ && ${FIND} . -type d -mindepth 1 | \
${AWK} -vB="${BOOTFWDIR}/" '{ sub("^./", "@dir "B); print; }') >> ${PLIST}.tmp
# Remove possibly duplicate @dir entries
@${SORT} -u ${PLIST}.tmp >> ${PLIST}
-.else
################################################################################
-# Build kernel modules.
- # Prepare toplevel Makefile and Makefile.inc.
- @${ECHO_CMD} "SUBDIR=" > ${WRKSRC}/Makefile
- @${SED} -e "s@%%FWDRV%%@${FWDRV}@g" \
- -e "s@%%FWSUBDIR%%@${FWSUBDIR}@g" \
- ${FILESDIR}/Makefile.inc.in > ${WRKSRC}/Makefile.inc
-.for _f in ${DISTFILES_${FLAVOR}:O:u}
- # We remove '.' and '-' as well as '/' as they don't work well in loader.conf.
- @${MKDIR} ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}
- # Create subdir (firmware file) Makefile.
- @${ECHO_CMD} "FWNAME=${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:T}" > ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile
-.if (${_f:H:C,^[^/]*,,1:C,^/,,} != "")
- @${ECHO_CMD} "FWSUBSUBDIR=${_f:H:C,^[^/]*,,1:C,^/,,}" >> ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile
-.endif
- # XXX-BZ recover firmware versions later again from somewhere? Pain to keep track though, else use 0 or ${FWDRV_VERSION}?
- @${ECHO_CMD} "VERSION=0" >> ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile
- @${ECHO_CMD} '.include <bsd.kmod.mk>' >> ${WRKSRC}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}/Makefile
- # Add subdir to top-level Makefile.
- @${ECHO_CMD} "SUBDIR+=${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}" >> ${WRKSRC}/Makefile
- # Create firmware source directory and copy in distfile.
- @${MKDIR} ${WRKSRC}/fw/${_f:H}
- ${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/fw/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@}
- @${ECHO_CMD} ${KMODDIR}/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,.,_,g:S,-,_,g:S,/,_,g}.ko >> ${PLIST}
-.endfor
- @${ECHO_CMD} '.include <bsd.subdir.mk>' >> ${WRKSRC}/Makefile
-################################################################################
-.endif
# Copy in additional licenses files.
.for _f in ${DISTFILES_${FLAVOR}_lic}
${CP} ${DISTDIR}/${DIST_SUBDIR}/${_f} ${WRKSRC}/lic/${_f:C@(^[^?]*)${DISTURL_SUFFIX:Q}@\1@:S,/,_,g}
.endfor
-.if (${OSVERSION} >= 1500014) || (${OSVERSION} < 1500000 && ${OSVERSION} >= 1402000)
do-install:
(cd ${WRKSRC}/fw/ && ${COPYTREE_SHARE} . ${STAGEDIR}/${BOOTFWDIR})
-.endif
post-install:
.if defined(COMPAT_LINUXKPI_SKB_MEM_LIMIT) && ${COMPAT_LINUXKPI_SKB_MEM_LIMIT} > 0
@${MKDIR} ${STAGEDIR}/${BOOT_LOADERCONFD}
@${INSTALL_DATA} ${WRKSRC}/${BOOT_LOADERCONFD}/${FLAVOR}.conf ${STAGEDIR}/${BOOT_LOADERCONFD}/${FLAVOR}.conf
.endif
-.if defined(COMPAT_LINUXKPI_IWL_HWCRYPTO_HT_VHT) && (${COMPAT_LINUXKPI_IWL_HWCRYPTO_HT_VHT:M${FLAVOR}} != "")
+.if defined(COMPAT_LINUXKPI_HWCRYPTO_HT_VHT) && (${COMPAT_LINUXKPI_HWCRYPTO_HT_VHT:M${FLAVOR}} != "")
@${MKDIR} ${STAGEDIR}/${BOOT_LOADERCONFD}
- @${INSTALL_DATA} ${WRKSRC}/${BOOT_LOADERCONFD}/iwlwifi-${FLAVOR}.conf ${STAGEDIR}/${BOOT_LOADERCONFD}/iwlwifi-${FLAVOR}.conf
+ @${INSTALL_DATA} ${WRKSRC}/${BOOT_LOADERCONFD}/${FWDRV}-${FLAVOR}.conf ${STAGEDIR}/${BOOT_LOADERCONFD}/${FWDRV}-${FLAVOR}.conf
.endif
@${DO_NADA}