Make fails for new Realtek Drivers (D-Link DWA-131)

Hello there,
I am trying desperately to get my wireless n adapter to work. I had it running sporadically with ndiswrapper for some months now (it was always unreliable).

Now I was very optimistic, when I found new driver sources from Realtek directly:
Realtek

I understand the DWA-131 is based on the Realtek 8192su chipset.

Unfortunately the build fails:


sandmann:/home/Documents/software/networkdriver/rtl8712_8188_8191_8192SU_usb_liux_v2.6.0006.20100226/driver/rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226 # make
make ARCH=i386 CROSS_COMPILE= -C /lib/modules/2.6.31.12-0.2-default/build M=/home/Documents/software/networkdriver/rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226/driver/rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226  modules
make[1]: Entering directory `/usr/src/linux-2.6.31.12-0.2-obj/i386/default'
make -C ../../../linux-2.6.31.12-0.2 O=/usr/src/linux-2.6.31.12-0.2-obj/i386/default/. modules
/home/Documents/software/networkdriver/rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226/driver/rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226/Makefile:15: /usr/src/linux-2.6.31.12-0.2/config: No such file or directory
make[4]: *** No rule to make target `/usr/src/linux-2.6.31.12-0.2/config'.  Stop.
make[3]: *** [_module_/home/Documents/software/networkdriver/rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226/driver/rtl8712_8188_8191_8192SU_usb_linux_v2.6.0006.20100226] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.31.12-0.2-obj/i386/default'
make: *** [modules] Error 2

I tried a lot (installed kernel-devel and kernel-source packages, followed the directions in this thread:
Samiux’s Blog: HOWTO : RealTek 8192SU USB dongle (RTL8192SU) on Ubuntu 10.04

And whatever else I could think of.

I am running Opensuse 11.2 with the kernel 2.6.31.12-0.2 on a Dell Latitude 640 laptop.

Probably the solution is relatively simple, but I need help to point me in the right direction.

Thanks in advance for any hints.

Best regards
Micha

Hi!
1 Install kernel-source and kernel-*-devel packages.
Download latest driver source from Realtek. This is version 0006 from 2010/3/25 to this moment. Unpack driver’s source.
2 Open to edit Makefile from driver’s directory. Change line #78.
Before edit:

ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
KVER  := $(shell uname -r)
**KSRC := /lib/modules/$(KVER)/build**
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif

After edit:

ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
KVER  := $(shell uname -r)
**KSRC := /lib/modules/$(KVER)/source**
MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/
INSTALL_PREFIX :=
endif

Save Makefile
3 Configure kernel sources:

cd /usr/src/linux/
make cloneconfig && make prepare && make modules_prepare

Create symlink to Module.symvers file from kernel-*-devel package:

ln -s /lib/modules/$(uname -r)/build/Module.symvers /usr/src/linux/

Or,instead of creating symlink, build modules. But it will take a lot of time:

make modules

4 Change directory where your driver’s source is. And try to compile driver:

make clean
make

If all things right, you’ll get 8712u.ko module.
After install driver, remove symlink to Module.symvers file (if you created it):

rm /usr/src/linux/Module.symvers

Hope it helps.
With best wishes.

This solution above is not only much more complicated as needed, it is also plain wrong.

Reason:

j.eng’s site - No cloneconfig needed!

A much easier fix which will NOT touch the sources in /usr/src/linux is this:

Change Makefile from

export TOPDIR := $(PWD)

ifeq ($(CONFIG_BUILT_IN), y)
include $(src)/config
else
include $(TOPDIR)/config
endif

to

#export TOPDIR := $(PWD)

#ifeq ($(CONFIG_BUILT_IN), y)
#include $(src)/config
#else
include $(CONFIG)
#endif

and compile with

CONFIG=$(pwd)/config make

su -c "CONFIG=$(pwd)/config make install"

Users of 64Bit installations should read this:

Realtek 8172 not recognized - fixed right or not? - Page 2 - openSUSE Forums

#14 and following

Akoellh,
Thank you, this is the best way.

Hello novsan and akoellh,
Thanks a lot for the quick and detailed replies. No way, that I could have figured out that by myself.

I am really confident, that my connection is now much more reliable compared to ndiswrapper and this would have been impossible without your help.

Thanks and best regards
Micha