RTL8851BU USB on Volumio 3.785

Hi, I’m trying to install drivers for RTL8851BU via USB 2.0. I am getting the following error, what should I do?

git clone GitHub - fofajardo/rtl8851bu: Realtek RTL8851BU Wi-Fi USB Driver for Linux
cd rtl8851bu
make
sudo make install

and:

Hey @SO3D,

VolumioOS is shipped without kernel source. For all custom adventures, the volumio kernelsource command is a staring point.

Kind Regards,

Hey @nerd,
Thank you, so what command should I issue?

Hey @SO3D,

Since you are already in ssh session, hence type in:

volumio kernelsource

Kind Regards,

1 Like

@nerd - After using the mentioned command:

Hey @SO3D,

I wonder if the repo will build for VolumioOS. Assuming that you are on latest release based on Raspberry Pi kernel 6.6.62 and GCC-8 build constraint options are limited:

The error unrecognized command -mgeneral-regs-only means that the -mgeneral-regs-only flag, introduced in GCC-11, is not recognized by the older GCC-8 compiler you are using. This flag is specific to certain architectures (e.g., ARM) and is used to restrict the compiler to general-purpose registers for specific operations.

To address this issue:


1. Remove the -mgeneral-regs-only Flag

  • Open the Makefile or build script where the flag is defined.
  • Locate any instance of -mgeneral-regs-only in the CFLAGS or CPPFLAGS section and remove it.
    Example:
    CFLAGS += -mgeneral-regs-only
    
    Change to:
    CFLAGS +=
    

Removing this flag might affect performance or specific optimizations, but it usually won’t prevent the module from functioning.


2. Use Conditional Compilation

If the code is intended to support multiple GCC versions, you can conditionally exclude the flag for older GCC versions:

ifeq ($(shell expr $(GCC_VERSION) \>= 11), 1)
    CFLAGS += -mgeneral-regs-only
endif

Add a line at the top of the Makefile to define the GCC_VERSION variable:

GCC_VERSION := $(shell gcc -dumpversion | cut -f1 -d.)

3. Replace the Flag with Alternatives

  • If the -mgeneral-regs-only flag is essential for the module, look for alternatives or workarounds in GCC-8.
  • For ARM platforms, ensure that any custom register restrictions are implemented directly in the assembly code or other architecture-specific configurations.

4. Suppress the Error

While not ideal, you can suppress the error by ignoring unknown flags:

make CFLAGS+=" -Wno-error=unknown-warning-option"

However, this approach only works for warnings and might not help if the build system treats this as a fatal error.


5. Contact the Module Maintainers

If the code explicitly depends on the -mgeneral-regs-only flag, reach out to the module maintainers or check the documentation for backward-compatible alternatives.


Summary

The best course of action is to remove the -mgeneral-regs-only flag from the build configuration when using GCC-8. This is often sufficient unless the flag is critical to the module’s functionality. I wonder if there are alternatives like GitHub - morrownr/rtl8852cu-20240510: Linux Driver for USB WiFi Adapters that are based on the RTL8832CU and RTL8852CU Chipsets - v1.19.2.1 - 20240510 better suited for builds, however GCC-8 is something that will need to be taken with the module maintainer.

Kind Regards,

@nerd Thank you for your detailed answer. I’ll try to run it after work, but it will probably be easier to buy another WLAN card :smiley: