WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: RTL8822be driver not found in Tinycore64 11.x  (Read 8359 times)

Offline mrjake2

  • Newbie
  • *
  • Posts: 35
RTL8822be driver not found in Tinycore64 11.x
« on: March 02, 2020, 11:59:56 PM »
Hello,

I saw a thread for 9.x where Juanito had made a tcz for the wireless driver rtl8822be-KERNEL.  It looks like this hasn't been created yet for 11.x .  Would it be possible to create it for 11.x and add it to the extensions repo?  I need it for Tinycore64 but others will probably need it for the standard tce repo as well.

Offline mrjake2

  • Newbie
  • *
  • Posts: 35
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #1 on: March 03, 2020, 02:33:56 PM »
(admin: you can move this topic if needed as the direction has changed.)

I actually went ahead and used the previous posts I found to compile this myself for Tiny Core 64 and it works.  I'd like to submit a tcz of this (currently testing it now), but I have a few questions.

1) Since it deals with firmware it has a non-standard license from Realtek.  The author of the code that uses that firmware has not included a separate license for his own work.  So I'm assuming the firmware files are covered under the Realtek license, and any other files are covered by standard copyright of the original author.  Is that correct?  FYI this is the Realtek license file: https://github.com/lwfinger/rtlwifi_new/blob/master/firmware/rtlwifi/Realtek-Firmware-License.txt

2) I don't believe this package has any dependencies since it's just firmware and drivers (although it won't actually do anything useful if you don't also install wireless-KERNEL).  Am I correct that I don't need to add any deps here?

3) Once I've tested it out, where do I send the archive file with everything necessary to submit the tcz to the repo?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11696
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #2 on: March 03, 2020, 04:43:35 PM »
Hi mrjake2
3) Once I've tested it out, where do I send the archive file with everything necessary to submit the tcz to the repo?
Instructions for submitting can be found here:
http://wiki.tinycorelinux.net/wiki:creating_extensions#submitting

Quote
(admin: you can move this topic if needed as the direction has changed.)
Moving to  TCE Talk.

Offline mrjake2

  • Newbie
  • *
  • Posts: 35
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #3 on: March 03, 2020, 04:47:39 PM »
Not sure why I can sometimes edit my previous messages and why sometimes I can't, so I'm just replying to the topic...

I found the answer to #3 in the wiki page for building tcz's so I'm assuming that information is still accurate.  I'm able to load my extension now, but I'm running into another issue that I'll need to clean up before I submit the package for inclusion in the repo. 

I'd still like answers to my first 2 questions from the previous post.  Additionally:

3a) The package I'm building does not include DESTDIR, but it is also an extremely simple Makefile.  I just looked at the install target in the Makefile, and used that to figure out where it was putting the files (confusingly, it actually seems to copy the firmware files twice - once explicitly to /lib/firmware and once to ${FIRMWAREDIR}/lib/firmware - but when I manually put them in /usr/local/lib/firmware instead of /lib/firmware it seems to work fine).  I manually copied the compiled drivers and firmware into /tmp/wifi-rtw88 (preserving the paths from the install target under that).  I'm assuming that should work fine, but I'd like confirmation of that.

3b) submitcq thinks everything is ok other than the license file issue mentioned above.  I then test this by copying the tcz file into my tce directory, booting up my USB on my laptop, and then loading the extension.  When I do that, though, I get the following output:

Code: [Select]
tc@box:~$ tce-load -il wifi-rtw88
loading out-of-tree module taints kernel.
rtw88: Unknown symbol ieeee80211_start_tx_ba_cb_irqsafe (err -2)
...

However after that I load wireless-KERNEL.tcz and wifi.tcz, and I'm able to connect to my access point.  What do those errors mean, and how do I fix them before submitting?

I'm attaching the makefile from the wireless driver package in case there is anything else in there that I'm missing.  The one item from the Makefile that I didn't explicitly handle in my tcz is "depmods -a ${KERNEL}", but since this module doesn't have any dependencies (that I know of) I assumed that step isn't actually necessary.  I don't know anything about depmods though, so please correct me if I'm wrong.
« Last Edit: March 03, 2020, 04:55:50 PM by mrjake2 »

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11696
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #4 on: March 03, 2020, 05:01:54 PM »
Hi mrjake2
Not sure why I can sometimes edit my previous messages and why sometimes I can't, so I'm just replying to the topic...
You have 30 minutes after posting to make changes.

Quote
Code: [Select]
tc@box:~$ tce-load -il wifi-rtw88
loading out-of-tree module taints kernel.
rtw88: Unknown symbol ieeee80211_start_tx_ba_cb_irqsafe (err -2)
...
Something else needs to be present before loading that. Try creating a dependency file containing  wireless-KERNEL  and
firmware-rtlwifi.tcz

Offline mrjake2

  • Newbie
  • *
  • Posts: 35
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #5 on: March 03, 2020, 05:49:58 PM »
Something else needs to be present before loading that. Try creating a dependency file containing  wireless-KERNEL  and
firmware-rtlwifi.tcz

