Realtek 8168

From LinuxMCE
(Redirected from R8168)
Jump to: navigation, search
Version Status Date Updated Updated By
710 Unknown N/A N/A
810 Unknown N/A N/A
1004 Unknown N/A N/A
1204 Unknown N/A N/A
1404 Unknown N/A N/A
Usage Information

The Realtek RTL8168 network card on LinuxMCE

This card is supposed to work with the r8169 module, but this seems to fail for newer cards. Realtek provides the source code for a r8168 module on their site.

What you need to do

  • Download the driver from Realtek (at the time of this article, the version is 8.008.00, released 2008/7/24) to compile the r8168 module
  • Install the linux-source package, to hack into the r8169 module.

The default r8169 module and Realtek's r8168 overlap on a PCI ID, and that's why you need the kernel source. You'll compile the r8169 without the PCI ID that r8168 will associate with.

>>TODO: Insert section of required packages for the build to work

Compiling Realtek's r8168 module

  • Download the Realtek driver: you'll get a file called r8168-8.008.00.tar.bz2

>> Please note the above link did not work, but Google allowed us to find an Username/Password for one of the realtek FTP Mirrors ;

 wget ftp://WebUser:2mG8dBW@202.134.71.22/cn/nic/r8168-8.020.00.tar.bz2


  • unpack the file:
tar -jxf r8168-8.008.00.tar.bz2
  • switch into the directory that is created:
cd r8168-8.008.00
  • build the module:
make
  • copy the module to the running kernel:
cp src/r8168.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net/

(I believe the last cp step is no longer required as it version 8.012.00 of the driver sources, as it does this as part of the make - colinjones)

Hacking the r8169 module

This part is only required if you actually need the r8169 to be in the kernel at the same time as the new r8168 module. You may not need this if your MD has only one r8168 compatible NIC. If so, just move the r8169.ko file out of /lib/modules/2.6.22-14-generic/kernel/drivers/net/ prior to generating the new initrd.mg file, and that module will not be included in the new image.

  • Install the kernel source:
apt-get install linux-source
  • Un pack the kernel source:
cd /usr/src; tar -jxf linux-source-2.6.22.tar.bz2
  • Switch to the kernel directory:
cd linux-source-2.6.22
  • Copy the running kernel's configuration:
cp /boot/config-2.6.22-14-generic .config
  • Prepare the kernel so you can build modules:
make scripts prepare
  • Apply this patch:
patch < r8168.diff
 --- drivers/net/r8169.c.orig	2008-09-05 17:07:29.000000000 +0300
 +++ drivers/net/r8169.c	2008-09-04 23:49:51.000000000 +0300
 @@ -162,7 +162,7 @@
  	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8129), 0, 0, RTL_CFG_0 },
  	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8136), 0, 0, RTL_CFG_2 },
  	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8167), 0, 0, RTL_CFG_0 },
 -	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8168), 0, 0, RTL_CFG_1 },
 +	//{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8168), 0, 0, RTL_CFG_1 },
  	{ PCI_DEVICE(PCI_VENDOR_ID_REALTEK,	0x8169), 0, 0, RTL_CFG_0 },
  	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4300), 0, 0, RTL_CFG_0 },
  	{ PCI_DEVICE(0x1259,			0xc107), 0, 0, RTL_CFG_0 },
  • Copy the Module.symvers to source directory
cd /usr/src/linux-source-`uname -r`/
cp ../linux-headers-`uname -r`/Module.symvers .
  • Build the network modules:
make M=`pwd`/drivers/net modules
  • Confirm that the new r8169 module doesn't have the "pci:v000010ECd00008168sv" alias:
modinfo drivers/net/r8169.ko
  • Copy the new r8169.ko to the running kernel:
cp drivers/net/r8169.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net/
  • Run depmod
depmod
  • Load the module:
modprobe r8169

MDs

After you created the modules as described above:

  • Copy the modules to all the affected MD filesystems, in the corresponding location
  • Follow the instructions on the Unrecognized NIC page

Asus M3A78-EM Please Note!!!! This driver was for LMCE version 710 !!!! Not valid for 810!!!

Here are the steps required to get this motherboard's Realtek 8168 Gigabit Ethernet Working for an MD.

To save some steps, I will make my driver available here for LinxMCE version 710.  : r8168 driver This can be used on the Realtek 8111B/8111C chipsets as well, that is what my motherboard says, just before PXE boot.

--Sethj 12:50, 12 December 2008 (CET)

First I manually created the Media Director from the LinuxMCE Admin Website. Did not want it to build an AMD64 image, wanted to stay with i386, and I knew the MAC address of the new MD onboard NIC. Ran "Setup Diskless MD" when that completed I clicked the "Rebuild Image" for the new MD. While that was running I completed the next few things. Wait for this to complete, and then continue.

  • Download the driver package for Linux from Asus' web site here : LinuxDrivers.zip - It is under "Others"
  • unzip the package to /usr/src
sudo su
cd /usr/src
unzip -qq /path/to/LinuxDrivers.zip
cd /usr/src/LinuxDrivers/LAN/r8168-8.003.00/r8168-8.003.00
make
cp src/r8168.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net/
mv /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8169.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8169.ko.not
depmod -a
/usr/pluto/bin/Diskless_BuildDefaultImage.sh
cp /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8168.ko /usr/pluto/diskless/<moon #>/lib/modules/2.6.22-14-generic/kernel/drivers/net
vi /usr/pluto/diskless/<moon #>/etc/initramfs-tools/modules
added r8168 and saved
cd /usr/pluto/diskless
chroot <moon #>
mv /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8169.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8169.ko.not
depmod -a /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8168.ko
cd /boot
update-initramfs -uv
(scrolled up to verify the new module was added it was at the top of the output)
for S and G's ran depmod -a again
exit out of the chroot

Now boot or reboot the MD.

For a Core:

I used a pen drive.

  • Once you have this file, boot the system in Safe Mode, using option 2 in grub (press ESC when system starts to get to grub)

after the system comes up, you will have your dcerouter# prompt. Insert pen drive, mount it some where: I did:

mkdir /mnt/temp
mount /dev/sdx1 /mnt/temp (insert your letter for "x" in this, you can find it with dmesg
cp /mnt/temp/r8168.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net/
mv /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8169.ko /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8169.ko.not
depmod -a /lib/modules/2.6.22-14-generic/kernel/drivers/net/r8168.ko
vi /etc/initramfs-tools/modules
add r8168
cd /boot 
update-initramfs -uv
(scroll up to verify the new module was added)
  • Now reboot, and that should sort it out.