Building the r8168 driver for RealTek RTL8168B/8111B, RTL8168C/8111C, RTL8168CP/8111CP, RTL8168D/8111D, DP/8111DP, and RTL8168E/8111E Gigabit Ethernet controllers with PCI-Express interface. * Official download page (download link captcha is broken): https://www.realtek.com/en/component/zoo/category/network-interface-controllers-10-100-1000m-gigabit-ethernet-pci-express-software * Download from Debian instead (check that they've got the latest version first): http://deb.debian.org/debian/pool/non-free/r/r8168/r8168_8.052.01.orig.tar.bz2 * cd /tmp mirror=`cat /opt/tcemirror` * kerver=`uname -r` && wget ${mirror}`version -m`.x/`uname -m`/release/src/kernel/linux-${kerver%-*}-patched.txz (~130MB download) * tce-load -i compiletc squashfs-tools submitqc gettext bc elfutils-dev * kerver=`uname -r` && tar xvJf /tmp/linux-${kerver%-*}-patched.txz * cd linux-${kerver%-*} * sudo ln -s "`pwd`" /lib/modules/`uname -r`/build * wget -O .config ${mirror}`version -m`.x/`uname -m`/release/src/kernel/config-${kerver%-*}-tinycore64 * wget ${mirror}`version -m`.x/`uname -m`/release/src/kernel/Module.symvers-${kerver%-*}-tinycore64.gz * gunzip -c Module.symvers-${kerver%-*}-tinycore64.gz > Module.symvers * export CFLAGS="-mtune=generic -Os -pipe" CXXFLAGS="-mtune=generic -Os -pipe" LDFLAGS="-Wl,-O1" * make oldconfig && make prepare && make modules_prepare DESCEND objtool /bin/sh: syntax error: unexpected ";" make[5]: *** [/tmp/linux-6.6.8/tools/build/Makefile.build:98: /tmp/linux-6.6.8/tools/objtool/libsubcmd/exec-cmd.o] Error 2 make[4]: *** [Makefile:80: /tmp/linux-6.6.8/tools/objtool/libsubcmd/libsubcmd-in.o] Error 2 make[3]: *** [Makefile:78: /tmp/linux-6.6.8/tools/objtool/libsubcmd/libsubcmd.a] Error 2 make[2]: *** [Makefile:73: objtool] Error 2 make[1]: *** [/tmp/linux-6.6.8/Makefile:1355: tools/objtool] Error 2 make: *** [Makefile:234: __sub-make] Error 2 - Something wrong with "host" variable in /tmp/linux-6.6.8/tools/build/Makefile.build when used in: $(call if_changed,$(host)cc_o_c) - Added this above line 96 in /tmp/linux-6.6.8/tools/build/Makefile.build: host = Then make finishes successfully. * Unpack driver source archive somewhere * Enter driver source directory and run: make modules * cd src * r8168.ko is the kernel module * strip module debugging symbols with: strip --strip-unneeded r8168.ko * gzip r8168.ko #config (manual): * Add "blacklist=r8169" bootcode to bootloader parameters list to prevent the Linux kernel driver from automatically loading at boot. * Add "modprobe r8168" command to /opt/bootlocal.sh #Making an extension: * mkdir -p r8168/usr/local/lib/modules/`uname -r`/kernel/drivers/net/ethernet/realtek * cp r8168.ko.gz r8168/usr/local/lib/modules/`uname -r`/kernel/drivers/net/ethernet/realtek/ * sudo chown -R root:root r8168 * mksquashfs r8168 r8168-`uname -r`.tcz * md5sum r8168-`uname -r`.tcz > r8168-`uname -r`.tcz.md5.txt * submitqc