Bug 270742 - net/wifi-firmware-*: add framework and firmware for various WiFi chipsets
Summary: net/wifi-firmware-*: add framework and firmware for various WiFi chipsets
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Bjoern A. Zeeb
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-10 17:28 UTC by Bjoern A. Zeeb
Modified: 2023-05-12 11:59 UTC (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-04-10 17:28:05 UTC
I am not a ports committer so need help to get this in.

Add a "base port framework" to fetch WiFi firmware and license files
from the linux-firmware.git repository and an accompanying FreeBSD
build kmod framework tarball (for now; we might do without that in
the future).
Add child ports for Realtek rtw88 and rtw89, Mediatek mt76, and
Atheros ath10k and ath11k firmware as a start.

This is a beginning in order to stop bloating src.git and the
installed kernels with lots of MB of firmware files whereas usually
only one vebdor/chipset/flavor is needed. Before fully switching
more infrastructure needs to be in place but this is the first and
most important step.

I've opened a review for this in order to sort out any things which might need changing and to make it easier to pull the changes into any local trees.

https://reviews.freebsd.org/D39487
Comment 1 commit-hook freebsd_committer freebsd_triage 2023-04-22 15:26:27 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3082cab3f868c1f7538d5221080703d891a2d0a6

commit 3082cab3f868c1f7538d5221080703d891a2d0a6
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-04-09 01:29:48 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-04-22 15:21:22 +0000

    net/wifi-firmware-*: add framework and firmware for various WiFi chipsets

    Add a "base port framework" to fetch (WiFi) firmware and license files
    from the linux-firmware.git repository and an accompanying FreeBSD
    build kmod framework tarball (for now; we might do without that in
    the future).
    Add child ports for Realtek rtw88 and rtw89, Mediatek mt76, and
    Atheros ath10k and ath11k firmware as a start.

    This is a beginning in order to stop bloating src.git and the
    installed kernels with lots of MB of firmware files whereas usually
    only one vebdor/chipset/flavor is needed.  Before fully switching
    more infrastructure needs to be in place but this is the first and
    most important step.

    PR:             270742
    Reviewed by:    lwhsu
    Approved by:    lwhsu (ports)
    Differential Revision: https://reviews.freebsd.org/D39487

 net/wifi-firmware-ath10k-kmod/Makefile (new)  |  88 +++++++++++++++++++++
 net/wifi-firmware-ath10k-kmod/distinfo (new)  |  79 +++++++++++++++++++
 net/wifi-firmware-ath10k-kmod/pkg-descr (new) |   3 +
 net/wifi-firmware-ath11k-kmod/Makefile (new)  | 105 ++++++++++++++++++++++++++
 net/wifi-firmware-ath11k-kmod/distinfo (new)  |  23 ++++++
 net/wifi-firmware-ath11k-kmod/pkg-descr (new) |   3 +
 net/wifi-firmware-base/Makefile (new)         |  80 ++++++++++++++++++++
 net/wifi-firmware-mt76-kmod/Makefile (new)    |  31 ++++++++
 net/wifi-firmware-mt76-kmod/distinfo (new)    |  27 +++++++
 net/wifi-firmware-mt76-kmod/pkg-descr (new)   |   5 ++
 net/wifi-firmware-rtw88-kmod/Makefile (new)   |  34 +++++++++
 net/wifi-firmware-rtw88-kmod/distinfo (new)   |  19 +++++
 net/wifi-firmware-rtw88-kmod/pkg-descr (new)  |   7 ++
 net/wifi-firmware-rtw89-kmod/Makefile (new)   |  28 +++++++
 net/wifi-firmware-rtw89-kmod/distinfo (new)   |  13 ++++
 net/wifi-firmware-rtw89-kmod/pkg-descr (new)  |   6 ++
 16 files changed, 551 insertions(+)
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-04-22 20:28:42 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a17882fde4bcce5bdb968563acd07778332302ac

commit a17882fde4bcce5bdb968563acd07778332302ac
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-04-22 20:23:14 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-04-22 20:27:27 +0000

    net/wifi-firmware-*: connect to build

    Add a missing pkg-decr [1] for wifi-firmware-base and connect all
    wifi-firmware-* to the build.

    Reported by:    dvl [1]
    Discussed on:   ports-committers (rene)
    PR:             270742

 net/Makefile                           | 6 ++++++
 net/wifi-firmware-base/pkg-descr (new) | 1 +
 2 files changed, 7 insertions(+)
Comment 3 Dmitry Marakasov freebsd_committer freebsd_triage 2023-04-24 15:40:08 UTC
wifi-firmware-base produces invalid INDEX entry, please fix:

% wget https://download.FreeBSD.org/ports/index/INDEX-13.bz2 -qO- | bunzip2 | grep wifi-firmware-base | awk -F\| '{print $1}'
wifi-firmware--kmod-
Comment 4 Bjoern A. Zeeb freebsd_committer freebsd_triage 2023-04-24 17:16:56 UTC
Adding rene as he suggested to add it to the build too.

On the other hand I do not understand why INDEX building does not properly deal with IGNORE?  I still have to learn a lot of "ports" it seems.
Comment 5 Dmitry Marakasov freebsd_committer freebsd_triage 2023-04-24 17:48:41 UTC
> I still have to learn a lot of "ports" it seems.

Well, with 16k+ commits to ports I would not expect it to generate INDEX entry either - looks like a framework problem to me.

After a quick glance at the port, it looks problematic too. Am I correct that it's never built on its own and is only meant for serving as a base for actual firmware modules? In that case it should not be a separate port, as we don't need ports which do nothing. It may be converted to Makefile.inc somewhere or into Mk/Uses/ entry (probably the former since there are not many consumers).

I would add net/wifi-firmware port as a metaport which depends on all wifi-firmware-*-kmod's and store Makefile.inc there, removing net/wifi-firmware-base.
Comment 6 Emanuel Haupt freebsd_committer freebsd_triage 2023-04-27 12:25:37 UTC
Meanwhile, could we disconnect wifi-firmware-* from ports/net/Makefile in order to resume INDEX build? Various tools (such as repology) depend on an up to date INDEX.
Comment 7 Rene Ladan freebsd_committer freebsd_triage 2023-04-27 19:44:46 UTC
(In reply to Emanuel Haupt from comment #6)

INDEX builds just fine for me with this unmodified tree: 12.3-eol-3410-g5285305165ea
Comment 8 Rene Ladan freebsd_committer freebsd_triage 2023-04-27 19:46:46 UTC
(In reply to Rene Ladan from comment #7)

So that is a tree of around 25 minutes ago.
Comment 9 Emanuel Haupt freebsd_committer freebsd_triage 2023-04-28 05:44:48 UTC
(In reply to Rene Ladan from comment #8)

According to amdmi3 (#3) the offending (no version number) entry seems to be:

wifi-firmware--kmod-
Comment 10 commit-hook freebsd_committer freebsd_triage 2023-04-28 22:50:11 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f0bc8dadb0f7aa8e9f52848ef54bc4425056a4f2

commit f0bc8dadb0f7aa8e9f52848ef54bc4425056a4f2
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-04-28 10:03:43 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-04-28 22:48:56 +0000

    net/wifi-firmware-base: fix make index entry

    It seems despite IGNORE make index still adds this to the index so
    make sure we have a sane PORTNAME until we improve the
    wifi-firmware ports even further (still suggestiongs coming in).

    PR:             270742
    Reported by:    amdmi3
    Approved by:    ehaupt

 net/wifi-firmware-base/Makefile | 3 +++
 1 file changed, 3 insertions(+)
Comment 11 commit-hook freebsd_committer freebsd_triage 2023-05-12 11:59:30 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6247964e51aa9d2dd972fb4c545c97164bda609c

commit 6247964e51aa9d2dd972fb4c545c97164bda609c
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-05-08 20:54:50 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-05-12 11:57:09 +0000

    net/wifi-firmware-*: use metaport for "base" and switch to Makefile.inc

    Rename the wifi-firmware-base to wifi-firmware-kmod (similar to
    gpu-firmware-mod).  The former was never build so technically it
    is no move.  Make the new subdir a metaport including all
    wireless firmware.
    Move the old Makefile to Makefile.inc and adjust the child ports
    accordingly.

    This solves two problems: (1) the base port is now buildable and (2)
    there is a single port to depend on to add all the needed firmware
    files to, e.g., put on a release media.

    Suggested by:   amdmi3
    PR:             270742
    Reviewed by:    ehaupt, jrm
    Approved by:    ehaupt, jrm
    Differential Revision: https://reviews.freebsd.org/D40014

 net/Makefile                                           |  2 +-
 net/wifi-firmware-ath10k-kmod/Makefile                 |  4 ++--
 net/wifi-firmware-ath11k-kmod/Makefile                 |  4 ++--
 net/wifi-firmware-base/pkg-descr (gone)                |  1 -
 net/wifi-firmware-kmod/Makefile (new)                  | 18 ++++++++++++++++++
 .../Makefile => wifi-firmware-kmod/Makefile.inc}       |  0
 net/wifi-firmware-kmod/pkg-descr (new)                 |  1 +
 net/wifi-firmware-mt76-kmod/Makefile                   |  4 ++--
 net/wifi-firmware-rtw88-kmod/Makefile                  |  4 ++--
 net/wifi-firmware-rtw89-kmod/Makefile                  |  4 ++--
 10 files changed, 30 insertions(+), 12 deletions(-)