Hmm, I think it's actually the other way around, i.e. wireless-KERNEL relies on my code (wifi-rtw88.tcz) already being loaded.  If I try loading wireless-KERNEL first (or wifi.tcz, which first loads wireless-KERNEL),  then I get a bunch of errors and wifi won't start:

Code: [Select]
tc@box:~$ tce-load -il wifi
libiw.tcz OK
wireless-5.4.3-tinycore64.tcz: OK
wireless_tools.tcz: OK
ncursesw.tcz: OK
platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
platform regulatory.0: Falling back to sysfs fallback for: regulatory.db
readline.tcz: OK
cfg80211: failed to load regulatory.db
rtw_pci 0000:02:00.0: Direct firmware load for rtw88/rtw8822b_fw.bin failed with error -2
rtw_pci 0000:02:00.0: Falling back to sysfs fallback for: rtw88/rtw8822b_fw.bin
rtw_pci 0000:02:00.0: failed to request firmware
rtw_pci 0000:02:00.0: failed to load firmware
rtw_pci 0000:02:00.0: failed to setup chip efuse info
rtw_pci 0000:02:00.0: failed to setup chip information
attr.tcz: OK
rtw_pci: probe of 0000:02:00.0 failed with error -22

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11696
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #6 on: March 03, 2020, 08:17:15 PM »
Hi mrjake2
Quote
Code: [Select]
rtw88: Unknown symbol ieeee80211_start_tx_ba_cb_irqsafe (err -2)
The symbol  ieee80211_start_tx_ba_cb_irqsafe  is provided by  mac80211.ko.gz. (there are 3 es in ieee, not 4)
mac80211.ko.gz  is provided by  wireless-KERNEL.tcz.

This is the dependency file for  wireless-rtl8822be-4.19.10-tinycore.tcz  created by Juanito:
Code: [Select]
firmware-rtlwifi.tcz
wireless-KERNEL.tcz
found here:
http://tinycorelinux.net/10.x/x86/tcz/wireless-rtl8822be-4.19.10-tinycore.tcz.dep

Quote
Code: [Select]
rtw_pci 0000:02:00.0: Direct firmware load for rtw88/rtw8822b_fw.bin failed with error -2
Error -2 == No such file or directory.

Quote
Code: [Select]
rtw_pci: probe of 0000:02:00.0 failed with error -22
Error -22 == Invalid argument.

Offline mrjake2

  • Newbie
  • *
  • Posts: 35
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #7 on: March 04, 2020, 01:41:57 AM »
I tried, and that doesn't work.  The whole package structure for rtlwifi_new changed in the last year since Juanito last compiled it, so I'm not surprised that the dependencies have changed.  If you load wireless-KERNEL before wifi-rtw88, it definitely fails with the errors in my last post (I have verified this).  But if you run wireless-KERNEL *after* you load my extension, then you get the tainted kernel warnings but wireless-KERNEL does load the firmware (and you are then able to use wifi).

firmware-rtlwifi doesn't seem to make a difference one way or the other.  This isn't surprising, as my code is really just a separate branch of rtlwifi_new that builds a different set of drivers in the same family as that package.

Interestingly, while loading wireless-KERNEL first and wifi-rtw88 second makes it so the firmware isn't loaded properly, it *does* get rid of the taint warnings.  Is it possible that mac80211.ko.gz from wireless-KERNEL is needed to prevent the taint warnings, but then wireless-KERNEL as a package needs the firmware loaded first before it can set up the drivers?  If so, this would create a circular dependency between the two packages that I'm not sure how to resolve.
« Last Edit: March 04, 2020, 01:49:06 AM by mrjake2 »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #8 on: March 04, 2020, 02:23:31 AM »
I believe that the wireless driver for your hardware loads the firmware - you can check this in dmesg, for example:
Code: [Select]
$ dmesg
...
platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
platform regulatory.0: Falling back to sysfs fallback for: regulatory.db
cfg80211: failed to load regulatory.db
Intel(R) Wireless WiFi driver for Linux
Copyright(c) 2003- 2015 Intel Corporation
iwlwifi 0000:02:00.0: enabling device (0000 -> 0002)
iwlwifi 0000:02:00.0: Direct firmware load for iwlwifi-7260-17.ucode failed with error -2
iwlwifi 0000:02:00.0: Falling back to sysfs fallback for: iwlwifi-7260-17.ucode
iwlwifi 0000:02:00.0: loaded firmware version 17.459231.0 op_mode iwlmvm
iwlwifi 0000:02:00.0: Detected Intel(R) Dual Band Wireless AC 7260, REV=0x14
i.e. the iwlwifi driver from wireless-KERNEL loads the firmware.

Since you are not using a driver from wireless-KERNEL, it should be your RTL8822be driver that loads the firmware.

