Open probonopd opened 3 years ago
Added the packages:
https://github.com/helloSystem/ISO/commit/93218c55ff02a92818ac420a762a6142a2a82a83
Possibly additional configuration is needed as described above.
There is no package for net/bwm-firmware-kmod, you need to build this from ports.
Maybe we can get the firmware from the existing Ubuntu package.
https://steemit.com/freebsd/@valkyr/freebsd-on-lenovo-ideapad-s10-feat-broadcom-bcm4312
Seems to be quite involved to get this thing running!
The 4312 does work on NomadBSD with some lines added to the loader.conf. I replaced the card with an Atheros, but I have a laptop where it is easy to switch, so I could do some testing once the firmware is added.
once the firmware is added
How would one do that in the most straightforward way? (How does it work on NomadBSD?)
Looking at https://github.com/nomadbsd/NomadBSD/blob/51c823f62993b14a5e2552c319191ccd38f1bbee/build.cfg#L83-L84 they are using
There is also
Where is the firmware actually contained?
pkg info on my nomad system shows: bwn-firmware-kmod-0.1.2 (bwi is for an older broadcom chipset). You may need to install from ports due to the license, not sure I haven't tried on pure FreeBSD. The nomad system has bwn_v4_ucode.ko, bwn_v4_lp_ucode.ko, bwn_v4_n_ucode.ko in /boot/modules. I added the following to /boot/loader.conf: if_bwn_load="YES" bwn_v4_ucode_load="YES" bwn_v4_lp_ucode_load="YES"
I was going to try just copying the modules over and editing the loader.conf, but it appears modifying the run from usb system is non trivial. I might be able to scrounge anpther laptop HDD to try a full install on.
Hint: You can also install helloSystem to a >= 8 GB USB stick rather than to an internal hard drive (I am typing this from one).
I got a laptop I could do an install to the HDD on and tested with the Broadcom 4312 card. This card is a b/g, but I also have a 4313, which is the n version. I tried fetching ports, but the bwn-firmware-kmod port requires kernel source, so I stopped there. It looks like it also requires the b43-fwcutter port. I installed from 0.5.0_OE141-FreeBSD-12.2, so I copied the .ko files from my Nomad system (also 12.2 based) into /boot/modules. I added if_bwn_load="YES" and bwn_v4_lp_ucode_load="YES" to the loader.conf and rebooted and was able to configure the card and connect to the network. I tried bwn_v4_ucode_load first, but the error messages showed it was looking for the lp firmware. I'm on that laptop now. pciconf shows: bwn_pci0@pci0:12:0:0: class=0x028000 card=0x000c1028 chip=0x431514e4 rev=0x01 hdr=0x00 vendor = 'Broadcom Inc. and subsidiaries' device = 'BCM4312 802.11b/g LP-PHY' class = network snippet from ifconfig: parent interface: bwn0 media: IEEE 802.11 Wireless Ethernet OFDM/48Mbps mode 11g status: associated
Thanks for testing @dotdash70. Can you please give the exact names of the files you copied?
bwn_v4_lp_ucode.ko bwn_v4_n_ucode.ko bwn_v4_ucode.ko (from NomadBSD 1.4) The 'proper' way of doing it is something like: install kernel sources, install bw43-fwcutter port, install bwn-firmware kmod port.
Additional Notes: I had to manually add the wlan entries to /etc/rc.conf to get the adapter to come up. I also copied over the working wpa_supplicant.conf from the Nomad system.
I tried the 4313 card, and that one is not supported under FreeBSD. Found some more detailed information on Broadcom wireless cards in FreeBSD here: https://landonf.org/code/freebsd/Broadcom_WiFi_Improvements.20180122.html Most of that was over my head, but it appears newer chipsets require the FullMAC driver, which is not currently implemented. This may happen in FreeBSD 13.x as work on SDIO progresses. Source: https://wiki.freebsd.org/SDIO
If one has Ports installed:
sudo su
cd /usr/ports/net/bwn-firmware-kmod && make install
Source: https://unix.stackexchange.com/a/595474
We would probably need to build that package ourselves, so that we can include it in the ISO. But first we need to understand the Legalese involved.
To build a package:
In the Makefile
comment out the line
# NO_PACKAGE= this is a modified version of a restricted firmware
then run sudo make package
.
FreeBSD% sudo make package
===> Building package for bwn-firmware-kmod-0.1.2
FreeBSD% pkg info bwn-firmware-kmod
bwn-firmware-kmod-0.1.2
Name : bwn-firmware-kmod
Version : 0.1.2
Installed on : Sat Oct 2 14:10:08 2021 CEST
Origin : net/bwn-firmware-kmod
Architecture : FreeBSD:12:amd64
Prefix : /usr/local
Categories : net kld
Licenses :
Maintainer : swhetzel@gmail.com
WWW : UNKNOWN
Comment : Broadcom AirForce IEEE 802.11 Firmware Kernel Module
Annotations :
FreeBSD_version: 1202000
Flat size : 411KiB
Description :
Firmware kernel module for bwn(4)
Rinse and repeat with bwi-firmware-kmod
.
On Mac mini Mid 2010 (Macmini4,1
) FreeBSD 13.0-RELEASE based helloSystem 0.7.0 (Live) getting KLD bwn:v4_ucode.ko: depends on kernel - not available or version mismatch
.
/boot/modules/bwn_v4_ucode.ko
exists, and trying to load it manually results in the same message in dmesg
.
FreeBSD breakage?
https://wiki.freebsd.org/IntelMacMini suggests (for MacMini3,1):
if_bwn_load="YES"
bwn_v4_ucode_load="YES"
bwn_v4_n_ucode_load="YES"
When doing this on FreeBSD 13.0-RELEASE based helloSystem 0.7.0, the boot loader complains about module "kernel" exists but with wrong version
.
FreeBSD packaging bug?
Coming back to do some testing with 7 G160 version based on FreeBSD 13.0 My older laptop has had issues installing from the 5 version on, though it's booting the live system nicely now. I tried this on a SFF desktop with a mini-pcie slot that I can put the old Broadcom card in. I decided to try it the hard way this time, rather than copy the files from my NomadBSD system. First I tried from my fresh Hello System 7 install, which was running fine with an Intel wireless card. First I installed ports, then found I needed source, so downloaded and extracted the src tree. When trying to make the b43-fwcutter port, I found the system wasn't finding cc. I tried symlinking clang, but the make was still blowing up, so I did a quick install of vanilla FreeBSD 13.0 on another box, installing ports and src. From that box, I was able to make b43-fwcutter, and bwn-firmware-kmod from the ports tree. I copied bwn_v4_ucode.ko, bwn_v4_n_ucode.ko, and bwn_v4_lp_ucode.ko from the FreeBSD system to /boot/modules/ on my HelloSystem. The added lines to boot/loader.conf: if_bwn_load="YES" bwn_v4_ucode_load="YES" bwn_v4_n_ucode_load="YES" bwn_v4_lp_ucode_load="YES" and etc/rc.conf: wlans_bwn0="wlan1" create_args_wlan1="down country US" ifconfig_wlan1="up scan WPA DHCP" I was then able to shut the HelloSystem machine down, swap the wireless card, and have it come up working on the broadcom card: ifconfig wlan1 wlan1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 ether 00:26:5e:00:aa:bb inet6 fe80::226:5eff:fe00:aabb%wlan1 prefixlen 64 scopeid 0x3 inet 172.16.32.147 netmask 0xffffff00 broadcast 172.16.32.255 groups: wlan ssid TEST channel 11 (2462 MHz 11g) bssid 24:a4:3c:00:aa:bb regdomain FCC country US authmode WPA2/802.11i privacy ON deftxkey UNDEF AES-CCM 3:128-bit txpower 30 bmiss 7 scanvalid 60 protmode CTS wme roaming MANUAL parent interface: bwn0 media: IEEE 802.11 Wireless Ethernet OFDM/24Mbps mode 11g status: associated nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL> I can supply the FreeBSD 13.0 versions of the .ko files (and bwi_v3_ucode.ko that I built since I was at it) if needed.
Thanks @dotdash70 for taking the time to check this out.
When trying to make the b43-fwcutter port, I found the system wasn't finding cc.
By default, helloSystem does not ship compilers and other developer-related tools. To get these, you need to install the Developer Tools from developer.img
on https://github.com/helloSystem/ISO/releases/tag/r0.7.0 as well.
I can supply the FreeBSD 13.0 versions of the .ko files (and bwi_v3_ucode.ko that I built since I was at it) if needed.
This would be very helpful. You can put them into a zip and attach them here. Thanks!
Could you also create pkg packages for b43-fwcutter and bwn-firmware-kmod using sudo make package && ls work/pkg
?
Here are the .ko files built from a FreeBSD 13.0-Release system: bw-ko-fbsd13.zip As for creating a pkg, do you mean running that command on FreeBSD 13, or on helloSystem? If helloSystem, then I'd imagine the procedure would go something like- download the developer.img, install Developer Tools, fetch kernel sources, fetch ports, make/install the bw43-fwcutter port, make/install bwn-firmware-kmod, then use the make package command for both ports. Does that sound correct? I've never tried to pkg a port. Additionally, I think the reason there is not a pkg for the firmware files is due to the licensing. The build process grabs the files from openwrt, iirc. Recent versions of GhostBSD and NomadBSD are based on FreeBSD 13.0 and have the .ko modules present in boot/modules, so their developers may have some insight on the particulars of bundling the files with a distribution.
Thanks @dotdash70. This is very helpful.
With making the pkg, i meant on FreeBSD 13. (helloSystem 0.7.0 is a preconfigured FreeBSD 13 with some additions, after all.) Running sudo make package && ls work/pkg
in your existing ports directory that contains the Makefile
for the respective Port should be sufficient.
Had to edit the makefile as detailed earlier. Here is the result pkg.zip
Thank you very much @dotdash70.
I've tried loading the Broadcom driver for the BCM4321 on my MacBook 4,1, but it doesn't work. /var/log/messages
says bwn_phy_n_attach: BWN_GPL_PHY not in kernel config; no PHY-N support
and then says that it failed. Any idea how to fix this? The most plausible one seems to be recompiling the kernel, but I have no idea how to do that on FreeBSD (and the documentation, as far as I've seen, is quite terrible compared to Linux).
@Slater91 did you install the package from @dotdash70?
There is one hardware probe that lists the BCM4321 in a MacBook4,1 as "works" with bwn_pci
(which probably means that the driver was loaded, not much more).
Yes, I have. I have read multiple discussions where people specifically said that you have to enable the flag in the kernel in order for the driver to work. I'll post the links as soon as I find them again. My loader.conf has this:
if_bwn_load="YES"
bwn_pci="YES"
bwn_v4_ucode_load="YES"
bwn_v4_n_ucode_load="YES"
bwn_v4_lp_ucode_load="YES"
Here is the /var/log/messages log: messages.txt
I have read multiple discussions where people specifically said that you have to enable the flag in the kernel in order for the driver to work.
Did you find any reason why this flag is apparently not enabled by default in the FreeBSD kernel then?
In helloSystem we want to use the official kernels provided by the FreeBSD project. So my question is, why is the FreeBSD project not setting the flag in the kernel.
If we can't find obvious downsides of using that kernel configuration, then possibly we should open a ticket at https://bugs.freebsd.org/ requesting a change in the default FreeBSD kernel configuration.
Unfortunately, my test kit consists of a 4312 (works) and a 4313 (does not work). A quick search seems to indicate the 4321 may not be supported, or may require additional steps. Landon Fuller's page shows only the dual-band version being supported under bwn, with the caveat 'The optional bwn(4) PHY driver is derived from b43 GPL code, and must be explicitly enabled.' I'm not sure exactly what that entails, having never had to do it. I'm not sure what deficiencies you are finding in the FreeBSD docs, but I have always found them very helpful. Kernel configuration is right in the handbook. https://docs.freebsd.org/en/books/handbook/kernelconfig/ If helloSystem is using the GENERIC kernel, you could use that as a base, but if there are any customizations in the kernel, you would need to include those as well.
Came across this post with detailed instructions on how to compile a kernel with BWN_GPL_PHY here: https://forums.freebsd.org/threads/bcm4322-wifi-card-freebsd-11-2-not-working.68103/ I would expect there are licensing issues keeping it from being in the GENRIC kernel.
I would expect there are licensing issues keeping it from being in the GENRIC kernel.
That is what I was fearing.
What I don't understand, though:
Why does the Broadcom kernel module need a special configuration (apparently with Broadcom proprietary parts?) of the kernel itself in order for it to work? Isn't the whole point of a kernel module to keep certain things out of the kernel itself?
A bit beyond me, but from looking over Landon's page, the Broadcom chipsets seem to have a lot of variation of parts, and some currently only work with by replacing the PHY bits with those borrowed from the Linux GPL version. I guess that needs to be done at the kernel level. https://svnweb.freebsd.org/base?view=revision&revision=326841
I can confirm that enabling "BWN_GPL_PHY" in the kernel build options leads to a working WiFi chip.
I'm not sure what deficiencies you are finding in the FreeBSD docs, but I have always found them very helpful. Kernel configuration is right in the handbook. https://docs.freebsd.org/en/books/handbook/kernelconfig/ If helloSystem is using the GENERIC kernel, you could use that as a base, but if there are any customizations in the kernel, you would need to include those as well.
helloSystem comes without kernel sources and finding instructions on how to download them wasn't easy, also due to the (relatively recent) change from SVN to Git. Most discussions I've found said "if you don't have the sources installed there's something wrong and you probably need to reinstall", which is not really helpful. In general, what I've seen of FreeBSD documentation is either very basic, or incomplete, or assuming that you already know most things, which is incredibly hostile towards newcomers. I don't want to start an in-depth discussion here about this, I'm just reporting my experience as a Linux system administrator with some experience.
https://twitter.com/Ericbsd/status/1488879439731695623
With the new update I made yesterday, I got my iMac BCM4322 wifi working with
net/bwn-firmware-kmod
andbwn_v4_n_ucode_load="YES"
inloader.conf
.That’s awesome! And no GPL code gets included in the kernel?
Oh yeah the GPL code is included.
Does this mean that technically it works but there is no way to distribute the working kernel in binary form legally?
A major issue I've found is that the driver randomly stops working. It simply brings everything down and I have found no way to make it work without a reboot; it would just try to connect and fail ("4-way handshake failed, the secret provided is not correct" without any changes made to anything!), then rinse and repeat ad libitum. I've found similar issues on the FreeBSD forums with no solutions. Adding to this, the WiFi connection only works with 2.4 GHz networks on my MacBook; if I try to connect to 5 GHz networks, the machine simply reboots leaving nothing in the logs to understand why. I won't even touch on theme of Bluetooth. Frankly speaking, seeing these issues on such basic things as WiFi and Bluetooth, on a very popular 14-year-old machine no less!, is making me question the choice of FreeBSD as the base system, mainly because I don't see the very significant improvements needed to these areas coming any time soon. If this is to be an operating system that "just works" and that appeals to the masses, the amount of work involved just to take FreeBSD to the twenty-first century in terms of hardware and features support is going to be mastodontic and I am not sure it can realistically be achieved. I don't want to be pessimistic, but my experience so far has been less than stellar on multiple machines (with FreeBSD, not with the strictly helloSystem parts such as helloDesktop) and it seems there are no solutions in sight.
https://twitter.com/Ericbsd/status/1488879439731695623
With the new update I made yesterday, I got my iMac BCM4322 wifi working with
net/bwn-firmware-kmod
andbwn_v4_n_ucode_load="YES"
inloader.conf
.That’s awesome! And no GPL code gets included in the kernel?
Oh yeah, the GPL code is included.
Does this mean that technically it works, but there is no way to distribute the working kernel in binary form legally?
@probonopd I don't think it is illegal, but to have most BWN drivers working correctly, you have to build the kernel with BWN_GPL_PHY in the GENERIC, and vanilla FreeBSD tries to avoid having GPL code installed by default.
It is one of the reasons I compile my own FreeBSD source code for GhostBSD.
As far as I know, distributing it is at the very least legally dubious. You would effectively be distributing GPL code as a fundamental part of a program that was licensed as BSD, which theoretically means that the whole code base would be relicensed to GPL. Which is, from a legal perspective, a bit of a nightmare. This is why vanilla FreeBSD tries to avoid having GPL code installed by default, because the GPL is more restrictive and it's viral.
Maybe if the FreeBSD project would ask the authors of the Broadcom kernel module nicely and explain the situation, then possibly the authors of the Broadcom kernel module might consider to dual-license it under a BSD License? Or has it been tried before?
If we are using the driver provided by open BSD, this is seen from the Internet. https://streof.github.io/freebsd-wifi-mac/ https://man.openbsd.org/bwfm
https://forum.nomadbsd.org/t/1-3-1-mac-on-macbook-pro-2011-17/32 well, maybe this one works too...
So, does it work on NomadBSD now?
https://unix.stackexchange.com/questions/595446/configuring-bcm4360-macbook-air-on-freebsd-to-connect-to-wifi