# Realtek 8168 NIC - can't compile module r8168

## Javanni

I'm having trouble compiling the module for my onboard Realtek 8168 network card.

I downloaded the drivers from Realtek website, latest version (1.02), but when I try to Make them I get:

```

make -C src/ clean

make[1]: Entering directory `/root/r1000/src'

rm -f *.o *.ko *~ core* .dep* .*.d .*.cmd *.mod.c *.a *.s .*.flags

make[1]: Leaving directory `/root/r1000/src'

make -C src/ modules

make[1]: Entering directory `/root/r1000/src'

make -C /lib/modules/2.6.15-gentoo-r5/build SUBDIRS=/root/r1000/src modules

make: *** /lib/modules/2.6.15-gentoo-r5/build: No such file or directory.  Stop.

make: Entering an unknown directorymake: Leaving an unknown directorymake[1]: *** [modules] Error 2

make[1]: Leaving directory `/root/r1000/src'

make: *** [modules] Error 2

```

What I'm supposed do to get them working?

Thanks in advance,

G.B.

----------

## borsdel

moin,

here a translation from a german forum

1. copy entire folder "r1000" from archive to /usr/src/linux

2. copy folder "src" from archive to /usr/src/linux/r1000

3. cd /usr/src/linux/r1000

4. follow readme:

"make clean modules"

"make install"

"depmod -a"

5. cd /usr/src/linux/r1000/src

6. modprobe r1000

7. modprobe -l | grep r1000

8. restart, try modprobe again

no garanty, but perhaps a little help

mfg borsdel

----------

## Javanni

No way!  :Sad: 

----------

## superwutze

according to http://www.root-forum.org/showthread.php?p=4897 there are several problems at once in the r1000 driver (including a typo  :Shocked:  ).

i followed the howto in the first post and it works great!

translation:

become root

```
su -

***password***
```

unpack the archive of the 1.03 driver package

```
unzip linux-r1000(103).zip
```

copy the r1000 folder into your kernel-source-tree

```
cp -a r1000 /usr/src/linux/
```

they copy the src directory contained inside the r1000 folder also to the kernel-sources, i did it with a symlink

```
ln -s /usr/src/linux/r1000/src /usr/src/linux/
```

now go to the r1000 folder (as root) and try to compile

```
cd /usr/src/linux/r1000

make clean modules
```

if that works then you are on the lucky side (or using an old kernel-version   :Very Happy:  )

now they give two options:

i386: edit line 46 in r1000/src/r1000_n.c:

```
from

MODULE_PARM (media, "1-" __MODULE_STRING(MAX_UNITS) "i");

to

MODULE_PARM_DESC (media, "1-" __MODULE_STRING(MAX_UNITS) "i");
```

now it should compile

amd64: edit line 1450 in r1000/src/r1000_n.c:

```
from

synchronize_irq (entdev->irq);

to

synchronize_irq (netdev->irq);
```

that's a typo   :Shocked: 

now it should compile

as i am using amd64 linux i can approve that the amd64-fix works!

----------

## dlewin

What I don't understand is that there is not any kernel source in /usr/src , where do you take it from ?

----------

## superwutze

if you installed gentoo according to the gentoo handbook the kernel source resides in /usr/src/linux-xx.yy-rz and /usr/src/linux is a symlink to that directory

if there is really nothing there try

```
emerge gentoo-sources
```

----------

## superwutze

something to mention:

with 2.6.17 the compile fails because there is some old definition in the r1000_n.c code. there you have to replace

```
MODULE_PARM
```

with

```
MODULE_PARM_DESC
```

and it works

----------

## dlewin

that is exactly I was looking for, thanks.

----------

## socksz

Yes but.. i'm on livecd and i have the same problem..

ls -l /usr/src report:

total 0.

:S how can i compile without kernel sources? my net is down.

----------

## socksz

 *socksz wrote:*   

> Yes but.. i'm on livecd and i have the same problem..
> 
> ls -l /usr/src report:
> 
> total 0.
> ...

 

uhm.. if possible load drivers on LIVECD or not?

if yes, how? please..

----------

## superwutze

just upgraded to r1000 v 1.04, the typo is gone but the MODULE_PARM error stays. now it is 3 times (lines 51,52,53 afair). simply replace MODULE_PARM with MODULE_PARM_DESC and it works like a charm. v 1.03 worked for me and v 1.04 works also (so far).

----------

## nader emami

 *borsdel wrote:*   

> moin,
> 
> here a translation from a german forum
> 
> 1. copy entire folder "r1000" from archive to /usr/src/linux
> ...

 

----------

## c0balt

 *superwutze wrote:*   

> just upgraded to r1000 v 1.04, the typo is gone but the MODULE_PARM error stays. now it is 3 times (lines 51,52,53 afair). simply replace MODULE_PARM with MODULE_PARM_DESC and it works like a charm. v 1.03 worked for me and v 1.04 works also (so far).

 

It still refuses to compile for me  :Sad: 

After I finally got gentoo-sources to emerge (had to download them on my desktop, put them on the notebook via windows boot, then copy them from win partition to /usr/portage/distfiles and it emerged^^)

but even with fixing "MODULE_PARM" I get an error 

```
[...] Entering dircetory /lib/modules/2.6.17-gentoo-r7/build

[...] No rule to make target 'modules'. Stop.
```

??? help

----------

## superwutze

you need to have kernel-sources with which your actual kernel was compiled. during compilation of your kernel several parts are built that are needed to compile modules. if your kernel sources were just clean emerged then there are several things missing.

also you need to do 'make modules_install' in /usr/src/linux before the r1000 module will compile, because in that step /lib/modules/{your_kernel_version} will be created.

where did your kernel come from? how did you get your kernel without having sources installed?

----------

## c0balt

Figured it out myself in the meantime (sry, wasnt able to post)

thx though!

----------