Offline mrjake2

  • Newbie
  • *
  • Posts: 35
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #9 on: March 04, 2020, 02:56:33 AM »
Hi Juanito - it sounds like you are saying that i should be able to load wireless-KERNEL before my RTL8822be driver because wireless-KERNEL is not actually loading the firmware.  Am I understanding you correctly?  That's not quite what I'm seeing when I load wireless-KERNEL:
Code: [Select]
> tce-load -il wireless-5.4.3-tinycore64
platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
platform regulatory.0: Falling back to sysfs fallback for: regulatory.db
cfg80211: failed to load regulatory.db
rtw_pci 0000:02:00.0: Direct firmware load for rtw88/rtw8822b_fw.bin failed with error -2
rtw_pci 0000:02:00.0: Falling back to sysfs fallback for: rtw88/rtw8822b_fw.bin
rtw_pci 0000:02:00.0: failed to request firmware
rtw_pci 0000:02:00.0: failed to load firmware
rtw_pci 0000:02:00.0: failed to setup chip efuse info
rtw_pci 0000:02:00.0: failed to setup chip information
rtw_pci: probe of 0000:02:00.0 failed with error -22

You can see above that it's failing because it is looking for rtw88/rtw8822b_fw.bin and not finding it - that's because that is the directory and firmware file that my driver code loads.

But if load my driver first and then wireless-KERNEL, I get the taint messages followed by the firmware being loaded as expected:

Code: [Select]
> tce-load -il wifi-rtw88
rtw88: loading out-of-tree module taints kernel.
rtw88: Unknown symbol ieee80211_start_tx_ba_cb_irqsafe (err -2)
rtw88: Unknown symbol ieee80211_txq_get_depth (err -2)
...
>tce-load -il wireless-5.4.3-tinycore64
platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
platform regulatory.0: Falling back to sysfs fallback for: regulatory.db
cfg80211: failed to load regulatory.db
rtw_pci 0000:02:00.0: Direct firmware load for rtw88/rtw8822b_fw.bin failed with error -2
rtw_pci 0000:02:00.0: Falling back to sysfs fallback for: rtw88/rtw8822b_fw.bin
rtw_pci 0000:02:00.0: Firmware version 27.2.0, H2C version 13

I'm not 100% clear what wireless-KERNEL does, but from the above it looks like it finds and uses (or maybe sets up) Firmware version 27.2.0, H2C version 13.  But it only does that if I load wifi-rtw88.tcz first.
« Last Edit: March 04, 2020, 03:03:55 AM by mrjake2 »

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #10 on: March 04, 2020, 03:35:28 AM »
From the look of your dmesg output, the kernel believes that the rtw88 driver in wireless-KERNEL is the correct one for your hardware.

rtw8822b_fw.bin is in firmware-rtlwifi

Have you tried loading firmware-rtlwifi then wireless-KERNEL and seeing if things work (all without loading your driver)?

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11696
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #11 on: March 04, 2020, 08:33:31 AM »
Hi mrjake2
... This is the dependency file for  wireless-rtl8822be-4.19.10-tinycore.tcz  created by Juanito:
Code: [Select]
firmware-rtlwifi.tcz
wireless-KERNEL.tcz
...
Try it with the dependencies in the order listed. If that doesn't work, you may have to break out your firmware into a separate
extension (firmware-rtl8822be.tcz). Then use a dependency file that looks like this:
Code: [Select]
firmware-rtl8822be.tcz
wireless-KERNEL.tcz

Offline mrjake2

  • Newbie
  • *
  • Posts: 35
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #12 on: March 04, 2020, 01:54:15 PM »
From the look of your dmesg output, the kernel believes that the rtw88 driver in wireless-KERNEL is the correct one for your hardware.

rtw8822b_fw.bin is in firmware-rtlwifi

Have you tried loading firmware-rtlwifi then wireless-KERNEL and seeing if things work (all without loading your driver)?

Yes, that was the first thing I tried, and it still complained about not being able to find rte88/rtl8822be.bin. That was why I compiled my own driver in the first place. Once I compiled my own driver then wifi started work, just with the taint errors on load.

Online Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11696
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #13 on: March 04, 2020, 02:08:22 PM »
Hi mrjake2
... Yes, that was the first thing I tried, and it still complained about not being able to find rte88/rtl8822be.bin. ...
Is that an exact quote? Because  firmware-rtlwifi.tcz.list  lists the firmware files name as:
/usr/local/lib/firmware/rtlwifi/rtl8822befw.bin

Found here:
http://tinycorelinux.net/11.x/x86_64/tcz/firmware-rtlwifi.tcz.list

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: RTL8822be driver not found in Tinycore64 11.x
« Reply #14 on: March 05, 2020, 01:38:19 AM »
The way wifi firmware loading works is that the kernel first tries to load the firmware from the driver itself and, if that fails, it tries to load the firmware from /usr/local/lib/firmware.

Looking at your dmesg output:
Code: [Select]
rtw_pci 0000:02:00.0: Direct firmware load for rtw88/rtw8822b_fw.bin failed with error -2
rtw_pci 0000:02:00.0: Falling back to sysfs fallback for: rtw88/rtw8822b_fw.bin
rtw_pci 0000:02:00.0: Firmware version 27.2.0, H2C version 13
..this is what seems to have happened.

You could try editing wireless-KERNEL to remove /usr/local/lib/modules/5.4.3-tinycore64/kernel/drivers/net/wireless/realtek/rtw88/rtw88.ko.gz and try again loading firmware-rtlwif then the modified wireless-KERNEL and finally your driver.