Installing rtl8125 drivers

Create partition and filesystem on a USB drive on Fedora Linux compatible with FreeBSD

Create the partition

fdisk /dev/[ device_name ]

e.g.

fdisk /dev/sdg
sudo fdisk /dev/sdg 

Welcome to fdisk (util-linux 2.40.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0xe1cd3ea9.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-15720447, default 2048): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-15720447, default 15720447): 

Created a new partition 1 of type 'Linux' and of size 7.5 GiB.

Command (m for help): t
Selected partition 1
Hex code or alias (type L to list all): 0b
Changed type of partition 'Linux' to 'W95 FAT32'.

Command (m for help): p
Disk /dev/sdg: 7.5 GiB, 8048869376 bytes, 15720448 sectors
Disk model: STORE N GO      
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe1cd3ea9

Device     Boot Start      End  Sectors  Size Id Type
/dev/sdg1        2048 15720447 15718400  7.5G  b W95 FAT32

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Create the filesystem

sudo mkfs.fat -F 32 /dev/sdg1

Mount the filesystem

sudo mount -t msdos /dev/sdg1 /mnt/

Download required tarballs

Find your FreeBSD release

uname -r
14.3-RELEASE-p1 # sample output

Download all the tarballs and copy to usb

## Download FreeBSD ports
curl -o ports.tar.gz https://ftp.freebsd.org/pub/FreeBSD/ports/ports.tar.gz && \
## Download the src that corresponds with your FreeBSD version
wget  https://ftpmirror.your.org/pub/FreeBSD-Archive/old-releases/amd64/14.3-RELEASE/src.txz && \
curl -o alexdupre-rtl_bsd_drv-v1100.00-ea4ed1e_GH0.tar.gz https://codeload.github.com/alexdupre/rtl_bsd_drv/tar.gz/ea4ed1e?dummy=/alexdupre-rtl_bsd_drv-v1100.00-ea4ed1e_GH0.tar.gz

Copy tarballs to usb

cp ports.tar.gz /mnt && \
cp src.txz /mnt && \
cp alexdupre-rtl_bsd_drv-v1100.00-ea4ed1e_GH0.tar.gz /mnt

Install the tarballs on the freebsd server

mount -t msdosfs /dev/da0s1 /mnt/

Ports

cd /usr/ && \
rm -Rf ports && \ # there was nothing here to begin with
tar -vxf /mnt/ports.tar.gz

Source

cd / && \
tar -vxf /mnt/src.txz

Driver

cp /mnt/alexdupre-rtl_bsd_drv-v1100.00-ea4ed1e_GH0.tar.gz /usr/ports/distfiles/

Compile the driver

make install clean

Conclusion

There is a default re driver that load the 1g version of the driver which conflicts with the manually compiled version. Recommendations were to build a custom kernel without the default re module. No thanks.