Make LibreElec 9.2 with RTL8125 driver

  • Hi!

    I try add Realtec 8125B driver (network on Odroid H2+) to LibreElec 9.2, but it not work...

    The driver RTL8125 i downloaded from realtek-r8125-dkms (it perfectly work on the pure Ubuntu server 18.04).

    I did the following:

    1. Installed as guest on the VmWare Ubuntu 18.04 server and installed build dependencies (as wrote in Building (Basics)).

    2. "git clone GitHub - LibreELEC/LibreELEC.tv: Just enough OS for KODI" and "cd LibreELEC.tv/"

    3. "git checkout libreelec-9.2" and created new branch "git checkout -b libreelec-9.2-rtl8125"

    4. In the http://LibreELEC.tv/packages/linux-drivers added directory RTL8125B.

    5. In the RTL8125B i created package.mk file with text:

    package.mk

    PKG_NAME="RTL8125B"

    PKG_VERSION="9.005.01"

    PKG_SHA256="6a1e07b0eee5424a197f2b8fa0da25a4ec097550747f0c235c647f390eab6707"

    # PKG_ARCH="x86_64"

    PKG_LICENSE="GPL"

    PKG_SITE="https://github.com/awesometic/realtek-r8125-dkms/"

    PKG_URL="http://MY_SERVER/RTL8125B-9.005.01.tar.gz"

    PKG_DEPENDS_TARGET="toolchain linux"

    PKG_NEED_UNPACK="$LINUX_DEPENDS"

    PKG_LONGDESC="Realtek RTL8125 driver for Linux"

    PKG_IS_KERNEL_PKG="yes"

    pre_make_target() {

    unset LDFLAGS

    }

    make_target() {

    ## kernel_make KDIR=$(kernel_path)

    # cd $PKG_BUILD

    # bash autorun.sh

    make V=1 \

    ARCH=$TARGET_KERNEL_ARCH \

    KSRC=$(kernel_path) \

    CROSS_COMPILE=$TARGET_KERNEL_PREFIX \

    CONFIG_POWER_SAVING=n

    }

    makeinstall_target() {

    cd $PKG_BUILD

    mkdir -p $INSTALL/$(get_full_module_dir)/$PKG_NAME

    cp src/*.ko $INSTALL/$(get_full_module_dir)/$PKG_NAME

    }

    6. In the file http://LibreELEC.tv/distributions/LibreELEC/options i modified string: "ADDITIONAL_DRIVERS="RTL8192CU RTL8192DU RTL8192EU RTL8188EU RTL8812AU RTL8125B""

    After this steps i committed all changes to my branch, downloaded sources - "PROJECT=Generic ARCH=x86_64 tools/download-tool" and builded image - "PROJECT=Generic ARCH=x86_64 make image".

    Image has been created, but, after install it to Odroid H2+, driver not worked.

    I tried change commands for make in section "make_target()" of file package.mk (see comments), but driver still not work.

    I know that this network adapter work in last version LibreElec, but i need LibreElec with Kodi 18.9.

    Can someone help me?

    Thanks in advance

  • But on the ubuntu server i don’t added RTL8125B firmware and network worked with this driver.

    ubuntu server probably ships with all of linux-firmware installed, see: rtl8125b-1.fw « rtl_nic - kernel/git/firmware/linux-firmware.git - Repository of firmware blobs for use with the Linux kernel

    EDIT: just an FYI you will have to add that here LibreELEC.tv/any.dat at master · LibreELEC/LibreELEC.tv · GitHub and make sure the kernel-firmware package is built and included in the image

  • EDIT: just an FYI you will have to add that here LibreELEC.tv/any.dat at master · LibreELEC/LibreELEC.tv · GitHub and make sure the kernel-firmware package is built and included in the image

    I've installed firmware (getted it from debian package firmware-realtek). Putted firmware to http://LibreELEC.tv/packages/linux-firmware/rtl8125b-firmware. Maked package.mk and added firmware name to file http://LibreELEC.tv/projects/Generic/options (FIRMWARE="misc-firmware wlan-firmware dvb-firmware iwlwifi-firmware rtl8125b-firmware").

    But after building driver still not work...

    Insmod on the LibreElec return error: "insmod: ERROR: could not insert module r8125.ko: Invalid module format".

  • Run "dmesg | paste" and "ls -l /usr/lib/firmware/rtl_nic | paste" after startup and share the URLs generated.

    "dmesg | paste" - http://ix.io/3jOt

    "ls -l /usr/lib/firmware/rtl_nic | paste" - return me "ls: /usr/lib/firmware/rtl_nic: No such file or directory", and i completed other command:

    "ls -l /usr/lib/kernel-overlays/base/lib/firmware/ | grep 8125 | paste" - http://ix.io/3jOe

    Quote from chewitt

    Also commit your local changes and push them to your GitHub repo so we can see the package you added and what they do.

    My repo - GitHub - MsVAsB/libreelec-9.2-rtl8125: Copy LibreElec 9.2 repository with network driver (rtl8125b) for Odroid H2+

  • Code
    [    3.211046] r8125: version magic '5.4.0-72-generic SMP mod_unload modversions ' should be '5.1.16 SMP mod_unload'

    ^ the r8125 kernel driver is compiled for Linux 5.4, and:

    Code
    [    0.000000] Linux version 5.1.16 (msv@vm-server) (gcc version 8.3.0 (GCC)) #1 SMP Fri Apr 23 09:46:06 UTC 2021

    ^ LE 9.2 uses Linux 5.1, so the module is not compatible. And:

    Code
    ls: /usr/lib/firmware/rtl_nic: No such file or directory

    ^ means even if you built the right kernel module, you did not put the firmware in the correct directory (because that's the correct one).

    I wasn't able to check the contents of http://80.251.144.40/update/RTL8125B-9.005.01.tar.gz as the file didn't download for me, but my guess is the package contains a pre-built module for Linux 5.4 in addition to sources, and even if you do build the module from sources in the LE build system, the script is copying the wrong .ko into the image; giving you the bad magic message. I would download the sources from the awesometic Git repo as this doesn't contain pre-built modules.

    On the firmware side; again I couldn't download the file to check contents but you're not moving the file to the correct location. I would not call ./install scripts writen for other build systems. Just do simple "cp" to the correct destination. Look at other packages and the format and $VARIABLE names to use for source/destination are simple to follow.

  • To complete chewitt 's analysis for the driver build: you are using a DKMS Makefile not working in LE build system.

    Use:

    Edited 2 times, last by mglae: Finally using "code" from different machime (April 30, 2021 at 4:01 PM).

  • Many thanks for your help!

    It worked for me.