Realtek : Latest ethernet module compilation

  • In this section, you are going to learn

  • How to load ethernet driver

  • Terminology

#

Version

Freebsd

14.1.0

  • Architecture

test:~$
test:~$

Source path :

c1

Bin path :

c2

List of C files

c3

NM output :

c4

Load file :

c5

  • The Ethernet module(if_re) as a separate module by modifying the GENERIC kernel configuration file:

test:~$ #device re
  • Unload the module

test:~$ kldunload if_re.ko
  • A FreeBSD ‘port’ is a collection of files designed to automate the process of compiling an application from source code.

  • The files that comprise a port contain all the necessary information to automatically download, extract, patch, compile, and install the application.

  • Path for port folder: /usr/ports/

  • If contain files and folder then check ethernet module.

  • If ‘ports’ was not installed during the installation of FreeBSD, use the following method to install it

    1. Ensure your system is up-to-date:

  • First, make sure your FreeBSD system is up-to-date. This can sometimes pull in updated drivers.

test:~$ freebsd-update fetch

test:~$ freebsd-update install
    1. Then, fetch update the FreeBSD ports tree:

test:~$ portsnap fetch
  • The extract command is only necessary if you’re setting up portsnap for the first time, otherwise the fetch and update commands should suffice.

test:~$ portsnap extract

test:~$ portsnap update
  • Check the folder which contains latest files and sub-folders of application software

test:~$ cd /usr/ports/

test:~$ ls
test:~$ cd /usr/ports/net/realtek-re-kmod/

test:~$ make install clean
  • This will compile and generate the binary for the realtek driver and place it in the /boot/modules/ directory

test:~$ ls -lrt /boot/modules/if_re.ko
-r--r--r--  1 root wheel 1171016 Sep 13 16:52 /boot/modules/if_re.ko
  • And also this module is present in:

test:~$ cd /usr/ports/net/realtek-re-kmod/work/stage/boot/modules/

test:~$ ls
if_re.ko
  • Now we can load/unload the module

test:~$ kldload ./if_re.ko
  • Source code of realtek (re) ethernet driver downloaded, check it

test:~$ cd work/rtl_bsd_drv-ea4ed1e/

test:~$ ls
if_re.c
  • Check ethernet interface

test:~$ ifconfig
re0: flags=1008843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500
options=60251b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,TSO4,LRO,WOL_MAGIC,RXCSUM_IPV6,TXCSUM_IPV6>
ether 7c:8a:e1:98:43:82
inet 10.91.229.72 netmask 0xffffff00 broadcast 10.91.229.255
inet6 fe80::7e8a:e1ff:fe98:4382%re0 prefixlen 64 scopeid 0x1
media: Ethernet autoselect (1000baseT <full-duplex>)
status: active
  • Add the following lines to /etc/rc.conf to load the driver module at boot

test:~$ vim /etc/rc.conf
if_re_load="YES"
if_re_name="/boot/modules/if_re.ko"
  • Reboot and check module

test:~$ reboot
test:~$
test:~$
test:~$
test:~$
test:~$
test:~$
test:~$
test:~$
test:~$
test:~$
test:~$
test:~$