Build Odroid H2+ network drivers for CentOS 7.9 (r8125)

Update: See how to build the updated r8125 driver (v 9.004.01) for Centos 7.9.

I just got my OdroidH2+ – a very nice x86 SBC. Unfortunately they don’t make OdroidH2 (with the 1Gb network card) anymore which has drivers built in into the CentOS kernel. So I’ll have to settle with the two Realtek RTL8125B  2.5Gbps network cards. I don’t know why they made this upgrade. Using SCP I barely reach 68 MB/s.

Anyway in order to build the driver I needed to find the source. I found this link which shows other people trying to build the driver from manufacturer sources. It didn’t work that well. The topic leads to a package elrepo kmod-r8125-9.003.05-1.el7_8.elrepo.x86_64 on elrepo repository. However it is for CentOS 7.8. So I downloaded the src rpm and built it on centos 7.9. Here is how to build it:

Note: If you don’t have USB network card to use temporarily to download the driver, download it on another pc and copy it using a flash drive.

install build tools
yum install make gcc gcc-c++ make autoconf automake rpm-build

The above command won’t work without internet. In order to make it work plug in a flash drive with CentOS install, mount it at /media/CentOS. Then edit /etc/yum.repos.d/CentOS-Media.repo and change enabled=0 to enabled =1. That should work although I didn’t test it. Anyway it’s not a bad idea to get a cheap Chinese USB LAN card just for situations like these.

Download the src rpm:
cd /home/
wget http://elrepo.reloumirrors.net/elrepo/el7/SRPMS/r8125-kmod-9.003.05-1.el7_8.elrepo.src.rpm

build the rpm (I’m not sure if root is needed, but I built it as root):
rpmbuild --rebuild --define "kversion $(uname -r)" r8125-kmod-9.003.05-1.el7_8.elrepo.src.rpm

Once this is finieshed the resulting rpm  will be in /root/rpmbuild/RPMS/x86_64/kmod-r8125-9.003.05-1.el7.x86_64.rpm

So install the rpm as follows:
rpm -Uvh /root/rpmbuild/RPMS/x86_64/kmod-r8125-9.003.05-1.el7.x86_64.rpm

Reboot and the LAN card should be done.

 

Download

In case you are too lazy to build it yourself or you are having troubles here is a zip with the srpm and pre-built rpm:

r8125-kmon-centos-7.9.zip

But it’s always better idea to download it from reputable source and build it yourself. You shouldn’t be downloading rpms from random blogs 🙂

Bonus

If you hate the non-sense names for the network interfaces you can change back to old eth0, eth1 … style like this:

Edit file /etc/default/grub and add net.ifnames=0 biosdevname=0 to line GRUB_CMDLINE_LINUX, for instance:

GRUB_CMDLINE_LINUX=" crashkernel=auto net.ifnames=0 biosdevname=0 rhgb quiet"

Then remake grub config:
grub2-mkconfig -o /boot/grub2/grub.cfg # for legacy installs
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg # for EFI installs

Then rename the interface config file:
mv /etc/sysconfig/network-scripts/ifcfg-enp2s0 /etc/sysconfig/network-scripts/ifcfg-eth0

and edit it to change device name:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
......
NAME=eth0
DEVICE=eth0
......

Then do the same with ifcfg-enp3s0 -> eth1

Posted in Advanced, Linux

Categories